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 ???


Il 22/04/2022 00:03 Paolo De Stefani ha scritto:
Il 21/04/2022 22:56 Cristián Maureira-Fredes ha scritto:
Hey,

it seems like your file got removed
due to a malware detection process.

Can you share your code using services like
pastebin.com dpaste.com linkode.org etc etc ?

In the zip archive there are text file, png icons, one .bat file
I've uploaded that file here:

ftp://ftp.paolodestefani.it
user: pys...@paolodestefani.it
pwd: Pyside123!



In that case we can see the full extent of the problem.

As an alternative,
you can report a bug and share the zip file (or all the files)
to the issue, so it can be discussed there (you'd need a Qt account)
This is the platform to do that:
http://bugreports.qt.io/browse/PYSIDE
Make sure you select the 'pyside' project
and here you have more info:
https://wiki.qt.io/Qt_for_Python/Reporting_Bugs

Uh maybe is my mistake...
Before reporting any bug is better that someone else check the code i suppose



Cheers

On 4/21/22 21:46, Paolo De Stefani wrote:
Il 20/04/2022 22:59 Cristián Maureira-Fredes ha scritto:
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)

OPS... Sorry


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


It seems a diffrerent issue


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


It looks like a QtDesigner problem or uic problem for me BUT i'm not a professional programmer

I created a small script that can show the problem. Simply comment/uncomment line 33/34

#from Ui.DBManagerMainWindowGood import Ui_DBManagerMainWindow
from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow

.ui files are included and you can see that the only difference between the 2 is a label and line edit added in the bad one. Of course both can be previewed in QtDesigner without any problem



--
Paolo De Stefani
# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file 'DBManagerMainWindowBad.ui'
##
## Created by: Qt User Interface Compiler version 6.3.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
    QMetaObject, QObject, QPoint, QRect,
    QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
    QCursor, QFont, QFontDatabase, QGradient,
    QIcon, QImage, QKeySequence, QLinearGradient,
    QPainter, QPalette, QPixmap, QRadialGradient,
    QTransform)
from PySide6.QtWidgets import (QApplication, QGroupBox, QHBoxLayout, QHeaderView,
    QLabel, QLineEdit, QMainWindow, QMenu,
    QMenuBar, QSizePolicy, QSpacerItem, QStatusBar,
    QTabWidget, QTableWidget, QTableWidgetItem, QToolBar,
    QVBoxLayout, QWidget)

