main
zhangxuxutm 2 years ago
parent 2bf9940961
commit acfb01e92e

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@ -1,5 +1,6 @@
from PyQt5.QtWidgets import QDialog, QFormLayout, QLineEdit, QComboBox, QDialogButtonBox, QApplication, QMessageBox from PyQt5.QtWidgets import QDialog, QFormLayout, QLineEdit, QComboBox, QDialogButtonBox, QApplication, QMessageBox
from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtCore import Qt
import sys import sys
import re import re
class AreaSettingWidget(QDialog): class AreaSettingWidget(QDialog):
@ -32,7 +33,8 @@ class AreaSettingWidget(QDialog):
layout.addRow(button_box) layout.addRow(button_box)
self.setWindowIcon(QIcon('../Static/zhjt.ico'))
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) # 去掉标题栏的问号
self.setLayout(layout) self.setLayout(layout)
self.setWindowTitle("通道配置") self.setWindowTitle("通道配置")

@ -0,0 +1,79 @@
from PyQt5.QtWidgets import QApplication, QMainWindow, QToolBar, QMdiArea, QAction, QInputDialog, QDialog, QFormLayout, QLineEdit, \
QMdiSubWindow, QDialogButtonBox, QWidget, QComboBox, QTabBar, QTabWidget, QGridLayout, QLabel, QPushButton, QSpacerItem,QSizePolicy, QCheckBox, QVBoxLayout
from AreaSettingWidget import AreaSettingWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap, QIcon
import sys
class DelAreaWidget(QDialog):
def __init__(self, areaLabel, deviceName):
super().__init__()
self.checkbox_data ={}
self.areaLabel = areaLabel
self.deviceName = deviceName
self.delAreaRowAndColunm = []
self.initUI()
def initUI(self):
vorlayout = QVBoxLayout() #主布局
layout = QGridLayout()
for i in self.areaLabel:
if self.deviceName in i:
widget = i[2]
row = i[3]
text = widget.text()
column = i[4]
checkbox = QCheckBox(text)
checkbox.stateChanged.connect(self.checkbox_state_changed)
if column > 0:
layout.addWidget(checkbox, row, 1)
self.checkbox_data[checkbox] = [row, 1]
else:
layout.addWidget(checkbox, row, column)
self.checkbox_data[checkbox] = [row, column]
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
button_box.accepted.connect(self.getDelAreaRowAndColunm)
button_box.rejected.connect(self.reject)
vorlayout.addLayout(layout)
vorlayout.addWidget(button_box)
self.setWindowIcon(QIcon('../Static/zhjt.ico'))
self.setWindowTitle("删除通道")
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)#去掉标题栏的问号
self.setLayout(vorlayout)
self.exec_()
def checkbox_state_changed(self, state):
sender = self.sender() # 获取触发信号的对象
if isinstance(sender, QCheckBox):
if state == 2: # 选中状态
self.delAreaRowAndColunm.append(self.checkbox_data[sender]) # 从字典中获取行列信息
elif state == 0: # 取消选中状态
self.delAreaRowAndColunm.remove(self.checkbox_data[sender])
def getDelAreaRowAndColunm(self):
self.close()
return self.delAreaRowAndColunm
if __name__ == '__main__':
app = QApplication(sys.argv)
# Client.initDB()
window = DelAreaWidget()
window.show()
sys.exit(app.exec_())

@ -1,5 +1,6 @@
from PyQt5.QtWidgets import QDialog, QFormLayout, QLineEdit, QComboBox, QDialogButtonBox, QMessageBox from PyQt5.QtWidgets import QDialog, QFormLayout, QLineEdit, QComboBox, QDialogButtonBox, QMessageBox
from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtCore import Qt
import sys import sys
import re import re
class DeviceDialog(QDialog): class DeviceDialog(QDialog):
@ -41,7 +42,8 @@ class DeviceDialog(QDialog):
button_box.rejected.connect(self.reject) button_box.rejected.connect(self.reject)
layout.addRow(button_box) layout.addRow(button_box)
self.setWindowIcon(QIcon('../Static/zhjt.ico'))
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) # 去掉标题栏的问号
self.setLayout(layout) self.setLayout(layout)
self.setWindowTitle("设备信息") self.setWindowTitle("设备信息")

@ -6,6 +6,7 @@ import time
from PyQt5.QtWidgets import QApplication, QMainWindow, QToolBar, QMdiArea, QAction, QInputDialog, QDialog, QFormLayout, QLineEdit, \ from PyQt5.QtWidgets import QApplication, QMainWindow, QToolBar, QMdiArea, QAction, QInputDialog, QDialog, QFormLayout, QLineEdit, \
QMdiSubWindow, QDialogButtonBox, QWidget, QComboBox, QTabBar, QTabWidget, QGridLayout, QLabel, QPushButton, QSpacerItem, QSizePolicy, QHBoxLayout, QTableWidget, QScrollArea QMdiSubWindow, QDialogButtonBox, QWidget, QComboBox, QTabBar, QTabWidget, QGridLayout, QLabel, QPushButton, QSpacerItem, QSizePolicy, QHBoxLayout, QTableWidget, QScrollArea
from PyQt5 import QtCore from PyQt5 import QtCore
from PyQt5.QtGui import QPixmap, QIcon
from DeviceWidget import * from DeviceWidget import *
from UI.AreaSettingWidget import AreaSettingWidget from UI.AreaSettingWidget import AreaSettingWidget
from UI.DelAreaWidget import DelAreaWidget from UI.DelAreaWidget import DelAreaWidget
@ -46,6 +47,7 @@ class MainWindow(QMainWindow):
# self.scrollArea.setWidget(self.mdi_area) # self.scrollArea.setWidget(self.mdi_area)
self.setCentralWidget(self.mdi_area) self.setCentralWidget(self.mdi_area)
self.setWindowIcon(QIcon('../Static/zhjt.ico'))
# self.mdi_area.setViewMode(QMdiArea.TabbedView) # self.mdi_area.setViewMode(QMdiArea.TabbedView)
@ -138,6 +140,7 @@ class MainWindow(QMainWindow):
sub_window.setWindowTitle(windowTitle) sub_window.setWindowTitle(windowTitle)
sub_window.setGeometry(0, 0, 600, 500) sub_window.setGeometry(0, 0, 600, 500)
sub_window.setWidget(scroll_widget) sub_window.setWidget(scroll_widget)
sub_window.setWindowIcon(QIcon('../Static/zhjt.ico'))
self.mdi_area.addSubWindow(sub_window) # 将子窗口添加到MDI区域 self.mdi_area.addSubWindow(sub_window) # 将子窗口添加到MDI区域
# self.mdi_area.subWindowActivated.connect(self.adjustMdiAreaSize) # self.mdi_area.subWindowActivated.connect(self.adjustMdiAreaSize)

Loading…
Cancel
Save