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.
81 lines
2.5 KiB
Python
81 lines
2.5 KiB
Python
import sys
|
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
|
from PyQt5.QtCore import Qt, QModelIndex
|
|
from PyQt5.QtGui import QStandardItemModel, QStandardItem
|
|
from PyQt5.QtWidgets import (QApplication, QMainWindow, QTreeView,QMessageBox,QHBoxLayout,QStackedWidget,QVBoxLayout,QPushButton,
|
|
QAbstractItemView, QHeaderView, QStyleFactory, QGridLayout)
|
|
from UI.VarManages.FFTreeView import ParamView
|
|
from UI.VarManages.VarWidget import VarWidgets
|
|
from protocol.FF.FFProtocol import FFProtocol
|
|
class FFWidget(VarWidgets):
|
|
def __init__(self, parent=None):
|
|
self.FFCom = FFProtocol()
|
|
super(FFWidget, self).__init__(parent)
|
|
# self.setupUI()
|
|
|
|
|
|
def setupUI(self):
|
|
# self.verticalLayout = QHBoxLayout(self)
|
|
self.model = QStandardItemModel()
|
|
self.model.setHorizontalHeaderLabels(['InterFace'])
|
|
|
|
self.deviceView = QTreeView()
|
|
self.deviceView.setModel(self.model)
|
|
self.deviceView.setObjectName('deviceView')
|
|
# self.initDevView()
|
|
self.deviceView.setStyle(QStyleFactory.create('windows'))
|
|
self.deviceView.expandAll()
|
|
self.deviceView.doubleClicked.connect(self.devClicked)
|
|
|
|
self.paramsView = ParamView(self.FFCom)
|
|
|
|
self.gridLayout = QGridLayout()
|
|
self.gridLayout.setObjectName(u"gridLayout")
|
|
|
|
self.gridLayout.addWidget(self.deviceView, 0, 0, 1, 2)
|
|
|
|
self.gridLayout.addWidget(self.paramsView, 0, 1, 1, 6)
|
|
self.setLayout(self.gridLayout)
|
|
|
|
# self.proxy = self.paramsView.proxy
|
|
# self.horizontalHeader = self.paramsView.header()
|
|
# self.horizontalHeader.sectionClicked.connect(self.on_view_horizontalHeader_sectionClicked)
|
|
|
|
|
|
|
|
def initDevView(self):
|
|
self.FFCom.open()
|
|
for dev in self.FFCom.getDevices():
|
|
devTagItem = QStandardItem(dev)
|
|
self.model.appendRow(devTagItem)
|
|
devTagItem.setEditable(False)
|
|
for block in self.FFCom.getBlocks(dev):
|
|
blockItem = QStandardItem(block)
|
|
blockItem.setEditable(False)
|
|
devTagItem.appendRow(blockItem)
|
|
|
|
def devClicked(self):
|
|
# print(1)
|
|
index = self.deviceView.currentIndex()
|
|
if not self.model.itemFromIndex(index).parent():
|
|
return
|
|
dev = self.model.parent(index).data()
|
|
block = self.model.itemFromIndex(index).text()
|
|
self.paramsView.initModel(dev, block)
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app = QApplication(sys.argv)
|
|
window = FFWidget()
|
|
window.show()
|
|
app.exec_()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|