class Ui_DBManagerMainWindow(object):
    def setupUi(self, DBManagerMainWindow):
        if not DBManagerMainWindow.objectName():
            DBManagerMainWindow.setObjectName(u"DBManagerMainWindow")
        DBManagerMainWindow.resize(769, 495)
        self.action_settings = QAction(DBManagerMainWindow)
        self.action_settings.setObjectName(u"action_settings")
        self.action_quit = QAction(DBManagerMainWindow)
        self.action_quit.setObjectName(u"action_quit")
        self.action_dump = QAction(DBManagerMainWindow)
        self.action_dump.setObjectName(u"action_dump")
        self.action_restore = QAction(DBManagerMainWindow)
        self.action_restore.setObjectName(u"action_restore")
        self.action_drop_database = QAction(DBManagerMainWindow)
        self.action_drop_database.setObjectName(u"action_drop_database")
        self.action_create_configure_database = QAction(DBManagerMainWindow)
        self.action_create_configure_database.setObjectName(u"action_create_configure_database")
        self.action_help_content = QAction(DBManagerMainWindow)
        self.action_help_content.setObjectName(u"action_help_content")
        self.action_about = QAction(DBManagerMainWindow)
        self.action_about.setObjectName(u"action_about")
        self.action_update = QAction(DBManagerMainWindow)
        self.action_update.setObjectName(u"action_update")
        self.action_disconnect_client = QAction(DBManagerMainWindow)
        self.action_disconnect_client.setObjectName(u"action_disconnect_client")
        self.action_about_qt = QAction(DBManagerMainWindow)
        self.action_about_qt.setObjectName(u"action_about_qt")
        self.central_widget = QWidget(DBManagerMainWindow)
        self.central_widget.setObjectName(u"central_widget")
        self.verticalLayout_3 = QVBoxLayout(self.central_widget)
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.tab_widget = QTabWidget(self.central_widget)
        self.tab_widget.setObjectName(u"tab_widget")
        self.tab_activity = QWidget()
        self.tab_activity.setObjectName(u"tab_activity")
        self.verticalLayout_activity = QVBoxLayout(self.tab_activity)
        self.verticalLayout_activity.setObjectName(u"verticalLayout_activity")
        self.activity_table_widget = QTableWidget(self.tab_activity)
        self.activity_table_widget.setObjectName(u"activity_table_widget")

        self.verticalLayout_activity.addWidget(self.activity_table_widget)

        self.tab_widget.addTab(self.tab_activity, "")
        self.tab_database = QWidget()
        self.tab_database.setObjectName(u"tab_database")
        self.verticalLayout_databases = QVBoxLayout(self.tab_database)
        self.verticalLayout_databases.setObjectName(u"verticalLayout_databases")
        self.databases_table_widget = QTableWidget(self.tab_database)
        self.databases_table_widget.setObjectName(u"databases_table_widget")

        self.verticalLayout_databases.addWidget(self.databases_table_widget)

        self.tab_widget.addTab(self.tab_database, "")
        self.tab_roles = QWidget()
        self.tab_roles.setObjectName(u"tab_roles")
        self.verticalLayout_roles = QVBoxLayout(self.tab_roles)
        self.verticalLayout_roles.setObjectName(u"verticalLayout_roles")
        self.roles_table_widget = QTableWidget(self.tab_roles)
        self.roles_table_widget.setObjectName(u"roles_table_widget")

        self.verticalLayout_roles.addWidget(self.roles_table_widget)

        self.tab_widget.addTab(self.tab_roles, "")
        self.tab_new_db = QWidget()
        self.tab_new_db.setObjectName(u"tab_new_db")
        self.verticalLayout = QVBoxLayout(self.tab_new_db)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.label_17 = QLabel(self.tab_new_db)
        self.label_17.setObjectName(u"label_17")

        self.horizontalLayout.addWidget(self.label_17)

        self.line_edit_new_database = QLineEdit(self.tab_new_db)
        self.line_edit_new_database.setObjectName(u"line_edit_new_database")

        self.horizontalLayout.addWidget(self.line_edit_new_database)

        self.horizontalSpacer_5 = QSpacerItem(244, 45, QSizePolicy.Expanding, QSizePolicy.Minimum)

        self.horizontalLayout.addItem(self.horizontalSpacer_5)

        self.label_5 = QLabel(self.tab_new_db)
        self.label_5.setObjectName(u"label_5")
        self.label_5.setWordWrap(True)

        self.horizontalLayout.addWidget(self.label_5)


        self.verticalLayout.addLayout(self.horizontalLayout)

        self.tab_widget_new_database = QTabWidget(self.tab_new_db)
        self.tab_widget_new_database.setObjectName(u"tab_widget_new_database")
        self.tab = QWidget()
        self.tab.setObjectName(u"tab")
        self.verticalLayout_2 = QVBoxLayout(self.tab)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.group_box_create_database = QGroupBox(self.tab)
        self.group_box_create_database.setObjectName(u"group_box_create_database")
        self.group_box_create_database.setCheckable(True)
        self.verticalLayout_4 = QVBoxLayout(self.group_box_create_database)
        self.verticalLayout_4.setObjectName(u"verticalLayout_4")
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.label = QLabel(self.group_box_create_database)
        self.label.setObjectName(u"label")

        self.horizontalLayout_2.addWidget(self.label)

        self.line_edit_user = QLineEdit(self.group_box_create_database)
        self.line_edit_user.setObjectName(u"line_edit_user")

        self.horizontalLayout_2.addWidget(self.line_edit_user)

        self.label_2 = QLabel(self.group_box_create_database)
        self.label_2.setObjectName(u"label_2")

        self.horizontalLayout_2.addWidget(self.label_2)

        self.line_Edit_password = QLineEdit(self.group_box_create_database)
        self.line_Edit_password.setObjectName(u"line_Edit_password")
        self.line_Edit_password.setEchoMode(QLineEdit.Password)

        self.horizontalLayout_2.addWidget(self.line_Edit_password)

        self.label_3 = QLabel(self.group_box_create_database)
        self.label_3.setObjectName(u"label_3")

        self.horizontalLayout_2.addWidget(self.label_3)

        self.line_edit_database = QLineEdit(self.group_box_create_database)
        self.line_edit_database.setObjectName(u"line_edit_database")

        self.horizontalLayout_2.addWidget(self.line_edit_database)


        self.verticalLayout_4.addLayout(self.horizontalLayout_2)

        self.verticalSpacer = QSpacerItem(20, 190, QSizePolicy.Minimum, QSizePolicy.Expanding)

        self.verticalLayout_4.addItem(self.verticalSpacer)


        self.verticalLayout_2.addWidget(self.group_box_create_database)

        self.tab_widget_new_database.addTab(self.tab, "")
        self.tab_2 = QWidget()
        self.tab_2.setObjectName(u"tab_2")
        self.tab_widget_new_database.addTab(self.tab_2, "")
        self.tab_3 = QWidget()
        self.tab_3.setObjectName(u"tab_3")
        self.tab_widget_new_database.addTab(self.tab_3, "")
        self.tab_4 = QWidget()
        self.tab_4.setObjectName(u"tab_4")
        self.tab_widget_new_database.addTab(self.tab_4, "")

        self.verticalLayout.addWidget(self.tab_widget_new_database)

        self.tab_widget.addTab(self.tab_new_db, "")

        self.verticalLayout_3.addWidget(self.tab_widget)

        DBManagerMainWindow.setCentralWidget(self.central_widget)
        self.menu_bar = QMenuBar(DBManagerMainWindow)
        self.menu_bar.setObjectName(u"menu_bar")
        self.menu_bar.setGeometry(QRect(0, 0, 769, 22))
        self.menu_system = QMenu(self.menu_bar)
        self.menu_system.setObjectName(u"menu_system")
        self.menu_actions = QMenu(self.menu_bar)
        self.menu_actions.setObjectName(u"menu_actions")
        self.menu_help = QMenu(self.menu_bar)
        self.menu_help.setObjectName(u"menu_help")
        DBManagerMainWindow.setMenuBar(self.menu_bar)
        self.status_bar = QStatusBar(DBManagerMainWindow)
        self.status_bar.setObjectName(u"status_bar")
        DBManagerMainWindow.setStatusBar(self.status_bar)
        self.tool_bar = QToolBar(DBManagerMainWindow)
        self.tool_bar.setObjectName(u"tool_bar")
        DBManagerMainWindow.addToolBar(Qt.TopToolBarArea, self.tool_bar)

        self.menu_bar.addAction(self.menu_system.menuAction())
        self.menu_bar.addAction(self.menu_actions.menuAction())
        self.menu_bar.addAction(self.menu_help.menuAction())
        self.menu_system.addAction(self.action_settings)
        self.menu_system.addSeparator()
        self.menu_system.addAction(self.action_quit)
        self.menu_actions.addAction(self.action_update)
        self.menu_actions.addAction(self.action_disconnect_client)
        self.menu_actions.addSeparator()
        self.menu_actions.addAction(self.action_dump)
        self.menu_actions.addAction(self.action_restore)
        self.menu_actions.addSeparator()
        self.menu_actions.addAction(self.action_drop_database)
        self.menu_actions.addSeparator()
        self.menu_help.addSeparator()
        self.menu_help.addAction(self.action_about)
        self.menu_help.addSeparator()
        self.menu_help.addAction(self.action_about_qt)
        self.tool_bar.addSeparator()
        self.tool_bar.addAction(self.action_dump)
        self.tool_bar.addAction(self.action_restore)
        self.tool_bar.addSeparator()
        self.tool_bar.addAction(self.action_drop_database)
        self.tool_bar.addSeparator()
        self.tool_bar.addSeparator()
        self.tool_bar.addAction(self.action_update)
        self.tool_bar.addAction(self.action_disconnect_client)

        self.retranslateUi(DBManagerMainWindow)

        self.tab_widget.setCurrentIndex(0)
        self.tab_widget_new_database.setCurrentIndex(0)


        QMetaObject.connectSlotsByName(DBManagerMainWindow)
    # setupUi

    def retranslateUi(self, DBManagerMainWindow):
        DBManagerMainWindow.setWindowTitle(QCoreApplication.translate("DBManagerMainWindow", u"MainWindow", None))
        self.action_settings.setText(QCoreApplication.translate("DBManagerMainWindow", u"Settings", None))
        self.action_quit.setText(QCoreApplication.translate("DBManagerMainWindow", u"Quit", None))
        self.action_dump.setText(QCoreApplication.translate("DBManagerMainWindow", u"Dump", None))
