def __init__(self, qt_parent=None, designMode=False): Qt.QWidget.__init__(self, qt_parent) self._history = CommandLineHistory() l = Qt.QHBoxLayout() self.setLayout(l) l.setContentsMargins(0, 0, 0, 0) l.setSpacing(0) self._detailsButton = Qt.QToolButton() self._detailsButton.setText("...") self._cmdLine = Qt.QComboBox() self._cmdLine.setEditable(True) self._applyButton = Qt.QToolButton() self._applyButton.setIcon(getIcon(":/actions/media_playback_start.svg")) self._stopButton = Qt.QToolButton() self._stopButton.setIcon(getIcon(":/actions/media_playback_stop.svg")) self._clearButton = Qt.QToolButton() self._clearButton.setIcon(getThemeIcon("edit-clear")) l.addWidget(self._detailsButton, 0) l.addWidget(self._cmdLine, 1) l.addWidget(self._applyButton, 0) l.addWidget(self._stopButton, 0) l.addWidget(self._clearButton, 0)
def __init__(self, parent=None): Qt.QListView.__init__(self, parent) self.setSelectionMode(Qt.QListView.ExtendedSelection) self.removeAction = Qt.QAction(getIcon(":/actions/list-remove.svg"), "Remove from favourites", self) self.removeAction.triggered.connect(self.removeMacros) self.removeAction.setToolTip( "Clicking this button will remove selected macros " "from favourites.") self.removeAllAction = Qt.QAction(getIcon(":/places/user-trash.svg"), "Remove all from favourites", self) self.removeAllAction.triggered.connect(self.removeAllMacros) self.removeAllAction.setToolTip( "Clicking this button will remove all macros from favourites.") self.moveUpAction = Qt.QAction(getIcon(":/actions/go-up.svg"), "Move up", self) self.moveUpAction.triggered.connect(self.upMacro) self.moveUpAction.setToolTip( "Clicking this button will move the macro up " "in the favourites hierarchy.") self.moveDownAction = Qt.QAction(getIcon(":/actions/go-down.svg"), "Move down", self) self.moveDownAction.triggered.connect(self.downMacro) self.moveDownAction.setToolTip( "Clicking this button will move the macro down " "in the favourites hierarchy.") self.disableActions()
def __init__(self, qt_parent=None, designMode=False): Qt.QWidget.__init__(self, qt_parent) self._history = CommandLineHistory() l = Qt.QHBoxLayout() self.setLayout(l) l.setContentsMargins(0, 0, 0, 0) l.setSpacing(0) self._detailsButton = Qt.QToolButton() self._detailsButton.setText("...") self._cmdLine = Qt.QComboBox() self._cmdLine.setEditable(True) self._applyButton = Qt.QToolButton() self._applyButton.setIcon( getIcon(":/actions/media_playback_start.svg")) self._stopButton = Qt.QToolButton() self._stopButton.setIcon(getIcon(":/actions/media_playback_stop.svg")) self._clearButton = Qt.QToolButton() self._clearButton.setIcon(getThemeIcon("edit-clear")) l.addWidget(self._detailsButton, 0) l.addWidget(self._cmdLine, 1) l.addWidget(self._applyButton, 0) l.addWidget(self._stopButton, 0) l.addWidget(self._clearButton, 0)
def updateState(self, state): btn_start_stop = self.btn_start_stop if self.btn_start_stop_clicked_slot is not None: btn_start_stop.clicked.disconnect(self.btn_start_stop_clicked_slot) if state == tango.DevState.MOVING: btn_start_stop.setToolTip("Stop the channel") btn_start_stop.setIcon( getIcon(":/actions/media_playback_stop.svg")) self.btn_start_stop_clicked_slot = self.abort else: btn_start_stop.setToolTip("Start the channel") btn_start_stop.setIcon( getIcon(":/actions/media_playback_start.svg")) self.btn_start_stop_clicked_slot = self.start btn_start_stop.clicked.connect(self.btn_start_stop_clicked_slot)
def processSrc(self, src): '''processes the src and sets the values of display, icon and ok attributes''' if src is None: self.display, self.icon, self.ok = '(Use indices)', Qt.QIcon( ), True return src = str(src).strip() # empty if src == '': self.display, self.icon, self.ok = '(Use indices)', Qt.QIcon( ), True return # for formulas if src.startswith('='): #@todo: evaluate/validate the expression self.display, self.icon, self.ok = src[1:].strip(), getThemeIcon( 'accessories-calculator'), True return # for tango attributes try: attr = taurus.Attribute(src) dev = attr.getParentObj() except TaurusException: self.display, self.icon, self.ok = src, getThemeIcon( 'dialog-warning'), False return if not dev.isValidDev(): self.display, self.icon, self.ok = src, getThemeIcon( 'network-error'), False return self.display, self.icon, self.ok = attr.getSimpleName(), getIcon( ':/taurus.png'), True
def __init__(self, manager, toolbar_id=DefaultToolbarID): super(SettingsTool, self).__init__(manager, "Camera Settings...", getIcon(":/categories/preferences-system.svg"), toolbar_id=toolbar_id) self.settingsDialog = CameraSettingsDialog(manager)
def __init__(self, perspective, view=None, parent=None, designMode=False): BaseToolBar.__init__(self, name="Taurus refresh toolbar", view=view, parent=parent, designMode=designMode) self._perspective = perspective view = self.viewWidget() b = self._perspective_button = Qt.QToolButton(self) b.setToolTip("Perspective selection") b.setPopupMode(Qt.QToolButton.InstantPopup) b.setToolButtonStyle(Qt.Qt.ToolButtonTextBesideIcon) menu = Qt.QMenu("Perspective", b) b.setMenu(menu) af = ActionFactory() for persp, persp_data in view.KnownPerspectives.items(): label = persp_data["label"] icon = getIcon(persp_data["icon"]) tip = persp_data["tooltip"] action = af.createAction(self, label, icon=icon, tip=tip, triggered=self.onSwitchPerspective) action.perspective = persp menu.addAction(action) if persp == perspective: b.setDefaultAction(action) self._perspectiveAction = self.addWidget(b)
def __init__(self, manager): super(TimeAxisTool, self).__init__(manager, "Time Scale", icon=getIcon(":/status/awaiting.svg"), tip=None, toolbar_id=None) self.action.setEnabled(True)
def update_button(self, lock_info=None): if lock_info is None: lock_info = self.get_lock_info() status = lock_info.status self.setIcon(getIcon(self._LOCK_MAP[status])) self.setDown(status in (LockStatus.Locked, LockStatus.LockedMaster)) self.setToolTip(lock_info.status_msg) self.update() return lock_info
def __init__(self, manager, toolbar_id=DefaultToolbarID, singleModel=False): super(TaurusModelChooserTool, self).__init__(manager, "Change Taurus Model...", getIcon(":/taurus.png"), toolbar_id=toolbar_id) self.singleModel = singleModel
def __init__(self, parent=None): Qt.QListView.__init__(self, parent) self.setSelectionMode(Qt.QListView.SingleSelection) self.removeAllAction = Qt.QAction(getIcon(":/places/user-trash.svg"), "Remove all from history", self) self.removeAllAction.triggered.connect(self.removeAllMacros) self.removeAllAction.setToolTip( "Clicking this button will remove all macros from history.") self.removeAllAction.setEnabled(False)
def __retriveMacroServersFromDB(self): ms_stateIcons = [] db = taurus.Database() macroServerList = db.getValueObj().get_device_name('*', 'MacroServer') for macroServer in macroServerList: #state = Device(macroServer).getState() state = None try: state = PyTango.DeviceProxy(macroServer).state() except: pass icon = None if state == PyTango.DevState.ON: icon = getIcon(":/leds/images24/ledgreen.png") elif state == PyTango.DevState.FAULT: icon = getIcon(":/leds/images24/ledred.png") elif state == None: icon = getIcon(":/leds/images24/ledredoff.png") ms_stateIcons.append((macroServer, icon)) return ms_stateIcons
def __init__(self, parent=None, door=None, plotsButton=True): Qt.QWidget.__init__(self, parent) TaurusBaseWidget.__init__(self, 'ExpDescriptionEditor') self.loadUi() self.ui.buttonBox.setStandardButtons(Qt.QDialogButtonBox.Reset | Qt.QDialogButtonBox.Apply) newperspectivesDict = copy.deepcopy(self.ui.sardanaElementTree.KnownPerspectives) #newperspectivesDict[self.ui.sardanaElementTree.DftPerspective]['model'] = [SardanaAcquirableProxyModel, SardanaElementPlainModel] newperspectivesDict[self.ui.sardanaElementTree.DftPerspective]['model'][0] = SardanaAcquirableProxyModel self.ui.sardanaElementTree.KnownPerspectives = newperspectivesDict #assign a copy because if just a key of this class memberwas modified, all instances of this class would be affected self.ui.sardanaElementTree._setPerspective(self.ui.sardanaElementTree.DftPerspective) self._localConfig = None self._originalConfiguration = None self._dirty = False self._dirtyMntGrps = set() self.connect(self.ui.activeMntGrpCB, Qt.SIGNAL('activated (QString)'), self.changeActiveMntGrp) self.connect(self.ui.createMntGrpBT, Qt.SIGNAL('clicked ()'), self.createMntGrp) self.connect(self.ui.deleteMntGrpBT, Qt.SIGNAL('clicked ()'), self.deleteMntGrp) self.connect(self.ui.compressionCB, Qt.SIGNAL('currentIndexChanged (int)'), self.onCompressionCBChanged) self.connect(self.ui.pathLE, Qt.SIGNAL('textEdited (QString)'), self.onPathLEEdited) self.connect(self.ui.filenameLE, Qt.SIGNAL('textEdited (QString)'), self.onFilenameLEEdited) self.connect(self.ui.channelEditor.getQModel(), Qt.SIGNAL('dataChanged (QModelIndex, QModelIndex)'), self._updateButtonBox) self.connect(self.ui.channelEditor.getQModel(), Qt.SIGNAL('modelReset ()'), self._updateButtonBox) preScanList = self.ui.preScanList self.connect(preScanList, Qt.SIGNAL('dataChanged'), self.onPreScanSnapshotChanged) #TODO: For Taurus 4 compatibility if hasattr(preScanList, "dataChangedSignal"): preScanList.dataChangedSignal.connect(self.onPreScanSnapshotChanged) self.connect(self.ui.choosePathBT, Qt.SIGNAL('clicked ()'), self.onChooseScanDirButtonClicked) self.__plotManager = None icon = resource.getIcon(":/actions/view.svg") self.togglePlotsAction = Qt.QAction(icon, "Show/Hide plots", self) self.togglePlotsAction.setCheckable(True) self.togglePlotsAction.setChecked(False) self.togglePlotsAction.setEnabled(plotsButton) self.addAction(self.togglePlotsAction) self.connect(self.togglePlotsAction, Qt.SIGNAL("toggled(bool)"), self.onPlotsButtonToggled) self.ui.plotsButton.setDefaultAction(self.togglePlotsAction) if door is not None: self.setModel(door) self.connect(self.ui.buttonBox, Qt.SIGNAL("clicked(QAbstractButton *)"), self.onDialogButtonClicked) #Taurus Configuration properties and delegates self.registerConfigDelegate(self.ui.channelEditor)
def __init__(self, view=None, parent=None, designMode=False): BaseToolBar.__init__(self, name="Taurus selection toolbar", view=view, parent=parent, designMode=designMode) af = ActionFactory() self._expandAllAction = af.createAction( self, "Expand All", icon=getIcon(":/actions/expand.png"), tip="Expand all items", triggered=self.onExpandAll) self._collapseAllAction = af.createAction( self, "Collapse All", icon=getIcon(":/actions/collapse.png"), tip="Collapse all items", triggered=self.onCollapseAll) self._expandSelectionAction = af.createAction( self, "Expand selection", icon=getIcon(":/actions/expand-selection.png"), tip="Expand selection", triggered=self.onExpandSelection) self._collapseSelectionAction = af.createAction( self, "Collapse All", icon=getIcon(":/actions/collapse-selection.png"), tip="Collapse selection", triggered=self.onCollapseSelection) self.addAction(self._expandAllAction) self.addAction(self._collapseAllAction) self.addAction(self._expandSelectionAction) self.addAction(self._collapseSelectionAction)
def getElementTypeIcon(t): if t == ChannelView.Channel: return getIcon(":/actions/system-shutdown.svg") elif t == ChannelView.Enabled: return getIcon(":/status/true.svg") elif t == ChannelView.Output: return getThemeIcon("utilities-terminal") elif t == ChannelView.PlotType: return getIcon(":/apps/utilities-system-monitor.svg") elif t == ChannelView.PlotAxes: return getIcon(":/apps/utilities-system-monitor.svg") elif t == ChannelView.Timer: return getIcon(":/status/flag-green-clock.svg") elif t == ChannelView.Monitor: return getIcon(":/status/flag-green.svg") elif t == ChannelView.Synchronization: return getIcon(":/actions/system-shutdown.svg") elif t == ChannelView.NXPath: return getThemeIcon("document-save-as") elif t == ChannelView.Synchronizer: return getIcon(":/actions/system-shutdown.svg") return getIcon(":/tango.png")
def contextMenuEvent(self, event): # Overwrite the default taurus label behaviour menu = Qt.QMenu(self) action_tango_attributes = Qt.QAction(self) action_tango_attributes.setIcon( getIcon(":/categories/preferences-system.svg")) action_tango_attributes.setText("Tango Attributes") menu.addAction(action_tango_attributes) action_tango_attributes.triggered.connect( self.taurusValueBuddy().showTangoAttributes) cm_action = menu.addAction("Compact") cm_action.setCheckable(True) cm_action.setChecked(self.taurusValueBuddy().isCompact()) cm_action.toggled.connect(self.taurusValueBuddy().setCompact) menu.exec_(event.globalPos()) event.accept()
def __init__(self, parent=None, designMode=False): TaurusMainWindow.__init__(self, parent, designMode) self.statusBar().showMessage("") self.setModelInConfig(True) self._doorName = "" self.registerConfigProperty("doorName", "setDoorName", "doorName") self._customMacroEditorPaths = "" self.registerConfigProperty("customMacroEditorPaths", "setCustomMacroEditorPaths", "customMacroEditorPaths") self._qDoor = None self.setWindowIcon(getIcon(":/apps/preferences-system-session.svg")) toolBar = self.basicTaurusToolbar() toolBar.setIconSize(Qt.QSize(24, 24)) self.configureAction = self.createConfigureAction() toolBar.addAction(self.configureAction) self.taurusMenu.addAction(self.configureAction) self.customMacroEditorsPathsAction = self.createCustomMacroEditorPathsAction() self.taurusMenu.addAction(self.customMacroEditorsPathsAction) self.addToolBar(toolBar) self.initComponents() self.splashScreen().finish(self) self.connect(self, Qt.SIGNAL("doorChanged"), self.onDoorChanged)
def __init__(self, parent=None, designMode=False): TaurusMainWindow.__init__(self, parent, designMode) self.statusBar().showMessage("") self.setModelInConfig(True) self._doorName = "" self.registerConfigProperty("doorName", "setDoorName", "doorName") self._customMacroEditorPaths = "" self.registerConfigProperty( "customMacroEditorPaths", "setCustomMacroEditorPaths", "customMacroEditorPaths") self._qDoor = None self.setWindowIcon(getIcon(":/apps/preferences-system-session.svg")) toolBar = self.basicTaurusToolbar() toolBar.setIconSize(Qt.QSize(24, 24)) self.configureAction = self.createConfigureAction() toolBar.addAction(self.configureAction) self.taurusMenu.addAction(self.configureAction) self.customMacroEditorsPathsAction = self.createCustomMacroEditorPathsAction() self.taurusMenu.addAction(self.customMacroEditorsPathsAction) self.addToolBar(toolBar) self.initComponents() self.splashScreen().finish(self) self.doorChanged.connect(self.onDoorChanged)
def __init__(self, parent=None, items=None, designMode=False): super(TaurusModelList, self).__init__(parent) if items is None: items = [] self._model = TaurusModelModel(items) self.setModel(self._model) self.setDragDropMode(self.DragDrop) # self.setAcceptDrops(True) self.setSelectionMode(self.ExtendedSelection) self._contextMenu = Qt.QMenu(self) self.addRowAction = self._contextMenu.addAction(getThemeIcon( 'list-add'), 'Add new row', self.newRow, Qt.QKeySequence.New) self.removeSelectedAction = self._contextMenu.addAction(getThemeIcon( 'list-remove'), 'Remove Selected', self.removeSelected, Qt.QKeySequence.Delete) self.removeAllAction = self._contextMenu.addAction(getThemeIcon( 'edit-clear'), 'Clear all', self.clear, Qt.QKeySequence("Ctrl+Del")) self.moveUpAction = self._contextMenu.addAction(getThemeIcon( 'go-up'), 'Move up in the list', self._onMoveUpAction, Qt.QKeySequence("Alt+Up")) self.moveDownAction = self._contextMenu.addAction(getThemeIcon( 'go-down'), 'Move down in the list', self._onMoveDownAction, Qt.QKeySequence("Alt+Down")) self.editDisplayAction = self._contextMenu.addAction(getIcon( ':/actions/format-text-italic.svg'), 'Edit the display (leave the source)', self._onEditDisplay, Qt.QKeySequence("Alt+D")) self.addActions([self.addRowAction, self.removeSelectedAction, self.removeAllAction, self.moveUpAction, self.moveDownAction, self.editDisplayAction]) # signal connections selectionmodel = self.selectionModel() self.connect(selectionmodel, Qt.SIGNAL( "selectionChanged(QItemSelection, QItemSelection)"), self._onSelectionChanged) self.connect(self._model, Qt.SIGNAL( "dataChanged (QModelIndex, QModelIndex)"), self._onDataChanged) self.connect(self._model, Qt.SIGNAL( "rowsInserted (QModelIndex, int, int)"), self._onDataChanged) self.connect(self._model, Qt.SIGNAL( "rowsRemoved (QModelIndex, int, int)"), self._onDataChanged) self._onSelectionChanged(Qt.QItemSelection(), Qt.QItemSelection())
def __init__(self, parent=None, designMode=False, widget=None, icon=None, text=None): '''Constructor :param parent: (Qt.QWidget or None) parent of this widget :param designMode: (bool) flag for Qt designer :param widget: (Qt.QWidget) a QWidget that will be shown when clicking in the button :param icon: (Qt.QIcon) icon for the button :param text: (str) the button text (if None passed, the widget's class name is used) ''' name = self.__class__.__name__ self.call__init__wo_kw(Qt.QPushButton, parent) self.call__init__(TaurusBaseWidget, name, designMode=designMode) self._dialog = _ButtonDialog(self) if icon is None and self._icon is not None: icon = getIcon(self._icon) if icon is not None: self.setIcon(Qt.QIcon(icon)) if text is not None: self._text = text if isinstance(widget, Qt.QWidget): # we cannot be sure on recreating the same widget again self._deleteWidgetOnClose = False self.setWidget(widget) elif widget is not None: self._widgetClassName = widget self.connect(self, Qt.SIGNAL('clicked()'), self.onClicked) self.setDefault(False) self.setAutoDefault(False) # no need to listen to change events! self.insertEventFilter(eventfilters.IGNORE_CHANGE_AND_PERIODIC) self._updateText()
def icon(self, index): taurus_role = index.model().role(index.column()) if taurus_role == ChannelView.Channel: return getIcon(":/actions/system-shutdown.svg")
def main(args=[]): import widgets from taurus.qt.qtgui import resource # print os.getenv('TANGO_HOST') print '='*80 trace(' Launching Panic ...') print '='*80 opts = [a for a in args if a.startswith('--')] args = [a for a in args if not a.startswith('--')] URL = 'http://www.cells.es/Intranet/Divisions/Computing/Controls/Help/Alarms/panic' uniqueapp = Qt.QApplication([]) if '--calc' in opts: args = args or [''] form = AlarmPreview(*args) form.show() uniqueapp.exec_() return tmw = CleanMainWindow() tmw.setWindowTitle('PANIC') #str(os.getenv('TANGO_HOST')).split(':',1)[0]+' ) tmw.menuBar = Qt.QMenuBar(tmw) tmw.toolsMenu = Qt.QMenu('Tools',tmw.menuBar) tmw.fileMenu = Qt.QMenu('File',tmw.menuBar) tmw.viewMenu = Qt.QMenu('View',tmw.menuBar) tmw.helpMenu = Qt.QMenu('Help',tmw.menuBar) trace('\tlaunching AlarmGUI ... %s'%sys.argv) alarmApp = AlarmGUI(filters='|'.join(a for a in sys.argv[1:] if not a.startswith('--')),options=opts,mainwindow=tmw) tmw.setCentralWidget(alarmApp) tmw.setMenuBar(tmw.menuBar) [tmw.menuBar.addAction(a.menuAction()) for a in (tmw.fileMenu,tmw.toolsMenu,tmw.helpMenu,tmw.viewMenu)] toolbar = Qt.QToolBar(tmw) toolbar.setIconSize(Qt.QSize(20,20)) tmw.helpMenu.addAction(getThemeIcon("applications-system"),"Webpage",lambda : os.system('konqueror %s &'%URL)) tmw.toolsMenu.addAction(getThemeIcon("applications-system"),"Jive",lambda : os.system('jive &')) tmw.toolsMenu.addAction(getThemeIcon("applications-system"),"Astor",lambda : os.system('astor &')) tmw.fileMenu.addAction(resource.getIcon(":/designer/back.png"),"Export to CSV file",alarmApp.saveToFile) tmw.fileMenu.addAction(resource.getIcon(":/designer/forward.png"),"Import from CSV file",alarmApp.loadFromFile) tmw.fileMenu.addAction(resource.getIcon(":/designer/filereader.png"),"Use external editor",alarmApp.editFile) tmw.fileMenu.addAction(getThemeIcon("applications-system"),"Exit",tmw.close) tmw.viewMenu.connect(tmw.viewMenu,Qt.SIGNAL('aboutToShow()'),alarmApp.setViewMenu) from phonebook import PhoneBook alarmApp.tools['bookApp'] = WindowManager.addWindow(PhoneBook(container=tmw)) tmw.toolsMenu.addAction(getThemeIcon("x-office-address-book"), "PhoneBook", alarmApp.tools['bookApp'].show) toolbar.addAction(getThemeIcon("x-office-address-book") ,"PhoneBook",alarmApp.tools['bookApp'].show) trend_action = (resource.getIcon(":/designer/qwtplot.png"), 'Trend', lambda:WindowManager.addWindow(widgets.get_archive_trend(show=True)) ) tmw.toolsMenu.addAction(*trend_action) toolbar.addAction(*trend_action) alarmApp.tools['config'] = WindowManager.addWindow(widgets.dacWidget(container=tmw)) tmw.toolsMenu.addAction(getThemeIcon("applications-system"),"Advanced Configuration", alarmApp.tools['config'].show) toolbar.addAction(getThemeIcon("applications-system") ,"Advanced Configuration",alarmApp.tools['config'].show) toolbar.setMovable(False) toolbar.setFloatable(False) tmw.addToolBar(toolbar) if SNAP_ALLOWED: alarmApp.tools['history'] = WindowManager.addWindow(widgets.ahWidget(container=tmw)) tmw.toolsMenu.addAction(getThemeIcon("office-calendar"),"Alarm History Viewer",alarmApp.tools['history'].show) toolbar.addAction(getThemeIcon("office-calendar") ,"Alarm History Viewer",alarmApp.tools['history'].show) else: trace("Unable to load SNAP",'History Viewer Disabled!') alarm_preview_action = (getThemeIcon("accessories-calculator"),"Alarm Calculator", lambda g=alarmApp:WindowManager.addWindow(AlarmPreview.showEmptyAlarmPreview(g))) [o.addAction(*alarm_preview_action) for o in (tmw.toolsMenu,toolbar)] tmw.show() return uniqueapp #.exec_()
def __init__(self, parent=None, curvePropDict={}, showButtons=False, autoApply=False, designMode=False): # try: super(CurvesAppearanceChooser, self).__init__(parent) self.loadUi() self.autoApply = autoApply self.sStyleCB.insertItems(0, sorted(NamedSymbolStyles.values())) self.lStyleCB.insertItems(0, NamedLineStyles.values()) self.cStyleCB.insertItems(0, NamedCurveStyles.values()) self.sColorCB.addItem("") self.lColorCB.addItem("") if not showButtons: self.applyBT.hide() self.resetBT.hide() for color in NamedColors: icon = self._colorIcon(color) self.sColorCB.addItem(icon, "", Qt.QVariant(Qt.QColor(color))) self.lColorCB.addItem(icon, "", Qt.QVariant(Qt.QColor(color))) self.__itemsDict = CaselessDict() self.setCurves(curvePropDict) # set the icon for the background button (stupid designer limitations # forces to do it programatically) self.bckgndBT.setIcon(getIcon(":/color-fill.svg")) # connections. # Note: The assignToY1BT and assignToY2BT buttons are not connected to anything # Their signals are handled by the Config dialog because we haven't got # access to the curve objects here Qt.QObject.connect(self.curvesLW, Qt.SIGNAL("itemSelectionChanged()"), self.onSelectedCurveChanged) Qt.QObject.connect(self.curvesLW, Qt.SIGNAL("itemChanged(QListWidgetItem *)"), self.onItemChanged) Qt.QObject.connect(self.applyBT, Qt.SIGNAL("clicked()"), self.onApply) Qt.QObject.connect(self.resetBT, Qt.SIGNAL("clicked()"), self.onReset) Qt.QObject.connect(self.sStyleCB, Qt.SIGNAL("currentIndexChanged(const QString&)"), self._onSymbolStyleChanged) Qt.QObject.connect(self.sStyleCB, Qt.SIGNAL("currentIndexChanged(int)"), self.onControlChanged) Qt.QObject.connect(self.lStyleCB, Qt.SIGNAL("currentIndexChanged(int)"), self.onControlChanged) Qt.QObject.connect(self.sColorCB, Qt.SIGNAL("currentIndexChanged(int)"), self.onControlChanged) Qt.QObject.connect(self.lColorCB, Qt.SIGNAL("currentIndexChanged(int)"), self.onControlChanged) Qt.QObject.connect(self.cStyleCB, Qt.SIGNAL("currentIndexChanged(int)"), self.onControlChanged) Qt.QObject.connect(self.sSizeSB, Qt.SIGNAL("valueChanged(int)"), self.onControlChanged) Qt.QObject.connect(self.lWidthSB, Qt.SIGNAL("valueChanged(int)"), self.onControlChanged) Qt.QObject.connect(self.sFillCB, Qt.SIGNAL("stateChanged(int)"), self.onControlChanged) Qt.QObject.connect(self.cFillCB, Qt.SIGNAL("stateChanged(int)"), self.onControlChanged)
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) # list representing all macros ids (all from sequence) currently # executed self._macroIds = [] self._sequencesPath = str(Qt.QDir.homePath()) self._sequenceModel = MacroSequenceTreeModel() self.registerConfigProperty( "sequencesPath", "setSequencesPath", "sequencesPath") self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) splitter = Qt.QSplitter() self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) sequenceEditor = TaurusWidget() splitter.addWidget(sequenceEditor) sequenceEditor.setUseParentModel(True) sequenceEditor.setLayout(Qt.QVBoxLayout()) sequenceEditor.layout().setContentsMargins(0, 0, 0, 0) self.tree = MacroSequenceTree(sequenceEditor) self.sequenceProxyModel = MacroSequenceProxyModel() self.sequenceProxyModel.setSourceModel(self._sequenceModel) self.tree.setModel(self.sequenceProxyModel) self.tree.setItemDelegate(SequenceEditorDelegate(self.tree)) actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) self.newSequenceAction = Qt.QAction( getThemeIcon("document-new"), "New", self) self.newSequenceAction.triggered.connect(self.onNewSequence) self.newSequenceAction.setToolTip("New sequence") self.newSequenceAction.setEnabled(False) newSequenceButton = Qt.QToolButton() newSequenceButton.setDefaultAction(self.newSequenceAction) actionsLayout.addWidget(newSequenceButton) self.openSequenceAction = Qt.QAction( getThemeIcon("document-open"), "Open...", self) self.openSequenceAction.triggered.connect(self.onOpenSequence) self.openSequenceAction.setToolTip("Open sequence...") openSequenceButton = Qt.QToolButton() openSequenceButton.setDefaultAction(self.openSequenceAction) actionsLayout.addWidget(openSequenceButton) self.saveSequenceAction = Qt.QAction( getThemeIcon("document-save"), "Save...", self) self.saveSequenceAction.triggered.connect(self.onSaveSequence) self.saveSequenceAction.setToolTip("Save sequence...") self.saveSequenceAction.setEnabled(False) saveSequenceButton = Qt.QToolButton() saveSequenceButton.setDefaultAction(self.saveSequenceAction) actionsLayout.addWidget(saveSequenceButton) self.stopSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop", self) self.stopSequenceAction.triggered.connect(self.onStopSequence) self.stopSequenceAction.setToolTip("Stop sequence") stopSequenceButton = Qt.QToolButton() stopSequenceButton.setDefaultAction(self.stopSequenceAction) actionsLayout.addWidget(stopSequenceButton) self.pauseSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause", self) self.pauseSequenceAction.triggered.connect(self.onPauseSequence) self.pauseSequenceAction.setToolTip("Pause sequence") pauseSequenceButton = Qt.QToolButton() pauseSequenceButton.setDefaultAction(self.pauseSequenceAction) actionsLayout.addWidget(pauseSequenceButton) self.playSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Play", self) self.playSequenceAction.triggered.connect(self.onPlaySequence) self.playSequenceAction.setToolTip("Play sequence") playSequenceButton = Qt.QToolButton() playSequenceButton.setDefaultAction(self.playSequenceAction) actionsLayout.addWidget(playSequenceButton) self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) #@todo this feature will be replaced by checkboxes in the # sequence tree view indicating clearing of the plot after execution self.fullSequencePlotCheckBox = Qt.QCheckBox( "Full sequence plot", self) self.fullSequencePlotCheckBox.toggled.connect(self.setFullSequencePlot) self.fullSequencePlotCheckBox.setChecked(True) actionsLayout.addWidget(self.fullSequencePlotCheckBox) spacerItem = Qt.QSpacerItem( 0, 0, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed) actionsLayout.addItem(spacerItem) sequenceEditor.layout().addLayout(actionsLayout) macroLayout = Qt.QHBoxLayout() macroLayout.setContentsMargins(0, 0, 0, 0) macroLabel = Qt.QLabel("Macro:") macroLayout.addWidget(macroLabel) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) self.macroComboBox.setSizePolicy( Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) macroLayout.addWidget(self.macroComboBox) self.addMacroAction = Qt.QAction( getThemeIcon("list-add"), "Add macro...", self) self.addMacroAction.triggered.connect(self.onAdd) self.addMacroAction.setToolTip( "Clicking this button will add selected macro") self.addMacroAction.setEnabled(False) addButton = Qt.QToolButton() addButton.setDefaultAction(self.addMacroAction) macroLayout.addWidget(addButton) sequenceEditor.layout().addLayout(macroLayout) sequenceLayout = Qt.QHBoxLayout() sequenceLayout.addWidget(self.tree) layout = Qt.QVBoxLayout() delButton = Qt.QToolButton() delButton.setDefaultAction(self.tree.deleteAction) delButton.setEnabled(False) layout.addWidget(delButton) upButton = Qt.QToolButton() upButton.setDefaultAction(self.tree.moveUpAction) upButton.setEnabled(False) layout.addWidget(upButton) downButton = Qt.QToolButton() downButton.setDefaultAction(self.tree.moveDownAction) downButton.setEnabled(False) layout.addWidget(downButton) leftButton = Qt.QToolButton() leftButton.setDefaultAction(self.tree.moveLeftAction) leftButton.setEnabled(False) layout.addWidget(leftButton) rightButton = Qt.QToolButton() rightButton.setDefaultAction(self.tree.moveRightAction) rightButton.setEnabled(False) layout.addWidget(rightButton) spacerItem = Qt.QSpacerItem( 0, 40, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding) layout.addItem(spacerItem) sequenceLayout.addLayout(layout) sequenceEditor.layout().addLayout(sequenceLayout) self.parametersProxyModel = MacroParametersProxyModel() self.parametersProxyModel.setSourceModel(self._sequenceModel) self.stackedWidget = Qt.QStackedWidget() splitter.addWidget(self.stackedWidget) self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.standardMacroParametersEditor.setModel(self.parametersProxyModel) self.standardMacroParametersEditor.tree.setItemDelegate( ParamEditorDelegate(self.standardMacroParametersEditor.tree)) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None self.macroComboBox.currentIndexChanged.connect( self.onMacroComboBoxChanged) self.tree.macroChanged.connect(self.setMacroParametersRootIndex)
def getElementTypeIcon(t): if t == PoolControllerView.ControllerModule: return getIcon(":/python-file.png") elif t == PoolControllerView.ControllerClass: return getIcon(":/python.png") return getIcon(":/tango.png")
def __init__(self, manager, toolbar_id=DefaultToolbarID): super(StopTool, self).__init__(manager, "Stop", getIcon(":/actions/media-playback-stop.svg"), toolbar_id=toolbar_id)
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction(getThemeIcon( "software-update-available"), "Add to favourites", self) self.addToFavouritesAction.triggered.connect(self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self) self.stopMacroAction.triggered.connect(self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self) self.pauseMacroAction.triggered.connect(self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Start macro", self) self.playMacroAction.triggered.connect(self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setUseParentModel(True) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setUseParentModel(True) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab( self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab( self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) # Due to a limitation in the useParentModel architecture of Taurus, # the parent of historyMacrosViewer and favouritesMacrosEditor # must be recalculated. See more details in the taurus snippet code [1] # [1] https://raw.githubusercontent.com/taurus-org/taurus/develop/doc/source/devel/examples/parentmodel_issue_demo.py self.historyMacrosViewer.recheckTaurusParent() self.favouritesMacrosEditor.recheckTaurusParent() self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) # spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy( Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) self.spockCommand.setUseParentModel(True) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) # spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.macroComboBox.currentIndexChanged['QString'].connect( self.onMacroComboBoxChanged) self.favouritesMacrosEditor.list.favouriteSelected.connect( self.onFavouriteSelected) self.historyMacrosViewer.list.historySelected.connect( self.onHistorySelected) self.spockCommand.pressedReturn.connect(self.onPlayMacro) self.spockCommand.spockComboBox.connect(self.setComboBoxItem) self.spockCommand.elementUp.connect(self.setHistoryUp) self.spockCommand.elementDown.connect(self.setHistoryDown) self.spockCommand.expandTree.connect( self.standardMacroParametersEditor.tree.expandAll)
def icon(self, index): return getIcon(":/python-file.png")
def __init__(self, parent=None): super(CurveStatsDialog, self).__init__(parent) self.loadUi() plot = parent xIsTime = plot.getXIsTime() self.ui.minDTE.setVisible(xIsTime) self.ui.maxDTE.setVisible(xIsTime) self.ui.minSB.setVisible(not xIsTime) self.ui.maxSB.setVisible(not xIsTime) self.ui.minSB.setMinimum(float('-inf')) self.ui.minSB.setMaximum(float('inf')) self.ui.maxSB.setMinimum(float('-inf')) self.ui.maxSB.setMaximum(float('inf')) icon = getIcon(':/actions/system-search.svg') self.ui.selectMinPB.setIcon(icon) self.ui.selectMaxPB.setIcon(icon) self.refreshCurves() cbs = (self.ui.npointsStatCB, self.ui.minStatCB, self.ui.maxStatCB, self.ui.meanStatCB, self.ui.stdStatCB, self.ui.rmsStatCB) self._checkboxToColMap = dict(zip(cbs, xrange(len(self.statColumns)))) self.minPicker = Qwt5.QwtPlotPicker(Qwt5.QwtPlot.xBottom, Qwt5.QwtPlot.yLeft, Qwt5.QwtPicker.PointSelection, Qwt5.QwtPicker.VLineRubberBand, Qwt5.QwtPicker.AlwaysOn, plot.canvas()) self.maxPicker = Qwt5.QwtPlotPicker(Qwt5.QwtPlot.xBottom, Qwt5.QwtPlot.yLeft, Qwt5.QwtPicker.PointSelection, Qwt5.QwtPicker.VLineRubberBand, Qwt5.QwtPicker.AlwaysOn, plot.canvas()) self.minPicker.setEnabled(False) self.maxPicker.setEnabled(False) # initialize min and max display xmin = plot.axisScaleDiv(Qwt5.QwtPlot.xBottom).lowerBound() xmax = plot.axisScaleDiv(Qwt5.QwtPlot.xBottom).upperBound() self.minMarker = Qwt5.QwtPlotMarker() self.minMarker.setLineStyle(Qwt5.QwtPlotMarker.VLine) self.minMarker.setLinePen(Qt.QPen(Qt.Qt.green, 3)) self.minMarker.setXValue(xmin) self.minMarker.attach(plot) self.minMarker.hide() self.maxMarker = Qwt5.QwtPlotMarker() self.maxMarker.setLineStyle(Qwt5.QwtPlotMarker.VLine) self.maxMarker.setLinePen(Qt.QPen(Qt.Qt.red, 3)) self.maxMarker.setXValue(xmax) self.maxMarker.attach(plot) self.maxMarker.hide() if xIsTime: self.ui.minDTE.setDateTime(self._timestamptToQDateTime(xmin)) self.ui.maxDTE.setDateTime(self._timestamptToQDateTime(xmax)) else: self.ui.minSB.setValue(xmin) self.ui.maxSB.setValue(xmax) refreshAction = Qt.QAction(getThemeIcon( 'view-refresh'), "Refresh available curves", self.ui.statsTW) refreshAction.setShortcut(Qt.Qt.Key_F5) self.connect(refreshAction, Qt.SIGNAL( "triggered()"), self.refreshCurves) self.ui.statsTW.addAction(refreshAction) # connections for cb in cbs: self.connect(cb, Qt.SIGNAL('toggled(bool)'), self.onStatToggled) self.connect(self.ui.calculatePB, Qt.SIGNAL( 'clicked()'), self.onCalculate) self.connect(self.ui.selectMinPB, Qt.SIGNAL( 'clicked()'), self.onSelectMin) self.connect(self.ui.selectMaxPB, Qt.SIGNAL( 'clicked()'), self.onSelectMax) self.connect(self.minPicker, Qt.SIGNAL( 'selected(QwtDoublePoint)'), self.minSelected) self.connect(self.maxPicker, Qt.SIGNAL( 'selected(QwtDoublePoint)'), self.maxSelected) self.connect(self.ui.minSB, Qt.SIGNAL( 'valueChanged(double)'), self.onMinChanged) self.connect(self.ui.minDTE, Qt.SIGNAL( 'dateTimeChanged(QDateTime)'), self.onMinChanged) self.connect(self.ui.maxSB, Qt.SIGNAL( 'valueChanged(double)'), self.onMaxChanged) self.connect(self.ui.maxDTE, Qt.SIGNAL( 'dateTimeChanged(QDateTime)'), self.onMaxChanged) self.connect(self.ui.minCB, Qt.SIGNAL( 'toggled(bool)'), self.onMinChanged) self.connect(self.ui.maxCB, Qt.SIGNAL( 'toggled(bool)'), self.onMaxChanged)
def getElementTypeIcon(t): if t == MacroView.MacroModule: return getIcon(":/python-file.png") elif t == MacroView.Macro: return getIcon(":/python.png") return getIcon(":/tango.png")
def __init__(self, manager, toolbar_id=DefaultToolbarID): super(TaurusCurveChooserTool, self).__init__(manager, "Taurus Models...", getIcon(":/taurus.png"), toolbar_id=toolbar_id)
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) # list representing all macros ids (all from sequence) currently # executed self._macroIds = [] self._sequencesPath = str(Qt.QDir.homePath()) self._sequenceModel = MacroSequenceTreeModel() self.registerConfigProperty("sequencesPath", "setSequencesPath", "sequencesPath") self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) splitter = Qt.QSplitter() self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) sequenceEditor = TaurusWidget() splitter.addWidget(sequenceEditor) sequenceEditor.setUseParentModel(True) sequenceEditor.setLayout(Qt.QVBoxLayout()) sequenceEditor.layout().setContentsMargins(0, 0, 0, 0) self.tree = MacroSequenceTree(sequenceEditor) self.sequenceProxyModel = MacroSequenceProxyModel() self.sequenceProxyModel.setSourceModel(self._sequenceModel) self.tree.setModel(self.sequenceProxyModel) self.tree.setItemDelegate(SequenceEditorDelegate(self.tree)) actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) self.newSequenceAction = Qt.QAction(getThemeIcon("document-new"), "New", self) self.newSequenceAction.triggered.connect(self.onNewSequence) self.newSequenceAction.setToolTip("New sequence") self.newSequenceAction.setEnabled(False) newSequenceButton = Qt.QToolButton() newSequenceButton.setDefaultAction(self.newSequenceAction) actionsLayout.addWidget(newSequenceButton) self.openSequenceAction = Qt.QAction(getThemeIcon("document-open"), "Open...", self) self.openSequenceAction.triggered.connect(self.onOpenSequence) self.openSequenceAction.setToolTip("Open sequence...") openSequenceButton = Qt.QToolButton() openSequenceButton.setDefaultAction(self.openSequenceAction) actionsLayout.addWidget(openSequenceButton) self.saveSequenceAction = Qt.QAction(getThemeIcon("document-save"), "Save...", self) self.saveSequenceAction.triggered.connect(self.onSaveSequence) self.saveSequenceAction.setToolTip("Save sequence...") self.saveSequenceAction.setEnabled(False) saveSequenceButton = Qt.QToolButton() saveSequenceButton.setDefaultAction(self.saveSequenceAction) actionsLayout.addWidget(saveSequenceButton) self.stopSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop", self) self.stopSequenceAction.triggered.connect(self.onStopSequence) self.stopSequenceAction.setToolTip("Stop sequence") stopSequenceButton = Qt.QToolButton() stopSequenceButton.setDefaultAction(self.stopSequenceAction) actionsLayout.addWidget(stopSequenceButton) self.pauseSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause", self) self.pauseSequenceAction.triggered.connect(self.onPauseSequence) self.pauseSequenceAction.setToolTip("Pause sequence") pauseSequenceButton = Qt.QToolButton() pauseSequenceButton.setDefaultAction(self.pauseSequenceAction) actionsLayout.addWidget(pauseSequenceButton) self.playSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Play", self) self.playSequenceAction.triggered.connect(self.onPlaySequence) self.playSequenceAction.setToolTip("Play sequence") playSequenceButton = Qt.QToolButton() playSequenceButton.setDefaultAction(self.playSequenceAction) actionsLayout.addWidget(playSequenceButton) self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) #@todo this feature will be replaced by checkboxes in the # sequence tree view indicating clearing of the plot after execution self.fullSequencePlotCheckBox = Qt.QCheckBox("Full sequence plot", self) self.fullSequencePlotCheckBox.toggled.connect(self.setFullSequencePlot) self.fullSequencePlotCheckBox.setChecked(True) actionsLayout.addWidget(self.fullSequencePlotCheckBox) spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed) actionsLayout.addItem(spacerItem) sequenceEditor.layout().addLayout(actionsLayout) macroLayout = Qt.QHBoxLayout() macroLayout.setContentsMargins(0, 0, 0, 0) macroLabel = Qt.QLabel("Macro:") macroLayout.addWidget(macroLabel) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) self.macroComboBox.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) macroLayout.addWidget(self.macroComboBox) self.addMacroAction = Qt.QAction(getThemeIcon("list-add"), "Add macro...", self) self.addMacroAction.triggered.connect(self.onAdd) self.addMacroAction.setToolTip( "Clicking this button will add selected macro") self.addMacroAction.setEnabled(False) addButton = Qt.QToolButton() addButton.setDefaultAction(self.addMacroAction) macroLayout.addWidget(addButton) sequenceEditor.layout().addLayout(macroLayout) sequenceLayout = Qt.QHBoxLayout() sequenceLayout.addWidget(self.tree) layout = Qt.QVBoxLayout() delButton = Qt.QToolButton() delButton.setDefaultAction(self.tree.deleteAction) delButton.setEnabled(False) layout.addWidget(delButton) upButton = Qt.QToolButton() upButton.setDefaultAction(self.tree.moveUpAction) upButton.setEnabled(False) layout.addWidget(upButton) downButton = Qt.QToolButton() downButton.setDefaultAction(self.tree.moveDownAction) downButton.setEnabled(False) layout.addWidget(downButton) leftButton = Qt.QToolButton() leftButton.setDefaultAction(self.tree.moveLeftAction) leftButton.setEnabled(False) layout.addWidget(leftButton) rightButton = Qt.QToolButton() rightButton.setDefaultAction(self.tree.moveRightAction) rightButton.setEnabled(False) layout.addWidget(rightButton) spacerItem = Qt.QSpacerItem(0, 40, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding) layout.addItem(spacerItem) sequenceLayout.addLayout(layout) sequenceEditor.layout().addLayout(sequenceLayout) self.parametersProxyModel = MacroParametersProxyModel() self.parametersProxyModel.setSourceModel(self._sequenceModel) self.stackedWidget = Qt.QStackedWidget() splitter.addWidget(self.stackedWidget) self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.standardMacroParametersEditor.setModel(self.parametersProxyModel) self.standardMacroParametersEditor.tree.setItemDelegate( ParamEditorDelegate(self.standardMacroParametersEditor.tree)) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None self.macroComboBox.currentIndexChanged.connect( self.onMacroComboBoxChanged) self.tree.macroChanged.connect(self.setMacroParametersRootIndex)
def __init__(self, manager, toolbar_id=DefaultToolbarID): super(TaurusImageChooserTool, self).__init__(manager, "Add Taurus images...", getIcon(":/taurus.png"), toolbar_id=toolbar_id)
def icon(self): return getIcon(":/python.png")
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction( getThemeIcon("software-update-available"), "Add to favourites", self) self.connect(self.addToFavouritesAction, Qt.SIGNAL("triggered()"), self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self) self.connect(self.stopMacroAction, Qt.SIGNAL("triggered()"), self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self) self.connect(self.pauseMacroAction, Qt.SIGNAL("triggered()"), self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Start macro", self) self.connect(self.playMacroAction, Qt.SIGNAL("triggered()"), self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setUseParentModel(True) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setUseParentModel(True) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab(self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab(self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) #spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) self.spockCommand.setUseParentModel(True) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) #spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.connect(self.macroComboBox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onMacroComboBoxChanged) self.connect(self.favouritesMacrosEditor.list, Qt.SIGNAL("favouriteSelected"), self.onFavouriteSelected) self.connect(self.historyMacrosViewer.list, Qt.SIGNAL("historySelected"), self.onHistorySelected) self.connect(self.spockCommand, Qt.SIGNAL("pressedReturn"), self.onPlayMacro) self.connect(self.spockCommand, Qt.SIGNAL("spockComboBox"), self.setComboBoxItem) self.connect(self.spockCommand, Qt.SIGNAL("elementUp"), self.setHistoryUp) self.connect(self.spockCommand, Qt.SIGNAL("elementDown"), self.setHistoryDown) self.connect(self.spockCommand, Qt.SIGNAL("setHistoryFocus"), self.setHistoryFocus) self.connect(self.spockCommand, Qt.SIGNAL("expandTree"), self.standardMacroParametersEditor.tree.expandAll)
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction(getThemeIcon("software-update-available"), "Add to favourites", self) self.connect(self.addToFavouritesAction, Qt.SIGNAL("triggered()"), self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction(getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self) self.connect(self.stopMacroAction, Qt.SIGNAL("triggered()"), self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction(getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self) self.connect(self.pauseMacroAction, Qt.SIGNAL("triggered()"), self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction(getIcon(":/actions/media_playback_start.svg"), "Start macro", self) self.connect(self.playMacroAction, Qt.SIGNAL("triggered()"), self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor(self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setUseParentModel(True) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setUseParentModel(True) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab(self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab(self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) #spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) self.spockCommand.setUseParentModel(True) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) #spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.connect(self.macroComboBox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onMacroComboBoxChanged) self.connect(self.favouritesMacrosEditor.list, Qt.SIGNAL("favouriteSelected"), self.onFavouriteSelected) self.connect(self.historyMacrosViewer.list, Qt.SIGNAL("historySelected"), self.onHistorySelected) self.connect(self.spockCommand, Qt.SIGNAL("pressedReturn"), self.onPlayMacro) self.connect(self.spockCommand, Qt.SIGNAL("spockComboBox"), self.setComboBoxItem) self.connect(self.spockCommand, Qt.SIGNAL("elementUp"), self.setHistoryUp) self.connect(self.spockCommand, Qt.SIGNAL("elementDown"), self.setHistoryDown) self.connect(self.spockCommand, Qt.SIGNAL("setHistoryFocus"), self.setHistoryFocus) self.connect(self.spockCommand, Qt.SIGNAL("expandTree"), self.standardMacroParametersEditor.tree.expandAll)