-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
157 lines (134 loc) · 5.48 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import sys
from pathlib import Path
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtGui import QIcon
from src.components.Logo.logo import Logo
from src.components.BrowseElement.browse_element import BrowseElement
from src.components.MessageBox.message_box import MessageBox
from src.components.HorizontalSeparator.horizontal_separator import HorizontalSeparator
from src.components.ConvertButton.convert_button import ConvertButton
from src.components.MenuBar.menu_bar import MenuBar
from src.components.StatusBar.status_bar import StatusBar
from src.components.ProgressBar.progress_bar import ProgressBar
class Ui_MainWindow(object):
"""Main UI class. The bare bone of this class was generated by QtDesigner."""
def setupUi(self, MainWindow: QtWidgets.QMainWindow) -> None:
"""Function for setting up all the elements of the UI. This method was generated by QtDesigner and then populated.
Args:
MainWindow (QtWidgets.QMainWindow): MainWindow object.
"""
MainWindow.setObjectName("MainWindow")
MainWindow.setFixedSize(300, 400)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.widget = QtWidgets.QWidget(self.centralwidget)
self.widget.setGeometry(QtCore.QRect(400, 390, 120, 80))
self.widget.setObjectName("widget")
MainWindow.setWindowTitle("TDMS Converter")
MainWindow.setWindowIcon(
QIcon(f'{Path(__file__).parent / "src" / "assets" / "python_logo.svg"}')
)
MainWindow.setStyleSheet(
open(
Path(__file__).parent
/ "src"
/ "components"
/ "MainWindow"
/ "styles"
/ "classic-style.css"
).read()
)
self.tdms_logo = (
Logo("", self.centralwidget)
.set_name("tdms_logo")
.set_size((120, 60))
.set_image("tdms-logo.svg")
)
self.separator_line_1 = (
HorizontalSeparator(self.centralwidget)
.set_name("seperator_line_1")
.set_size((272, 1))
)
self.message_box = (
MessageBox(self.centralwidget)
.set_name("message_box")
.set_size((270, 60))
.set_text("")
)
self.separator_line_2 = (
HorizontalSeparator(self.centralwidget)
.set_name("seperator_line_2")
.set_size((272, 1))
)
self.browse_source_element = (
BrowseElement(self.centralwidget)
.set_size((290, 40))
.set_name("source_browser")
.set_textbox_text("Path to TDMS file")
)
self.browse_destination_element = (
BrowseElement(self.centralwidget)
.set_size((290, 40))
.set_name("destination_browser")
.set_textbox_text("Path to destination file")
)
self.separator_line_4 = (
HorizontalSeparator(self.centralwidget)
.set_name("seperator_line_3")
.set_size((272, 1))
)
self.separator_line_5 = (
HorizontalSeparator(self.centralwidget)
.set_name("seperator_line_5")
.set_size((272, 1))
)
self.progress_bar = (
ProgressBar(self.centralwidget).set_name("progress_bar").set_size((270, 30))
)
self.status_bar = StatusBar(MainWindow).set_name("status_bar")
self.convert_button = (
ConvertButton("Convert", self.centralwidget)
.set_name("converter_button")
.set_size((121, 40))
.pass_down_widget(
self.browse_source_element,
self.browse_destination_element,
self.message_box,
self.progress_bar,
self.status_bar,
)
)
layout = QtWidgets.QGridLayout()
layout.addWidget(self.tdms_logo, 0, 0, alignment=QtCore.Qt.AlignCenter)
layout.addWidget(self.separator_line_1, 1, 0, alignment=QtCore.Qt.AlignCenter)
layout.addWidget(self.message_box, 2, 0, alignment=QtCore.Qt.AlignCenter)
layout.addWidget(self.separator_line_2, 3, 0, alignment=QtCore.Qt.AlignCenter)
layout.addWidget(
self.browse_source_element, 4, 0, alignment=QtCore.Qt.AlignCenter
)
layout.addWidget(
self.browse_destination_element, 5, 0, alignment=QtCore.Qt.AlignCenter
)
layout.addWidget(self.separator_line_4, 6, 0, alignment=QtCore.Qt.AlignCenter)
layout.addWidget(self.convert_button, 7, 0, alignment=QtCore.Qt.AlignCenter)
layout.addWidget(self.separator_line_5, 8, 0, alignment=QtCore.Qt.AlignCenter)
layout.addWidget(self.progress_bar, 9, 0, alignment=QtCore.Qt.AlignCenter)
layout.setHorizontalSpacing(0)
layout.setVerticalSpacing(0)
self.centralwidget.setLayout(layout)
MainWindow.setCentralWidget(self.centralwidget)
self.menu_bar = (
MenuBar(MainWindow)
.set_name("menu_bar")
.set_geometry((0, 0, 300, 20))
.pass_down_widget(self.tdms_logo, self.message_box)
)
MainWindow.setMenuBar(self.menu_bar)
MainWindow.setStatusBar(self.status_bar)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())