-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_develop.py
42 lines (30 loc) · 1.31 KB
/
main_develop.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import sys
from PySide6.QtWidgets import QApplication
from PySide6.QtCore import QFile, QObject
from PySide6.QtUiTools import QUiLoader
from tabs.tabLogExtractor import LogExtractorTab
from tabs.tabFwUpdater import FwUpdaterTab
UPDATER_XML_FILE = os.path.join(os.getenv('APPDATA'), "ifm electronic", "ifmVisionServiceTool", "updater", "recent.xml")
EXTRACTOR_XML_FILE = os.path.join(os.getenv('APPDATA'), "ifm electronic", "ifmVisionServiceTool", "extractor", "recent.xml")
class Window(QObject):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
ui_file_name = "form/form.ui"
ui_file = QFile(ui_file_name)
if not ui_file.open(QFile.ReadOnly):
print(f"Cannot open {ui_file_name}: {ui_file.errorString()}")
sys.exit(-1)
loader = QUiLoader()
self.window = loader.load(ui_file)
ui_file.close()
self.logExtractorTab = LogExtractorTab(window=self.window, recent_xml_file=EXTRACTOR_XML_FILE)
self.FwUpdaterTab = FwUpdaterTab(window=self.window, recent_xml_file=UPDATER_XML_FILE)
if not self.window:
print(loader.errorString())
sys.exit(-1)
if __name__ == '__main__':
app = QApplication(sys.argv)
widget = Window()
widget.window.show()
sys.exit(app.exec())