#if QT_CONFIG(tooltip)
        self.action_dump.setToolTip(QCoreApplication.translate("DBManagerMainWindow", u"Database dump", None))
#endif // QT_CONFIG(tooltip)
        self.action_restore.setText(QCoreApplication.translate("DBManagerMainWindow", u"Restore", None))
#if QT_CONFIG(tooltip)
        self.action_restore.setToolTip(QCoreApplication.translate("DBManagerMainWindow", u"Database restore", None))
#endif // QT_CONFIG(tooltip)
        self.action_drop_database.setText(QCoreApplication.translate("DBManagerMainWindow", u"Drop Database", None))
        self.action_create_configure_database.setText(QCoreApplication.translate("DBManagerMainWindow", u"Create and configure a database", None))
        self.action_help_content.setText(QCoreApplication.translate("DBManagerMainWindow", u"Help content", None))
        self.action_about.setText(QCoreApplication.translate("DBManagerMainWindow", u"About...", None))
        self.action_update.setText(QCoreApplication.translate("DBManagerMainWindow", u"Update", None))
        self.action_disconnect_client.setText(QCoreApplication.translate("DBManagerMainWindow", u"Disconnect client", None))
        self.action_about_qt.setText(QCoreApplication.translate("DBManagerMainWindow", u"About Qt...", None))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_activity), QCoreApplication.translate("DBManagerMainWindow", u"Activity", None))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_database), QCoreApplication.translate("DBManagerMainWindow", u"Databases", None))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_roles), QCoreApplication.translate("DBManagerMainWindow", u"Roles", None))
        self.label_17.setText(QCoreApplication.translate("DBManagerMainWindow", u"New database name *", None))
        self.label_5.setText(QCoreApplication.translate("DBManagerMainWindow", u"* = As SQL language is NOT case sensitive to avoid problems these strings are automatically LOWERED", None))
        self.group_box_create_database.setTitle(QCoreApplication.translate("DBManagerMainWindow", u"Create database", None))
        self.label.setText(QCoreApplication.translate("DBManagerMainWindow", u"User", None))
        self.label_2.setText(QCoreApplication.translate("DBManagerMainWindow", u"Password", None))
        self.label_3.setText(QCoreApplication.translate("DBManagerMainWindow", u"Database", None))
        self.tab_widget_new_database.setTabText(self.tab_widget_new_database.indexOf(self.tab), QCoreApplication.translate("DBManagerMainWindow", u"Create database", None))
        self.tab_widget_new_database.setTabText(self.tab_widget_new_database.indexOf(self.tab_2), QCoreApplication.translate("DBManagerMainWindow", u"Configure database", None))
        self.tab_widget_new_database.setTabText(self.tab_widget_new_database.indexOf(self.tab_3), QCoreApplication.translate("DBManagerMainWindow", u"Messages", None))
        self.tab_widget_new_database.setTabText(self.tab_widget_new_database.indexOf(self.tab_4), QCoreApplication.translate("DBManagerMainWindow", u"Variables", None))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_new_db), QCoreApplication.translate("DBManagerMainWindow", u"New database", None))
        self.menu_system.setTitle(QCoreApplication.translate("DBManagerMainWindow", u"System", None))
        self.menu_actions.setTitle(QCoreApplication.translate("DBManagerMainWindow", u"Actions", None))
        self.menu_help.setTitle(QCoreApplication.translate("DBManagerMainWindow", u"Help", None))
        self.tool_bar.setWindowTitle(QCoreApplication.translate("DBManagerMainWindow", u"Quick Access", None))
    # retranslateUi

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>DBManagerMainWindow</class>
 <widget class="QMainWindow" name="DBManagerMainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>769</width>
    <height>495</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="central_widget">
   <layout class="QVBoxLayout" name="verticalLayout_3">
    <item>
     <widget class="QTabWidget" name="tab_widget">
      <property name="currentIndex">
       <number>0</number>
      </property>
      <widget class="QWidget" name="tab_activity">
       <attribute name="title">
        <string>Activity</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_activity">
        <item>
         <widget class="QTableWidget" name="activity_table_widget"/>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_database">
       <attribute name="title">
        <string>Databases</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_databases">
        <item>
         <widget class="QTableWidget" name="databases_table_widget"/>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_roles">
       <attribute name="title">
        <string>Roles</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_roles">
        <item>
         <widget class="QTableWidget" name="roles_table_widget"/>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_new_db">
       <attribute name="title">
        <string>New database</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout">
        <item>
         <layout class="QHBoxLayout" name="horizontalLayout">
          <item>
           <widget class="QLabel" name="label_17">
            <property name="text">
             <string>New database name *</string>
            </property>
           </widget>
          </item>
          <item>
           <widget class="QLineEdit" name="line_edit_new_database"/>
          </item>
          <item>
           <spacer name="horizontalSpacer_5">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
            <property name="sizeHint" stdset="0">
             <size>
              <width>244</width>
              <height>45</height>
             </size>
            </property>
           </spacer>
          </item>
          <item>
           <widget class="QLabel" name="label_5">
            <property name="text">
             <string>* = As SQL language is NOT case sensitive to avoid problems these strings are automatically LOWERED</string>
            </property>
            <property name="wordWrap">
             <bool>true</bool>
            </property>
           </widget>
          </item>
         </layout>
        </item>
        <item>
         <widget class="QTabWidget" name="tab_widget_new_database">
          <property name="currentIndex">
           <number>0</number>
          </property>
          <widget class="QWidget" name="tab">
           <attribute name="title">
            <string>Create database</string>
           </attribute>
           <layout class="QVBoxLayout" name="verticalLayout_2">
            <item>
             <widget class="QGroupBox" name="group_box_create_database">
              <property name="title">
               <string>Create database</string>
              </property>
              <property name="checkable">
               <bool>true</bool>
              </property>
              <layout class="QVBoxLayout" name="verticalLayout_4">
               <item>
                <layout class="QHBoxLayout" name="horizontalLayout_2">
                 <item>
                  <widget class="QLabel" name="label">
                   <property name="text">
                    <string>User</string>
                   </property>
                  </widget>
                 </item>
                 <item>
                  <widget class="QLineEdit" name="line_edit_user"/>
                 </item>
                 <item>
                  <widget class="QLabel" name="label_2">
                   <property name="text">
                    <string>Password</string>
                   </property>
                  </widget>
                 </item>
                 <item>
                  <widget class="QLineEdit" name="line_Edit_password">
                   <property name="echoMode">
                    <enum>QLineEdit::Password</enum>
                   </property>
                  </widget>
                 </item>
                 <item>
                  <widget class="QLabel" name="label_3">
                   <property name="text">
                    <string>Database</string>
                   </property>
                  </widget>
                 </item>
                 <item>
                  <widget class="QLineEdit" name="line_edit_database"/>
                 </item>
                </layout>
               </item>
               <item>
                <spacer name="verticalSpacer">
                 <property name="orientation">
                  <enum>Qt::Vertical</enum>
                 </property>
                 <property name="sizeHint" stdset="0">
                  <size>
                   <width>20</width>
                   <height>190</height>
                  </size>
                 </property>
                </spacer>
               </item>
              </layout>
             </widget>
            </item>
           </layout>
          </widget>
          <widget class="QWidget" name="tab_2">
           <attribute name="title">
            <string>Configure database</string>
           </attribute>
          </widget>
          <widget class="QWidget" name="tab_3">
           <attribute name="title">
            <string>Messages</string>
           </attribute>
          </widget>
          <widget class="QWidget" name="tab_4">
           <attribute name="title">
            <string>Variables</string>
           </attribute>
          </widget>
         </widget>
        </item>
       </layout>
      </widget>
     </widget>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menu_bar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>769</width>
     <height>22</height>
    </rect>
   </property>
   <widget class="QMenu" name="menu_system">
    <property name="title">
     <string>System</string>
    </property>
    <addaction name="action_settings"/>
    <addaction name="separator"/>
    <addaction name="action_quit"/>
   </widget>
   <widget class="QMenu" name="menu_actions">
    <property name="title">
     <string>Actions</string>
    </property>
    <addaction name="action_update"/>
    <addaction name="action_disconnect_client"/>
    <addaction name="separator"/>
    <addaction name="action_dump"/>
    <addaction name="action_restore"/>
    <addaction name="separator"/>
    <addaction name="action_drop_database"/>
    <addaction name="separator"/>
   </widget>
   <widget class="QMenu" name="menu_help">
    <property name="title">
     <string>Help</string>
    </property>
    <addaction name="separator"/>
    <addaction name="action_about"/>
    <addaction name="separator"/>
    <addaction name="action_about_qt"/>
   </widget>
   <addaction name="menu_system"/>
   <addaction name="menu_actions"/>
   <addaction name="menu_help"/>
  </widget>
  <widget class="QStatusBar" name="status_bar"/>
  <widget class="QToolBar" name="tool_bar">
   <property name="windowTitle">
    <string>Quick Access</string>
   </property>
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>false</bool>
   </attribute>
   <addaction name="separator"/>
   <addaction name="action_dump"/>
   <addaction name="action_restore"/>
   <addaction name="separator"/>
   <addaction name="action_drop_database"/>
   <addaction name="separator"/>
   <addaction name="separator"/>
   <addaction name="action_update"/>
   <addaction name="action_disconnect_client"/>
  </widget>
  <action name="action_settings">
   <property name="text">
    <string>Settings</string>
   </property>
  </action>
  <action name="action_quit">
   <property name="text">
    <string>Quit</string>
   </property>
  </action>
  <action name="action_dump">
   <property name="text">
    <string>Dump</string>
   </property>
   <property name="toolTip">
    <string>Database dump</string>
   </property>
  </action>
  <action name="action_restore">
   <property name="text">
    <string>Restore</string>
   </property>
   <property name="toolTip">
    <string>Database restore</string>
   </property>
  </action>
  <action name="action_drop_database">
   <property name="text">
    <string>Drop Database</string>
   </property>
  </action>
  <action name="action_create_configure_database">
   <property name="text">
    <string>Create and configure a database</string>
   </property>
  </action>
  <action name="action_help_content">
   <property name="text">
    <string>Help content</string>
   </property>
  </action>
  <action name="action_about">
   <property name="text">
    <string>About...</string>
   </property>
  </action>
  <action name="action_update">
   <property name="text">
    <string>Update</string>
   </property>
  </action>
  <action name="action_disconnect_client">
   <property name="text">
    <string>Disconnect client</string>
   </property>
  </action>
  <action name="action_about_qt">
   <property name="text">
    <string>About Qt...</string>
   </property>
  </action>
 </widget>
 <resources/>
 <connections/>
