Hi,
I had defined a menu option in my start menu (windows) to call the
ClassDesigner. But when I tried to "Open Saved Class" the ClassDesigner
would crash due to the fact that it expected to be called from the saved
class's directory. So tonight I bit the bullet, opened ClassDesigner.py
and patched it. It is a really simple patch, just one line. Here it is :
-----------------------------------------------------------------------
def _importClassXML(self, pth):
"""Read in the XML and associated code file (if any), and
return a dict that can be used to re-create the object.
"""
try:
if not os.path.exists(pth):
if os.path.exists(os.path.abspath(pth)):
pth = os.path.abspath(pth)
os.chdir(os.path.dirname(pth))
-------------------------------------------------------------------------
The patch is the last line (os.chdir()) and works nicely, now I can open
the ClassDesigner from my Start menu.
It could have been done in the openClass() method
-------------------------------------------------------------------------
def openClass(self, pth):
"""Called when the user selects the 'Open' menu and selects
a saved XML file. We need to open the file, and confirm that it is
indeed a valid class file. If so, we then re-construct the class in
a new ClassDesigner window.
"""
-------------------------------------------------------------------------
But this method almost immediately calls _importClassXML() and there the
path is being validated, so it seemed convenient. Anyway I think it's a
hack and it would be proper to put code to validate the path and change
dir to it in the openClass method.
Is there a chance of this ever getting into the code base?
Thx.
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]