Hey,

(remember to reply to the list, so other folks can read the discussion,
I'm adding the ML on CC to jump back to the topic)

Maybe you are hitting https://bugreports.qt.io/browse/PYSIDE-1561

Can you share more information regarding how you are using the generated
ui file?

You should be able to have 1 file with the option,
and another one without.

Let's say your generated file is this one:

---
from PySide6.QtWidgets import QLabel

class MyLabel(QLabel):
    def __init__(self, parent=None):
        super().__init__(parent)
        # Using camelCase
        self.setText("Hello")

    def connectNotify(self):
        pass
---

Which is not using snake_case,
then you can import it and use it:


---
import sys
from PySide6.QtWidgets import QApplication, QWidget, QHBoxLayout

from a import MyLabel

from __feature__ import snake_case

class MyWidget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)

        self.label = MyLabel()
        # overriding the value, with snake_case
        self.label.set_text("World")

        layout = QHBoxLayout()
        layout.add_widget(self.label)
        self.set_layout(layout)

if __name__ == "__main__":

    app = QApplication()
    w = MyWidget()
    w.show()
    sys.exit(app.exec())
---

Executing that will have 'World' on the Widget.

When you use the __feature__ import shouldn't matter.

I hope it helps!

Cheers


On 4/20/22 17:30, Paolo De Stefani wrote:
Hi and thank for the quick response

The problem IS that the DBManagerMainWindow.py is generate by pyside6-uic not by me...
That's why i've attached the source .ui file and the resulting .py file

Do i need to remove from __feature__ import snake_case, true_property from my script for work correctly ???


Il 20/04/2022 14:09 Cristián Maureira-Fredes ha scritto:
Hello Paolo,

On 4/20/22 13:55, Paolo De Stefani wrote:
Hi
I've just upgraded to 6.3.0 and i'm hitting a weird problem
In a small program that i created years ago and that i've already ported to pyside6 some months ago with true property and snake case enabled i've decided to change a little bit the user interface I did it in QtDisigner BUT now i don't understand why my application don't work

This is the error:

Traceback (most recent call last):
   File "c:\PyWare\pyDBManager\pyDBManager.py", line 1165, in <module>
     window = MainWindow()
   File "c:\PyWare\pyDBManager\pyDBManager.py", line 788, in __init__
     self.setupUi(self)
   File "c:\PyWare\pyDBManager\Ui\DBManagerMainWindow.py", line 208, in setupUi
     self.tab_widget_new_db.addTab(self.tab_create_db, "")
AttributeError: 'PySide6.QtWidgets.QGridLayout' object has no attribute 'isEmpty'


Is this related to the use of snake_case ?
DBManagerMainWindow.py is generated from DBManagerMainWindow.ui using c:\Python310\Scripts\pyside6-uic
QGridLayout HAS an IsEmpty attribute or maybe is_empty ???

Hello!

You can always try this without the whole application:

from PySide6.QtWidgets import QGridLayout
dir(QGridLayout)
[i for i in dir(QGridLayout) if 'empty' in i.lower()]
['isEmpty']
from __feature__ import snake_case
[i for i in dir(QGridLayout) if 'empty' in i.lower()]
['is_empty']


is you enable the 'snake_case' from __feature__
the method is called 'is_empty' instead of 'isEmpty'


Let's know if that did the trick!

Cheers


--
Dr. Cristian Maureira-Fredes
R&D Manager

The Qt Company GmbH
Erich-Thilo-Str. 10
D-12489 Berlin

Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B
--
_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside


--
Dr. Cristián Maureira-Fredes
R&D Manager

The Qt Company GmbH
Erich-Thilo-Str. 10
D-12489 Berlin

Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B
_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to