def __init__(self): QApplication.__init__(self, sys.argv) # Enable High DPI display with PyQt5 if hasattr(Qt, 'AA_UseHighDpiPixmaps'): self.setAttribute(Qt.AA_UseHighDpiPixmaps) self.setApplicationName("Algorithm Visualizer") with open(AbsJoin(APP_ROOT, "resources/stylesheet.qss")) as styleSheetFile: self.setStyleSheet(styleSheetFile.read()) self.mainWindow = QMainWindow() self.mainWindow.setProperty("class", "MainWindow") self.mainWindow.resize(1024, 768) self.mainWidget = MainWidget() self.mainWindow.setCentralWidget(self.mainWidget) self.mainWindow.show() # this needs to happen after the main window is shown self.mainWidget.showTopAlgorithm() sys.exit(self.exec_())
elif tStart < xl: self.faaTempPlot.setXRange(tStart - 0.1 * span, tStart + 0.9 * span) elif tEnd > xr: self.faaTempPlot.setXRange(tEnd - 0.9 * span, tEnd + 0.1 * span) def removeTimeSpanHighlight(self): if self.lri is not None: self.faaTempPlot.removeItem(self.lri) self.lri = None if __name__ == '__main__': from qtpy.QtGui import QApplication #from qtpy.QtCore import QTimer import h5py as hdf path = 'ExampleData/' fileName = path + 'TES2_IV_20180117_090049.h5' app = QApplication([]) from Analysis.HkImport import HkImporter f = hdf.File(fileName, 'r') hkGroup = f['HK'] hk = HkImporter(hkGroup) mw = HkDockWidget(hk) mw.show() #QTimer.singleShot(3000, lambda: mw.setSelection('up+/up-')) app.exec_()
def event(self, event): if event.type() == QEvent.FileOpen: fname = str(event.file()) self.open_external_file.emit(fname) return QApplication.event(self, event)
#=============================================================================== # Example #=============================================================================== if __name__ == '__main__': import sys from qtpy.QtGui import QMainWindow, QApplication from numpy import linspace class ApplicationWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.mplwidget = MatplotlibWidget(self, title='Example', xlabel='Linear scale', ylabel='Log scale', hold=True, yscale='log') self.mplwidget.setFocus() self.setCentralWidget(self.mplwidget) self.plot(self.mplwidget.axes) def plot(self, axes): x = linspace(-10, 10) axes.plot(x, x**2) axes.plot(x, x**3) app = QApplication(sys.argv) win = ApplicationWindow() win.show() sys.exit(app.exec_())
def __init__(self, *args): QApplication.__init__(self, *args)