Reputation: 22552
I started using Qt Designer a few weeks ago to generate some custom widgets for my PySide application. There is something I wish I could do, but I cannot manage to find how: I would like to save all my widgets in only one big .ui
, then compile them to only one big .py
file so that all the GUI details are in the same file, say gui.py
. That would allow me to write things like this:
import gui.MainWindow
import gui.FluffyRabbitWidget
class MainWindow(gui.MainWindow): pass
class FluffyRabbitWidget(gui.FluffyRabbitWidget): pass
Then I would not have to bother having a whole bunch of different files with Python code that I will never read since it is generated. So, how could I manage to have just one big .ui
file? And if not feasable, would there be a way to tell pyside-uic
to generate only one .py
file with several .ui
files as input?
Upvotes: 0
Views: 1297
Reputation: 101919
Reading the source code of pyside-uic
, you can see that it doesn't accept more than one .ui
argument:
opts, args = parser.parse_args()
if len(args) != 1:
sys.stderr.write("Error: one input ui-file must be specified\n")
sys.exit(1)
sys.exit(invoke(Driver(opts, args[0])))
So the answer is: no. pyside-uic
can't do this.
A dirty solution might be to cat
the generated files together, but this must be done every time you modify the widgets:
$ cat generated_*.py > gui.py
(Where generated_*.py
should be a regex that matches the files generated for your widgets.
Upvotes: 1