调整界面布局和样式

This commit is contained in:
halliday2023 2024-02-14 21:33:54 +08:00
parent 04867c9467
commit d9749e42ee
3 changed files with 645 additions and 533 deletions

View File

@ -9,15 +9,19 @@ from PySide6.QtGui import QIcon
from pathlib import Path from pathlib import Path
path = Path(__file__) path = Path(__file__)
ui_file_patch = path.parent.parent / "images" / "bjx.png" ico_file_patch = path.parent.parent / "images" / "bjx.png"
css_file_patch = path.parent.parent / "ui" / "style.qss"
if __name__ == '__main__': if __name__ == '__main__':
app = QApplication([]) app = QApplication([])
app.setStyle("Fusion") app.setStyle("Fusion")
app.setWindowIcon(QIcon(str(ui_file_patch))) app.setWindowIcon(QIcon(str(ico_file_patch)))
# 样式 # 样式
# print(QtWidgets.QStyleFactory.keys()) # print(QtWidgets.QStyleFactory.keys())
# print(app.style().name()) # print(app.style().name())
with open(css_file_patch,"r") as cssfile:
_style = cssfile.read()
app.setStyleSheet(_style)
win = Window() win = Window()
win.ui.show() win.ui.show()
sys.exit(app.exec()) sys.exit(app.exec())

30
ui/style.qss Normal file
View File

@ -0,0 +1,30 @@
*{
font-family: 宋体;
font-size: 15px;
}
#Log_Output{
margin: 10px 5px 5px 2px;
}
#groupBox{
margin: 5px 5px 5px 2px;
}
#filename_label{
margin: 5px 5px 10px 1px;
}
#output_label{
margin: 5px 5px 15px 2px;
}
#fileinit_label{
margin: 5px 5px 15px 2px;
}
#fileOutputText{
margin: 5px 5px 10px 2px;
}
#fileInitRowsText{
margin: 5px 5px 10px 2px;
}
#fileNameText{
margin: 5px 5px 5px 2px;
}

View File

