vunghixuan 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,310 @@
1
+ import sys
2
+ from PySide6.QtWidgets import(
3
+ QApplication,
4
+ QMainWindow,
5
+ QWidget,
6
+ QHBoxLayout,
7
+ QVBoxLayout,
8
+ QLabel,
9
+ QLineEdit,
10
+ QPushButton,
11
+ QTabBar, QTabWidget,
12
+ QMessageBox,
13
+ QComboBox
14
+
15
+ )
16
+ from PySide6.QtGui import QColor, QFont
17
+ from vunghixuan.login import LoginGroupBox
18
+ from PySide6.QtGui import QPixmap
19
+ from vunghixuan.settings import COLOR_FONT_BACKGROUND, color_fnt_bg
20
+ # color_default = COLOR_FONT_BACKGROUND['Xanh lục, chữ trắng']
21
+ # print(color_font_background)
22
+
23
+ class LoginForm(QWidget):
24
+ def __init__(self):
25
+ super().__init__()
26
+ self.initUI()
27
+
28
+ def initUI(self):
29
+ layout = QVBoxLayout()
30
+ self.username = QLineEdit(self)
31
+ self.password = QLineEdit(self)
32
+ self.password.setEchoMode(QLineEdit.Password)
33
+ login_button = QPushButton('Đăng Nhập', self)
34
+ login_button.clicked.connect(self.handle_login)
35
+
36
+ layout.addWidget(QLabel("Tên đăng nhập:"))
37
+ layout.addWidget(self.username)
38
+ layout.addWidget(QLabel("Mật khẩu:"))
39
+ layout.addWidget(self.password)
40
+ layout.addWidget(login_button)
41
+
42
+ self.setLayout(layout)
43
+
44
+ def handle_login(self):
45
+ # Kiểm tra thông tin đăng nhập (đơn giản)
46
+ if self.username.text() == "admin" and self.password.text() == "password":
47
+ self.parent().show_content() # Hiện nội dung chính
48
+ self.close() # Đóng form đăng nhập
49
+
50
+ # Create Header
51
+ class Header(QWidget):
52
+ def __init__(self):
53
+ super().__init__()
54
+ self.initUI()
55
+
56
+ def initUI(self):
57
+ # self.dic_theme = {}
58
+ self.set_background(color_fnt_bg)
59
+ # self.set_background(QColor(0, 127, 140)) ##FF5733
60
+ # self.set_background(QColor('#FF5733')) ##FF5733
61
+
62
+
63
+ layout = QHBoxLayout()
64
+ layout.setContentsMargins(10, 10, 10, 10) # Căn chỉnh nội dung
65
+
66
+ # Logo trái
67
+ # ico = QPixmap("src/vunghixuan/img/vunghixuan_logo.png")
68
+ # scaled_ico = ico.scaled(100, 100) # Thay đổi kích thước thành 100x100 pixel
69
+ # logo = QLabel()
70
+ # logo.setPixmap(scaled_ico)
71
+
72
+ logo = QLabel('VuNghiXuan')
73
+
74
+ font = QFont('Brush Script MT', 30)
75
+ # font = QFont('Dancing Script', 20)#('Segoe Script', 20)#('Lucida Handwriting', 20)#('Brush Script MT', 20) # Thay đổi font chữ ở đây
76
+
77
+ logo.setFont(font)
78
+ logo.setStyleSheet("color: gold;")
79
+
80
+ # logo.setStyleSheet("font-size: 20px; color: gold;")
81
+ layout.addWidget(logo)
82
+
83
+ layout.addStretch()
84
+
85
+
86
+ # # Nút để chuyển đổi giữa chế độ sáng và tối
87
+ # toggle_button = QPushButton('Chế độ sáng/tối', self)
88
+ # toggle_button.clicked.connect(self.toggle_theme)
89
+ # layout.addWidget(toggle_button)
90
+
91
+ # Combobox
92
+ self.theme_selector = QComboBox(self)
93
+ list_color = ['-- Chọn nền và màu chữ --']
94
+ for color in COLOR_FONT_BACKGROUND.keys():
95
+ list_color.append(color)
96
+
97
+ # self.theme_selector.addItems(["Chế độ sáng", "Chế độ tối"])
98
+ self.theme_selector.addItems(list_color)
99
+ self.theme_selector.currentIndexChanged.connect(self.change_theme)
100
+ layout.addWidget(self.theme_selector)
101
+
102
+
103
+
104
+ # login and register
105
+ login = QPushButton('Đăng nhập')
106
+ register = QPushButton('Đăng ký')
107
+ layout.addWidget(login)
108
+ layout.addWidget(register)
109
+
110
+ # Tạo layout chính
111
+ main_layout = QVBoxLayout()
112
+ main_layout.addLayout(layout)
113
+ main_layout.setContentsMargins(0, 0, 0, 0) # Loại bỏ khoảng cách mặc định
114
+
115
+ self.setLayout(main_layout)
116
+
117
+ # Đặt kích thước cho Header
118
+ self.setFixedHeight(50) # Bạn có thể điều chỉnh chiều cao theo ý muốn
119
+
120
+ def change_theme(self, index):
121
+ if index != 0:
122
+ color_name = self.theme_selector.currentText()
123
+ color_fnt_bg = COLOR_FONT_BACKGROUND[color_name]
124
+
125
+
126
+ # Tìm kiếm đối tượng MyWindow và gọi phương thức change_theme
127
+ main_window = self.window() # Lấy đối tượng MyWindow
128
+ main_window.change_theme(color_fnt_bg)
129
+
130
+
131
+
132
+
133
+ def set_background(self, color_fnt_bg):
134
+ # Thay toàn bộ màu nền
135
+ palette = self.palette()
136
+ palette.setColor(self.backgroundRole(), color_fnt_bg[0]) # Thay đổi màu nền
137
+ palette.setColor(self.foregroundRole(), color_fnt_bg[1]) # Thay đổi màu chữ
138
+ self.setAutoFillBackground(True)
139
+ self.setPalette(palette)
140
+
141
+
142
+
143
+ # Create Header
144
+ class Footer(QWidget):
145
+ def __init__(self):
146
+ super().__init__()
147
+ self.initUI()
148
+
149
+
150
+
151
+ def initUI(self):
152
+ # self.set_background(QColor(0, 127, 140))
153
+
154
+ layout = QHBoxLayout()
155
+ layout.setContentsMargins(10, 10, 10, 10) # Căn chỉnh nội dung
156
+
157
+ # Logo
158
+ logo = QLabel("@Copyright 2025 by VuNghiXuan")
159
+ layout.addWidget(logo)
160
+
161
+
162
+ # Tạo layout chính
163
+ main_layout = QVBoxLayout()
164
+ main_layout.addLayout(layout)
165
+ main_layout.setContentsMargins(0, 0, 0, 0) # Loại bỏ khoảng cách mặc định
166
+
167
+ self.setLayout(main_layout)
168
+
169
+ # Đặt kích thước cho Header
170
+ self.setFixedHeight(50) # Bạn có thể điều chỉnh chiều cao theo ý muốn
171
+
172
+ # Set background
173
+ self.set_background(color_fnt_bg)
174
+
175
+ def set_background(self, color_fnt_bg):
176
+ palette = self.palette()
177
+ palette.setColor(self.backgroundRole(), color_fnt_bg[0])
178
+ palette.setColor(self.foregroundRole(), color_fnt_bg[1])
179
+ self.setAutoFillBackground(True)
180
+ self.setPalette(palette)
181
+
182
+
183
+ class Content(QWidget):
184
+ def __init__(self):
185
+ super().__init__()
186
+ self.initUI()
187
+
188
+ def initUI(self):
189
+ self.login_widget = LoginGroupBox() # Sử dụng LoginGroupBox
190
+ self.tab_widget = QTabWidget()
191
+ self.tab1 = QWidget()
192
+ self.tab2 = QWidget()
193
+
194
+ self.tab_widget.addTab(self.tab1, "Tab 1")
195
+ self.tab_widget.addTab(self.tab2, "Tab 2")
196
+
197
+ layout = QVBoxLayout()
198
+ layout.addWidget(self.login_widget)
199
+ layout.addWidget(self.tab_widget)
200
+ self.setLayout(layout)
201
+
202
+ self.tab_widget.hide() # Ẩn tab ban đầu
203
+
204
+ def set_background(self, color_fnt_bg):
205
+ # palette = self.palette()
206
+ # palette.setColor(self.backgroundRole(), color_fnt_bg[0])
207
+ # palette.setColor(self.foregroundRole(), color_fnt_bg[1])
208
+ # self.setAutoFillBackground(True)
209
+ # self.setPalette(palette)
210
+ # Cập nhật màu cho các nhãn
211
+ for widget in self.findChildren(QLabel):
212
+ # widget.setStyleSheet(f"background-color: {color_fnt_bg[0]}; color: {color_fnt_bg[1]};")
213
+ widget.setStyleSheet(f"background-color: {color_fnt_bg[0]}; color: {color_fnt_bg[1]}; font-size: 18px;")
214
+
215
+ class BackgroundManager:
216
+ def __init__(self, widgets):
217
+ self.widgets = widgets # Danh sách các widget cần thay đổi màu nền
218
+
219
+
220
+ def set_background(self, color_fnt_bg):
221
+ for widget in self.widgets:
222
+ widget.set_background(color_fnt_bg)
223
+ # palette = widget.palette()
224
+ # palette.setColor(widget.backgroundRole(), color)
225
+ # widget.setAutoFillBackground(True)
226
+ # widget.setPalette(palette)
227
+
228
+
229
+ # Create window
230
+ class MyWindow(QMainWindow):
231
+ def __init__(self):
232
+ super().__init__()
233
+ self.initUI()
234
+
235
+ def initUI(self):
236
+
237
+ self.setGeometry(100, 100, 800, 600)
238
+ self.setWindowTitle('Phần mềm VuNghiXuan')
239
+
240
+ # Tạo ra Qwidget trung tâm
241
+ center_layout = QWidget()
242
+
243
+ # Put layout Header
244
+ main_layout = QVBoxLayout()
245
+ self.header = Header()
246
+ main_layout.addWidget(self.header)
247
+
248
+ # Put Content
249
+ self.content = Content()
250
+ main_layout.addWidget(self.content)
251
+
252
+
253
+ # Thêm lớp co dãn
254
+ # main_layout.addStretch()
255
+
256
+
257
+ # Put layout Footer
258
+ self.footer = Footer()
259
+ main_layout.addWidget(self.footer)
260
+
261
+ center_layout.setLayout(main_layout)
262
+
263
+ # Căn chỉnh nội dung
264
+ main_layout.setContentsMargins(0, 0, 0, 0)
265
+
266
+ # Set center_layout
267
+ self.setCentralWidget(center_layout)
268
+
269
+ # Setting background_manager
270
+ self.background_manager = BackgroundManager([self.header, self.footer, self.content])
271
+
272
+
273
+ def change_theme(self, color_fnt_bg):
274
+ self.background_manager.set_background(color_fnt_bg)
275
+ self.update_color_theme()
276
+
277
+ def update_color_theme(self):
278
+ color_fnt_bg = self.header.theme_selector.currentText()
279
+ with open('vunghixuan/settings.py', 'r', encoding='utf-8' ) as file:
280
+ lines = file.readlines()
281
+
282
+ with open('vunghixuan/settings.py', 'w', encoding='utf-8') as file:
283
+ for line in lines:
284
+ if line.startswith('color_fnt_bg'):
285
+ file.write(f"color_fnt_bg = COLOR_FONT_BACKGROUND['{color_fnt_bg}']\n")
286
+ else:
287
+ file.write(line)
288
+
289
+ # def toggle_theme(self):
290
+ # current_color = self.palette().color(self.backgroundRole())
291
+ # new_color = QColor(255, 255, 255) if current_color == QColor(0, 127, 140) else QColor(0, 127, 140)
292
+ # self.change_theme(new_color)
293
+
294
+
295
+
296
+ def create_gui():
297
+ app = QApplication(sys.argv)
298
+ window = MyWindow()
299
+ window.show()
300
+ sys.exit(app.exec())
301
+
302
+
303
+
304
+ if __name__=='__main__':
305
+ create_gui()
306
+ # app = QApplication(sys.argv)
307
+ # window = MyWindow()
308
+ # window.show()
309
+ # sys.exit(app.exec())
310
+ # main()
vunghixuan/login.py ADDED
@@ -0,0 +1,84 @@
1
+ from PySide6.QtWidgets import(
2
+
3
+ QWidget,
4
+
5
+ QVBoxLayout,
6
+ QLabel,
7
+ QLineEdit,
8
+ QPushButton,
9
+ QTabWidget,
10
+ QMessageBox,
11
+ QGroupBox,
12
+ QSizePolicy
13
+
14
+ )
15
+ from PySide6.QtCore import Qt
16
+ from PySide6.QtGui import QColor
17
+ from vunghixuan.settings import color_fnt_bg
18
+
19
+ class LoginGroupBox(QWidget):
20
+ def __init__(self):
21
+ super().__init__()
22
+ self.initUI()
23
+
24
+ def set_background(self):
25
+ # Tạo nền xanh
26
+ palette = self.palette()
27
+ palette.setColor(self.backgroundRole(), color_fnt_bg[0]) # Màu xanh lục
28
+ palette.setColor(self.backgroundRole(), color_fnt_bg[1]) # Màu xanh lục
29
+
30
+ self.setAutoFillBackground(True)
31
+ self.setPalette(palette)
32
+
33
+ def initUI(self):
34
+ # self.set_background()
35
+
36
+ layout = QVBoxLayout()
37
+ group_box = QGroupBox("") #Đăng Nhập
38
+
39
+ lb_login = QLabel('ĐĂNG NHẬP HỆ THỐNG')
40
+ # lb_login.setStyleSheet("font-size: 20px; color: white;")
41
+ lb_login.setAlignment(Qt.AlignmentFlag.AlignCenter)
42
+ lb_login.setFixedHeight(30) # Thiết lập chiều cao cố định cho lb_login
43
+
44
+
45
+ lb_login.setStyleSheet(f"background-color: {color_fnt_bg[0]}; color: {color_fnt_bg[1]}; font-size: 18px;")
46
+ # lb_login.setStyleSheet('background-color: #007f8c; font-size: 20px; color: white;')
47
+ # lb_login.setStyleSheet(f"background-color: {QColor(0, 127, 140).name()};")
48
+ # '#007f8c'
49
+ # print(QColor(0, 127, 140).name())
50
+
51
+ self.username_input = QLineEdit()
52
+ self.username_input.setPlaceholderText("Tên người dùng")
53
+ self.password_input = QLineEdit()
54
+ self.password_input.setPlaceholderText("Mật khẩu")
55
+ self.password_input.setEchoMode(QLineEdit.Password)
56
+
57
+ login_button = QPushButton("Đăng Nhập")
58
+ login_button.clicked.connect(self.handle_login)
59
+
60
+ layout.addWidget(lb_login)
61
+ layout.addWidget(self.username_input)
62
+ layout.addWidget(self.password_input)
63
+ layout.addWidget(login_button)
64
+ group_box.setLayout(layout)
65
+
66
+ main_layout = QVBoxLayout()
67
+ main_layout.addWidget(group_box)
68
+ self.setLayout(main_layout)
69
+
70
+ # Thiết lập kích thước tối thiểu cho form
71
+ self.setMaximumSize(350, 250)
72
+ # self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
73
+
74
+ def handle_login(self):
75
+ username = self.username_input.text()
76
+ password = self.password_input.text()
77
+
78
+ if username == "admin" and password == "password":
79
+ QMessageBox.information(self, "Thành công", "Đăng nhập thành công!")
80
+ self.parent().tab_widget.show() # Hiện tab
81
+ self.hide() # Ẩn form đăng nhập
82
+ else:
83
+ QMessageBox.warning(self, "Lỗi", "Tên người dùng hoặc mật khẩu không đúng.")
84
+
vunghixuan/main.py CHANGED
@@ -2,7 +2,8 @@
2
2
  import sys
