DEV Community

KateMLady
KateMLady

Posted on

PyQt5 isn't only for frontend

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
Enter fullscreen mode Exit fullscreen mode

QT tasks:

  1. Provide output of the graphic editor with the specified parameters in the executable file (.py/.ui)
  2. Link the core code with the frontend (output to the web is provided by a number of libraries using drawing/design)
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>1126</width>
    <height>694</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Security analysis of the Smart Home system</string>
  </property>
  <property name="styleSheet">
   <string notr="true"/>
  </property>
Enter fullscreen mode Exit fullscreen mode

Databases not linked to SQL are displayed manually using table forms. All field headers and their contents are listed here in XML format and their characteristics in the system.

def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Security analysis of the Smart Home system"))
        self.label.setText(_translate("MainWindow", "Select Smart Home options"))
        self.label_2.setText(_translate("MainWindow", "Smart lighting solutions:"))
        self.label_3.setText(_translate("MainWindow", "Smart home appliances:"))
        self.label_4.setText(_translate("MainWindow", "Control modules:"))
        self.label_5.setText(_translate("MainWindow", "Smart CCTV Cameras:"))
        self.label_6.setText(_translate("MainWindow", "Smart Garage Door Openers:"))
        self.label_7.setText(_translate("MainWindow", "Smart Home Sensors:"))
        self.pushButton.setText(_translate("MainWindow", "Analyze"))
Enter fullscreen mode Exit fullscreen mode

Graphic objects and their symbols are listed in a highlighted form (web possible).

Top comments (0)