@ -6,23 +6,24 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>801</width> <width>966</width>
<height>585</height> <height>633</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>DataCreating</string> <string>DataCreating</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <property name="styleSheet">
<widget class="QTabWidget" name="tabWidget"> <string notr="true"/>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>481</width>
<height>471</height>
</rect>
</property> </property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
@ -30,15 +31,59 @@
<attribute name="title"> <attribute name="title">
<string>文件</string> <string>文件</string>
</attribute> </attribute>
<widget class="QLineEdit" name="fileNameText"> <layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="geometry"> <item>
<rect> <layout class="QVBoxLayout" name="verticalLayout_10" stretch="2,0,3,0">
<x>90</x> <item>
<y>30</y> <widget class="QGroupBox" name="groupBox_3">
<width>201</width> <property name="title">
<height>31</height> <string>基本信息:</string>
</rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6" stretch="0,0,0,1">
<item>
<widget class="QLabel" name="filename_label">
<property name="text">
<string>文件名</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="output_label">
<property name="text">
<string>输出路径</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fileinit_label">
<property name="text">
<string>初始数据量</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLineEdit" name="fileNameText">
<property name="text"> <property name="text">
<string>filetest</string> <string>filetest</string>
</property> </property>
@ -46,127 +91,71 @@
<string>qqq</string> <string>qqq</string>
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="fileOutputText"> </item>
<property name="geometry"> <item>
<rect> <widget class="QLineEdit" name="fileOutputText"/>
<x>90</x> </item>
<y>80</y> <item>
<width>201</width> <widget class="QLineEdit" name="fileInitRowsText"/>
<height>31</height> </item>
</rect> <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget> </widget>
<widget class="QLineEdit" name="fileInitRowsText"> </item>
<property name="geometry"> <item>
<rect> <spacer name="verticalSpacer_3">
<x>90</x> <property name="orientation">
<y>130</y> <enum>Qt::Vertical</enum>
<width>201</width>
<height>31</height>
</rect>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
<widget class="QLabel" name="filename_label"> <size>
<property name="geometry"> <width>20</width>
<rect> <height>15</height>
<x>20</x> </size>
<y>30</y>
<width>81</width>
<height>31</height>
</rect>
</property> </property>
<property name="text"> </spacer>
<string>文件名</string> </item>
</property> <item>
</widget> <widget class="QGroupBox" name="groupBox_2">
<widget class="QLabel" name="output_label"> <property name="title">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>61</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>输出路径</string>
</property>
</widget>
<widget class="QLabel" name="fileinit_label">
<property name="geometry">
<rect>
<x>20</x>
<y>130</y>
<width>61</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>初始数据量</string>
</property>
</widget>
<widget class="QLabel" name="filearges_bool_label">
<property name="geometry">
<rect>
<x>30</x>
<y>230</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>是否持续生成:</string>
</property>
</widget>
<widget class="QLabel" name="filearges_label">
<property name="geometry">
<rect>
<x>0</x>
<y>200</y>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>参数配置:</string> <string>参数配置:</string>
</property> </property>
</widget>
<widget class="QLabel" name="fileinfo_label">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>基本信息:</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>120</x>
<y>230</y>
<width>79</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>是/否</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>12</x>
<y>270</y> <y>64</y>
<width>291</width> <width>337</width>
<height>131</height> <height>72</height>
</rect> </rect>
</property> </property>
<property name="frameShape"> <property name="frameShape">
@ -175,82 +164,106 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<widget class="QLabel" name="filearges_del_label"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="geometry"> <item>
<rect> <layout class="QVBoxLayout" name="verticalLayout_2">
<x>10</x> <item>
<y>40</y> <layout class="QHBoxLayout" name="horizontalLayout_3">
<width>91</width> <item>
<height>21</height>
</rect>
</property>
<property name="text">
<string>每次删除数据量:</string>
</property>
</widget>
<widget class="QLabel" name="filearges_insert_label"> <widget class="QLabel" name="filearges_insert_label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>每次插入数据量:</string> <string>每次插入数据量:</string>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QLineEdit" name="fileInsertRowsText"> <widget class="QLineEdit" name="fileInsertRowsText">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="geometry">
<rect>
<x>110</x>
<y>10</y>
<width>81</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="fileDelRowsText">
<property name="geometry">
<rect>
<x>110</x>
<y>40</y>
<width>81</width>
<height>21</height>
</rect>
</property>
</widget> </widget>
</item>
<item>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>200</x>
<y>10</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>条</string> <string>条</string>
</property> </property>
</widget> </widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="filearges_del_label">
<property name="text">
<string>每次删除数据量:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fileDelRowsText"/>
</item>
<item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>200</x>
<y>40</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>条</string> <string>条</string>
</property> </property>
</widget> </widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>12</x>
<y>27</y>
<width>174</width>
<height>22</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="filearges_bool_label">
<property name="text">
<string>是否持续生成:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>是/否</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="DB_tab"> <widget class="QWidget" name="DB_tab">
<attribute name="title"> <attribute name="title">
@ -510,49 +523,114 @@
</widget> </widget>
</widget> </widget>
</widget> </widget>
<widget class="QTextBrowser" name="Log_Output"> </item>
<property name="geometry"> <item>
<rect> <spacer name="horizontalSpacer_6">
<x>510</x> <property name="orientation">
<y>30</y> <enum>Qt::Horizontal</enum>
<width>281</width>
<height>451</height>
</rect>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>15</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>输出日志:</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,2">
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QTextBrowser" name="Log_Output"/>
</item>
</layout>
</widget> </widget>
<widget class="QPushButton" name="startButton"> </item>
<property name="geometry"> </layout>
<rect> </item>
<x>60</x> <item>
<y>490</y> <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,1,2,1,10">
<width>71</width> <item>
<height>41</height> <spacer name="horizontalSpacer_3">
</rect> <property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="startButton">
<property name="text"> <property name="text">
<string>开始</string> <string>开始</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="stopButton"> </item>
<property name="geometry"> <item>
<rect> <spacer name="horizontalSpacer">
<x>370</x> <property name="orientation">
<y>490</y> <enum>Qt::Horizontal</enum>
<width>71</width>
<height>41</height>
</rect>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="stopButton">
<property name="text"> <property name="text">
<string>停止</string> <string>停止</string>
</property> </property>
</widget> </widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>801</width> <width>966</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>