xiaochaoui 4.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xiaochaoui/__init__.py +16 -0
- xiaochaoui/components/__init__.py +29 -0
- xiaochaoui/components/diglog_widget.py +87 -0
- xiaochaoui/components/message.py +37 -0
- xiaochaoui/components/notification.py +41 -0
- xiaochaoui/components/right_button.py +31 -0
- xiaochaoui/components/search_widget.py +101 -0
- xiaochaoui/components/table_list.py +33 -0
- xiaochaoui/components/title_info.py +43 -0
- xiaochaoui/enums/__init__.py +5 -0
- xiaochaoui/enums/enums.py +42 -0
- xiaochaoui/exceptins/__init__.py +5 -0
- xiaochaoui/models/__init__.py +31 -0
- xiaochaoui/models/models.py +287 -0
- xiaochaoui/qt_environment.py +22 -0
- xiaochaoui/resources/__init__.py +5 -0
- xiaochaoui/resources/app_rc.py +21961 -0
- xiaochaoui/settings/__init__.py +5 -0
- xiaochaoui/settings/settings.py +162 -0
- xiaochaoui/styles/__init__.py +5 -0
- xiaochaoui/styles/fonts.py +20 -0
- xiaochaoui/styles/generate_qss.py +141 -0
- xiaochaoui/styles/qss.py +110 -0
- xiaochaoui/widget_tool.py +38 -0
- xiaochaoui/widgets/__init__.py +5 -0
- xiaochaoui/widgets/charts/__init__.py +11 -0
- xiaochaoui/widgets/charts/line.py +99 -0
- xiaochaoui/widgets/charts/pie.py +120 -0
- xiaochaoui/widgets/container/__init__.py +16 -0
- xiaochaoui/widgets/container/xiaochao_card.py +221 -0
- xiaochaoui/widgets/container/xiaochao_group_box.py +67 -0
- xiaochaoui/widgets/container/xiaochao_stacked_widget.py +50 -0
- xiaochaoui/widgets/container/xiaochao_tool_box.py +79 -0
- xiaochaoui/widgets/display/__init__.py +43 -0
- xiaochaoui/widgets/display/xiaochao_calendar_widget.py +109 -0
- xiaochaoui/widgets/display/xiaochao_circular_progress.py +152 -0
- xiaochaoui/widgets/display/xiaochao_label.py +156 -0
- xiaochaoui/widgets/display/xiaochao_lcd_number.py +52 -0
- xiaochaoui/widgets/display/xiaochao_line.py +49 -0
- xiaochaoui/widgets/display/xiaochao_list_view.py +167 -0
- xiaochaoui/widgets/display/xiaochao_list_widget.py +70 -0
- xiaochaoui/widgets/display/xiaochao_message.py +87 -0
- xiaochaoui/widgets/display/xiaochao_notification.py +73 -0
- xiaochaoui/widgets/display/xiaochao_pagination.py +252 -0
- xiaochaoui/widgets/display/xiaochao_progress_bar.py +69 -0
- xiaochaoui/widgets/display/xiaochao_status_bar.py +82 -0
- xiaochaoui/widgets/display/xiaochao_table.py +390 -0
- xiaochaoui/widgets/display/xiaochao_table_view.py +146 -0
- xiaochaoui/widgets/display/xiaochao_table_widget.py +60 -0
- xiaochaoui/widgets/display/xiaochao_tree_view.py +197 -0
- xiaochaoui/widgets/display/xiaochao_tree_widget.py +70 -0
- xiaochaoui/widgets/input/__init__.py +43 -0
- xiaochaoui/widgets/input/mang_time_edit.py +64 -0
- xiaochaoui/widgets/input/xiaochao_cascader.py +148 -0
- xiaochaoui/widgets/input/xiaochao_checkbox.py +99 -0
- xiaochaoui/widgets/input/xiaochao_combo_box.py +539 -0
- xiaochaoui/widgets/input/xiaochao_date_edit.py +180 -0
- xiaochaoui/widgets/input/xiaochao_dial.py +72 -0
- xiaochaoui/widgets/input/xiaochao_font_combo_box.py +88 -0
- xiaochaoui/widgets/input/xiaochao_icon_button.py +308 -0
- xiaochaoui/widgets/input/xiaochao_line_edit.py +137 -0
- xiaochaoui/widgets/input/xiaochao_plain_text_edit.py +113 -0
- xiaochaoui/widgets/input/xiaochao_push_button.py +83 -0
- xiaochaoui/widgets/input/xiaochao_radio_button.py +148 -0
- xiaochaoui/widgets/input/xiaochao_slider.py +98 -0
- xiaochaoui/widgets/input/xiaochao_spin_box.py +219 -0
- xiaochaoui/widgets/input/xiaochao_text_edit.py +180 -0
- xiaochaoui/widgets/input/xiaochao_toggle.py +185 -0
- xiaochaoui/widgets/layout/__init__.py +13 -0
- xiaochaoui/widgets/layout/xiaochao_layout.py +86 -0
- xiaochaoui/widgets/menu/__init__.py +17 -0
- xiaochaoui/widgets/menu/xiaochao_menu/__init__.py +15 -0
- xiaochaoui/widgets/menu/xiaochao_menu/xiaochao_div.py +40 -0
- xiaochaoui/widgets/menu/xiaochao_menu/xiaochao_menu.py +259 -0
- xiaochaoui/widgets/menu/xiaochao_menu/xiaochao_menu_button.py +326 -0
- xiaochaoui/widgets/menu/xiaochao_menu_bar.py +93 -0
- xiaochaoui/widgets/menu/xiaochao_tabs.py +110 -0
- xiaochaoui/widgets/menu/xiaochao_tool_bar.py +94 -0
- xiaochaoui/widgets/miscellaneous/__init__.py +12 -0
- xiaochaoui/widgets/miscellaneous/xiaochao_credits.py +124 -0
- xiaochaoui/widgets/miscellaneous/xiaochao_grips.py +302 -0
- xiaochaoui/widgets/network/__init__.py +7 -0
- xiaochaoui/widgets/network/base_http_client.py +160 -0
- xiaochaoui/widgets/title_bar/__init__.py +10 -0
- xiaochaoui/widgets/title_bar/xiaochao_div.py +22 -0
- xiaochaoui/widgets/title_bar/xiaochao_title_bar.py +262 -0
- xiaochaoui/widgets/title_bar/xiaochao_title_button.py +202 -0
- xiaochaoui/widgets/title_bar/xiaochao_title_button_main2.py +196 -0
- xiaochaoui/widgets/window/__init__.py +31 -0
- xiaochaoui/widgets/window/main_window/__init__.py +5 -0
- xiaochaoui/widgets/window/main_window/main_1/__init__.py +5 -0
- xiaochaoui/widgets/window/main_window/main_1/main_window.py +21 -0
- xiaochaoui/widgets/window/main_window/main_1/pages_window.py +4 -0
- xiaochaoui/widgets/window/main_window/main_1/ui_window.py +237 -0
- xiaochaoui/widgets/window/main_window/main_2/__init__.py +9 -0
- xiaochaoui/widgets/window/main_window/main_2/main_window.py +31 -0
- xiaochaoui/widgets/window/main_window/main_2/menu_button_style2.py +205 -0
- xiaochaoui/widgets/window/main_window/main_2/menu_style2.py +174 -0
- xiaochaoui/widgets/window/main_window/main_2/pages_window.py +4 -0
- xiaochaoui/widgets/window/main_window/main_2/ui_window.py +366 -0
- xiaochaoui/widgets/window/pages_window.py +100 -0
- xiaochaoui/widgets/window/xiaochao_diglog.py +66 -0
- xiaochaoui/widgets/window/xiaochao_frame.py +100 -0
- xiaochaoui/widgets/window/xiaochao_main_window.py +27 -0
- xiaochaoui/widgets/window/xiaochao_scroll_area.py +146 -0
- xiaochaoui/widgets/window/xiaochao_tooltip_box.py +152 -0
- xiaochaoui/widgets/window/xiaochao_tree.py +78 -0
- xiaochaoui/widgets/window/xiaochao_widget.py +62 -0
- xiaochaoui/widgets/window/xiaochao_winodw.py +14 -0
- xiaochaoui-4.1.2.dist-info/METADATA +676 -0
- xiaochaoui-4.1.2.dist-info/RECORD +114 -0
- xiaochaoui-4.1.2.dist-info/WHEEL +5 -0
- xiaochaoui-4.1.2.dist-info/licenses/LICENSE +661 -0
- xiaochaoui-4.1.2.dist-info/top_level.txt +1 -0
xiaochaoui/__init__.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-10-08 16:09
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
|
|
7
|
+
from xiaochaoui.qt_environment import setup_qt_environment
|
|
8
|
+
|
|
9
|
+
setup_qt_environment()
|
|
10
|
+
|
|
11
|
+
from xiaochaoui.resources.app_rc import *
|
|
12
|
+
|
|
13
|
+
# from PySide6.QtCore import *
|
|
14
|
+
# from PySide6.QtGui import *
|
|
15
|
+
# from PySide6.QtWidgets import *
|
|
16
|
+
# from PySide6.QtSvgWidgets import *
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-08-29 15:32
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
|
|
7
|
+
from .diglog_widget import DialogWidget
|
|
8
|
+
from .message import info_message, error_message, success_message, warning_message
|
|
9
|
+
from .notification import info_notification, error_notification, success_notification, warning_notification
|
|
10
|
+
from .right_button import RightButton
|
|
11
|
+
from .search_widget import SearchWidget
|
|
12
|
+
from .table_list import TableList
|
|
13
|
+
from .title_info import TitleInfoWidget
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
'DialogWidget',
|
|
17
|
+
'info_message',
|
|
18
|
+
'error_message',
|
|
19
|
+
'success_message',
|
|
20
|
+
'warning_message',
|
|
21
|
+
'info_notification',
|
|
22
|
+
'error_notification',
|
|
23
|
+
'success_notification',
|
|
24
|
+
'warning_notification',
|
|
25
|
+
'RightButton',
|
|
26
|
+
'SearchWidget',
|
|
27
|
+
'TableList',
|
|
28
|
+
'TitleInfoWidget'
|
|
29
|
+
]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-08-30 14:52
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
from PySide6.QtCore import Signal
|
|
7
|
+
from PySide6.QtWidgets import QFormLayout, QSpacerItem, QSizePolicy, QHBoxLayout
|
|
8
|
+
|
|
9
|
+
from xiaochaoui.settings.settings import THEME
|
|
10
|
+
from xiaochaoui.enums.enums import *
|
|
11
|
+
from xiaochaoui.models.models import FormDataModel, DialogCallbackModel
|
|
12
|
+
from xiaochaoui.widgets.window import XiaochaoDialog
|
|
13
|
+
from xiaochaoui.widgets.input import (
|
|
14
|
+
XiaochaoLineEdit, XiaochaoComboBox, XiaochaoCascade, XiaochaoToggle,
|
|
15
|
+
XiaochaoComboBoxMany, XiaochaoTextEdit, XiaochaoPushButton
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DialogWidget(XiaochaoDialog):
|
|
20
|
+
clicked = Signal(object)
|
|
21
|
+
|
|
22
|
+
def __init__(self, tips: str, form_data: list[FormDataModel], size: tuple = (400, 300)):
|
|
23
|
+
super().__init__(tips, size)
|
|
24
|
+
self.form_data = form_data
|
|
25
|
+
form_layout = QFormLayout()
|
|
26
|
+
for form in self.form_data:
|
|
27
|
+
if form.type == InputEnum.INPUT:
|
|
28
|
+
input_object = XiaochaoLineEdit(form.placeholder, form.value, form.subordinate, key=form.key)
|
|
29
|
+
elif form.type == InputEnum.SELECT:
|
|
30
|
+
input_object = XiaochaoComboBox(form.placeholder, form.select, form.value, form.subordinate, key=form.key)
|
|
31
|
+
elif form.type == InputEnum.CASCADER:
|
|
32
|
+
input_object = XiaochaoCascade(form.placeholder, form.select, form.value, form.subordinate, key=form.key)
|
|
33
|
+
elif form.type == InputEnum.TOGGLE:
|
|
34
|
+
input_object = XiaochaoToggle(form.value, key=form.key)
|
|
35
|
+
elif form.type == InputEnum.SELECT_MANY:
|
|
36
|
+
input_object = XiaochaoComboBoxMany(form.placeholder, form.select, form.value)
|
|
37
|
+
elif form.type == InputEnum.TEXT:
|
|
38
|
+
input_object = XiaochaoTextEdit(form.placeholder, form.value, form.subordinate)
|
|
39
|
+
else:
|
|
40
|
+
raise ValueError(f'类型错误: {form.type}')
|
|
41
|
+
input_object.click.connect(self.entered)
|
|
42
|
+
if form.required:
|
|
43
|
+
form_layout.addRow(f"*{form.title}:", input_object)
|
|
44
|
+
else:
|
|
45
|
+
form_layout.addRow(f"{form.title}:", input_object)
|
|
46
|
+
|
|
47
|
+
form.input_object = input_object
|
|
48
|
+
|
|
49
|
+
self.layout.addLayout(form_layout)
|
|
50
|
+
self.layout.addSpacerItem(QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding))
|
|
51
|
+
button_layout = QHBoxLayout()
|
|
52
|
+
self.layout.addLayout(button_layout)
|
|
53
|
+
button_layout.addStretch()
|
|
54
|
+
cancel_button = XiaochaoPushButton("取消")
|
|
55
|
+
cancel_button.clicked.connect(self.reject)
|
|
56
|
+
button_layout.addWidget(cancel_button)
|
|
57
|
+
submit_button = XiaochaoPushButton("提交", color=THEME.group.info)
|
|
58
|
+
submit_button.clicked.connect(self.submit_form)
|
|
59
|
+
button_layout.addWidget(submit_button)
|
|
60
|
+
|
|
61
|
+
self.data = {}
|
|
62
|
+
|
|
63
|
+
def submit_form(self):
|
|
64
|
+
for form in self.form_data:
|
|
65
|
+
value = form.input_object.get_value()
|
|
66
|
+
if form.required:
|
|
67
|
+
if value is None or value == '':
|
|
68
|
+
from xiaochaoui.components import error_message
|
|
69
|
+
self.data = {}
|
|
70
|
+
error_message(self, f'{form.title} 是必填项')
|
|
71
|
+
return
|
|
72
|
+
if value == '':
|
|
73
|
+
self.data[form.key] = None
|
|
74
|
+
else:
|
|
75
|
+
self.data[form.key] = value
|
|
76
|
+
self.accept() # 关闭对话框
|
|
77
|
+
|
|
78
|
+
def entered(self, data: DialogCallbackModel):
|
|
79
|
+
if isinstance(data, DialogCallbackModel):
|
|
80
|
+
for i in self.form_data:
|
|
81
|
+
if i.key == data.subordinate and i.key:
|
|
82
|
+
data.subordinate_input_object = i.input_object
|
|
83
|
+
data.key = i.key
|
|
84
|
+
self.clicked.emit(data)
|
|
85
|
+
|
|
86
|
+
def check_value(self, value):
|
|
87
|
+
pass
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-09-04 14:35
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
from PySide6.QtCore import QPoint
|
|
7
|
+
|
|
8
|
+
from xiaochaoui.settings.settings import THEME
|
|
9
|
+
from xiaochaoui.widgets.display import XiaochaoMessage
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def info_message(parent, text):
|
|
13
|
+
message = XiaochaoMessage(parent, text, THEME.group.info)
|
|
14
|
+
parent_pos = parent.mapToGlobal(QPoint(parent.width() // 2 - message.width() // 2, 0))
|
|
15
|
+
message.move(parent_pos)
|
|
16
|
+
message.show()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def success_message(parent, text):
|
|
20
|
+
message = XiaochaoMessage(parent, text, THEME.group.success)
|
|
21
|
+
parent_pos = parent.mapToGlobal(QPoint(parent.width() // 2 - message.width() // 2, 0))
|
|
22
|
+
message.move(parent_pos)
|
|
23
|
+
message.show()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def warning_message(parent, text):
|
|
27
|
+
message = XiaochaoMessage(parent, text, THEME.group.warning)
|
|
28
|
+
parent_pos = parent.mapToGlobal(QPoint(parent.width() // 2 - message.width() // 2, 0))
|
|
29
|
+
message.move(parent_pos)
|
|
30
|
+
message.show()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def error_message(parent, text):
|
|
34
|
+
message = XiaochaoMessage(parent, text, THEME.group.error)
|
|
35
|
+
parent_pos = parent.mapToGlobal(QPoint(parent.width() // 2 - message.width() // 2, 0))
|
|
36
|
+
message.move(parent_pos)
|
|
37
|
+
message.show()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-09-04 14:36
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
from PySide6.QtCore import QPoint
|
|
7
|
+
|
|
8
|
+
from xiaochaoui.settings.settings import THEME
|
|
9
|
+
from xiaochaoui.widgets.display import XiaochaoNotification
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def success_notification(parent, text):
|
|
13
|
+
notification = XiaochaoNotification(parent, text, THEME.group.success)
|
|
14
|
+
# 获取主窗口右上角位置
|
|
15
|
+
parent_pos = parent.mapToGlobal(QPoint(parent.width() - notification.width() - 10, 40))
|
|
16
|
+
notification.move(parent_pos)
|
|
17
|
+
notification.show()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def info_notification(parent, text):
|
|
21
|
+
notification = XiaochaoNotification(parent, text, THEME.group.info)
|
|
22
|
+
# 获取主窗口右上角位置
|
|
23
|
+
parent_pos = parent.mapToGlobal(QPoint(parent.width() - notification.width() - 10, 50))
|
|
24
|
+
notification.move(parent_pos)
|
|
25
|
+
notification.show()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def warning_notification(parent, text):
|
|
29
|
+
notification = XiaochaoNotification(parent, text, THEME.group.warning)
|
|
30
|
+
# 获取主窗口右上角位置
|
|
31
|
+
parent_pos = parent.mapToGlobal(QPoint(parent.width() - notification.width() - 10, 60))
|
|
32
|
+
notification.move(parent_pos)
|
|
33
|
+
notification.show()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def error_notification(parent, text):
|
|
37
|
+
notification = XiaochaoNotification(parent, text, THEME.group.error)
|
|
38
|
+
# 获取主窗口右上角位置
|
|
39
|
+
parent_pos = parent.mapToGlobal(QPoint(parent.width() - notification.width() - 10, 20))
|
|
40
|
+
notification.move(parent_pos)
|
|
41
|
+
notification.show()
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-08-30 14:08
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
from functools import partial
|
|
7
|
+
|
|
8
|
+
from PySide6.QtCore import Signal
|
|
9
|
+
from PySide6.QtWidgets import *
|
|
10
|
+
|
|
11
|
+
from xiaochaoui.models.models import RightDataModel
|
|
12
|
+
from xiaochaoui.widgets.input import XiaochaoPushButton
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class RightButton(QWidget):
|
|
16
|
+
clicked = Signal(object)
|
|
17
|
+
|
|
18
|
+
def __init__(self, but_list_obj: list[RightDataModel]):
|
|
19
|
+
super().__init__()
|
|
20
|
+
self.but_list_obj = but_list_obj
|
|
21
|
+
self.layout = QHBoxLayout()
|
|
22
|
+
self.layout.setContentsMargins(0, 0, 0, 0)
|
|
23
|
+
self.layout.addStretch()
|
|
24
|
+
for but_obj in self.but_list_obj:
|
|
25
|
+
but_obj.obj = XiaochaoPushButton(but_obj.name, color=but_obj.theme)
|
|
26
|
+
but_obj.obj.clicked.connect(partial(self.but_clicked, but_obj.action))
|
|
27
|
+
self.layout.addWidget(but_obj.obj)
|
|
28
|
+
self.setLayout(self.layout)
|
|
29
|
+
|
|
30
|
+
def but_clicked(self, action):
|
|
31
|
+
self.clicked.emit({'action': action, 'row': None})
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-08-30 14:08
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
from PySide6.QtCore import Signal
|
|
7
|
+
from PySide6.QtWidgets import *
|
|
8
|
+
|
|
9
|
+
from xiaochaoui.settings.settings import THEME
|
|
10
|
+
from xiaochaoui.enums.enums import InputEnum
|
|
11
|
+
from xiaochaoui.models.models import SearchDataModel, DialogCallbackModel
|
|
12
|
+
from xiaochaoui.widgets.input import (
|
|
13
|
+
XiaochaoLineEdit, XiaochaoComboBox, XiaochaoCascade, XiaochaoToggle,
|
|
14
|
+
XiaochaoComboBoxMany, XiaochaoPushButton
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SearchWidget(QWidget):
|
|
19
|
+
clicked = Signal(object)
|
|
20
|
+
|
|
21
|
+
def __init__(self, search_data: list[SearchDataModel]):
|
|
22
|
+
super().__init__()
|
|
23
|
+
self.search_data = search_data
|
|
24
|
+
self.layout = QHBoxLayout()
|
|
25
|
+
self.layout.setContentsMargins(0, 0, 0, 0)
|
|
26
|
+
self.setLayout(self.layout)
|
|
27
|
+
|
|
28
|
+
self.v_layout = QVBoxLayout()
|
|
29
|
+
self.v_layout.setContentsMargins(0, 0, 0, 0)
|
|
30
|
+
self.layout.addLayout(self.v_layout)
|
|
31
|
+
for index, search in enumerate(self.search_data):
|
|
32
|
+
if index % 4 == 0 or index == 0:
|
|
33
|
+
but_layout = QHBoxLayout()
|
|
34
|
+
but_layout.setContentsMargins(0, 0, 0, 0)
|
|
35
|
+
self.v_layout.addLayout(but_layout)
|
|
36
|
+
if search.select and callable(search.select):
|
|
37
|
+
select = search.select()
|
|
38
|
+
else:
|
|
39
|
+
select = search.select
|
|
40
|
+
if search.type == InputEnum.INPUT:
|
|
41
|
+
input_object = XiaochaoLineEdit(search.placeholder, '', )
|
|
42
|
+
elif search.type == InputEnum.SELECT:
|
|
43
|
+
input_object = XiaochaoComboBox(search.placeholder, select, search.value, search.subordinate,
|
|
44
|
+
key=search.key)
|
|
45
|
+
input_object.setMinimumWidth(145)
|
|
46
|
+
elif search.type == InputEnum.CASCADER:
|
|
47
|
+
input_object = XiaochaoCascade(search.placeholder, select, search.value, search.subordinate,
|
|
48
|
+
key=search.key)
|
|
49
|
+
input_object.setMinimumWidth(145)
|
|
50
|
+
|
|
51
|
+
elif search.type == InputEnum.TOGGLE:
|
|
52
|
+
input_object = XiaochaoToggle(search.value, key=search.key)
|
|
53
|
+
elif search.type == InputEnum.SELECT_MANY:
|
|
54
|
+
input_object = XiaochaoComboBoxMany(search.placeholder, select)
|
|
55
|
+
else:
|
|
56
|
+
raise ValueError(f'类型错误: {search.type}')
|
|
57
|
+
input_object.click.connect(self.entered)
|
|
58
|
+
from_layout = QFormLayout()
|
|
59
|
+
from_layout.addRow(f'{search.title}:', input_object)
|
|
60
|
+
but_layout.addLayout(from_layout)
|
|
61
|
+
search.input_object = input_object
|
|
62
|
+
if (index + 1) % 4 == 0 or index == len(self.search_data) - 1:
|
|
63
|
+
if (index + 1) % 4 != 0:
|
|
64
|
+
but_layout.addStretch()
|
|
65
|
+
|
|
66
|
+
self.layout.addStretch()
|
|
67
|
+
self.search_but = XiaochaoPushButton('搜索', color=THEME.group.info)
|
|
68
|
+
self.search_but.setMinimumHeight(30) # 设置最小高度
|
|
69
|
+
self.search_but.setMinimumWidth(50)
|
|
70
|
+
self.search_but.clicked.connect(self.on_search_but_clicked)
|
|
71
|
+
|
|
72
|
+
self.layout.addWidget(self.search_but)
|
|
73
|
+
|
|
74
|
+
self.reset_but = XiaochaoPushButton('重置', color=THEME.group.error)
|
|
75
|
+
self.reset_but.setMinimumHeight(30) # 设置最小高度
|
|
76
|
+
self.reset_but.setMinimumWidth(50)
|
|
77
|
+
self.reset_but.clicked.connect(self.on_reset_but_clicked)
|
|
78
|
+
self.layout.addWidget(self.reset_but)
|
|
79
|
+
|
|
80
|
+
self.layout.addLayout(self.layout)
|
|
81
|
+
|
|
82
|
+
def on_reset_but_clicked(self):
|
|
83
|
+
for search in self.search_data:
|
|
84
|
+
search.input_object.set_value('')
|
|
85
|
+
self.clicked.emit({})
|
|
86
|
+
|
|
87
|
+
def entered(self, data: DialogCallbackModel):
|
|
88
|
+
if isinstance(data, DialogCallbackModel):
|
|
89
|
+
for i in self.search_data:
|
|
90
|
+
if i.key == data.subordinate and i.key:
|
|
91
|
+
data.subordinate_input_object = i.input_object
|
|
92
|
+
data.key = i.key
|
|
93
|
+
self.clicked.emit(data)
|
|
94
|
+
|
|
95
|
+
def on_search_but_clicked(self):
|
|
96
|
+
data = {}
|
|
97
|
+
for search in self.search_data:
|
|
98
|
+
value = search.input_object.get_value()
|
|
99
|
+
if value:
|
|
100
|
+
data[search.key] = value
|
|
101
|
+
self.clicked.emit(data)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from PySide6.QtCore import Signal
|
|
2
|
+
from PySide6.QtWidgets import *
|
|
3
|
+
|
|
4
|
+
from xiaochaoui.models.models import TableColumnModel, TableMenuItemModel
|
|
5
|
+
from xiaochaoui.widgets.display import XiaochaoTable, XiaochaoPagination
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TableList(QWidget):
|
|
9
|
+
clicked = Signal(object)
|
|
10
|
+
released = Signal(object)
|
|
11
|
+
|
|
12
|
+
def __init__(self, row_column: list[TableColumnModel], row_ope: list[TableMenuItemModel] = None):
|
|
13
|
+
super().__init__()
|
|
14
|
+
self.row_column = row_column
|
|
15
|
+
self.row_ope = row_ope
|
|
16
|
+
self.layout = QVBoxLayout()
|
|
17
|
+
self.layout.setContentsMargins(0, 0, 0, 0)
|
|
18
|
+
self.layout.setSpacing(0)
|
|
19
|
+
self.table_widget = XiaochaoTable(row_column, row_ope, )
|
|
20
|
+
self.table_widget.click.connect(self.but_clicked)
|
|
21
|
+
self.layout.addWidget(self.table_widget)
|
|
22
|
+
self.pagination = XiaochaoPagination(self)
|
|
23
|
+
self.layout.addWidget(self.pagination)
|
|
24
|
+
self.setLayout(self.layout)
|
|
25
|
+
self.page_size = 10
|
|
26
|
+
|
|
27
|
+
def set_data(self, data, total_size: int | None = None):
|
|
28
|
+
if total_size:
|
|
29
|
+
self.pagination.set_total_size(str(total_size))
|
|
30
|
+
self.table_widget.set_value(data)
|
|
31
|
+
|
|
32
|
+
def but_clicked(self, data):
|
|
33
|
+
self.clicked.emit(data)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-08-30 14:08
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
|
|
7
|
+
from PySide6.QtWidgets import QWidget
|
|
8
|
+
|
|
9
|
+
from xiaochaoui.models.models import FieldListModel
|
|
10
|
+
from xiaochaoui.widgets.layout import XiaochaoVBoxLayout, XiaochaoGridLayout
|
|
11
|
+
from xiaochaoui.widgets.container import XiaochaoCard
|
|
12
|
+
from xiaochaoui.widgets.display import XiaochaoLabel
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class TitleInfoWidget(QWidget):
|
|
16
|
+
|
|
17
|
+
def __init__(self):
|
|
18
|
+
super().__init__()
|
|
19
|
+
self.field_list = None
|
|
20
|
+
self.raw_data = None
|
|
21
|
+
self.layout = XiaochaoVBoxLayout()
|
|
22
|
+
self.layout.setContentsMargins(0, 0, 0, 0)
|
|
23
|
+
self.grid_layout = XiaochaoGridLayout()
|
|
24
|
+
self.xiaochao_card = XiaochaoCard(self.grid_layout)
|
|
25
|
+
self.layout.addWidget(self.xiaochao_card)
|
|
26
|
+
self.setLayout(self.layout)
|
|
27
|
+
|
|
28
|
+
def init(self, raw_data: dict, field_list: list[FieldListModel]):
|
|
29
|
+
if self.field_list is None and self.raw_data is None:
|
|
30
|
+
self.field_list = field_list
|
|
31
|
+
self.raw_data = raw_data
|
|
32
|
+
row = 0
|
|
33
|
+
column = 0
|
|
34
|
+
for index, item in enumerate(self.field_list):
|
|
35
|
+
if self.raw_data[item.key] and isinstance(self.raw_data[item.key], dict):
|
|
36
|
+
value = self.raw_data[item.key].get('name')
|
|
37
|
+
else:
|
|
38
|
+
value = self.raw_data[item.key]
|
|
39
|
+
self.grid_layout.addWidget(XiaochaoLabel(f'{item.name}:{value}'), column, row)
|
|
40
|
+
column += 1
|
|
41
|
+
if index % 3 == 0 and index != 0:
|
|
42
|
+
row += 1
|
|
43
|
+
column = 0
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-10-08 16:25
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
from enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class InputEnum(Enum):
|
|
10
|
+
INPUT = 0
|
|
11
|
+
SELECT = 1
|
|
12
|
+
CASCADER = 2
|
|
13
|
+
TOGGLE = 3
|
|
14
|
+
SELECT_MANY = 4
|
|
15
|
+
TEXT = 5
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TableTypeEnum(Enum):
|
|
19
|
+
DEFAULT = 0
|
|
20
|
+
MENU = 1
|
|
21
|
+
LABEL = 2
|
|
22
|
+
TOGGLE = 3
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class StatusEnum(Enum):
|
|
26
|
+
"""状态枚举"""
|
|
27
|
+
SUCCESS = 1
|
|
28
|
+
FAIL = 0
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def obj(cls):
|
|
32
|
+
return {0: "关闭&进行中&失败", 1: "启用&已完成&通过"}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Status1Enum(Enum):
|
|
36
|
+
"""状态枚举"""
|
|
37
|
+
SUCCESS = 1
|
|
38
|
+
FAIL = 0
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def obj(cls):
|
|
42
|
+
return {0: "否", 1: "是"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Project: 筱超测试平台
|
|
3
|
+
# @Description:
|
|
4
|
+
# @Time : 2024-10-08 16:14
|
|
5
|
+
# @Author : 筱超
|
|
6
|
+
|
|
7
|
+
from .models import *
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
'Font',
|
|
11
|
+
'GroupColors',
|
|
12
|
+
'State',
|
|
13
|
+
'Theme',
|
|
14
|
+
'LeftMenuSize',
|
|
15
|
+
'ColumnSize',
|
|
16
|
+
'AppConfig',
|
|
17
|
+
'ThemeConfig',
|
|
18
|
+
'LeftMenuModel',
|
|
19
|
+
'TitleBarMenusModel',
|
|
20
|
+
'MenusModel',
|
|
21
|
+
'SearchDataModel',
|
|
22
|
+
'RightDataModel',
|
|
23
|
+
'FormDataModel',
|
|
24
|
+
'TableColumnModel',
|
|
25
|
+
'TableMenuItemModel',
|
|
26
|
+
'FieldListModel',
|
|
27
|
+
'CascaderModel',
|
|
28
|
+
'TreeModel',
|
|
29
|
+
'DialogCallbackModel',
|
|
30
|
+
'ComboBoxDataModel'
|
|
31
|
+
]
|