-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
27 lines (20 loc) · 880 Bytes
/
app.py
File metadata and controls
27 lines (20 loc) · 880 Bytes
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
from PyQt5.QtWidgets import QApplication
from printer_tool.registration import LicenseStore, get_machine_code, validate_registration_token
from printer_tool.registration_ui import RegistrationDialog
from printer_tool.runtime_icon import apply_application_icon
from printer_tool.ui import MainWindow
def main() -> int:
app = QApplication.instance() or QApplication([])
apply_application_icon(app, "PrinterTool.ico", app_id="PrinterTool.Main")
store = LicenseStore()
machine_code = get_machine_code()
valid, _, _ = validate_registration_token(store.load(), machine_code)
if not valid:
dialog = RegistrationDialog(store=store, machine_code=machine_code)
if dialog.exec_() != dialog.Accepted:
return 0
window = MainWindow()
window.show()
return app.exec_()
if __name__ == "__main__":
raise SystemExit(main())