PyMui problem with Notify()
  • Just looking around
    sandlbn
    Posts: 19 from 2009/4/5
    From: Ireland
    I have a problem with pymui. I tried to start according to the tutorial from the http://yellowblue.free.fr/yiki/doku.php/en:dev:pymui:docs:tutorial . But the Notify function syntax for the class Window () is incorrect. I looked through gribouillis2 sources and found that the changed order of arguments.
    Now I use it as follows

    win.Notify ('CloseRequest', lambda e: app.Quit (), when = True)

    For SimpleButton() object function Notify() works fine, but for the Window Object shows the error AssertionError. Does anyone know how to use the Notify() for windows objects ?
  • »21.07.11 - 06:58
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Yomgui
    Posts: 348 from 2004/8/31
    From: Québec - Canada
    Hi,

    Excellent way: you've read a good documentation, GB2 ;-)
    Yes, my wiki documentation is totally outdated.
    In fact even GB2 is also but only for minor things.

    But current public PyMUI release is also a bit wrong and bugged: I've recently fixed Notify() implementation (same API as you as written, but working now :-D)

    So your code is right, I just need to make a new release to make it work correctly.

    But my MacMini (where I'm developping usually) is broken and I'm doing the backup on my Peg2.
    I need to reconstruct all the SDK and my dependencies for GB3, pymui, python, etc.

    Sorry for the delay...

    Note: which version are you using? There is a v0.4-r238 available here: http://www.yomgui.fr/python/thirdparties/2.5/PyMUI-0.4.morphos-r238.lha
    It's not the one with my Notify fix but should work,


    [ Edited by Yomgui 21.07.2011 - 09:24 ]
    And now... next project!
  • »21.07.11 - 08:21
    Profile Visit Website
  • Just looking around
    sandlbn
    Posts: 19 from 2009/4/5
    From: Ireland
    You have the right. On my mac mini, I still had the old version PyMUI 0.4, SVN r237. Thank you for the hint. Now it works. :D

    I have one more question of Class MyArea() from your example. I see that the converter() method takes 3 arguments (self, msg, tp). In the example, wants two arguments. What is and what he must be given in the third argument, called tp.

    [ Edited by sandlbn 21.07.2011 - 09:16 ]
  • »21.07.11 - 08:44
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Yomgui
    Posts: 348 from 2004/8/31
    From: Québec - Canada
    convertor() is an inline function used inside muimethod().

    only this latter is public!

    So don't try to think what's the hell is "tp" ;-)

    This is the simple example to construct a new MUI MCC class with PyMUI:

    http://www.yomgui.fr/python/simple.py

    [ Edited by Yomgui 21.07.2011 - 11:02 ]
    And now... next project!
  • »21.07.11 - 09:57
    Profile Visit Website
  • Just looking around
    sandlbn
    Posts: 19 from 2009/4/5
    From: Ireland
    Thanks for the reply. Now I have a error with the attributes of the MUI, "Close on Request" not found and "Close on last" not found. For now I will be learning about mui. Probably because of ignorance mui classes, I make mistakes.
  • »21.07.11 - 10:19
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Yomgui
    Posts: 348 from 2004/8/31
    From: Québec - Canada
    Sorry for my mistakes: It's not "CloseOnRequest", but "CloseOnReq"
    and CloseOnLast is bugged, so forget it and add this line before the app.Run():

    win.Notify('CloseRequest', lambda *a: app.Quit(), when=True)

    et voilà (I think... :-D)

    Note: next release got all of that fixed.

    [ Edited by Yomgui 21.07.2011 - 11:38 ]
    And now... next project!
  • »21.07.11 - 10:35
    Profile Visit Website
  • Just looking around
    sandlbn
    Posts: 19 from 2009/4/5
    From: Ireland
    Thanks again, you probably forgot about win.OpenWindows(). Application produced only a small window with no Area() object, like in the image http://oi51.tinypic.com/xlzgbt.jpg
  • »21.07.11 - 11:05
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Yomgui
    Posts: 348 from 2004/8/31
    From: Québec - Canada
    ah yes... need some holidays
    hmm try with Rectangle than Area.

    Note: never put a "print" statement or related during the call of Draw method, or the system may freeze (very old bug than have never succeed to remove yet)

    [ Edited by Yomgui 21.07.2011 - 12:54 ]
    And now... next project!
  • »21.07.11 - 11:53
    Profile Visit Website
  • MorphOS Developer
    itix
    Posts: 1516 from 2003/2/24
    From: Finland
    Yomgui,

    In Draw method Intuition may have locked layers and anything causing drawing operations to other windows can cause a freeze. I havent done low level Intuition coding for ages but IIRC it depends on windows refresh mode.

    Edit: for the same reason you must suppress DOS requester if you are using disk I/O from Draw method for some strange reason. It can cause deadlock if DOS is trying to open requester but requester is waiting for Intuition which is waiting in your Draw method for DOS...

    [ Edited by itix 21.07.2011 - 14:14 ]
    1 + 1 = 3 with very large values of 1
  • »21.07.11 - 12:10
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Yomgui
    Posts: 348 from 2004/8/31
    From: Québec - Canada
    @Itix: thanks for this information. I've already guessed that there is a problem of deadlock between print and intuition, but without really knowing who does this lock exactly.
    Now I've no idea how to prevent that, Python is not C and it's so easy to have a print call during the MDraw call.
    And now... next project!
  • »21.07.11 - 12:42
    Profile Visit Website
  • MorphOS Developer
    itix
    Posts: 1516 from 2003/2/24
    From: Finland
    You can not prevent it on other languages either. The best is advise users to avoid calling any functions involving disk i/o or printing to console window.
    1 + 1 = 3 with very large values of 1
  • »21.07.11 - 18:20
    Profile
  • Just looking around
    sandlbn
    Posts: 19 from 2009/4/5
    From: Ireland
    when I added the Rectangle() as the RootObject everything started working fine.
  • »22.07.11 - 07:33
    Profile
  • Just looking around
    sandlbn
    Posts: 19 from 2009/4/5
    From: Ireland
    so far everything works, I have only one small problem. I do not know how to define and add items to a Virtual Group. I tried in different ways, but nothing works.
  • »27.07.11 - 06:33
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Yomgui
    Posts: 348 from 2004/8/31
    From: Québec - Canada
    @Sandlbn: like on MUI. See in GB2, view/pymui/layermgr.py file.

    Code:

    grp = pymui.VGroupV(Frame='Virtual')
    obj = pymui.SimpleButton('Test')
    grp.AddChild(obj)
    And now... next project!
  • »27.07.11 - 08:54
    Profile Visit Website
  • Just looking around
    sandlbn
    Posts: 19 from 2009/4/5
    From: Ireland
    Yomgui,
    Quote:

    like on MUI. See in GB2, view/pymui/layermgr.py file.

    Sometimes a man is lost. And it was so easy. Thanks again :) . I will no longer torment you such stupid questions.
  • »27.07.11 - 10:39
    Profile
  • Just looking around
    sandlbn
    Posts: 19 from 2009/4/5
    From: Ireland
    sorry. error was in my code. :)


    [ Edited by sandlbn 22.08.2011 - 07:47 ]
  • »20.08.11 - 12:21
    Profile