-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
106 lines (80 loc) · 2.85 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
import sys
import os
import time
import threading
from turtle import width
from qt_core import *
# third_party = "{}/site-packages".format(os.environ["PLE_THIRDPARTY_PATH"])
third_party = "V:/thirdparty/site-packages"
if third_party not in sys.path:
sys.path.append(third_party)
# IMPORT MAIN WINDOW
from gui.windows.main_window.ui_main_window import *
# MAIN WINDOW
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("bundleman")
# SETUP MAIN WINDOW
self.ui = UI_MainWindow()
self.ui.setup_ui(self)
# Toggle button
self.ui.toggle_btn.clicked.connect(self.toggle_button)
# Show pages
self.ui.btn_1.clicked.connect(self.show_page_1)
self.ui.btn_2.clicked.connect(self.show_page_2)
self.ui.btn_3.clicked.connect(self.show_page_3)
self.ui.btn_4.clicked.connect(self.show_page_4)
# Show settings
self.ui.settings_btn.clicked.connect(self.show_settings)
self.toggle_button()
# EXIBE A APLICAÇÂO
self.show()
def reset_selection(self):
for btn in self.ui.left_menu.findChildren(QPushButton):
try:
btn.set_active(False)
except:
pass
def show_page_1(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_page_1.page)
self.ui.btn_1.set_active(True)
def show_page_2(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_page_2.page)
self.ui.btn_2.set_active(True)
def show_page_3(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_page_3.page)
self.ui.btn_3.set_active(True)
def show_page_4(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_page_4.page)
self.ui.btn_4.set_active(True)
def show_settings(self):
self.reset_selection()
self.ui.pages.setCurrentWidget(self.ui.ui_sttgs.page)
self.ui.settings_btn.set_active(True)
def toggle_button(self):
# Get left menu width
menu_width = self.ui.left_menu.width()
# Check width
width = 0
if menu_width == 0:
width = 50
# Start animation
self.animation = QPropertyAnimation(self.ui.left_menu, b"minimumWidth")
self.animation.setStartValue(menu_width)
self.animation.setEndValue(width)
self.animation.setDuration(150)
self.animation.start()
def get_text(self):
text = self.mw.text_edit.toPlainText()
print(text)
if __name__ == "__main__":
icon_path = os.path.join(os.path.dirname(__file__), "gui", "images")
app = QApplication(sys.argv)
app.setWindowIcon(QIcon(f"{icon_path}/bundle.png"))
window = MainWindow()
sys.exit(app.exec())