On Dienstag, 16. Juni 2009, Сергей Гринько wrote: > Offer amuse the problem this way: > The file ProjectFormsBrowser.py method __generateDialogCode class > ProjectFormsBrowser add a change to the current directory to open a file - > 'fn' -> os.chdir (os.path.dirname (os.path.abspath (fn))) > > import os > ... > class ProjectFormsBrowser (ProjectBaseBrowser): > ... > def __generateDialogCode (self): > " > Private method to generate dialog code for the form (Qt4 only) > " > itm = self.model (). item (self.currentIndex ()) > fn = unicode (itm.fileName ()) > > if self.hooks [ "generateDialogCode"] is not None: > self.hooks [ "generateDialogCode"] (filename) > else: > from CreateDialogCodeDialog import CreateDialogCodeDialog > # In 915 line add: > # Change directory to local place for file "fn" > os.chdir (os.path.dirname (os.path.abspath (fn))) > dlg = CreateDialogCodeDialog (fn, self.project, self) > if not dlg.initError (): > dlg.exec_ () > > Following these changes, all is well.
That fix works for your particular project setup. But what happens, if the custom widget is not below the directory of the file in question but somewhere else. In order to have it work more generally, we might have to introduce some conventions. Following is the proposal. 1. I'll include the os.chdir solution proposed by you. This allows the custom widgets to be placed somewhere below the directory of the dialog. 2. I'll add the project directory (project.ppath) to the PYTHONPATH environment variable. That makes custom widgets below the project directory available. And this defines the convention. Custom widgets must be accessible either from the project directory or below the dialog in question. Would this proposal be ok? > > 12 июня 2009 г. 17:01 пользователь Detlev Offenbach < > > [email protected]> написал: > > Hi, > > > > the problem is, that project/UI is not in PYTHONPATH. This causes the > > import > > done by pyuic to fail. I've seen this lately over here as well but > > haven't found a fix yet. Any suggestions. > > > > Regards, > > Detlev > > > > On Mittwoch, 10. Juni 2009, Сергей Гринько wrote: > > > Structure folder/files: > > > project/ > > > UI/ > > > widgets/ > > > plugins/ > > > QLineEditWErrState_plugin.py > > > __init__.py > > > qlineeditwerrstate.py > > > erredit.ui > > > __init__.py > > > Ui_erredit.py > > > Regards, Detlev -- Detlev Offenbach [email protected] _______________________________________________ Eric mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/eric