3
3
  from .api_and_otp import APIKey, Otp
4
4
  from .create_project import Project
5
-
5
+ from . import create_gui
6
+ # from PySide6.QtWidgets import QApplication
6
7
  def main():
7
8
  args = sys.argv[1:]
8
9
  if '-h' in args or '--help' in args:
@@ -25,6 +26,13 @@ def main():
25
26
  else:
26
27
  print("Missing API key")
27
28
 
29
+ # Tạo giao diên chính
30
+ # create_gui.create_gui()
31
+
28
32
 
29
33
  if __name__ == '__main__':
30
- main()
34
+ main()
35
+ # app = QApplication(sys.argv)
36
+ # window = MyWindow()
37
+ # window.show()
38
+ # sys.exit(app.exec())
vunghixuan/settings.py ADDED
@@ -0,0 +1,24 @@
1
+ # src/vunghixuan/settings.py
2
+
3
+ # Cặp màu nền và chữ
4
+ COLOR = {
5
+ 'Trắng' : '#FFFFFF',
6
+ 'Đen' : '#000000',
7
+ 'Đỏ': 'F70000',
8
+ 'Xanh lục' : '#007f8c',
9
+ 'Xanh lục tối':'#29465B',
10
+ 'Xanh lá cây':'#006400',
11
+ 'Vàng gold': '#FFD700',
12
+
13
+
14
+ }
15
+ COLOR_FONT_BACKGROUND ={
16
+ 'Nền xanh lục, chữ trắng': ['#007f8c', '#FFFFFF'], # xanh lục tối
17
+ 'Nền xanh xám, chữ vàng Gold': ['#29465B', '#FFD700'], #Gold (W3C)
18
+ 'Nền xanh xám, chữ trắng': ['#29465B', '#FFFFFF'], # xanh lục tối #29465B
19
+ 'Nền đen, chữ trắng': ['#000000', '#FFFFFF'],
20
+ 'Nền đen, chữ vàng': ['#000000', '#FFD700'],
21
+
22
+ }
23
+ color_fnt_bg = COLOR_FONT_BACKGROUND['Nền xanh xám, chữ vàng Gold']
24
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vunghixuan
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Get API, OTP, Create Project, Date_created = 2025-01-08
5
5
  Author: Đặng Thanh Vũ