</ui>
# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file 'DBManagerMainWindowGood.ui'
##
## Created by: Qt User Interface Compiler version 6.3.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
    QMetaObject, QObject, QPoint, QRect,
    QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
    QCursor, QFont, QFontDatabase, QGradient,
    QIcon, QImage, QKeySequence, QLinearGradient,
    QPainter, QPalette, QPixmap, QRadialGradient,
    QTransform)
from PySide6.QtWidgets import (QApplication, QGroupBox, QHBoxLayout, QHeaderView,
    QLabel, QLineEdit, QMainWindow, QMenu,
    QMenuBar, QSizePolicy, QSpacerItem, QStatusBar,
    QTabWidget, QTableWidget, QTableWidgetItem, QToolBar,
    QVBoxLayout, QWidget)

class Ui_DBManagerMainWindow(object):
    def setupUi(self, DBManagerMainWindow):
        if not DBManagerMainWindow.objectName():
            DBManagerMainWindow.setObjectName(u"DBManagerMainWindow")
        DBManagerMainWindow.resize(992, 596)
        self.action_settings = QAction(DBManagerMainWindow)
        self.action_settings.setObjectName(u"action_settings")
        self.action_quit = QAction(DBManagerMainWindow)
        self.action_quit.setObjectName(u"action_quit")
        self.action_dump = QAction(DBManagerMainWindow)
        self.action_dump.setObjectName(u"action_dump")
        self.action_restore = QAction(DBManagerMainWindow)
        self.action_restore.setObjectName(u"action_restore")
        self.action_drop_database = QAction(DBManagerMainWindow)
        self.action_drop_database.setObjectName(u"action_drop_database")
        self.action_create_configure_database = QAction(DBManagerMainWindow)
        self.action_create_configure_database.setObjectName(u"action_create_configure_database")
        self.action_help_content = QAction(DBManagerMainWindow)
        self.action_help_content.setObjectName(u"action_help_content")
        self.action_about = QAction(DBManagerMainWindow)
        self.action_about.setObjectName(u"action_about")
        self.action_update = QAction(DBManagerMainWindow)
        self.action_update.setObjectName(u"action_update")
        self.action_disconnect_client = QAction(DBManagerMainWindow)
        self.action_disconnect_client.setObjectName(u"action_disconnect_client")
        self.action_about_qt = QAction(DBManagerMainWindow)
        self.action_about_qt.setObjectName(u"action_about_qt")
        self.central_widget = QWidget(DBManagerMainWindow)
        self.central_widget.setObjectName(u"central_widget")
        self.verticalLayout_3 = QVBoxLayout(self.central_widget)
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.tab_widget = QTabWidget(self.central_widget)
        self.tab_widget.setObjectName(u"tab_widget")
        self.tab_activity = QWidget()
        self.tab_activity.setObjectName(u"tab_activity")
        self.verticalLayout_activity = QVBoxLayout(self.tab_activity)
        self.verticalLayout_activity.setObjectName(u"verticalLayout_activity")
        self.activity_table_widget = QTableWidget(self.tab_activity)
        self.activity_table_widget.setObjectName(u"activity_table_widget")

        self.verticalLayout_activity.addWidget(self.activity_table_widget)

        self.tab_widget.addTab(self.tab_activity, "")
        self.tab_database = QWidget()
        self.tab_database.setObjectName(u"tab_database")
        self.verticalLayout_databases = QVBoxLayout(self.tab_database)
        self.verticalLayout_databases.setObjectName(u"verticalLayout_databases")
        self.databases_table_widget = QTableWidget(self.tab_database)
        self.databases_table_widget.setObjectName(u"databases_table_widget")

        self.verticalLayout_databases.addWidget(self.databases_table_widget)

        self.tab_widget.addTab(self.tab_database, "")
        self.tab_roles = QWidget()
        self.tab_roles.setObjectName(u"tab_roles")
        self.verticalLayout_roles = QVBoxLayout(self.tab_roles)
        self.verticalLayout_roles.setObjectName(u"verticalLayout_roles")
        self.roles_table_widget = QTableWidget(self.tab_roles)
        self.roles_table_widget.setObjectName(u"roles_table_widget")

        self.verticalLayout_roles.addWidget(self.roles_table_widget)

        self.tab_widget.addTab(self.tab_roles, "")
        self.tab_new_db = QWidget()
        self.tab_new_db.setObjectName(u"tab_new_db")
        self.verticalLayout = QVBoxLayout(self.tab_new_db)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.label_17 = QLabel(self.tab_new_db)
        self.label_17.setObjectName(u"label_17")

        self.horizontalLayout.addWidget(self.label_17)

        self.line_edit_new_database = QLineEdit(self.tab_new_db)
        self.line_edit_new_database.setObjectName(u"line_edit_new_database")

        self.horizontalLayout.addWidget(self.line_edit_new_database)

        self.horizontalSpacer_5 = QSpacerItem(244, 45, QSizePolicy.Expanding, QSizePolicy.Minimum)

        self.horizontalLayout.addItem(self.horizontalSpacer_5)

        self.label_5 = QLabel(self.tab_new_db)
        self.label_5.setObjectName(u"label_5")
        self.label_5.setWordWrap(True)

        self.horizontalLayout.addWidget(self.label_5)


        self.verticalLayout.addLayout(self.horizontalLayout)

        self.tab_widget_new_database = QTabWidget(self.tab_new_db)
        self.tab_widget_new_database.setObjectName(u"tab_widget_new_database")
        self.tab = QWidget()
        self.tab.setObjectName(u"tab")
        self.verticalLayout_2 = QVBoxLayout(self.tab)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.group_box_create_database = QGroupBox(self.tab)
        self.group_box_create_database.setObjectName(u"group_box_create_database")
        self.group_box_create_database.setCheckable(True)

        self.verticalLayout_2.addWidget(self.group_box_create_database)

        self.tab_widget_new_database.addTab(self.tab, "")
        self.tab_2 = QWidget()
        self.tab_2.setObjectName(u"tab_2")
        self.tab_widget_new_database.addTab(self.tab_2, "")
        self.tab_3 = QWidget()
        self.tab_3.setObjectName(u"tab_3")
        self.tab_widget_new_database.addTab(self.tab_3, "")
        self.tab_4 = QWidget()
        self.tab_4.setObjectName(u"tab_4")
        self.tab_widget_new_database.addTab(self.tab_4, "")

        self.verticalLayout.addWidget(self.tab_widget_new_database)

        self.tab_widget.addTab(self.tab_new_db, "")

        self.verticalLayout_3.addWidget(self.tab_widget)

        DBManagerMainWindow.setCentralWidget(self.central_widget)
        self.menu_bar = QMenuBar(DBManagerMainWindow)
        self.menu_bar.setObjectName(u"menu_bar")
        self.menu_bar.setGeometry(QRect(0, 0, 992, 22))
        self.menu_system = QMenu(self.menu_bar)
        self.menu_system.setObjectName(u"menu_system")
        self.menu_actions = QMenu(self.menu_bar)
        self.menu_actions.setObjectName(u"menu_actions")
        self.menu_help = QMenu(self.menu_bar)
        self.menu_help.setObjectName(u"menu_help")
        DBManagerMainWindow.setMenuBar(self.menu_bar)
        self.status_bar = QStatusBar(DBManagerMainWindow)
        self.status_bar.setObjectName(u"status_bar")
        DBManagerMainWindow.setStatusBar(self.status_bar)
        self.tool_bar = QToolBar(DBManagerMainWindow)
        self.tool_bar.setObjectName(u"tool_bar")
        DBManagerMainWindow.addToolBar(Qt.TopToolBarArea, self.tool_bar)

        self.menu_bar.addAction(self.menu_system.menuAction())
        self.menu_bar.addAction(self.menu_actions.menuAction())
        self.menu_bar.addAction(self.menu_help.menuAction())
        self.menu_system.addAction(self.action_settings)
        self.menu_system.addSeparator()
        self.menu_system.addAction(self.action_quit)
        self.menu_actions.addAction(self.action_update)
        self.menu_actions.addAction(self.action_disconnect_client)
        self.menu_actions.addSeparator()
        self.menu_actions.addAction(self.action_dump)
        self.menu_actions.addAction(self.action_restore)
        self.menu_actions.addSeparator()
        self.menu_actions.addAction(self.action_drop_database)
        self.menu_actions.addSeparator()
        self.menu_help.addSeparator()
        self.menu_help.addAction(self.action_about)
        self.menu_help.addSeparator()
        self.menu_help.addAction(self.action_about_qt)
        self.tool_bar.addSeparator()
        self.tool_bar.addAction(self.action_dump)
        self.tool_bar.addAction(self.action_restore)
        self.tool_bar.addSeparator()
        self.tool_bar.addAction(self.action_drop_database)
        self.tool_bar.addSeparator()
        self.tool_bar.addSeparator()
        self.tool_bar.addAction(self.action_update)
        self.tool_bar.addAction(self.action_disconnect_client)

        self.retranslateUi(DBManagerMainWindow)

        self.tab_widget.setCurrentIndex(2)
        self.tab_widget_new_database.setCurrentIndex(3)


        QMetaObject.connectSlotsByName(DBManagerMainWindow)
    # setupUi

    def retranslateUi(self, DBManagerMainWindow):
        DBManagerMainWindow.setWindowTitle(QCoreApplication.translate("DBManagerMainWindow", u"MainWindow", None))
        self.action_settings.setText(QCoreApplication.translate("DBManagerMainWindow", u"Settings", None))
        self.action_quit.setText(QCoreApplication.translate("DBManagerMainWindow", u"Quit", None))
        self.action_dump.setText(QCoreApplication.translate("DBManagerMainWindow", u"Dump", None))
