-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.py
More file actions
79 lines (63 loc) · 2.44 KB
/
mainwindow.py
File metadata and controls
79 lines (63 loc) · 2.44 KB
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
from PyQt5.QtWidgets import QMainWindow, QWidget, QTabWidget, QVBoxLayout
import connection
from mytabwidget import HomeTab, RecycleBinTab, AutoLockTab, AboutTab
from mimabox import MimaBox
class MimaWindow(QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
self.setStyleSheet(
'QWidget {font-size: 18px; font-family: Serif;}'
# 'QLabel {font-size: 18px; font-family: Serif;}'
# 'QPushButton {font-size: 18px; font-family: Serif;}'
# 'QLineEdit {font-size: 18px; font-family: Serif;}'
# 'QPlainTextEdit {font-size: 18px; font-family: Serif;}'
'QTableView {font-size: 16px; font-family: Serif;}'
)
self._init_ui_()
def _init_ui_(self):
self.setWindowTitle('Mima (PyQt5)')
homeTab_homeTableView_width = 80+150+200+200+100
margin = 60
self.setGeometry(
200,
200,
homeTab_homeTableView_width + margin,
600
)
# Central Widget
centralWidget = QWidget()
vbox = QVBoxLayout()
tabWidget = QTabWidget()
vbox.addWidget(tabWidget)
centralWidget.setLayout(vbox)
self.setCentralWidget(centralWidget)
self.homeTab = HomeTab(tabWidget)
tabWidget.addTab(self.homeTab, 'Home')
self.recycleBinTab = RecycleBinTab()
tabWidget.addTab(self.recycleBinTab, 'Recycle Bin')
self.homeTab.set_recyclebin_model(self.recycleBinTab.model)
self.recycleBinTab.set_hometable_model(self.homeTab.model)
autoCloseTab = AutoLockTab(tabWidget)
tabWidget.addTab(autoCloseTab, 'Auto Lock')
self.homeTab.set_autoclose_tab(autoCloseTab)
aboutTab = AboutTab()
tabWidget.addTab(aboutTab, 'About')
self.show()
secretbox = connection.login(self, cancelToQuit=True)
if secretbox:
MimaBox.secretbox = secretbox
connection.populate_temp_tables()
self.homeTab.model.submitAll()
self.recycleBinTab.model.submitAll()
autoCloseTab.start_timer()
self.homeTab.searchEdit.setFocus()
if __name__ == '__main__':
import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
if not connection.create_connection():
sys.exit(1)
# connection.populate_temp_table()
window = MimaWindow()
# window.show()
sys.exit(app.exec_())