6
6
  Author-email: vunghixuan@gmail.com
@@ -0,0 +1,12 @@
1
+ vunghixuan/__init__.py,sha256=XJZldrnzPcJ9Okg129nZo82TDpxOm6amb5xAX5rkzyg,38
2
+ vunghixuan/api_and_otp.py,sha256=qmqVzLgnqYW1fFIpuh8PefTChiFXRHG3yhZb8aJwlZ8,568
3
+ vunghixuan/create_gui.py,sha256=GbPf3zZxToNWsWYsuNl0OdDpg5o3oUWuGQ0p3h4roA0,10183
4
+ vunghixuan/create_project.py,sha256=em94tNc1Wj8jL8CCf9MLNqjBMecF78zx6VtmloTHSiI,1917
5
+ vunghixuan/login.py,sha256=f_D1Q8u3HMxMGTc9MX76oGyttSLf0OMKLZDGAV4d5p8,3004
6
+ vunghixuan/main.py,sha256=UXIPv09rCDvozi73EFYdCfbVUSJ0FhNWlPh8bwoGVfw,1089
7
+ vunghixuan/settings.py,sha256=srShsnEDDr_74JPBMRhnITQwgy8uW4RhwUi5zhsvj3I,742
8
+ vunghixuan-0.1.3.dist-info/METADATA,sha256=HpBvddggLAwLCsPLtKYWnystxOoDcZinM_qqs-Ai0KM,208
9
+ vunghixuan-0.1.3.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
10
+ vunghixuan-0.1.3.dist-info/entry_points.txt,sha256=ItPfGjQnpyp6eR1oHdSbpfuf309GxCvEpX64UwBBTAU,52
11
+ vunghixuan-0.1.3.dist-info/top_level.txt,sha256=_Q6TIeNruS-ZEyAlP1gS80DCPggKksv8GoO396v9gr8,11
12
+ vunghixuan-0.1.3.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- vunghixuan/__init__.py,sha256=XJZldrnzPcJ9Okg129nZo82TDpxOm6amb5xAX5rkzyg,38
2
- vunghixuan/api_and_otp.py,sha256=qmqVzLgnqYW1fFIpuh8PefTChiFXRHG3yhZb8aJwlZ8,568
3
- vunghixuan/create_project.py,sha256=em94tNc1Wj8jL8CCf9MLNqjBMecF78zx6VtmloTHSiI,1917
4
- vunghixuan/main.py,sha256=tqC9Kpr8RNwYdCrOrIOA808UgCyIofB-a7zUylyxCdg,843
5
- vunghixuan-0.1.1.dist-info/METADATA,sha256=kd_bi198h0DpucOWiL5bPKSIn7m3e13KgYALlkizvkU,208
6
- vunghixuan-0.1.1.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
7
- vunghixuan-0.1.1.dist-info/entry_points.txt,sha256=ItPfGjQnpyp6eR1oHdSbpfuf309GxCvEpX64UwBBTAU,52
8
- vunghixuan-0.1.1.dist-info/top_level.txt,sha256=_Q6TIeNruS-ZEyAlP1gS80DCPggKksv8GoO396v9gr8,11
9
- vunghixuan-0.1.1.dist-info/RECORD,,