You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
from PyQt5.QtWidgets import QApplication, QMainWindow, QToolBar, QMdiArea, QAction, QInputDialog, QDialog, QFormLayout, QLineEdit, \
|
|
QMdiSubWindow, QDialogButtonBox, QWidget, QComboBox, QTabBar, QTabWidget, QGridLayout, QLabel, QPushButton, QSpacerItem,QSizePolicy
|
|
from AreaSettingWidget import AreaSettingWidget
|
|
|
|
import sys
|
|
|
|
class AreaWidget(QWidget):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.initUI()
|
|
|
|
def initUI(self):
|
|
|
|
self.sub_window = QMdiSubWindow() # 创建一个子窗口
|
|
self.layoutAI = QGridLayout()
|
|
|
|
self.widget = QWidget()
|
|
self.widget.setLayout(self.layoutAI)
|
|
|
|
self.newbtn = QPushButton('New')
|
|
self.delbtn = QPushButton('Del')
|
|
self.layoutAI.addWidget(self.newbtn, 0, 0)
|
|
self.layoutAI.addWidget(self.delbtn, 0, 1)
|
|
self.newbtn.clicked.connect(lambda: self.newArea)
|
|
self.delbtn.clicked.connect(self.delArea)
|
|
|
|
|
|
self.layoutAI.addWidget(self.newbtn, 0, 0, 1, 1)
|
|
|
|
|
|
self.layoutAI.addWidget(self.delbtn, 0, 2, 1, 1)
|
|
|
|
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
|
|
self.layoutAI.addItem(self.horizontalSpacer, 0, 1, 1, 1)
|
|
|
|
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
|
|
|
|
self.layoutAI.addItem(self.verticalSpacer, 1, 0, 1, 1)
|
|
|
|
# self.sub_window.setGeometry(100, 100, 400, 300)
|
|
self.sub_window.setWidget(self.widget)
|
|
|
|
def newArea(self):
|
|
print(1)
|
|
areaSettingWidget = AreaSettingWidget()
|
|
if areaSettingWidget.exec_() == QDialog.Accepted:
|
|
deviceName, proType, varType = areaSettingWidget.getParameters()
|
|
|
|
|
|
|
|
def delArea(self):
|
|
pass
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app = QApplication(sys.argv)
|
|
window = AreaWidget()
|
|
window.show()
|
|
sys.exit(app.exec_())
|
|
|