#if QT_CONFIG(tooltip)
        self.action_dump.setToolTip(QCoreApplication.translate("DBManagerMainWindow", u"Database dump", None))
#endif // QT_CONFIG(tooltip)
        self.action_restore.setText(QCoreApplication.translate("DBManagerMainWindow", u"Restore", None))
#if QT_CONFIG(tooltip)
        self.action_restore.setToolTip(QCoreApplication.translate("DBManagerMainWindow", u"Database restore", None))
#endif // QT_CONFIG(tooltip)
        self.action_drop_database.setText(QCoreApplication.translate("DBManagerMainWindow", u"Drop Database", None))
        self.action_create_configure_database.setText(QCoreApplication.translate("DBManagerMainWindow", u"Create and configure a database", None))
        self.action_help_content.setText(QCoreApplication.translate("DBManagerMainWindow", u"Help content", None))
        self.action_about.setText(QCoreApplication.translate("DBManagerMainWindow", u"About...", None))
        self.action_update.setText(QCoreApplication.translate("DBManagerMainWindow", u"Update", None))
        self.action_disconnect_client.setText(QCoreApplication.translate("DBManagerMainWindow", u"Disconnect client", None))
        self.action_about_qt.setText(QCoreApplication.translate("DBManagerMainWindow", u"About Qt...", None))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_activity), QCoreApplication.translate("DBManagerMainWindow", u"Activity", None))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_database), QCoreApplication.translate("DBManagerMainWindow", u"Databases", None))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_roles), QCoreApplication.translate("DBManagerMainWindow", u"Roles", None))
        self.label_17.setText(QCoreApplication.translate("DBManagerMainWindow", u"New database name *", None))
        self.label_5.setText(QCoreApplication.translate("DBManagerMainWindow", u"* = As SQL language is NOT case sensitive to avoid problems these strings are automatically LOWERED", None))
        self.group_box_create_database.setTitle(QCoreApplication.translate("DBManagerMainWindow", u"Create database", None))
        self.tab_widget_new_database.setTabText(self.tab_widget_new_database.indexOf(self.tab), QCoreApplication.translate("DBManagerMainWindow", u"Create database", None))
        self.tab_widget_new_database.setTabText(self.tab_widget_new_database.indexOf(self.tab_2), QCoreApplication.translate("DBManagerMainWindow", u"Configure database", None))
        self.tab_widget_new_database.setTabText(self.tab_widget_new_database.indexOf(self.tab_3), QCoreApplication.translate("DBManagerMainWindow", u"Messages", None))
        self.tab_widget_new_database.setTabText(self.tab_widget_new_database.indexOf(self.tab_4), QCoreApplication.translate("DBManagerMainWindow", u"Variables", None))
        self.tab_widget.setTabText(self.tab_widget.indexOf(self.tab_new_db), QCoreApplication.translate("DBManagerMainWindow", u"New database", None))
        self.menu_system.setTitle(QCoreApplication.translate("DBManagerMainWindow", u"System", None))
        self.menu_actions.setTitle(QCoreApplication.translate("DBManagerMainWindow", u"Actions", None))
        self.menu_help.setTitle(QCoreApplication.translate("DBManagerMainWindow", u"Help", None))
        self.tool_bar.setWindowTitle(QCoreApplication.translate("DBManagerMainWindow", u"Quick Access", None))
    # retranslateUi

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>DBManagerMainWindow</class>
 <widget class="QMainWindow" name="DBManagerMainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>992</width>
    <height>596</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="central_widget">
   <layout class="QVBoxLayout" name="verticalLayout_3">
    <item>
     <widget class="QTabWidget" name="tab_widget">
      <property name="currentIndex">
       <number>2</number>
      </property>
      <widget class="QWidget" name="tab_activity">
       <attribute name="title">
        <string>Activity</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_activity">
        <item>
         <widget class="QTableWidget" name="activity_table_widget"/>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_database">
       <attribute name="title">
        <string>Databases</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_databases">
        <item>
         <widget class="QTableWidget" name="databases_table_widget"/>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_roles">
       <attribute name="title">
        <string>Roles</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_roles">
        <item>
         <widget class="QTableWidget" name="roles_table_widget"/>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_new_db">
       <attribute name="title">
        <string>New database</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout">
        <item>
         <layout class="QHBoxLayout" name="horizontalLayout">
          <item>
           <widget class="QLabel" name="label_17">
            <property name="text">
             <string>New database name *</string>
            </property>
           </widget>
          </item>
          <item>
           <widget class="QLineEdit" name="line_edit_new_database"/>
          </item>
          <item>
           <spacer name="horizontalSpacer_5">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
            <property name="sizeHint" stdset="0">
             <size>
              <width>244</width>
              <height>45</height>
             </size>
            </property>
           </spacer>
          </item>
          <item>
           <widget class="QLabel" name="label_5">
            <property name="text">
             <string>* = As SQL language is NOT case sensitive to avoid problems these strings are automatically LOWERED</string>
            </property>
            <property name="wordWrap">
             <bool>true</bool>
            </property>
           </widget>
          </item>
         </layout>
        </item>
        <item>
         <widget class="QTabWidget" name="tab_widget_new_database">
          <property name="currentIndex">
           <number>3</number>
          </property>
          <widget class="QWidget" name="tab">
           <attribute name="title">
            <string>Create database</string>
           </attribute>
           <layout class="QVBoxLayout" name="verticalLayout_2">
            <item>
             <widget class="QGroupBox" name="group_box_create_database">
              <property name="title">
               <string>Create database</string>
              </property>
              <property name="checkable">
               <bool>true</bool>
              </property>
             </widget>
            </item>
           </layout>
          </widget>
          <widget class="QWidget" name="tab_2">
           <attribute name="title">
            <string>Configure database</string>
           </attribute>
          </widget>
          <widget class="QWidget" name="tab_3">
           <attribute name="title">
            <string>Messages</string>
           </attribute>
          </widget>
          <widget class="QWidget" name="tab_4">
           <attribute name="title">
            <string>Variables</string>
           </attribute>
          </widget>
         </widget>
        </item>
       </layout>
      </widget>
     </widget>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menu_bar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>992</width>
     <height>22</height>
    </rect>
   </property>
   <widget class="QMenu" name="menu_system">
    <property name="title">
     <string>System</string>
    </property>
    <addaction name="action_settings"/>
    <addaction name="separator"/>
    <addaction name="action_quit"/>
   </widget>
   <widget class="QMenu" name="menu_actions">
    <property name="title">
     <string>Actions</string>
    </property>
    <addaction name="action_update"/>
    <addaction name="action_disconnect_client"/>
    <addaction name="separator"/>
    <addaction name="action_dump"/>
    <addaction name="action_restore"/>
    <addaction name="separator"/>
    <addaction name="action_drop_database"/>
    <addaction name="separator"/>
   </widget>
   <widget class="QMenu" name="menu_help">
    <property name="title">
     <string>Help</string>
    </property>
    <addaction name="separator"/>
    <addaction name="action_about"/>
    <addaction name="separator"/>
    <addaction name="action_about_qt"/>
   </widget>
   <addaction name="menu_system"/>
   <addaction name="menu_actions"/>
   <addaction name="menu_help"/>
  </widget>
  <widget class="QStatusBar" name="status_bar"/>
  <widget class="QToolBar" name="tool_bar">
   <property name="windowTitle">
    <string>Quick Access</string>
   </property>
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>false</bool>
   </attribute>
   <addaction name="separator"/>
   <addaction name="action_dump"/>
   <addaction name="action_restore"/>
   <addaction name="separator"/>
   <addaction name="action_drop_database"/>
   <addaction name="separator"/>
   <addaction name="separator"/>
   <addaction name="action_update"/>
   <addaction name="action_disconnect_client"/>
  </widget>
  <action name="action_settings">
   <property name="text">
    <string>Settings</string>
   </property>
  </action>
  <action name="action_quit">
   <property name="text">
    <string>Quit</string>
   </property>
  </action>
  <action name="action_dump">
   <property name="text">
    <string>Dump</string>
   </property>
   <property name="toolTip">
    <string>Database dump</string>
   </property>
  </action>
  <action name="action_restore">
   <property name="text">
    <string>Restore</string>
   </property>
   <property name="toolTip">
    <string>Database restore</string>
   </property>
  </action>
  <action name="action_drop_database">
   <property name="text">
    <string>Drop Database</string>
   </property>
  </action>
  <action name="action_create_configure_database">
   <property name="text">
    <string>Create and configure a database</string>
   </property>
  </action>
  <action name="action_help_content">
   <property name="text">
    <string>Help content</string>
   </property>
  </action>
  <action name="action_about">
   <property name="text">
    <string>About...</string>
   </property>
  </action>
  <action name="action_update">
   <property name="text">
    <string>Update</string>
   </property>
  </action>
  <action name="action_disconnect_client">
   <property name="text">
    <string>Disconnect client</string>
   </property>
  </action>
  <action name="action_about_qt">
   <property name="text">
    <string>About Qt...</string>
   </property>
  </action>
 </widget>
 <resources/>
 <connections/>
