vunghixuan 0.1.3__tar.gz → 0.1.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. vunghixuan-0.1.5/PKG-INFO +14 -0
  2. vunghixuan-0.1.5/config/__init__.py +0 -0
  3. vunghixuan-0.1.5/config/config_menubar.py +107 -0
  4. vunghixuan-0.1.5/config/settings.py +105 -0
  5. vunghixuan-0.1.5/config/settings_1.py +84 -0
  6. vunghixuan-0.1.5/config/settings_2.py +24 -0
  7. vunghixuan-0.1.5/setup.py +47 -0
  8. {vunghixuan-0.1.3/src → vunghixuan-0.1.5}/vunghixuan/__init__.py +3 -0
  9. vunghixuan-0.1.5/vunghixuan/create_files_for_package.py +48 -0
  10. vunghixuan-0.1.3/src/vunghixuan/create_gui.py → vunghixuan-0.1.5/vunghixuan/gui_main.py +37 -10
  11. {vunghixuan-0.1.3/src → vunghixuan-0.1.5}/vunghixuan/login.py +2 -0
  12. {vunghixuan-0.1.3/src → vunghixuan-0.1.5}/vunghixuan/main.py +4 -6
  13. vunghixuan-0.1.3/src/vunghixuan/create_project.py → vunghixuan-0.1.5/vunghixuan/project.py +24 -19
  14. vunghixuan-0.1.5/vunghixuan/setting_controlls.py +67 -0
  15. vunghixuan-0.1.5/vunghixuan/settings.py +160 -0
  16. vunghixuan-0.1.5/vunghixuan.egg-info/PKG-INFO +14 -0
  17. vunghixuan-0.1.5/vunghixuan.egg-info/SOURCES.txt +21 -0
  18. vunghixuan-0.1.5/vunghixuan.egg-info/entry_points.txt +2 -0
  19. vunghixuan-0.1.5/vunghixuan.egg-info/requires.txt +7 -0
  20. {vunghixuan-0.1.3/src → vunghixuan-0.1.5}/vunghixuan.egg-info/top_level.txt +1 -0
  21. vunghixuan-0.1.3/PKG-INFO +0 -7
  22. vunghixuan-0.1.3/setup.py +0 -82
  23. vunghixuan-0.1.3/src/vunghixuan/settings.py +0 -24
  24. vunghixuan-0.1.3/src/vunghixuan.egg-info/PKG-INFO +0 -7
  25. vunghixuan-0.1.3/src/vunghixuan.egg-info/SOURCES.txt +0 -16
  26. vunghixuan-0.1.3/src/vunghixuan.egg-info/entry_points.txt +0 -2
  27. vunghixuan-0.1.3/src/vunghixuan.egg-info/requires.txt +0 -1
  28. vunghixuan-0.1.3/test/test_api_otp.py +0 -14
  29. vunghixuan-0.1.3/test/test_create_gui.py +0 -18
  30. {vunghixuan-0.1.3 → vunghixuan-0.1.5}/setup.cfg +0 -0
  31. {vunghixuan-0.1.3/src → vunghixuan-0.1.5}/vunghixuan/api_and_otp.py +0 -0
  32. {vunghixuan-0.1.3/src → vunghixuan-0.1.5}/vunghixuan.egg-info/dependency_links.txt +0 -0
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.1
2
+ Name: vunghixuan
3
+ Version: 0.1.5
4
+ Summary: Get API, OTP, Create Project
5
+ Home-page: https://github.com/VuNghiXuan/pypi_package
6
+ Author: Đặng Thanh Vũ
7
+ Author-email: vunghixuan.info@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.11
13
+
14
+ Gói này cung cấp các chức năng để lấy API, tạo OTP và quản lý dự án.Tạo giao diện User - date: 250217
File without changes
@@ -0,0 +1,107 @@
1
+
2
+ "4. Khai báo cho menu và actions"
3
+ # Định nghĩa Action và tên các sheét sử dụng trong Excel
4
+ class ACTION:
5
+ def __init__(self, name, sheet_name_used=None):
6
+ self.name = name
7
+ self.isChoice = False
8
+
9
+ # khai báo Sheet sử dụng cho hành động Action
10
+ if sheet_name_used!=None:
11
+ self.sheet_name_used = sheet_name_used
12
+ else:
13
+ self.sheet_name_used = ''
14
+
15
+
16
+ # Định nghĩa Menu
17
+ class MENU:
18
+ def __init__(self, name, actions):
19
+ self.name = name
20
+ self.actions = actions
21
+ self.isChoice = False #Menu đang đuọc chọn
22
+ # sheet_names_used = sheet_names_used
23
+
24
+ # Thay đổi isChoice
25
+ # Lấy danh sách actions
26
+ def get_action_names(self):
27
+ action_names = []
28
+ for act in self.actions:
29
+ action_names.append(act.name)
30
+ return action_names
31
+
32
+ # Lấy danh sách sheets tương ứng actions
33
+ def get_sheet_names(self):
34
+ sheet_names = []
35
+ for act in self.actions:
36
+ sheet_names.append(act.sheet_name_used)
37
+ return sheet_names
38
+
39
+
40
+ class MENU_BAR():
41
+ def __init__(self, name, menus):
42
+ self.name = name
43
+ self.menus = menus
44
+
45
+ # Lấy danh sách tên menus
46
+ def get_menu_names(self):
47
+ menus_names =[]
48
+ for menu in self.menus:
49
+ menus_names.append(menu.name)
50
+ return menus_names
51
+
52
+
53
+
54
+
55
+ # Khởi tạo MenuBar
56
+ menubar_name = 'MenuBar cho phần Phân Kim'
57
+ dic_menus = {
58
+ "Nhập dữ liệu":{
59
+ 'Đổi dẻ': 'Nhap_DoiDe',
60
+ 'Mua dẻ': 'Nhap_MuaDe',
61
+ 'Bán dẻ': 'Nhap_BanDe',
62
+ 'Giá vàng': 'GiaVang',
63
+ 'Loại vàng': 'LoaiVang'
64
+ },
65
+ "Báo cáo": {
66
+ 'Đổi dẻ': 'Nhap_DoiDe',
67
+ 'Mua dẻ': 'Nhap_MuaDe',
68
+ 'Bán dẻ': 'Nhap_BanDe',
69
+ 'Công nợ': 'Chưa có sheet'
70
+ },
71
+ "Phiếu xuất":{
72
+ 'Nhập kho': 'Chưa có sheet',
73
+ 'Xuất kho': 'Chưa có sheet',
74
+ }
75
+ }
76
+
77
+ def create_menubar():
78
+ menu_objs = []
79
+ for menu, actions in dic_menus.items():
80
+ action_objs = []
81
+ for act, sh in actions.items():
82
+ action = ACTION(act, sh)
83
+ action_objs.append(action)
84
+ menu = MENU(menu, action_objs)
85
+ menu_objs.append(menu)
86
+
87
+ menubar = MENU_BAR(menubar_name,menu_objs)
88
+ return menubar
89
+
90
+
91
+
92
+
93
+
94
+
95
+ if __name__ == "__main__":
96
+
97
+
98
+ MENUBAR = create_menubar(menubar_name)
99
+
100
+ print("Danh sách tên menu", MENUBAR.get_menu_names())
101
+
102
+ for menu in MENUBAR.menus:
103
+ print(f'Tên menu: {menu.name}, Danh mục actions{menu.get_action_names()}')
104
+ print(f'Tên menu: {menu.name}, Danh mục sheets{menu.get_sheet_names()}')
105
+
106
+ # print("Danh sách tên actions", MENUBAR.menus.get_action_names())
107
+ # print("Danh sách tên sheet",MENUBAR.menus.get_sheet_names())
@@ -0,0 +1,105 @@
1
+ from pathlib import Path
2
+ import os
3
+ import sys
4
+
5
+ "1. Khai báo đường dẫn chung dự án"
6
+ # BASE_DIR = os.path.dirname(os.path.abspath(__file__))
7
+ BASE_DIR = str(Path(__file__).parent.parent)
8
+ sys.path.append(BASE_DIR)
9
+
10
+ # BASE_DIR = os.path.dirname(os.path.abspath(__file__))
11
+ DATABASE_URL = 'sqlite:///data.db' # Thay đổi nếu sử dụng DB khác
12
+
13
+ STATIC_DIR = os.path.join(BASE_DIR, 'static')
14
+
15
+ MENUS_INFO = {
16
+ "File": {
17
+ "New": f'{STATIC_DIR}/icon/icons8-file-64.png',
18
+ "Open": f'{STATIC_DIR}/icon/icons8-opened-folder-50.png',
19
+ "Save": None,
20
+ },
21
+
22
+
23
+ "Edit": {
24
+ "Cut": f'{STATIC_DIR}/icon/icons8-file-64.png',
25
+ "Copy": f'{STATIC_DIR}/icon/icons8-opened-folder-50.png',
26
+ "Paste": None,
27
+ },
28
+
29
+ "Help": {
30
+ "About": None,
31
+ "Documentation": None
32
+ }
33
+
34
+ }
35
+ # TABS_INFO = {
36
+ # "Xi Ngoài": [["Xi ngoài", "Xi nội bộ", "Xuất tạm"]],
37
+ # "Phân Kim": [["Chưa code 1", "chưa code 2", "chưa code 2---------------------------------------------------------"]],
38
+ # "Hàng O": [["Chưa code 1", "chưa code 2"]],
39
+ # "Hệ thống": [["Đăng ký", "Nhóm truy cập", 'Quyền truy cập']],
40
+ # }
41
+
42
+ TABS_INFO = {
43
+ "Quản lý tài khoản": {
44
+ "Đăng nhập": f'{STATIC_DIR}/icon/icon_sys.png',
45
+ "Đăng ký": f'{STATIC_DIR}/icon/icon_user_64.png',
46
+ "Cập nhật": f'{STATIC_DIR}/icon/update.png',
47
+ },
48
+
49
+ "Nhập dữ liêu Xi ngoài": {
50
+ "Xi ngoài": f'{STATIC_DIR}/icon/icons8-file-64.png',
51
+ "Xi nội bộ": f'{STATIC_DIR}/icon/icons8-opened-folder-50.png',
52
+ "Xuất tạm": None,
53
+ },
54
+ "Tab 2": {
55
+ "Action 1": None,
56
+ "Action 2": None,
57
+ },
58
+ "Tab 3": {
59
+ "Action 3": None,
60
+ "Action 4": None,
61
+ },
62
+ }
63
+
64
+ # https://getemoji.com/
65
+ ICON = {
66
+ 'eye_open': '👁️', # Mắt mở
67
+ 'eye_closed': '👁️‍🗨️', # Mắt đóng
68
+ 'smile': '😀',
69
+ 'party': '🎉',
70
+ 'rocket': '🚀',
71
+ 'star': '🌟',
72
+ 'heart': '❤️',
73
+ 'thumbs_up': '👍',
74
+ 'fire': '🔥',
75
+ 'check_mark': '✔️',
76
+ 'clap': '👏',
77
+ 'sun': '☀️',
78
+ 'moon': '🌙',
79
+ 'sparkles': '✨',
80
+ 'gift': '🎁',
81
+ 'music': '🎵',
82
+ 'folder': '📁',
83
+ 'file': '📄',
84
+ 'add_button': '➕',
85
+ 'remove_button': '➖',
86
+ 'edit_button': '✏️',
87
+ 'open_folder': '📂',
88
+ 'close_folder': '📁',
89
+ 'user': '👤',
90
+ 'sys': '🖥️',
91
+ 'lock': '🔒',
92
+ 'unlock': '🔓',
93
+ 'search': '🔍',
94
+ 'settings': '⚙️',
95
+ 'warning': '⚠️',
96
+ }
97
+
98
+
99
+ # {
100
+ # "Xi Ngoài": ["Xi ngoài", "Xi nội bộ", "Xuất tạm"],
101
+ # "Hệ thống": ["Đăng ký", "Nhóm truy cập", 'Quyền truy cập'],
102
+ # }
103
+
104
+ if __name__ == "__main__":
105
+ print(STATIC_DIR)
@@ -0,0 +1,84 @@
1
+ # config.py
2
+ from pathlib import Path
3
+ import os
4
+ import sys
5
+ from config_menubar import create_menubar
6
+
7
+
8
+
9
+ "1. Khai báo đường dẫn chung dự án"
10
+ # BASE_DIR = os.path.dirname(os.path.abspath(__file__))
11
+ BASE_DIR = Path(__file__).parent
12
+ sys.path.append(BASE_DIR)
13
+
14
+ class Config:
15
+ def __init__(self):
16
+ # self.apps_dir = os.path.join(BASE_DIR, 'apps')
17
+ self.resources_url = os.path.join(BASE_DIR, 'resources')
18
+ # self.database_url = f"sqlite:///{BASE_DIR}/resources/database.db"
19
+ self.templates_url = f"{BASE_DIR}/resources/templates"
20
+ self.logo_url = f"{BASE_DIR}/resources/logo"
21
+
22
+ # 1. app_mainGui
23
+ self.app_mainGui = f"{BASE_DIR}/app_mainGui"
24
+
25
+ "2. Khai báo các app được sử dụng"
26
+ self.apps = ['app_mainGui', 'resources']
27
+ self.apps_dir = {}
28
+ # Thêm đường dẫn của các thư mục con nếu cần
29
+ for app in self.apps:
30
+ app_dir = os.path.join(BASE_DIR, app)
31
+
32
+ # Thêm đường dẫn vào danh mục đường dẫn dự án
33
+ sys.path.append(app_dir)
34
+ self.apps_dir[app] = app_dir
35
+
36
+
37
+ "3. File Excel"
38
+ # Khai báo file Excel và các sheet sử dụng
39
+ EXCEL_FILE = {
40
+ "path": f"{self.apps_dir['resources']}/templates/input.xlsm",
41
+ 'sheet_names': ['Nhap_DoiDe', 'Nhap_MuaDe', 'Nhap_BanDe', 'GiaVang', 'LoaiVang'],
42
+
43
+ }
44
+
45
+ "4. Khởi tạo menubar"
46
+ self.menubar = create_menubar()
47
+
48
+
49
+
50
+ # self.app_metalStool = os.path.join(self.apps_dir, 'app_metalStool')
51
+ # self.app2_dir = os.path.join(self.apps_dir, 'App2')
52
+ # self.app3_dir = os.path.join(self.apps_dir, 'App3')
53
+ # ... thêm các đường dẫn khác theo nhu cầu
54
+ # url_config = Config() # Khởi tạo biến toàn cục
55
+
56
+
57
+
58
+
59
+
60
+
61
+ # class UrlConfig:
62
+ # def __init__(self) -> None:
63
+ # self.base_dir = Path(__file__).resolve().parent
64
+ # self.database_url = f"sqlite:///{self.base_dir}/resources/database.db"
65
+ # self.logo_url = f"{self.base_dir}/resources/logo"
66
+
67
+ # url_config = UrlConfig() # Khởi tạo biến toàn cục
68
+
69
+ # main.py
70
+ # import config
71
+
72
+ # # Kết nối đến database
73
+ # engine = create_engine(config.DATABASE_URL)
74
+
75
+ if __name__ == "__main__":
76
+
77
+ config = Config()
78
+ print('BASE_DIR:', BASE_DIR)
79
+ print('apps_dir:', config.apps_dir)
80
+ print('DATABASE_URL:',config.templates_url)
81
+ print('LOGO_URL:', config.logo_url)
82
+ print('app_gui_excel:', config.app_mainGui)
83
+
84
+
@@ -0,0 +1,24 @@
1
+ # config/settings.py
2
+
3
+ DATABASE_CONFIG = {
4
+ 'HOST': 'localhost',
5
+ 'PORT': 5432,
6
+ 'USER': 'your_username',
7
+ 'PASSWORD': 'your_password',
8
+ 'DB_NAME': 'your_database'
9
+ }
10
+
11
+ APPS = [
12
+ 'apps.app_mainGui'
13
+ # 'apps.users',
14
+ # 'apps.products',
15
+ # 'apps.orders'
16
+ ]
17
+
18
+ def register_apps():
19
+ for app in APPS:
20
+ __import__(app)
21
+
22
+ def get_model(app_name, model_name):
23
+ app = __import__(app_name)
24
+ return getattr(app.models, model_name)
@@ -0,0 +1,47 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='vunghixuan',
5
+ version='0.1.5',
6
+ description='Get API, OTP, Create Project',
7
+ long_description='Gói này cung cấp các chức năng để lấy API, tạo OTP và quản lý dự án.Tạo giao diện User - date: 250217',
8
+ author='Đặng Thanh Vũ',
9
+ author_email='vunghixuan.info@gmail.com',
10
+ # url='http://vunghixuan.com', # Thay thế bằng URL trang chủ của bạn
11
+ url='https://github.com/VuNghiXuan/pypi_package',
12
+ license='MIT', # Hoặc loại giấy phép bạn muốn
13
+ packages=find_packages(), # Tự động tìm tất cả các gói con
14
+ install_requires=[
15
+ 'pyotp==2.9.0',
16
+ 'PySide6==6.8.0.1',
17
+ 'PySide6_Addons==6.8.0.1',
18
+ 'PySide6_Essentials==6.8.0.1',
19
+ 'shiboken6==6.8.0.1',
20
+ 'SQLAlchemy==2.0.36',
21
+ 'typing_extensions==4.12.2',
22
+ ],
23
+ classifiers=[
24
+ 'Programming Language :: Python :: 3',
25
+ 'License :: OSI Approved :: MIT License',
26
+ 'Operating System :: OS Independent',
27
+ ],
28
+
29
+ entry_points={
30
+ 'console_scripts': [
31
+ 'vunghixuan=vunghixuan:main',
32
+ ],
33
+ },
34
+ python_requires='>=3.11',
35
+ )
36
+
37
+
38
+ """
39
+ Tải gói
40
+ 1. Tạo ra các gói phân phối: python setup.py sdist bdist_wheel
41
+ 2. Cấu hình file: .pypirc
42
+ 3. Tải gói lên pypi: twine upload --repository vunghixuan dist/*
43
+
44
+
45
+ python setup.py sdist upload
46
+
47
+ """
@@ -1 +1,4 @@
1
1
  from .api_and_otp import APIKey, Otp
