[PySide] QtDesigner ???

David Ching dc at dcsoft.com
Sun Apr 24 16:38:29 CEST 2022


Hi Paolo,

I could not reproduce.   Either:

[pyDBManager.py]
#from Ui.DBManagerMainWindowGood import Ui_DBManagerMainWindow
from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow

Or:
[pyDBManager.py]
from Ui.DBManagerMainWindowGood import Ui_DBManagerMainWindow
#from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow

Ran without error.  The first added the Label and LineEdit as expected.

I ran your batch file after modifying it to work on my system (removed
hard-coded paths, etc.)  So I re-ran pyside6-uic and pyside6-rcc and ensured
the generated files were the same as yours.  They were, except for the
tooling version in the comments.  Mine is slightly older: 

My system:
    * Windows 10
    * Python 3.9.6 (from https://python.org)
    * PySide6 6.2.3

In short, the (essentially) exact .py code works flawlessly here.

Let me know if I can help more,
David

> Date: Sun, 24 Apr 2022 09:58:55 +0200
> From: Paolo De Stefani <paolo at paolodestefani.it>
> To: Cristi?n Maureira-Fredes <Cristian.Maureira-Fredes at qt.io>
> Cc: pyside at qt-project.org
> Subject: Re: [PySide] QtDesigner ???
> Message-ID: <4d55f5618bf932a303e1207d1ea3a12b at paolodestefani.it>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> Hi
>
> I shrinked more all of my ui file so now everything is in 5 ui/py files
>
> To create py files from ui i use this command in a windows batch file:
>
> cd c:\PyWare\pyDBManager\Bug
> REM create lib ui modules
> "c:\windows\system32\forfiles.exe" /P "C:\PyWare\pyDBManager\Bug" /M *.ui
/c "cmd /c c:\Python310\Scripts\pyside6-uic -o @fname.py @file"
> pause
>
> If i import from DBManagerMainWindowBad (line 33/34) running
pyDBManager.py i get:
>
> Traceback (most recent call last):
>    File "c:\PyWare\pyDBManager\Bug\pyDBManager.py", line 161, in <module>
>      window = MainWindow()
>    File "c:\PyWare\pyDBManager\Bug\pyDBManager.py", line 56, in __init__
>      self.ui.setupUi(self)
>    File "c:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line 171,
in setupUi
>      self.tab_widget_new_database.addTab(self.tab, "")
> AttributeError: 'PySide6.QtWidgets.QHBoxLayout' object has no attribute
'isEmpty'
>
> If i import from DBManagerMainWindowGood everything is working
>
> So what's wrong in DBManagerMainWindowBad.ui ???





More information about the PySide mailing list