</ui>
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

# Author: Paolo De Stefani
# Contact: paolo <at> paolodestefani <dot> it
# Copyright (C) Paolo De Stefani
# Licence: <???>

"""DB Manager - Manage Databases

This program manage databases

"""
# standard library
import sys
import os
import platform

#import os.path
#import glob

# PySide6
from PySide6 import __version__ as pyside6_version
from PySide6.QtCore import qVersion
from PySide6.QtCore import Qt
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QMessageBox
from PySide6.QtWidgets import QMainWindow
from PySide6.QtWidgets import QLabel
from PySide6.QtWidgets import QAbstractItemView
from PySide6.QtWidgets import QApplication

#from DBManagerMainWindowGood import Ui_DBManagerMainWindow
from DBManagerMainWindowBad import Ui_DBManagerMainWindow

from __feature__ import snake_case, true_property

APPNAME = 'pyDBManager'
APPVERSION = '00.04.00'
ORGANIZATION = 'PDS Software'
DOMAIN = 'www.paolodestefani.it'

AUTHOR = 'Paolo De Stefani'
EMAIL = 'pa...@paolodestefani.it'
WEBSITE = 'www.paolodestefani.it'


# main window
class MainWindow(QMainWindow):
    """Application Main Window"""

    def __init__(self, parent=None):
        """Main window Initialization"""
        super().__init__(parent)
        self.ui = Ui_DBManagerMainWindow()
        self.ui.setupUi(self)
        # window title
        self.window_title = f"{APPNAME} version {APPVERSION}"
        # set statusbar
        self.status_log = QLabel()
        self.ui.status_bar.add_permanent_widget(self.status_log)
        # connection parameters
        self.connpar = dict()
        # activity table widget
        self.activity_table_widget_header = ["PID",
                                             "State",
                                             "Database",
                                             "User name",
                                             "Client name",
                                             "Client address",
                                             "Client port",
                                             "Application name",
                                             "Connection start time",
                                             "Query start time",
                                             "Query"]
        self.ui.activity_table_widget.column_count = len(self.activity_table_widget_header)
        self.ui.activity_table_widget.sorting_enabled = True
        self.ui.activity_table_widget.set_horizontal_header_labels(self.activity_table_widget_header)
        self.ui.activity_table_widget.horizontal_header().default_alignment = Qt.AlignLeft
        self.ui.activity_table_widget.selection_behavior = QAbstractItemView.SelectRows
        # databases table widget
        self.databases_table_widget_header = ["OID",
                                              "Name",
                                              "Encoding",
                                              "Collate",
                                              "CType",
                                              "Template"]
        self.ui.databases_table_widget.column_count = len(self.databases_table_widget_header)
        self.ui.databases_table_widget.sorting_enabled = True
        self.ui.databases_table_widget.set_horizontal_header_labels(self.databases_table_widget_header)
        self.ui.databases_table_widget.horizontal_header().default_alignment = Qt.AlignLeft
        self.ui.databases_table_widget.selection_behavior = QAbstractItemView.SelectRows
        # users table widget
        self.roles_table_widget_header = ["Name",
                                          "Superuser",
                                          "Inherit",
                                          "Create role",
                                          "Create db",
                                          "Cat update",
                                          "Login",
                                          "Replication",
                                          "OID"]
        self.ui.roles_table_widget.column_count = len(self.roles_table_widget_header)
        self.ui.roles_table_widget.sorting_enabled = True
        self.ui.roles_table_widget.set_horizontal_header_labels(self.roles_table_widget_header)
        self.ui.roles_table_widget.horizontal_header().default_alignment = Qt.AlignLeft
        self.ui.roles_table_widget.selection_behavior = QAbstractItemView.SelectRows
        # signal/slot mappings
        self.ui.action_quit.triggered.connect(self.close)
        self.ui.action_about.triggered.connect(self.about)
        self.ui.action_about_qt.triggered.connect(self.about_qt)

    def close_event(self, event):
        if QMessageBox.question(self,
                                "Information",
                                f"Quit from {APPNAME} ?",
                                QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
           pass
        else:
            event.ignore()

    def about(self):
        "About action"
        text = """
            <p style="font-size: 20pt; font-weight: bold; font-style: italic; color: blue;">{0}
            <span style="font-size: 12pt; font-style: normal; color: black;"> version {1}</span></p>
            <p style="font-weight: bold;">Copyright &copy; {2}</p>
            <p style="font-weight: bold;"><a class="mail" href="mailto:{3}">{3}</a> - <a href="{4}">{4}</a></p>
            <p>Developed with:
            <ul>
                <li><a href="http://www.python.org";>Python</a> programming language</li>
                <li><a href="http://qt-project.org/";>Qt</a> cross-platform application and UI framework</li>
                <li><a href="http://pyside.org";>PySide6</a> a set of python bindings for Qt</li>
                <li><a href="http://www.oxygen-icons.org/";>oxygen icons</a> icon set</li>
            </ul>
            </p>
            <p style="font-style: italic">Python {5} - PyQt {6} -
             Qt {7} on {8}</p>""".format(APPNAME,
                                         APPVERSION,
                                         AUTHOR,
                                         EMAIL,
                                         WEBSITE,
                                         platform.python_version(),
                                         pyside6_version,
                                         qVersion(),
                                         platform.system())
        QMessageBox.about(self, f"{APPNAME} {APPNAME}", text)

    def about_qt(self):
        "About Qt"
        QMessageBox.about_qt(self, "About Qt")


if __name__ == "__main__":
    "Start QApplication"
    app = QApplication(sys.argv)
    app.organization_name = ORGANIZATION
    app.organization_domain = DOMAIN
    app.application_name = APPNAME
    app.window_icon = QIcon(f":/{APPNAME}")
    window = MainWindow()
    window.show()
    sys.exit(app.exec())


_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to