Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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.Trigger:
return getIcon(":/actions/system-shutdown.svg")
elif t == ChannelView.NXPath:
return getThemeIcon("document-save-as")
return getIcon(":/tango.png")
self.stopSequenceAction = Qt.QAction(getIcon(":/actions/media_playback_stop.svg"), "Stop", self)
self.connect(self.stopSequenceAction, Qt.SIGNAL("triggered()"), 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.connect(self.pauseSequenceAction, Qt.SIGNAL("triggered()"), 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.connect(self.playSequenceAction, Qt.SIGNAL("triggered()"), 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.connect(self.fullSequencePlotCheckBox, Qt.SIGNAL("toggled(bool)"), self.setFullSequencePlot)
self.fullSequencePlotCheckBox.setChecked(True)
actionsLayout.addWidget(self.fullSequencePlotCheckBox)
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)
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.Trigger:
return getIcon(":/actions/system-shutdown.svg")
elif t == ChannelView.NXPath:
return getThemeIcon("document-save-as")
return getIcon(":/tango.png")
tip='IPython shell (%s profile)',
data=profile,
triggered=self.on_select_ipython_profile)
ipy_actions.append(action)
ipy_actions.append(None)
ipy_actions.append(ipy_action)
ipy_menu = Qt.QMenu("IPython")
ipy_menu.setIcon(ipy_icon)
add_actions(ipy_menu, ipy_actions)
self.profile_menu_actions.append(ipy_menu)
# ------------------------------------------------------------------
# ITango items
# ------------------------------------------------------------------
tango_icon = getIcon(':/tango.png')
tango_action = create_action(self, self.tr("Tango"),
icon=tango_icon,
tip='Tango shell',
data="/Tango",
triggered=self.on_select_tango_profile)
self.profile_menu_actions.append(tango_action)
# ------------------------------------------------------------------
# Sardana items
# ------------------------------------------------------------------
if spocklib is not None and self.has_sardana():
sardana_icon = getIcon(':/categories/user-digital-person.svg')
sardana_profiles = spocklib.genutils.get_spock_profiles()
sardana_profiles = sorted(sardana_profiles)
sardana_actions = []
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)
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")
self.__doorResult = DoorResult(mainwindow)
SDM.connectReader("doorResultChanged",
self.__doorResult.onDoorResultChanged)
mainwindow.createPanel(self.__doorResult, 'DoorResult',
registerconfig=False, permanent=True)
#puts sardanaEditor
self.__sardanaEditor = SardanaEditor()
SDM.connectReader("macroserverName", self.__sardanaEditor.setModel)
mainwindow.createPanel(self.__sardanaEditor, 'SardanaEditor',
registerconfig=False, permanent=True)
#add panic button for aborting the door
text = "Panic Button: stops the pool (double-click for abort)"
self.doorAbortAction = mainwindow.jorgsBar.addAction(
getIcon(":/actions/process-stop.svg"),
text, self.__onDoorAbort)
#store beginning of times as a datetime
self.__lastAbortTime = datetime.datetime(1, 1, 1)
#store doubleclick interval as a timedelta
td = datetime.timedelta(0, 0, 1000 * Qt.qApp.doubleClickInterval())
self.__doubleclickInterval = td
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.Trigger:
return getIcon(":/actions/system-shutdown.svg")
elif t == ChannelView.NXPath:
return getThemeIcon("document-save-as")
return getIcon(":/tango.png")
def getElementTypeIcon(t):
if t == MacroView.MacroModule:
return getIcon(":/python-file.png")
elif t == MacroView.Macro:
return getIcon(":/python.png")
return getIcon(":/tango.png")