[Eric] Re: Re: QT Designer & Plugins on PyQT
Сергей Гринько
sergey.grinko at gmail.com
Mon Jun 22 09:32:05 BST 2009
This problem correlates with the problem:
Error at startup item "Generate Dialog Code ..."
they need to be addressed in an integrated manner.
I suggest to add at the level of the project, two new properties:
1) "PYQTDESIGNERPATH" - the way the search module plug-ins for
QT-Designer (custom widgets)
2) "PYTHONPATH" - module search path for the realization of
QT-Designer (custom widgets)
3) and to add management os.chdir ()
Waiting for the new release, thanks!
>On Dienstag, 16. Juni 2009, Сергей Гринько wrote:
>> I suggest to add at the level of the project, two new properties:
>> 1) "PYQTDESIGNERPATH" - the way the search module plug-ins for QT-Designer
>> (custom widgets)
>> 2) "PYTHONPATH" - module search path for the realization of QT-Designer
>> (custom widgets)
>>
>> The module UserInterface.py in class UserInterface method __designer () add
>> the code reads these properties and changing environment.
>> Example:
>>
>> import os
>> ...
>> class UserInterface(KQMainWindow):
>> ...
>> # Set a specified environment variable with a directory name.
>> def setEnvDesigner(self, var_name, dir_name):
>> # Convert the relative directory name to an absolute one.
>> os.putenv(var_name, os.path.join(self.project.ppath, dir_name))
>>
>> def __designer(self, fn = None, version = 0):
>> ...
>> # Tell Qt Designer where it can find the directory containing the
>> plugins and
>> # Python where it can find the widgets.
>> # "kernel/UI/widgets/plugins" - sample path (must be read from the
>> properties of the project)
>> # "kernel/UI/widgets" - sample path (must be read from the
>> properties of the project)
>
>Which properties should this be in order to work in general? Right now I don't
>see a generic approach.
>
>> self.setEnvDesigner("PYQTDESIGNERPATH",
>> "kernel/UI/widgets/plugins") self.setEnvDesigner("PYTHONPATH",
>> "kernel/UI/widgets")
>> #
>> proc = QProcess()
>> if not proc.startDetached(designer, args):
>> KQMessageBox.critical(self,
>> self.trUtf8('Process Generation Error'),
>> self.trUtf8(
>> '<p>Could not start Qt-Designer.<br>'
>> 'Ensure that it is available as <b>%1</b>.</p>'
>> ).arg(designer))
>>
>> Following these changes, everything works well.
>>
>> 9 июня 2009 г. 13:08 пользователь Сергей Гринько
>>
>> <sergey.grinko at ...>написал:
>> > I use Eric 4.3.4
>> > How to make it possible to start with QT Designer, designate the path
>> > search directory containing the plugins and Python where it can find the
>> > widgets.
>> > Example:
>> >
>> > # Set a specified environment variable with a directory name.
>> > def setEnvironment(env, var_name, dir_name):
>> > # Convert the relative directory name to an absolute one.
>> > dir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
>> > dir_name)
>> >
>> > # Remove any existing value so that we have a controlled environment.
>> > idx = env.indexOf(QtCore.QRegExp("^%s=.*" % var_name,
>> > QtCore.Qt.CaseInsensitive))
>> >
>> > if idx >= 0:
>> > env.removeAt(idx)
>> >
>> > env << "%s=%s" % (var_name, dir)
>> >
>> > # Tell Qt Designer where it can find the directory containing the plugins
>> > and
>> > # Python where it can find the widgets.
>> > env = QtCore.QProcess.systemEnvironment()
>> > setEnvironment(env, "PYQTDESIGNERPATH", "python")
>> > setEnvironment(env, "PYTHONPATH", "widgets")
>> >
>> > # Start Designer.
>> > designer = QtCore.QProcess()
>> > designer.setEnvironment(env)
>> > ....
>--
>Detlev Offenbach
>detlev at ...
--
Sergey Grinko
Email: sergey.grinko at gmail.com
More information about the Eric
mailing list