def openAllGraph(self):
self.plot_file_list = self.parent.plot_file[self.root_name]
self.graphviewer = QtWidgets.QFrame()
self.screen = QtWidgets.QDesktopWidget().screenGeometry()
# Set geometry
self.graphviewer.setGeometry(self.screen.width()/4, 100, 800, 600)
self.graphviewer.setWindowFlags(QtCore.Qt.Popup)
self.graphviewer.setObjectName("graphView")
self.graphviewer.setStyleSheet("QFrame#graphView{background:#ffffff;border:0.5px solid #fa7064;} QPushButton:hover{background:#6e66cc;border:1px solid #373366;} QToolButton:hover{background:#fa7064;}")
# self.graphviewer.setWindowModality(QtCore.Qt.WindowModal)
# Layout
graph_layout = QtWidgets.QVBoxLayout()
# Title
graph_title = SubTitleBar(self.graphviewer)
graph_title.title_Label.setText(self.root_name)
# Separator line
hline = QtWidgets.QWidget()
hline.setStyleSheet("QWidget{min-height:2px; max-height:2px; background:#399ee5;}")
# ComboBox
graph_control = QtWidgets.QWidget()
graph_control_layout = QtWidgets.QHBoxLayout()
self.graph_control_comboBox = QtWidgets.QComboBox()
self.graph_control_comboBox.setStyleSheet("QComboBox{font-family:'Segoe UI';font-size: 10pt;border: 1px solid #c5d2d9; border-radius:5px;padding: 5px 10px 5px 10px; color: #66767c;min-width: 250px;} QComboBox:hover{border: 2px solid #2a4d69;border-radius: 5px;height: 30ps;} QComboBox::drop-down {subcontrol-origin: padding; subcontrol-position: top right;width: 40px;border-left-width: 2px;border-left-color: #c5d2d9;border-left-style: solid; border-top-right-radius: 5px; border-bottom-right-radius: 5px;padding: 1px 1px 1px 1px;image: url(:/resources/dropdown_arrow.png);} QComboBox QAbstractItemView {border: 1px solid #c5d2d9; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;selection-background-color:#4b86b4;outline: solid #2a4d69;font-family: 'Segoe UI';font-size: 10pt;color: #66767c;}")
graph_control_layout.insertStretch(0, 4)
graph_control_layout.addWidget(self.graph_control_comboBox)
graph_control_layout.insertStretch(3, 4)
graph_control.setLayout(graph_control_layout)
# Main Content
self.graph_content = QtWidgets.QStackedWidget()
# Add stack
for i in range(1, len(self.plot_file_list)):
currentName = self.plot_file_list[i].rsplit("/", 1)[1].rsplit(".", 1)[0]
self.graph_control_comboBox.addItem(currentName)
graph_label = QtWidgets.QLabel()
currentGraph = QtGui.QPixmap(self.plot_file_list[i])
graph_label.setPixmap(currentGraph)
graph_label.setAlignment(QtCore.Qt.AlignCenter)
self.graph_content.addWidget(graph_label)
# Add layout
graph_layout.addWidget(graph_title, 1)
graph_layout.addWidget(hline, 1)
graph_layout.addWidget(graph_control, 1)
graph_layout.addWidget(self.graph_content, 8)
graph_layout.setContentsMargins(5, 10, 5, 10)
graph_layout.setAlignment(QtCore.Qt.AlignTop)
self.graphviewer.setLayout(graph_layout)
self.graph_control_comboBox.currentIndexChanged.connect(self.changeGraph)
self.graphviewer.show()
BATS.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录