def add_menu_contents(self): ## Load pacing file self.loadPacingAction = QtGui.QAction('&Load Pacing GEMS .mat', self) self.loadPacingAction.setStatusTip('') self.menu.addAction(self.loadPacingAction) ## Load normal file self.loadNormalAction = QtGui.QAction('&Load Normal GEMS .mat', self) self.loadNormalAction.setStatusTip('') self.menu.addAction(self.loadNormalAction) ## Save as gems file self.saveAsAction = QtGui.QAction('&Save as GEMS .mat', self) self.saveAsAction.setStatusTip('Save data with filename.') self.menu.addAction(self.saveAsAction) ## Save (update existing file) self.saveAction = QtGui.QAction('&Save', self) self.saveAction.setShortcut('Ctrl+S') self.saveAction.setStatusTip('Overwrite currently loaded file.') self.menu.addAction(self.saveAction) ## Exit self.quitAction = QtGui.QAction('Close', self) self.quitAction.setStatusTip('Quit the program') self.quitAction.setShortcut('Ctrl+Q') self.menu.addAction(self.quitAction)
def menu_exec(self, pos): instances = [] # hold on to QT objects menu = QtGui.QMenu() menu.setToolTipsVisible(True) submenus = {} if self._pair is not None: plugins = self._cmdp['Plugins/#registered'] for name in plugins.range_tools.keys(): m, subm = menu, submenus name_parts = name.split('/') while len(name_parts) > 1: name_part = name_parts.pop(0) if name_part not in subm: subm[name_part] = [m.addMenu(name_part), {}] m, subm = subm[name_part] else: m, subm = subm[name_part] t = QtGui.QAction(name_parts[0], self) t.triggered.connect(self._range_tool_factory(name)) m.addAction(t) instances.append(t) marker_remove = QtGui.QAction('&Remove', self) marker_remove.triggered.connect(self._remove) menu.addAction(marker_remove) menu.exec_(pos)
def createActions(self): self.newAct = QtGui.QAction("& New", self.main, shortcut="Ctrl+N", statusTip="New the application", triggered=self.new) self.connectAct = QtGui.QAction("& Connect", self.main, shortcut="Ctrl+C", statusTip="Connect the application", triggered=self.connect) self.quitAct = QtGui.QAction("& Quit", self.main, shortcut="Ctrl+Q", statusTip="Quit the application", triggered=self.close) self.settingAct = QtGui.QAction("& Setting", self.main, shortcut="Ctrl+S", statusTip="Setting the application", triggered=self.setting) self.aboutAct = QtGui.QAction( "&About", self.main, statusTip="Show the application's About box", triggered=self.about)
def init(self): self.resize(1024, 1024) self.setWindowTitle('Mandelbrot') self.window = FractalWidget() # self.keyPressEvent = self.window.keyPressEvent self.setCentralWidget(self.window) # self.statusBar() # Menubar entries closeApp = QtGui.QAction(QtGui.QIcon('quit.png'), 'Quit', self) closeApp.setShortcut('Escape') # closeApp.setStatusTip('Exit application') closeApp.triggered.connect(pg.exit) setIter = QtGui.QAction(QtGui.QIcon('quit.png'), 'Iterations', self) setIter.setShortcut('I') # setIter.setStatusTip('Set number of iterations to calculate') setIter.triggered.connect(self.window.setMaxIt) setCol = QtGui.QAction(QtGui.QIcon('quit.png'), 'Colors', self) setCol.setShortcut('C') # setCol.setStatusTip('Set number of colors') setCol.triggered.connect(self.window.setCol) # Add menubar # menubar = self.menuBar() # fileMenu = menubar.addMenu('&File') # fileMenu.addAction(setIter) # fileMenu.addAction(setCol) # fileMenu.addAction(closeApp) self.addAction(setIter) self.addAction(setCol) self.addAction(closeApp)
def fileMenu(self, parent): menu = parent.addMenu('&File') icon = QtGui.QIcon.fromTheme('camera-photo') action = QtGui.QAction(icon, 'Save &Photo', self) action.setStatusTip('Save a snapshot') action.triggered.connect(self.savePhoto) menu.addAction(action) icon = QtGui.QIcon.fromTheme('camera-photo') action = QtGui.QAction(icon, 'Save Photo As ...', self) action.setStatusTip('Save a snapshot') action.triggered.connect(lambda: self.savePhoto(True)) menu.addAction(action) icon = QtGui.QIcon.fromTheme('document-save') action = QtGui.QAction(icon, '&Save Settings', self) action.setStatusTip('Save current settings') action.triggered.connect(self.saveSettings) menu.addAction(action) icon = QtGui.QIcon.fromTheme('application-exit') action = QtGui.QAction(icon, '&Exit', self) action.setShortcut('Ctrl-Q') action.setStatusTip('Exit PyFab') action.triggered.connect(self.close) menu.addAction(action)
def __init__(self, parent=None): pg.GraphicsView.__init__(self, parent=None) self.name = None self.id = None self.wavelength = None self.ydata = None self.starting_point = 0 self.menu = QtGui.QMenuBar(self) self.main_plot = pg.PlotWidget() self.main_plot.setLabel('bottom', 'Wavelength', units='nm') self.layout = QtGui.QVBoxLayout(self) self.layout.addWidget(self.main_plot) self.two_way = False # If the laser scan is two-ways self.file_menu = self.menu.addMenu("&File") self.save_action = QtGui.QAction("&Save", self) self.save_action.setShortcut('Ctrl+O') self.save_action.triggered.connect(self.choose_dir) self.file_menu.addAction(self.save_action) self.quick_save_action = QtGui.QAction("&Quick save", self) self.quick_save_action.triggered.connect(self.save) self.quick_save_action.setShortcut('Ctrl+S') self.file_menu.addAction(self.quick_save_action) self.directory = None
def initUI(self): """Setup the main UI, status bar, and keyboard shortcuts""" self.setGeometry(300, 300, 1200, 800) # Initialize the plotting window self.graphwin = pg.GraphicsWindow(title="Current Sense Analysis") self.graphwin.setWindowTitle('Current vs time') self.setCentralWidget(self.graphwin) # Add button and shortcut to open files openFile = QtGui.QAction(QtGui.QIcon('open.png'), 'Open File', self) openFile.setShortcut('Ctrl+O') openFile.setStatusTip('Open new File') openFile.triggered.connect(self.openFile) # Add button and shortcut to open folders openFolder = QtGui.QAction(QtGui.QIcon('open.png'), 'Open Folder', self) openFolder.setStatusTip('Open Folder') openFolder.triggered.connect(self.openFolder) # Add button and shortcut to export plots exportPlot = QtGui.QAction(QtGui.QIcon('exit24.png'), 'Export', self) exportPlot.setShortcut('Ctrl+P') exportPlot.setStatusTip('Export Plot') exportPlot.triggered.connect(self.exportPlot) # Add button and shortcut to quit the program exitAction = QtGui.QAction(QtGui.QIcon('exit24.png'), 'Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.setStatusTip('Exit application') exitAction.triggered.connect(self.close) # Add button and shortcut to quit the program exportTableAction = QtGui.QAction(QtGui.QIcon('exit24.png'), 'Export Table', self) exportTableAction.setShortcut('Ctrl+E') exportTableAction.setStatusTip('Export Table as CSV') exportTableAction.triggered.connect(self.exportCSV) # Create a status bar self.statusBar() # Create a menu bar menubar = self.menuBar() # Create File menu menuFile = menubar.addMenu('File') menuFile.addAction(openFile) menuFile.addAction(openFolder) menuFile.addAction(exitAction) # Create the Export menu menuExport = menubar.addMenu('Export') menuExport.addAction(exportPlot) menuExport.addAction(exportTableAction) self.setWindowTitle('Data Analysis') self.layoutStatistics() self.show()
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent=None) self.resize(450, 450) self.name = None self.id = None self.wavelength = None self.y_axis = None self.data = None self.pos = [0, 0] self.accuracy = [1, 1] self.starting_point = 0 self.y_pos = 0 self.menu = QtGui.QMenuBar(self) self.main_plot = None self.layout = QtGui.QHBoxLayout(self) self.two_way = False # If the laser scan is two-ways self.average = False # Plot the average self.difference = False # Plot the difference self.file_menu = self.menu.addMenu("&File") self.save_action = QtGui.QAction("&Save", self) self.save_action.setShortcut('Ctrl+O') self.save_action.triggered.connect(self.choose_dir) self.file_menu.addAction(self.save_action) self.quick_save_action = QtGui.QAction("&Quick save", self) self.quick_save_action.triggered.connect(self.save) self.quick_save_action.setShortcut('Ctrl+S') self.file_menu.addAction(self.quick_save_action) self.directory = None
def getContextMenus(self, event=None): if self.menu is None: self.menu = QtGui.QMenu() self.menu.setTitle(self.name+ " options..") green = QtGui.QAction("Turn green", self.menu) green.triggered.connect(self.setGreen) self.menu.addAction(green) self.menu.green = green blue = QtGui.QAction("Turn blue", self.menu) blue.triggered.connect(self.setBlue) self.menu.addAction(blue) self.menu.green = blue alpha = QtGui.QWidgetAction(self.menu) alphaSlider = QtGui.QSlider() alphaSlider.setOrientation(QtCore.Qt.Horizontal) alphaSlider.setMaximum(255) alphaSlider.setValue(255) alphaSlider.valueChanged.connect(self.setAlpha) alpha.setDefaultWidget(alphaSlider) self.menu.addAction(alpha) self.menu.alpha = alpha self.menu.alphaSlider = alphaSlider return self.menu
def openright(self): popMenu = QtGui.QMenu() if (window.play_button.text() == "Stop"): window.playBtn() popMenu.addAction( QtGui.QAction("W", self, enabled=True, triggered=window.X0)) popMenu.addAction( QtGui.QAction("M", self, enabled=True, triggered=window.M)) popMenu.addAction( QtGui.QAction("K", self, enabled=True, triggered=window.K)) popMenu.addAction( QtGui.QAction("D", self, enabled=True, triggered=window.D)) popMenu.addAction( QtGui.QAction("S", self, enabled=True, triggered=window.S)) popMenu.addAction(QtGui.QAction("----------", self, enabled=True)) popMenu.addAction( QtGui.QAction("Set Line 1", self, enabled=True, triggered=window.setLine1)) popMenu.addAction( QtGui.QAction("Set Line 2", self, enabled=True, triggered=window.setLine2)) popMenu.addAction(QtGui.QAction("----------", self, enabled=False)) popMenu.addAction( QtGui.QAction("Erese", self, enabled=True, triggered=window.Erese)) popMenu.exec_(QtGui.QCursor.pos())
def __init__(self, window, parent): super(End_Dialog, self).__init__(parent) self.window = window self.new = False # layout = QtGui.QHBoxLayout() self.myQMenuBar = self.menuBar() exitMenu = self.myQMenuBar.addMenu('File') exitAction = QtGui.QAction('Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.setShortcut('Ctrl+W') exitAction.triggered.connect(self.exit) exitMenu.addAction(exitAction) newWindowAction = QtGui.QAction(QtGui.QIcon.fromTheme('new'), 'New Window', self) newWindowAction.setShortcut('Ctrl+N') newWindowAction.setStatusTip('New Window') newWindowAction.triggered.connect(self.newWindow) exitMenu.addAction(newWindowAction) self.centralWidget = QtGui.QWidget() layout = QtGui.QFormLayout() self.green_weight_lbl = QtGui.QLabel("Green Weight ") self.green_weight_fld = QtGui.QLineEdit() layout.addRow(self.green_weight_lbl, self.green_weight_fld) self.roasted_weight_lbl = QtGui.QLabel("Roasted Weight") self.roasted_weight_fld = QtGui.QLineEdit() layout.addRow(self.roasted_weight_lbl, self.roasted_weight_fld) self.comments = QtGui.QLabel("Comments") self.percentage_loss = QtGui.QLabel() layout.addRow(QtGui.QLabel(" "), self.percentage_loss) self.le2 = QtGui.QLineEdit() layout.addRow(self.comments, self.le2) self.xit = QtGui.QPushButton("Confirm and Exit") layout.addRow(self.xit) self.xit.clicked.connect(self.confirm) self.roasted_weight_fld.textChanged.connect(self.updateLoss) self.green_weight_fld.textChanged.connect(self.updateLoss) self.centralWidget.setLayout(layout) self.setCentralWidget(self.centralWidget) self.setWindowTitle("Roast End") # self.showMaximized() self._tempFile = self.window.directory + '/Temp.csv' self.export_tempFile = open(self._tempFile, 'a') self.temp_writer = csv.writer(self.export_tempFile, dialect='excel')
def setupUI(self): self.layout = pg.LayoutWidget(self) self.setCentralWidget(self.layout) self.dock_area1 = DockArea(self) self.dock_area2 = DockArea(self) self.dock_area3 = DockArea(self) self.layout.addWidget(self.dock_area1) self.layout.addWidget(self.dock_area2) self.layout.addWidget(self.dock_area3) self.resize(1200, 621) # Set menubar & whole widget appearance self.myMenubar = QtGui.QMenuBar(self) self.myMenubar.setGeometry(0, 0, 40, 21) self.myMenubar.setObjectName("MenuBar") fileMenu = self.myMenubar.addMenu('File') add_Continuous_ChannelAction = QtGui.QAction('Add a Continous Channel', self) fileMenu.addAction(add_Continuous_ChannelAction) add_Continuous_ChannelAction.triggered.connect( self.Add_Continuous_Channel) add_Raster_ChannelAction = QtGui.QAction('Add a Raster Channel', self) fileMenu.addAction(add_Raster_ChannelAction) add_Raster_ChannelAction.triggered.connect(self.Add_Raster_Channel) self.setWindowTitle('Neuroport DBS') self.statusBar().showMessage('Ready...') #TODO: Create NUNITS pens self.mypens = [pg.mkPen(width=0, color='y')] #self.mypens[0] = pg.mkPen(color='y') # mybrush = pg.mkBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue), style=QtCore.Qt.VerPattern)) self.mybrush = None self.painter = QtGui.QPainter() #self.painter.setPen() #poly = QtGui.QPolygonF([QtCore.QPoint(0, 0), QtCore.QPoint(0, 1)]) self.ticks = QtGui.QPainterPath() #self.ticks.addPolygon(poly) self.ticks.moveTo(0.0, 0.0) self.ticks.lineTo(0.0, 1.0) self.ticks.closeSubpath() #self.line = QtCore.QLineF(0,0,0,1) #self.painter.fillPath(self.ticks, QColor=(255,0,0)) self.spk_buffer = np.empty((0, 0)) self.raw_buffer = np.empty((0, 0)) self.raster_buffer = [] self.dock_info = [] self.my_rasters = [] # A list of the GraphItems for plotting rasters. self.continuous_counter = 0 self.raster_counter = 0
def buildMenu(self): self.menu = QtGui.QMenu() self.normAction = QtGui.QAction("Normalization", self.menu) self.normAction.setCheckable(True) self.normAction.toggled.connect(self.normToggled) self.menu.addAction(self.normAction) self.exportAction = QtGui.QAction("Export", self.menu) self.exportAction.triggered.connect(self.exportClicked) self.menu.addAction(self.exportAction)
def _make_base_actions(self): self.dockMenu.addAction( QtGui.QAction("Re&name Dock", self, triggered=lambda: self._rename())) self.dockMenu.addAction( QtGui.QAction("&Float Dock", self, triggered=self.float)) self.dockMenu.addAction( QtGui.QAction("&Paste to", self, triggered=self.paste))
def getMenu(self, event): if self.menu is None: self.menu = QMenuCustom() self.viewAll = QtGui.QAction("View All", self.menu) self.exportImage = QtGui.QAction("Export image", self.menu) self.viewAll.triggered[()].connect(self.autoRange) self.exportImage.triggered[()].connect(self.export) self.menu.addAction(self.viewAll) self.menu.addAction(self.exportImage) return self.menu
def set_file_actions(m): openAct = QtGui.QAction("Open project", m) saveAct = QtGui.QAction("Save project", m) saveasAct = QtGui.QAction("Save Project as", m) openAct.triggered.connect(configs.load_config) saveAct.triggered.connect(configs.save_config) saveasAct.triggered.connect(configs.save_config_as) m.addAction(openAct) m.addAction(saveAct) m.addAction(saveasAct)
def __init__(self, view): QtGui.QMenu.__init__(self) self.view = view self.setTitle("ViewBox options") self.add_red_roi = QtGui.QAction('Add Red ROI', self) self.addAction(self.add_red_roi) self.add_red_roi.triggered.connect(self.on_add_red_roi) self.add_green_roi = QtGui.QAction('Add Green ROI', self) self.addAction(self.add_green_roi) self.add_green_roi.triggered.connect(self.on_add_green_roi)
def menu_exec(self, pos): menu = QtGui.QMenu() menu.setToolTipsVisible(True) if self._pair is not None: export_data = QtGui.QAction('&Export data', self) export_data.triggered.connect(self.export_data) menu.addAction(export_data) marker_remove = QtGui.QAction('&Remove', self) marker_remove.triggered.connect( lambda: self.sigRemoveRequest.emit(self)) menu.addAction(marker_remove) menu.exec_(pos)
def home(self): startRec = QtGui.QAction(QtGui.QIcon('greenlight.png'), "Start Recording", self) startRec.triggered.connect(self.startRecording) stopRec = QtGui.QAction(QtGui.QIcon('redlight.png'), "Stop Recording", self) stopRec.triggered.connect(self.stopRecording) self.toolBar = self.addToolBar("ToolBar") self.toolBar.addAction(startRec) self.toolBar.addAction(stopRec) self.show()
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._remove_unwanted_actions() # Define own menu entries self.mpl_export = QtGui.QAction('MPL export', self) self.addAction(self.mpl_export) self.transpose = QtGui.QAction('Transpose', self) self.addAction(self.transpose) self.toggle_cursor = QtGui.QAction('Show cursor', self, checkable=True) self.addAction(self.toggle_cursor)
def clear_data(self): self.central_widget.layout().removeWidget(self.main_plot) self.main_plot.deleteLater() self.main_plot = pg.PlotWidget() self.main_plot.setLabel('bottom', 'Wavelength (nm)', **{ 'color': '#FFF', 'font-size': '14pt' }) self.central_widget.layout().addWidget(self.main_plot) self.ydata = None self.wavelength = None self.wavelength2 = None self.starting_point = 0 self.two_way = False self.p1 = None self.p2 = None self.p = None self.show_label = False self.do_average_plot = False self.lorentz_fitting = False self.x_mouse = 0 self.y_mouse = 0 if self.params is not None: self.params.deleteLater() if self.params1 is not None: self.params1.deleteLater() if self.params2 is not None: self.params2.deleteLater() self.lorentz_plot1 = None self.lorentz_plot2 = None self.lorentz_plot = None self.params = None self.params1 = None self.params2 = None self.label = pg.TextItem(border='w', fill=(0, 0, 255)) self.plot_average = QtGui.QAction("Plot Average", self.main_plot.plotItem.vb.menu) self.plot_average.triggered.connect(self.make_average) self.main_plot.plotItem.vb.menu.addAction(self.plot_average) self.fit_lorentzian_action = QtGui.QAction( "Fit a Lorentzian", self.main_plot.plotItem.vb.menu) self.fit_lorentzian_action.triggered.connect(self.fit_lorentzian) self.main_plot.plotItem.vb.menu.addAction(self.fit_lorentzian_action) self.hide_lorentzian_action = QtGui.QAction( "Hide Lorentzian", self.main_plot.plotItem.vb.menu) self.hide_lorentzian_action.triggered.connect(self.hide_lorentzian) self.main_plot.plotItem.vb.menu.addAction(self.hide_lorentzian_action)
def calibrationMenu(self, parent): menu = parent.addMenu('&Calibration') action = QtGui.QAction('Calibrate rc', self) action.setStatusTip('Find location of optical axis in field of view') action.triggered.connect( lambda: self.instrument.tasks.registerTask('calibrate_rc')) menu.addAction(action) self.stageMenu(menu) action = QtGui.QAction('Aberrations', self) action.setStatusTip('NOT IMPLEMENTED YET') action.triggered.connect( lambda: self.instrument.tasks.registerTask('calibrate_haar')) menu.addAction(action)
def __init__(self, *args): QtGui.QWidget.__init__(self, *args) self.plot = pg.PlotWidget() self.curveColors = [ QtGui.QColor("#FF0000"), #Red QtGui.QColor("#0000FF"), #Blue QtGui.QColor("#006400"), #DarkGreen QtGui.QColor("#9932CC"), #DarkOrchid QtGui.QColor("#FFA500"), #Orange QtGui.QColor("#DC143C"), #Crimson QtGui.QColor("#00008B"), #DarkBlue QtGui.QColor("#556B2F"), #DarkOLiveGreen QtGui.QColor("#FF00FF"), #Magenta QtGui.QColor("#FFD700"), #Gold ] self.dictCurves = {} # {"name" : {'curve': , 'x': , 'y':, 'color', 'show'}, ... } self.colorIndex = 0 self.plot.setLabel('bottom', 'Position/Energy') self.menu = self.plot.getMenu() self.autoScale = QtGui.QAction("Auto Scale", self.menu) self.autoScale.triggered.connect(self.setAutoScale) self.menu.addAction(self.autoScale) self.buttons = {} self.buttonsLayout = QtGui.QHBoxLayout() self.layout = QtGui.QVBoxLayout() self.layout.addLayout(self.buttonsLayout) self.layout.addWidget(self.plot) self.setLayout(self.layout)
def mainmenubar(self): self.menu = self.menuBar() self.file = self.menu.addMenu('F&ile') SaveData = QtGui.QAction('S&ave Data', self) SaveData.setShortcut('Ctrl+S') SaveData.setStatusTip('Save Data') SaveData.triggered.connect(self.onSaveData) Destroy = QtGui.QAction('E&xit', self) Destroy.setShortcut('Ctrl+X') Destroy.setStatusTip('Finish Application') Destroy.triggered.connect(self.close) self.file.addAction(SaveData) self.file.addAction(Destroy)
def initLeftBar(self): self.leftbar = QtGui.QToolBar(self) self.addToolBar(QtCore.Qt.LeftToolBarArea, self.leftbar) showStockAction = QtGui.QAction("Stock", self) showStockAction.triggered.connect(self.showStockWidget) self.leftbar.addAction(showStockAction)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # General layout of the widget to hold an image and a histogram self.layout = QtGui.QHBoxLayout(self) # Settings for the image self.viewport = GraphicsLayoutWidget() self.view = self.viewport.addViewBox(lockAspect=False, enableMenu=True) self.autoScale = QtGui.QAction("Auto Range", self.view.menu) self.autoScale.triggered.connect(self.doAutoScale) self.view.menu.addAction(self.autoScale) self.img = pg.ImageItem() self.view.addItem(self.img) self.imv = pg.ImageView(view=self.view, imageItem=self.img) # Add everything to the widget self.layout.addWidget(self.imv) self.setLayout(self.layout) self.showCrosshair = False self.showCrossCut = False
def __init__(self): super().__init__() self.setWindowTitle('BrittleStar Animation') self.setWindowIcon(QtGui.QIcon('icon/icon.png')) self.statusBar().showMessage('Ready') #WIDGETS self.central_widget=CentralWidget() self.setCentralWidget(self.central_widget) #Data self.directory='' # Create menu bar and add action menuBar = self.menuBar() fileMenu = menuBar.addMenu('&File') save3DplotAction = QtGui.QAction(QtGui.QIcon('open.png'), '&Save 3D plot', self) save3DplotAction.setShortcut('Ctrl+S') save3DplotAction.setStatusTip('Save 3D Plot') save3DplotAction.triggered.connect(self.save_3Dplot) fileMenu.addAction(save3DplotAction)
def __init__(self, x=None, y1=None, y2=None, set_range=None): super(MyPW, self).__init__() self.plotItem.autoBtn = ButtonItem.ButtonItem( pixmaps.getPixmap('default'), 14, self.plotItem) self._rescale = lambda: None # self.plotItem.autoBtn.clicked.connect(self._rescale) self.plotItem.vb.menu.clear() self.vmenu = QtGui.QMenu() defaultview = QtGui.QAction("Default View", self.vmenu) defaultview.triggered.connect(set_range) self.vmenu.addAction(defaultview) self.plotItem.ctrlMenu = [defaultview] # mouse tracking label self.x = x self.y1 = y1 self.y2 = y2 # delete default view, get rid of Export self.plotItem.hideButtons() self.plotItem.scene().contextMenu = None # get rid of 'Export' self.proxy = pg.SignalProxy(self.plotItem.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
def __init__(self, parent, gui_name, is_experiment=False): super(QtGui.QDialog, self).__init__(parent) self.parent = parent self.gui_name = gui_name self.generator_data = self.get_custom_gui_data(is_experiment) if self.generator_data: self.parent.print_to_log( f'\nLoading "{gui_name}" custom variable dialog') self.setWindowTitle("Set Variables") self.layout = QtGui.QVBoxLayout(self) toolBar = QtGui.QToolBar() toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) toolBar.setIconSize(QtCore.QSize(15, 15)) self.layout.addWidget(toolBar) self.edit_action = QtGui.QAction(QtGui.QIcon("gui/icons/edit.svg"), "&edit", self) self.edit_action.setEnabled(True) if not is_experiment: toolBar.addAction(self.edit_action) self.edit_action.triggered.connect(self.edit) self.variables_grid = Custom_variables_grid( self, parent.board, self.generator_data) self.layout.addWidget(self.variables_grid) self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) self.close_shortcut = QtGui.QShortcut(QtGui.QKeySequence("Ctrl+W"), self) self.close_shortcut.activated.connect(self.close) self.using_custom_gui = True else: self.using_custom_gui = False
def __init__(self, node, brush=None): super().__init__() self.pen = fn.mkPen(0, 0, 0) self.selectPen = fn.mkPen(200, 200, 200, width=2) if brush: self.brush = brush else: self.brush = fn.mkBrush(255, 255, 255, 255) self.hoverBrush = fn.mkBrush(200, 200, 200, 200) self.selectBrush = fn.mkBrush(200, 200, 255, 200) self.hovered = False self.node = node flags = self.ItemIsMovable | self.ItemIsSelectable | self.ItemSendsGeometryChanges self.setFlags(flags) self.bounds = QtCore.QRectF(0, 0, 100, 100) self.nameItem = QtGui.QGraphicsTextItem(self.node.name(), self) self.nameItem.setDefaultTextColor(QtGui.QColor(50, 50, 50)) self.nameItem.moveBy( self.bounds.width() / 2. - self.nameItem.boundingRect().width() / 2., 0) self.updateTerminals() self.menu = None self.add_condition = None self.enabled = QtGui.QAction("Enabled", self.menu, checkable=True, checked=True) self.buildMenu()