Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setRole(self, dim, role, **kw):
super().setRole(dim, role, **kw)
item = self.findItems(dim, QtCore.Qt.MatchExactly, 0)[0]
if role == 'Boo!':
idx = kw.get('value', 0)
w = self._makeSlider(value=idx)
w.valueChanged.connect(lambda x: self.sliderChange(dim, role, x))
self.choices[dim]['optionsWidget'] = w
self.setItemWidget(item, 2, w)
super().__init__(parent=parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.plotDialogs = {}
self.selectedFile = None
self.newFiles = []
self.monitorPath = os.path.abspath(monitorPath)
self.refreshInterval = refreshInterval
self.refreshFiles = partial(self.ui.fileList.loadFromPath, self.monitorPath,
emitNew=True)
self.ui.fileList.loadFromPath(self.monitorPath, emitNew=False)
self.monitor = QtCore.QTimer()
self.monitor.timeout.connect(self.refreshFiles)
self.monitor.timeout.connect(self.plotQueuedFiles)
self.monitor.start(self.refreshInterval * 1000)
super().__init__(parent=parent)
self.plotDataType = PlotDataType.unknown
self.plotType = PlotType.empty
self.dataType = type(None)
self.dataStructure = None
self.dataShapes = None
self.dataLimits = None
# A toolbar for configuring the plot
self.plotOptionsToolBar = _AutoPlotToolBar('Plot options', self)
self.layout.insertWidget(1, self.plotOptionsToolBar)
self.plotOptionsToolBar.plotTypeSelected.connect(
self._plotTypeFromToolBar)
self.plotOptionsToolBar.setIconSize(QtCore.QSize(32, 32))
self.setMinimumSize(640, 480)
self._plot2d(axes, self.data, style='mesh')
elif self.plotType is PlotType.scatter2d:
logger.debug(f"Plot 2D data as scatter plot.")
self._plot2d(axes, self.data, style='scatter')
else:
logger.info(f"No plot routine defined for {self.plotType}")
return
self.setMeta(self.data)
if adjustSize:
self.plot.autosize()
else:
self.plot.draw()
QtCore.QCoreApplication.processEvents()
def setDimInfo(self, dim: str, info: str = ''):
try:
item = self.findItems(dim, QtCore.Qt.MatchExactly, 0)[0]
item.setText(3, info)
except IndexError:
pass
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(935, 569)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.splitter = QtWidgets.QSplitter(self.centralwidget)
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setObjectName("splitter")
self.fileList = DataFileList(self.splitter)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.fileList.sizePolicy().hasHeightForWidth())
self.fileList.setSizePolicy(sizePolicy)
self.fileList.setAlternatingRowColors(False)
self.fileList.setUniformRowHeights(True)
self.fileList.setObjectName("fileList")
self.fileContents = DataFileContent(self.splitter)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(2)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.fileContents.sizePolicy().hasHeightForWidth())
self.fileContents.setSizePolicy(sizePolicy)