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
[email protected]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pygui mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pygui

Reply via email to