2
+
3
+
4
+ # print(Otp)
@@ -0,0 +1,48 @@
1
+ import os
2
+ import shutil
3
+ import importlib.util as is_package
4
+ import site
5
+
6
+ # Kiểm tra sự tồn tại file
7
+ def path_exists(path):
8
+ return os.path.exists(path)
9
+
10
+ # Kiểm tra sự tồn tại gói
11
+ def package_exists(package_name):
12
+ return is_package.find_spec(package_name) is not None
13
+
14
+ # Chép file từ nguồn đến đích
15
+ def copy_file(source_file, destination):
16
+ if path_exists(source_file):
17
+ shutil.copy(source_file, destination)
18
+
19
+
20
+ def copy_file_from_vunghixuan_package(settings_path, requirements_path):
21
+ source_file = 'vunghixuan/settings.py'
22
+ copy_file(source_file, settings_path)
23
+ copy_file('vunghixuan/requirements.txt', requirements_path)
24
+
25
+ def create_file():
26
+ base_dir = os.getcwd()
27
+ settings_path = os.path.join('settings', 'settings.py')
28
+ requirements_path = os.path.join(base_dir, 'requirements.txt')
29
+
30
+ if not path_exists(settings_path):
31
+ package_name = 'vunghixuan'
32
+ source_file = 'vunghixuan/settings.py'
33
+
34
+ if package_exists(package_name):
35
+ source_folder = os.path.join(site.getsitepackages()[1], package_name)
36
+ setting_file = os.path.join(source_folder, 'settings.py')
37
+ requirement_file = os.path.join(source_folder, 'requirements.txt')
38
+
39
+ # Kiểm tra file do có sự tòn tại cả cache
40
+ if path_exists(setting_file):
41
+ copy_file(setting_file, settings_path)
42
+ copy_file(requirement_file, requirements_path)
43
+ else:
44
+ copy_file_from_vunghixuan_package(settings_path, requirements_path)
45
+ else:
46
+ copy_file_from_vunghixuan_package(settings_path, requirements_path)
47
+
48
+ create_file()
@@ -1,4 +1,4 @@
1
- import sys
1
+ import sys, os
2
2
  from PySide6.QtWidgets import(
3
3
  QApplication,
4
4
  QMainWindow,
@@ -16,7 +16,9 @@ from PySide6.QtWidgets import(
16
16
  from PySide6.QtGui import QColor, QFont
17
17
  from vunghixuan.login import LoginGroupBox
18
18
  from PySide6.QtGui import QPixmap
19
+ # from vunghixuan.settings import COLOR_FONT_BACKGROUND, color_fnt_bg
19
20
  from vunghixuan.settings import COLOR_FONT_BACKGROUND, color_fnt_bg
21
+
20
22
  # color_default = COLOR_FONT_BACKGROUND['Xanh lục, chữ trắng']
21
23
  # print(color_font_background)
22
24
 
@@ -71,7 +73,7 @@ class Header(QWidget):
71
73
 
72
74
  logo = QLabel('VuNghiXuan')
73
75
 
74
- font = QFont('Brush Script MT', 30)
76
+ font = QFont('Brush Script MT', 20)
75
77
  # font = QFont('Dancing Script', 20)#('Segoe Script', 20)#('Lucida Handwriting', 20)#('Brush Script MT', 20) # Thay đổi font chữ ở đây
76
78
 
77
79
  logo.setFont(font)
@@ -275,17 +277,42 @@ class MyWindow(QMainWindow):
275
277
  self.update_color_theme()
276
278
 
277
279
  def update_color_theme(self):
280
+ from vunghixuan import setting_controlls
281
+
282
+
283
+ # Lấy thông tin thay đỏi từ giao diện
278
284
  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
285
 
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
286
 
287
+ setting_controlls.update_theme(color_fnt_bg)
288
+
289
+ # file_path = 'settings/settings.py'
290
+ # if os.path.exists(file_path):
291
+ # color_fnt_bg = self.header.theme_selector.currentText()
292
+ # with open(setting_file, 'r', encoding='utf-8' ) as file:
293
+ # lines = file.readlines()
294
+
295
+ # with open(setting_file, 'w', encoding='utf-8') as file:
296
+ # for line in lines:
297
+ # if line.startswith('color_fnt_bg'):
298
+ # file.write(f"color_fnt_bg = COLOR_FONT_BACKGROUND['{color_fnt_bg}']\n")
299
+ # else:
300
+ # file.write(line)
301
+ # file.close()
302
+
303
+ # # Copy file settings qua venv
304
+ # import site, shutil
305
+ # package_name = 'vunghixuan'
306
+ # source_folder = os.path.join(site.getsitepackages()[1], package_name)
307
+
308
+ # setting_file = os.path.join(source_folder, 'settings.py')
309
+
310
+ # if os.path.exists(setting_file):
311
+ # shutil.copy(file_path, setting_file)
312
+
313
+
314
+ # else:
315
+ # print(f"File {setting_file} không tồn tại.")
289
316
  # def toggle_theme(self):
290
317
  # current_color = self.palette().color(self.backgroundRole())
291
318
  # new_color = QColor(255, 255, 255) if current_color == QColor(0, 127, 140) else QColor(0, 127, 140)
@@ -14,8 +14,10 @@ from PySide6.QtWidgets import(
14
14
  )
15
15
  from PySide6.QtCore import Qt
16
16
  from PySide6.QtGui import QColor
17
+ # from vunghixuan.settings import color_fnt_bg
17
18
  from vunghixuan.settings import color_fnt_bg
18
19
 
20
+
19
21
  class LoginGroupBox(QWidget):
20
22
  def __init__(self):
21
23
  super().__init__()
@@ -1,8 +1,8 @@
1
1
  # src/vunghixuan/main.py
2
2
  import sys
3
3
  from .api_and_otp import APIKey, Otp
4
- from .create_project import Project
5
- from . import create_gui
4
+ from .project import Project
5
+ # from . import gui_main
6
6
  # from PySide6.QtWidgets import QApplication
7
7
  def main():
8
8
  args = sys.argv[1:]
@@ -18,11 +18,9 @@ def main():
18
18
  obj = Otp(key)
19
19
  obj.get_otp()
20
20
  if '-create_project' in args :
21
- obj = Project(key)
22
- obj.create_project()
21
+ Project().create_project()
23
22
  if '-create_app' in args :
24
- obj = Project(key)
25
- obj.create_app()
23
+ Project().create_app()
26
24
  else:
27
25
  print("Missing API key")
28
26
 
@@ -7,30 +7,26 @@ class Project:
7
7
  def __init__(self):
8
8
  # self.root_path = Path(__file__).parent
9
9
  self.root_path = Path(os.getcwd()) # Lấy đường dẫn hiện tại
10
- # self.create_project()
11
-
12
- # def create_project(self):
13
- # for folder, content in structure.items():
14
- # if isinstance(content, dict):
15
- # folder_path = os.path.join(self.root_path, folder)
16
- # os.makedirs(folder_path)
17
- # self.create_project()
18
- # else:
19
- # with open(os.path.join(folder_path, 'models', '__init__.py'), 'w') as f:
20
- # f.write("# Init file for models\n")
21
-
22
- # Tạo ra folder
10
+
11
+ # Tạo ra folder cần thiết cho dự án
23
12
  def create_folder(self, folder_path, name):
24
13
  folder_path = os.path.join(folder_path, name)
25
14
  os.makedirs(folder_path, exist_ok=True)
26
15
 
16
+
17
+
27
18
  # Tạo ra folder apps
28
19
  def create_project(self):
29
- list_folder = ['apps', 'config', 'data_base']
20
+ # Tạo ra các app
21
+ list_folder = ['apps', 'settings']
30
22
  for folder in list_folder:
31
23
  self.create_folder(self.root_path, folder)
32
24
 
33
-
25
+ # Tạo ra file settings
26
+ from . import create_files_for_package
27
+ create_files_for_package.create_file()
28
+
29
+
34
30
 
35
31
  def create_app(self, app_name):
36
32
  folder_path = os.path.join(self.root_path, 'apps')
@@ -40,12 +36,21 @@ class Project:
40
36
  self.create_app(app_name)
41
37
  else:
42
38
  self.create_folder(folder_path, app_name)
43
- folder_path = os.path.join(self.root_path, 'apps', app_name)
39
+ app_folder_path = os.path.join(self.root_path, 'apps', app_name)
40
+
41
+ # list_folder = ['models', 'views', 'tests.py', f'{app_name}.py']
42
+ # for folder in list_folder:
43
+ # self.create_folder(folder_path, folder)
44
+
45
+ list_files = ['models', 'views', 'tests', app_name]
44
46
 
45
- list_folder = ['models', 'views', 'controlers']
46
- for folder in list_folder:
47
- self.create_folder(folder_path, folder)
47
+ for file in list_files:
48
48
 
49
+ # Tạo các file cần thiết cho ứng dụng
50
+ with open(os.path.join(app_folder_path, file), 'w', encoding='utf-8') as f:
51
+ f.write("# Đây là file chính của ứng dụng\n")
52
+
53
+
49
54
 
50
55
 
51
56
 
@@ -0,0 +1,67 @@
1
+ # vugnhixuan/update_setting_file.py
2
+
3
+ import os, site, shutil
4
+ import importlib.util as is_package
5
+
6
+ # Kiểm tra sự tồn tại file
7
+ def path_exists(path):
8
+ return os.path.exists(path)
9
+
10
+ # Kiểm tra sự tồn tại gói
11
+ def package_exists(package_name):
12
+ return is_package.find_spec(package_name) is not None
13
+
14
+ # Chép file từ nguồn đến đích
15
+ def copy_file(source_file, destination):
16
+ if path_exists(source_file):
17
+ shutil.copy(source_file, destination)
18
+
19
+ # Kiểm tra gói VuNghiXuan đã cài đặt bằng pip chưa?
20
+ def chk_VuNghixuan_package():
21
+ package_name = 'vunghixuan'
22
+ package_folder = os.path.join(site.getsitepackages()[1], package_name)
23
+
24
+ package_setting_file = os.path.join(package_folder, 'settings.py')
25
+
26
+ # Kiểm tra gói VuNghiXuan đã cài đaetj chưa
27
+ if os.path.exists(package_setting_file):
28
+ # Tiếp tục kiểm tra sụe tồn tại 'settings/settings.py'
29
+ return package_setting_file
30
+ else:
31
+ print(f'Chưa cài đặt gói "VuNghiXuan" hoặc không tồn tại "{package_setting_file}"')
32
+ return False
33
+
34
+ # Tiếp tục kiểm tra sự tồn tại 'settings/settings.py'
35
+ def chk_file_setting_from_folder_setting():
36
+ setting_file = 'settings/settings.py'
37
+ # Kiểm tra tồn tại file
38
+ if not os.path.exists(setting_file):
39
+ print('Không tồn tại ', setting_file)
40
+ return False
41
+ else:
42
+ return setting_file
43
+
44
+ # Update file settings from giao diện
45
+ def change_theme_for_setting_file(color_fnt_bg, setting_file):
46
+ # color_fnt_bg = self.header.theme_selector.currentText()
47
+ with open(setting_file, 'r', encoding='utf-8' ) as file:
48
+ lines = file.readlines()
49
+
50
+ with open(setting_file, 'w', encoding='utf-8') as file:
51
+ for line in lines:
52
+ if line.startswith('color_fnt_bg'):
53
+ file.write(f"color_fnt_bg = COLOR_FONT_BACKGROUND['{color_fnt_bg}']\n")
54
+ else:
55
+ file.write(line)
56
+ file.close()
57
+
58
+ def update_theme(color_fnt_bg):
59
+ package_setting_file = chk_VuNghixuan_package()
60
+ setting_file = chk_file_setting_from_folder_setting()
61
+ if package_setting_file and setting_file:
62
+ # Update file settings from giao diện
63
+ change_theme_for_setting_file(color_fnt_bg, setting_file)
64
+ # Copy settings file vào gói VuNghiXuan
65
+ copy_file(setting_file, package_setting_file)
66
+ print('update setting file thành công!')
67
+
@@ -0,0 +1,160 @@
1
+ # settings/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
+
25
+ from pathlib import Path
26
+ import os
27
+ import sys
28
+ import site
29
+ import importlib.util as is_package
30
+
31
+ class Settings:
32
+ def __init__(self):
33
+ self.APP_NAME = "My PySide6 App"
34
+ self.VERSION = "1.0.0"
35
+ self.DEBUG = True
36
+ self.BASE_DIR = str(Path(__file__).parent.parent)
37
+ # self.path = self.get_path()
38
+ # sys.path.append(self.BASE_DIR)
39
+
40
+ # # BASE_DIR = os.path.dirname(os.path.abspath(__file__))
41
+ self.DATABASE_URL = 'sqlite:///data.db' # Thay đổi nếu sử dụng DB khác
42
+
43
+ # STATIC_DIR = os.path.join(BASE_DIR, 'static')
44
+
45
+ # self.DATABASE = self.get_database_config()
46
+ # self.FNT_BG_COLOR = self.get_color_config()
47
+ self.MENUS_INFO = self.get_menus_info()
48
+ self.TABS_INFO = self.get_tabs_info()
49
+ self.ICON = self.get_icon_config()
50
+ self.STATIC_DIR = self.get_static_dir()
51
+
52
+ # def get_database_config(self):
53
+ # # return {
54
+ # # 'NAME': 'mydatabase.db',
55
+ # # 'USER': 'user',
56
+ # # 'PASSWORD': 'password',
57
+ # # 'HOST': 'localhost',
58
+ # # 'PORT': 5432,
59
+ # # }
60
+ # return {
61
+ # 'ENGINE': 'sqlite',
62
+ # 'NAME': self.BASE_DIR / "db.sqlite3",
63
+ # }
64
+
65
+
66
+ def get_color_config(self):
67
+ return {
68
+ 'Trắng': '#FFFFFF',
69
+ 'Đen': '#000000',
70
+ 'Đỏ': '#F70000',
71
+ 'Xanh lục': '#007f8c',
72
+ 'Xanh lục tối': '#29465B',
73
+ 'Xanh lá cây': '#006400',
74
+ 'Vàng gold': '#FFD700',
75
+ }
76
+ def get_color_fnt_bg(self):
77
+ return {
78
+ 'Nền xanh lục, chữ trắng': ['#007f8c', '#FFFFFF'], # xanh lục tối
79
+ 'Nền xanh xám, chữ vàng Gold': ['#29465B', '#FFD700'], #Gold (W3C)
80
+ 'Nền xanh xám, chữ trắng': ['#29465B', '#FFFFFF'], # xanh lục tối #29465B
81
+ 'Nền đen, chữ trắng': ['#000000', '#FFFFFF'],
82
+ 'Nền đen, chữ vàng': ['#000000', '#FFD700'],
83
+
84
+ }
85
+ # color_fnt_bg = COLOR_FONT_BACKGROUND['Nền xanh xám, chữ vàng Gold']
86
+
87
+ def get_menus_info(self):
88
+ static_dir = self.get_static_dir()
89
+ return {
90
+ "File": {
91
+ "New": f'{static_dir}/icon/icons8-file-64.png',
92
+ "Open": f'{static_dir}/icon/icons8-opened-folder-50.png',
93
+ "Save": None,
94
+ },
95
+ "Edit": {
96
+ "Cut": f'{static_dir}/icon/icons8-file-64.png',
97
+ "Copy": f'{static_dir}/icon/icons8-opened-folder-50.png',
98
+ "Paste": None,
99
+ },
100
+ "Help": {
101
+ "About": None,
102
+ "Documentation": None
103
+ }
104
+ }
105
+
106
+ def get_tabs_info(self):
107
+ static_dir = self.get_static_dir()
108
+ return {
109
+ "Quản lý tài khoản": {
110
+ "Đăng nhập": f'{static_dir}/icon/icon_sys.png',
111
+ "Đăng ký": f'{static_dir}/icon/icon_user_64.png',
112
+ "Cập nhật": f'{static_dir}/icon/update.png',
113
+ },
114
+ "Nhập dữ liệu Xi ngoài": {
115
+ "Xi ngoài": f'{static_dir}/icon/icons8-file-64.png',
116
+ "Xi nội bộ": f'{static_dir}/icon/icons8-opened-folder-50.png',
117
+ "Xuất tạm": None,
118
+ },
119
+ }
120
+
121
+ def get_icon_config(self):
122
+ return {
123
+ 'eye_open': '👁️',
124
+ 'eye_closed': '👁️‍🗨️',
125
+ 'smile': '😀',
126
+ 'party': '🎉',
127
+ 'rocket': '🚀',
128
+ 'star': '🌟',
129
+ 'heart': '❤️',
130
+ 'thumbs_up': '👍',
131
+ 'fire': '🔥',
132
+ 'check_mark': '✔️',
133
+ 'clap': '👏',
134
+ 'sun': '☀️',
135
+ 'moon': '🌙',
136
+ 'sparkles': '✨',
137
+ 'gift': '🎁',
138
+ 'music': '🎵',
139
+ 'folder': '📁',
140
+ 'file': '📄',
141
+ 'add_button': '➕',
142
+ 'remove_button': '➖',
143
+ 'edit_button': '✏️',
144
+ 'open_folder': '📂',
145
+ 'close_folder': '📁',
146
+ 'user': '👤',
147
+ 'sys': '🖥️',
148
+ 'lock': '🔒',
149
+ 'unlock': '🔓',
150
+ 'search': '🔍',
151
+ 'settings': '⚙️',
152
+ 'warning': '⚠️',
153
+ }
154
+
155
+ def get_static_dir(self):
156
+ return str(Path(__file__).parent.parent / 'static')
157
+
158
+ if __name__ == "__main__":
159
+ settings = Settings()
160
+ print(settings.STATIC_DIR)
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.1
2
+ Name: vunghixuan
3
+ Version: 0.1.5
4
+ Summary: Get API, OTP, Create Project
5
+ Home-page: https://github.com/VuNghiXuan/pypi_package
6
+ Author: Đặng Thanh Vũ
7
+ Author-email: vunghixuan.info@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.11
13
+
14
+ Gói này cung cấp các chức năng để lấy API, tạo OTP và quản lý dự án.Tạo giao diện User - date: 250217
@@ -0,0 +1,21 @@
1
+ setup.py
2
+ config/__init__.py
3
+ config/config_menubar.py
4
+ config/settings.py
5
+ config/settings_1.py
6
+ config/settings_2.py
7
+ vunghixuan/__init__.py
8
+ vunghixuan/api_and_otp.py
9
+ vunghixuan/create_files_for_package.py
10
+ vunghixuan/gui_main.py
11
+ vunghixuan/login.py
12
+ vunghixuan/main.py
13
+ vunghixuan/project.py
14
+ vunghixuan/setting_controlls.py
15
+ vunghixuan/settings.py
16
+ vunghixuan.egg-info/PKG-INFO
17
+ vunghixuan.egg-info/SOURCES.txt
18
+ vunghixuan.egg-info/dependency_links.txt
19
+ vunghixuan.egg-info/entry_points.txt
20
+ vunghixuan.egg-info/requires.txt
21
+ vunghixuan.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ vunghixuan = vunghixuan:main
@@ -0,0 +1,7 @@
1
+ pyotp==2.9.0
2
+ PySide6==6.8.0.1
3
+ PySide6_Addons==6.8.0.1
4
+ PySide6_Essentials==6.8.0.1
5
+ shiboken6==6.8.0.1
6
+ SQLAlchemy==2.0.36
7
+ typing_extensions==4.12.2
vunghixuan-0.1.3/PKG-INFO DELETED
@@ -1,7 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: vunghixuan
3
- Version: 0.1.3
4
- Summary: Get API, OTP, Create Project, Date_created = 2025-01-08
5
- Author: Đặng Thanh Vũ
6
- Author-email: vunghixuan@gmail.com
7
- Requires-Dist: pyotp
vunghixuan-0.1.3/setup.py DELETED
@@ -1,82 +0,0 @@
1
- # setup.py
2
-
3
- from setuptools import setup, find_packages
4
-
5
- # setup(
6
- # name='vunghixuan_package',
7
- # version='0.1.0',
8
- # description='API, OTP, Create Project',
9
- # author='Đăng Thanh Vũ',
10
- # author_email='vunghixuan@gmail.com',
11
- # packages=find_packages(where='src'), #Tìm kiếm và liệt kê các gói con trong thư mục src, nơi chứa mã nguồn chính.
12
- # package_dir={'': 'src'}, #Chỉ định thư mục chứa các gói, ở đây là {'': 'src'} nghĩa là gói nằm trong thư mục src.
13
- # install_requires=['python-dotenv','requests', 'pyotp', 'setuptools'], # Các gói phụ thuộc
14
- # entry_points={
15
- # 'console_scripts': [
16
- # 'vunghixuan_package=vunghixuan_package.main:main'
17
- # ]
18
- # }
19
- # )
20
-
21
-
22
- from setuptools import setup, find_packages
23
-
24
- setup(
25
- name='vunghixuan',
26
- version='0.1.3',
27
- packages=find_packages(where='src'),
28
- description='Get API, OTP, Create Project, Date_created = 2025-01-08',
29
- author='Đặng Thanh Vũ',
30
- author_email='vunghixuan@gmail.com',
31
- package_dir={'': 'src'},
32
- install_requires=[
33
- 'pyotp',
34
- ],
35
- entry_points={
36
- 'console_scripts': [
37
- 'vunghixuan = vunghixuan.main:main',
38
- ],
39
- },
40
- )
41
-
42
- """
43
- Quy trình phát hành gói Python bao gồm nhiều bước quan trọng, mỗi bước đều có chức năng riêng biệt:
44
-
45
- 1. pip install .: Lệnh này được sử dụng để cài đặt gói Python từ thư mục hiện tại. Nó sẽ tìm kiếm file setup.py và cài đặt gói theo cấu hình đã định nghĩa.
46
-
47
- 2. python setup.py sdist bdist_wheel: Lệnh này tạo ra các gói phân phối. sdist tạo ra gói nguồn, trong khi bdist_wheel tạo ra gói nhị phân (wheel). Điều này giúp người dùng có thể cài đặt gói một cách dễ dàng hơn.
48
-
49
- Vào folder dist lấy thông tin file và: Sau khi tạo gói, bạn cần vào thư mục dist để tìm file gói đã tạo.
50
-
51
- 3. pip install dist/vunghixuan-0.1.2-py3-none-any.whl: Lệnh này cài đặt gói đã được tạo ra từ thư mục dist.
52
-
53
- 4. Cập nhật nếu hỏi: pip install dist/vunghixuan-0.1.1-py3-none-any.whl --force-reinstall: Nếu bạn cần cập nhật gói đã cài đặt, lệnh này sẽ cài đặt lại gói, bất kể phiên bản hiện tại.
54
-
55
- 5. Chạy file main lấy opt 6 chứ số và mở pypi đưa vào
56
-
57
- 5. Bản 0.1.2: twine upload dist/* -u __token__ -p pypi-AgEIcHlwaS5vcmcCJDdmZmViYzIwLWJkYjctNDhmZC1hOTI3LTM0ZTIyYzQ4Mzk5YgACKlszLCI4OWIwMTU4NS0wNzFhLTQ1M2ItYTU2Yi1lMjU2YTAyYzUzMzkiXQAABiAwRKMR8U-1QAq-lIozrcJy9SwZhwaCG0VUyE1gsZKLWA --verbose
58
-
59
-
60
- pypi-AgEIcHlwaS5vcmcCJDdmZmViYzIwLWJkYjctNDhmZC1hOTI3LTM0ZTIyYzQ4Mzk5YgACKlszLCI4OWIwMTU4NS0wNzFhLTQ1M2ItYTU2Yi1lMjU2YTAyYzUzMzkiXQAABiAwRKMR8U-1QAq-lIozrcJy9SwZhwaCG0VUyE1gsZKLWA
61
-
62
- Tóm lại, bước 1 và 2 tạo môi trường local, trong khi bước 5 là bước tải lên gói lên PyPI.
63
-
64
- 6. Sử dụng lệnh gỡ bỏ: twine remove <tên-gói> --version <phiên-bản> -u __token__ -p pypi
65
-
66
-
67
-
68
-
69
-
70
- Mã Otp:
71
- obj = Otp('OXATAFVTTUIVMXNQCKMZAOFZYUYE6MGZ').get_otp()
72
-
73
- src/
74
- │ │
75
- │ └── vunghixuan/
76
- │ ├── __init__.py
77
- │ ├── create_project.py
78
- │ ├── api_and_otp.py
79
- │ └── main.py
80
-
81
- └── setup.py
82
- """
@@ -1,24 +0,0 @@
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,7 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: vunghixuan
3
- Version: 0.1.3
4
- Summary: Get API, OTP, Create Project, Date_created = 2025-01-08
5
- Author: Đặng Thanh Vũ
6
- Author-email: vunghixuan@gmail.com
7
- Requires-Dist: pyotp
@@ -1,16 +0,0 @@
1
- setup.py
2
- src/vunghixuan/__init__.py
3
- src/vunghixuan/api_and_otp.py
4
- src/vunghixuan/create_gui.py
5
- src/vunghixuan/create_project.py
6
- src/vunghixuan/login.py
7
- src/vunghixuan/main.py
8
- src/vunghixuan/settings.py
9
- src/vunghixuan.egg-info/PKG-INFO
10
- src/vunghixuan.egg-info/SOURCES.txt
11
- src/vunghixuan.egg-info/dependency_links.txt
12
- src/vunghixuan.egg-info/entry_points.txt
13
- src/vunghixuan.egg-info/requires.txt
14
- src/vunghixuan.egg-info/top_level.txt
15
- test/test_api_otp.py
16
- test/test_create_gui.py
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- vunghixuan = vunghixuan.main:main
@@ -1 +0,0 @@
1
- pyotp
@@ -1,14 +0,0 @@
1
- from vunghixuan import APIKey, Otp
2
- # obj = APIKey("your_api_key")
3
- # obj.get_api()
4
-
5
- obj = Otp('OXATAFVTTUIVMXNQCKMZAOFZYUYE6MGZ').get_otp()
6
- obj = Otp()
7
- obj.otp_vunghixuan()
8
-
9
- # from vunghixuan.create_project import Project
10
-
11
- # obj = Project()
12
- # obj.create_project()
13
-
14
- # from .sr
@@ -1,18 +0,0 @@
1
- # from vunghixuan import APIKey, Otp
2
- # obj = APIKey("your_api_key")
3
- # obj.get_api()
4
-
5
- # obj = Otp('OXATAFVTTUIVMXNQCKMZAOFZYUYE6MGZ').get_otp()
6
- # obj = Otp()
7
- # obj.otp_vunghixuan()
8
-
9
- # from vunghixuan.create_project import Project
10
-
11
- # obj = Project()
12
- # obj.create_project()
13
-
14
- # from .sr
15
-
16
- from src.vunghixuan import create_gui
17
-
18
- create_gui.create_gui()
File without changes