[Pygui] Native wrappers?

Dan Villiom Podlaski Christiansen danchr at gmail.com
Sun Dec 20 17:41:39 CET 2009


On 20 Dec 2009, at 04:04, Greg Ewing wrote:

> Dan Villiom Podlaski Christiansen wrote:
> 
>> I'm seeing a weird issue; for some  reason ‘Open as…’ and ‘Save as…’
> > create a menu item per character in their name.
> 
> Sounds like it thinks they're menu item groups instead of
> single items.
> 
> Are these perhaps unicode strings? In Generic/GMenus.py,
> Menu._make_item(), there's the following piece of code:
> 
>  if isinstance(text, str):
>    return SingleMenuItem(text, cmd, substitutions)
>  else:
>    return MenuItemGroup(text, cmd)
> 
> This could get confused if it's given a unicode string
> instead of a plain str. It should probably be amended to
> take unicode into account.

Indeed; changing the check to basestring fixed it :) (It was caused by me making ‘Save as…’, etc., use Unicode strings for the ellipsis.)

I have another issue where you may have an idea what I'm doing wrong…

> Traceback (most recent call last):
>   File "/opt/python/lib/python/GUI/Generic/GApplications.py", line 379, in report_error
>     raise
> TypeError: exceptions must be classes or instances, not NoneType

The relevant snippet of code in -[PyApplication sendEvent:] looks like this:

r = PyObject_CallMethod(self.app, "handle", "OO", kind, pyevent);

if (r == NULL) {
    PyObject_CallMethod(self.app, "report_error", "");
}

I'm not terribly familiar with how exceptions work with the Python API, but shouldn't that suffice? (The ‘app’ property accessor imports the Applications module and calls the ‘application()’ accessor in it to obtain the PyGUI application instance.)

(I sent this email as rich text because of the code paste; I hope you don't mind!)

--

Dan Villiom Podlaski Christiansen
danchr at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pygui/attachments/20091220/2a398588/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dialog.png
Type: image/png
Size: 24920 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pygui/attachments/20091220/2a398588/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1943 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pygui/attachments/20091220/2a398588/attachment-0001.bin>


More information about the Pygui mailing list