-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
55 lines (43 loc) · 1.73 KB
/
main.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
43
44
45
46
47
48
49
50
51
52
53
54
55
import sys
import platform
import serial.tools.list_ports
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import (QCoreApplication, QPropertyAnimation, QDate, QDateTime,
QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt, QEvent)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabase,
QIcon, QKeySequence, QLinearGradient, QPalette, QPainter, QPixmap, QRadialGradient)
from PySide2.QtWidgets import *
# GUI FILE
from ui_serial import Ui_MainWindow
# IMPORT FUNCTIONS
from ui_functions import *
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
# MOVE WINDOW
def moveWindow(event):
# RESTORE BEFORE MOVE
if UIFunctions.returnStatus() == 1:
UIFunctions.maximize_restore(self)
# IF LEFT CLICK MOVE WINDOW
if event.buttons() == Qt.LeftButton:
self.move(self.pos() + event.globalPos() - self.dragPos)
self.dragPos = event.globalPos()
event.accept()
# SET TITLE BAR
self.ui.title_bar.mouseMoveEvent = moveWindow
# ==> SET UI DEFINITIONS
UIFunctions.uiDefinitions(self)
# SHOW ==> MAIN WINDOW
########################################################################
self.show()
# APP EVENTS
########################################################################
def mousePressEvent(self, event):
self.dragPos = event.globalPos()
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec_())