[Eric] /ui directory and Ui.mainwindow
Detlev Offenbach
detlev at die-offenbachs.de
Wed Sep 27 16:52:36 BST 2017
Hello Phil,
eric generates a file called Ui_*.py when compiling a form file (*.ui). In your
example the compiled source would be Ui_mainwindow.py. This file is stored
alongside the form file. In your module implementing the functionality of the
form you would include a line like this
from .Ui_mainwindow import Ui_mainwindow <- your dialog class here
class MainWindow(QMainWindow, Ui_mainwindow):
def __init__(self, parent=None):
QMainWindow.__init__(self, parent=parent)
self.setupUi(self)
That's it. This is the pattern used to implement the eric IDE.
Detlev
Am Dienstag, 26. September 2017, 11:40:30 CEST schrieb Phil:
> One last question, for tonight at least.
>
> When I compile a form and generate dialog code the two generated files
> "mainwindow.ui" and "Ui.mainwindow.py" are stored in the project
> directory (/project_name). I have to move Ui.mainwindow.py to
> /project_name/ui otherwise an error message says something about not
> finding Ui.mainwindow.
>
> I've always had to do this ever since I first started playing with Eric
> years ago. Shouldn't the two files go into /ui automatically or have I
> misunderstood something?
--
Detlev Offenbach
detlev at die-offenbachs.de
More information about the Eric
mailing list