diff --git a/Static/Main.qss b/Static/Main.qss index 961cdea..8575c34 100644 --- a/Static/Main.qss +++ b/Static/Main.qss @@ -111,7 +111,8 @@ QPushButton#startProtocolBtn, QPushButton#switchBtn, QPushButton#switchTouchBtn, } -QPushButton#startProtocolBtn:hover, QPushButton#switchBtn:hover, QPushButton#switchTouchBtn:hover, QPushButton#deviceParameterManageBtn:hover{ +QPushButton#startProtocolBtn:hover, QPushButton#switchBtn:hover, QPushButton#switchTouchBtn:hover, +QPushButton#deviceParameterManageBtn:hover{ font-size: 25px; @@ -125,7 +126,8 @@ QPushButton#startProtocolBtn:hover, QPushButton#switchBtn:hover, QPushButton#swi } -QPushButton#startProtocolBtn:checked, QPushButton#switchBtn:checked, QPushButton#switchTouchBtn:checked, QPushButton#deviceParameterManageBtn:checked{ +QPushButton#startProtocolBtn:checked, QPushButton#switchBtn:checked, QPushButton#switchTouchBtn:checked, +QPushButton#deviceParameterManageBtn:checked{ font-size: 25px; @@ -183,7 +185,7 @@ QPushButton#okButton:hover, QPushButton#cancelButton:hover{ } -QPushButton#closeButton, QPushButton#minButton{ +QPushButton#closeButton, QPushButton#minButton, QPushButton#startActionBtn{ border: none; @@ -209,6 +211,76 @@ QPushButton#confirmButton, QPushButton#exitButton{ } +QPushButton#parameBtn{ + + border: none; + + width: 54.75px; + + height: 40px; + + background-color: #f0f0f0; + + border-radius: 5px; + + color: #0e0000; + + font-family: ".SFNSDisplay-Medium"; + + font-size: 17px; + + font-weight: 520; + + + +} + + +QPushButton#parameBtn:hover{ + + font: bold; + + border: none; + + background-color: #007bff; + + margin-bottom: -1px; + +} + +QPushButton#parameBtn:checked{ + + background-color: #007bff; + + color: #f7f6f6; + +} + +QPushButton#startActionBtn:hover{ + + font: bold; + + border: none; + + background-color: #67f38e; + + margin-bottom: -2px; + +} + +QPushButton#startActionBtn:pressed{ + + font: bold; + + border: none; + + background-color: #04942c; + + margin-bottom: -2px; + +} + + QWidget#MainWindow{ @@ -255,6 +327,21 @@ QLabel#batteryLabel{ } +QLabel#deviceAddressLabel{ + + font-size: 23px; + + font: bold; + + border: none; + + font-family: ".SFNSDisplay-Medium"; + +} + + + + QProgressBar { border: 2px solid grey; @@ -334,4 +421,38 @@ QLineEdit#deviceMesEdit{ font-weight: 520; -} \ No newline at end of file +} + +QLineEdit#deviceAddressEdit, QLineEdit#parameEditline{ + + font-size: 16px; + + border-top: none; + + border-left: none; + + border-right: none; + + background: rgba(255, 255, 255, 0); + + border-bottom: 2px solid gary; + + +} + +QTableView#BlockView{ + + font-size: 25px; + + font-family: ".SFNSDisplay-Regular"; + +} + +QHeaderView::section { + /* background-color: lightblue; + color: black; */ + /* padding: 4px; + border: 1px solid #6c6c6c; */ + font-size: 16pt; +} + diff --git a/UI/BlockParameterManageWidget.py b/UI/BlockParameterManageWidget.py index 6d7e346..0ba8cd4 100644 --- a/UI/BlockParameterManageWidget.py +++ b/UI/BlockParameterManageWidget.py @@ -1,20 +1,13 @@ -from PyQt5.QtWidgets import QPushButton,QStackedWidget, QLineEdit, QVBoxLayout, QHBoxLayout, QWidget, QLabel, QSplitter - - +import qtawesome +from PyQt5.QtWidgets import QPushButton,QStackedWidget, QLineEdit, QVBoxLayout, QHBoxLayout, QWidget, QLabel, QSplitter, QButtonGroup from utils.DBModels.DeviceParModels import * from UI.BlockParameterView import PressureTBlockView, AIFunctionBlockView, PhysicalBlockView from UI.SearchAddressWidget import SearchAddressWidget - - - - - - class BlockParameterManageWidget(QWidget): def __init__(self): super().__init__() @@ -30,26 +23,48 @@ class BlockParameterManageWidget(QWidget): self.parameStackWidget = QStackedWidget() self.settingLayout = QHBoxLayout() self.deviceAddressLabel = QLabel('从站地址') + self.deviceAddressLabel.setObjectName('deviceAddressLabel') self.deviceAddressEdit = QLineEdit() + self.deviceAddressEdit.setObjectName("deviceAddressEdit") self.confirmBtn = QPushButton('确定') + self.confirmBtn.setIcon(qtawesome.icon('fa5s.check-circle', color='#1fbb6f')) self.confirmBtn.clicked.connect(self.testUI) + self.confirmBtn.setObjectName("parameBtn") self.deviceAddressSearchBtn = QPushButton('查找') + self.deviceAddressSearchBtn.setIcon(qtawesome.icon('fa.search', color='#1fbb6f')) self.deviceAddressSearchBtn.clicked.connect(self.searchAddress) + self.deviceAddressSearchBtn.setObjectName("parameBtn") self.pblockBtn = QPushButton('物理块') + self.pblockBtn.setCheckable(True) + self.pblockBtn.setChecked(True) + self.pblockBtn.setObjectName("parameBtn") + self.pblockBtn.setIcon(qtawesome.icon('fa.th-large', color='#1fbb6f')) # self.pblockBtn.setCheckable(True) self.pblockBtn.clicked.connect(lambda: self.switchParameterWidget('pblockBtn')) self.fblockBtn = QPushButton('功能块') + self.fblockBtn.setCheckable(True) + self.fblockBtn.setObjectName("parameBtn") + self.fblockBtn.setIcon(qtawesome.icon('fa.th-large', color='#1fbb6f')) self.fblockBtn.clicked.connect(lambda: self.switchParameterWidget('fblockBtn')) # self.pblockBtn.setCheckable(True) self.tblockBtn = QPushButton('转换块') + self.tblockBtn.setObjectName("parameBtn") + self.tblockBtn.setCheckable(True) + self.tblockBtn.setIcon(qtawesome.icon('fa.th-large', color='#1fbb6f')) self.tblockBtn.clicked.connect(lambda: self.switchParameterWidget('tblockBtn')) # self.tblockBtn.setCheckable(True) + self.parameterButtonGroup = QButtonGroup() + self.parameterButtonGroup.setExclusive(True) + self.parameterButtonGroup.addButton(self.pblockBtn) + self.parameterButtonGroup.addButton(self.fblockBtn) + self.parameterButtonGroup.addButton(self.tblockBtn) + self.settingLayout.addWidget(self.deviceAddressLabel, 1) self.settingLayout.addWidget(self.deviceAddressEdit, 1) diff --git a/UI/BlockParameterModel.py b/UI/BlockParameterModel.py index 27b4241..801fa3e 100644 --- a/UI/BlockParameterModel.py +++ b/UI/BlockParameterModel.py @@ -134,7 +134,7 @@ class VarButtonDelegate(QItemDelegate): def paint(self, painter, option, index): if not self.parent().indexWidget(index): - button1 = QPushButton( + startActionBtn = QPushButton( qtawesome.icon('fa.play', color='#1fbb6f'), "", self.parent() @@ -144,15 +144,17 @@ class VarButtonDelegate(QItemDelegate): return - button1.index = [index.row(), index.column()] + startActionBtn.index = [index.row(), index.column()] parameEditline = QLineEdit() + parameEditline.setObjectName('parameEditline') boxLayout = QHBoxLayout() boxLayout.addWidget(parameEditline) - boxLayout.addWidget(button1) + boxLayout.addWidget(startActionBtn) - button1.clicked.connect(lambda: self.startAction(parameEditline)) + startActionBtn.clicked.connect(lambda: self.startAction(parameEditline)) + startActionBtn.setObjectName('startActionBtn') boxLayout.setContentsMargins(2, 0, 0, 2) boxLayout.setAlignment(Qt.AlignCenter) diff --git a/UI/BlockParameterView.py b/UI/BlockParameterView.py index 14e45ee..1e945e6 100644 --- a/UI/BlockParameterView.py +++ b/UI/BlockParameterView.py @@ -39,7 +39,7 @@ class VarTableView(QTableView): self.setShowGrid(True) self.setAlternatingRowColors(True) self.setSelectionBehavior(QAbstractItemView.SelectRows) - + self.setObjectName('BlockView') #设置单元格宽度比例 self.header = self.horizontalHeader() @@ -94,6 +94,7 @@ class PressureTBlockView(VarTableView): data = data + ['', '', ''] self.model.append_data(data) self.setVerticalHeader(ParamsVHeader(self, self.model.datas)) + class AIFunctionBlockView(PressureTBlockView): def __init__(self):