Final goyda
This commit is contained in:
22
final.py
22
final.py
@ -3,7 +3,7 @@ import os
|
||||
import sys
|
||||
import time
|
||||
from datetime import datetime
|
||||
from logging import debug, info
|
||||
from logging import debug, info, error
|
||||
from threading import Timer
|
||||
|
||||
from PyQt6 import QtCore, QtWidgets, QtGui
|
||||
@ -439,10 +439,25 @@ class Window(QtWidgets.QMainWindow):
|
||||
self.ui.DeviceSelection.setCurrentText(selected)
|
||||
|
||||
def showModeTable(self) -> None:
|
||||
self.pixmap = QtGui.QPixmap("../table.png")
|
||||
def resource_path(relative_path):
|
||||
try:
|
||||
base_path = sys._MEIPASS
|
||||
except Exception:
|
||||
base_path = os.path.abspath(".")
|
||||
return os.path.join(base_path, relative_path)
|
||||
|
||||
self.pixmap = QtGui.QPixmap(resource_path("../table.png"))
|
||||
if self.pixmap.width() == 0:
|
||||
self.pixmap = QtGui.QPixmap(resource_path("table.png"))
|
||||
if self.pixmap.width() == 0:
|
||||
error('Failed to load mode table image!')
|
||||
exit(1)
|
||||
|
||||
|
||||
debug(self.pixmap.width())
|
||||
|
||||
self.imageDialog = QtWidgets.QDialog()
|
||||
self.imageDialog.setWindowTitle('Описание режимов работы')
|
||||
self.imageDialog.resize(self.pixmap.width(), self.pixmap.height())
|
||||
self.imageLabel = QtWidgets.QLabel(self.imageDialog)
|
||||
self.imageLabel.resize(self.pixmap.width(), self.pixmap.height())
|
||||
@ -461,10 +476,8 @@ class Window(QtWidgets.QMainWindow):
|
||||
return super().eventFilter(obj, event)
|
||||
|
||||
|
||||
# 2, 37, 33, 60
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
|
||||
def setup_logs() -> None:
|
||||
os.makedirs("logs", exist_ok=True)
|
||||
logging.basicConfig(
|
||||
@ -479,6 +492,7 @@ def setup_logs() -> None:
|
||||
|
||||
if __name__ == '__main__':
|
||||
setup_logs()
|
||||
|
||||
window = Window()
|
||||
window.show()
|
||||
|
||||
|
Reference in New Issue
Block a user