Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def createCustomMacroEditorPathsAction(self):
configureAction = Qt.QAction(getThemeIcon(
"folder-open"), "Change custom macro editors paths", self)
self.connect(configureAction, Qt.SIGNAL(
"triggered()"), self.onCustomMacroEditorPaths)
configureAction.setToolTip("Change custom macro editors paths")
configureAction.setShortcut("F11")
return configureAction
self.deleteAction.triggered.connect(self.onDelRepeat)
self.deleteAction.setToolTip(
"Clicking this button will remove current repetition.")
self.moveUpAction = Qt.QAction(getThemeIcon("go-up"), "Move up", self)
self.moveUpAction.triggered.connect(self.onUpRepeat)
self.moveUpAction.setToolTip(
"Clicking this button will move current repetition up.")
self.moveDownAction = Qt.QAction(
getThemeIcon("go-down"), "Move down", self)
self.moveDownAction.triggered.connect(self.onDownRepeat)
self.moveDownAction.setToolTip(
"Clicking this button will move current repetition down.")
self.duplicateAction = Qt.QAction(getThemeIcon("edit-copy"),
"Duplicate", self)
self.duplicateAction.triggered.connect(self.onDuplicateRepeat)
msg = "Clicking this button will duplicate the given node."
self.duplicateAction.setToolTip(msg)
self.disableActions()
self.copyAction = Qt.QAction(getThemeIcon("edit-copy"), "Copy", self)
self.connect(self.copyAction, Qt.SIGNAL("triggered()"), self.copy)
self.copyAction.setToolTip(
"Copy current selection's contents to the clipboard")
self.copyAction.setShortcut("Ctrl+C")
self.copyAction.setEnabled(False)
self.pasteAction = Qt.QAction(
getThemeIcon("edit-paste"), "Paste", self)
self.connect(self.pasteAction, Qt.SIGNAL("triggered()"), self.paste)
self.pasteAction.setToolTip(
"Paste the clipboard's contents into the current selection")
self.pasteAction.setShortcut("Ctrl+V")
self.aboutAction = Qt.QAction("About", self)
self.connect(self.aboutAction, Qt.SIGNAL("triggered()"), self.about)
self.aboutAction.setToolTip("Show the application's About box")
self.connect(self.textEdit, Qt.SIGNAL(
"copyAvailable(bool)"), self.cutAction.setEnabled)
self.connect(self.textEdit, Qt.SIGNAL(
"copyAvailable(bool)"), self.copyAction.setEnabled)
self.setCurrentFile("")
def setActions(self):
self._downAction = Qt.QAction("downAction", self)
self._upAction = Qt.QAction("upAction", self)
self._ctrlDownAction = Qt.QAction("controlDownAction", self)
self._ctrlUpAction = Qt.QAction("controlUpAction", self)
self._ctrlDownAction.setShortcut(
Qt.QKeySequence(Qt.Qt.CTRL + Qt.Qt.Key_Down))
self._ctrlUpAction.setShortcut(
Qt.QKeySequence(Qt.Qt.CTRL + Qt.Qt.Key_Up))
self._downAction.setShortcuts([Qt.Qt.Key_Down])
self._upAction.setShortcuts([Qt.Qt.Key_Up])
self._ctrlDownAction.setShortcutContext(Qt.Qt.WidgetShortcut)
self._ctrlUpAction.setShortcutContext(Qt.Qt.WidgetShortcut)
self._downAction.setShortcutContext(Qt.Qt.WidgetShortcut)
self._upAction.setShortcutContext(Qt.Qt.WidgetShortcut)
self.addAction(self._ctrlDownAction)
self.addAction(self._ctrlUpAction)
self.addAction(self._downAction)
def __createActions(self):
'''initializes the application-wide actions'''
self.quitApplicationAction = Qt.QAction(
Qt.QIcon.fromTheme("process-stop"), 'Exit Application', self)
self.quitApplicationAction.triggered.connect(self.close)
self.changeTangoHostAction = Qt.QAction(Qt.QIcon.fromTheme(
"network-server"), 'Change Tango Host ...', self)
self.changeTangoHostAction.triggered.connect(self._onChangeTangoHostAction)
# make this action invisible since it is deprecated
self.changeTangoHostAction.setVisible(False)
self.loadPerspectiveAction = Qt.QAction(Qt.QIcon.fromTheme(
"document-open"), 'Load Perspective ...', self)
self.loadPerspectiveAction.triggered.connect(
partial(self.loadPerspective, name=None, settings=None))
self.savePerspectiveAction = Qt.QAction(Qt.QIcon.fromTheme(
"document-save"), 'Save Perspective ...', self)
self.savePerspectiveAction.triggered.connect(
partial(self.savePerspective, name=None))
self.deletePerspectiveAction = Qt.QAction(
Qt.QIcon("actions:edit-delete.svg"), 'Delete Perspective ...', self)
self.deletePerspectiveAction.triggered.connect(
partial(self.removePerspective, name=None, settings=None))
self.exportSettingsFileAction = Qt.QAction(
Qt.QIcon.fromTheme("document-save"), 'Export Settings ...', self)
from taurus.qt.qtgui.container import TaurusMainWindow, TaurusWidget
from taurus.qt.qtcore.configuration import BaseConfigurableClass
from taurus.qt.qtgui.display import TaurusLed
from taurus.qt.qtgui.dialog import TaurusMessageBox
from taurus.qt.qtgui.resource import getIcon, getThemeIcon
from sardana.taurus.qt.qtgui.extra_macroexecutor.common import MacroExecutionWindow, MacroComboBox, standardPlotablesFilter
from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor import ParamEditorManager, StandardMacroParametersEditor
from sardana.taurus.qt.qtgui.extra_macroexecutor.macroparameterseditor.delegate import ParamEditorDelegate
from sardana.taurus.core.tango.sardana.macro import MacroRunException, MacroNode
from sardana.taurus.qt.qtgui.extra_macroexecutor import globals
from .model import MacroSequenceTreeModel, MacroSequenceProxyModel, MacroParametersProxyModel
from .delegate import SequenceEditorDelegate
class HookAction(Qt.QAction):
def __init__(self, text, parent, macroNode):
Qt.QAction.__init__(self, text, parent)
self.setCheckable(True)
self.setMacroNode(macroNode)
if text in self.macroNode().hookPlaces():
self.setChecked(True)
self.setToolTip("This macro will be executed as a %s" % text)
self.connect(self, Qt.SIGNAL('toggled(bool)'), self.onToggle)
def macroNode(self):
return self._macroNode
def setMacroNode(self, macroNode):
self._macroNode = macroNode
app = TaurusApplication(cmd_line_parser=parser,
app_name="taurusform",
app_version=taurus.Release.version)
args = app.get_command_line_args()
options = app.get_command_line_options()
dialog = TaurusForm()
dialog.setModifiableByUser(True)
dialog.setModelInConfig(True)
dialog.setWindowTitle(options.window_name)
from taurus.qt.qtgui.resource import getThemeIcon
quitApplicationAction = Qt.QAction(getThemeIcon("process-stop"),'Close Form', dialog)
dialog.connect(quitApplicationAction, Qt.SIGNAL("triggered()"), dialog.close)
saveConfigAction = Qt.QAction("Save current settings...", dialog)
saveConfigAction.setShortcut(Qt.QKeySequence.Save)
dialog.connect(saveConfigAction, Qt.SIGNAL("triggered()"), dialog.saveConfigFile)
loadConfigAction = Qt.QAction("&Retrieve saved settings...", dialog)
loadConfigAction.setShortcut(Qt.QKeySequence.Open)
dialog.connect(loadConfigAction, Qt.SIGNAL("triggered()"), dialog.loadConfigFile)
dialog.addActions ((saveConfigAction, loadConfigAction, quitApplicationAction) )
#set the default map for this installation
from taurus import tauruscustomsettings
dialog.setCustomWidgetMap(getattr(tauruscustomsettings,'T_FORM_CUSTOM_WIDGET_MAP',{}))
#set a model list from the command line or launch the chooser
if options.config_file is not None:
dialog.loadConfigFile(options.config_file)
'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)
Qt.QIcon("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(
Qt.QIcon("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(
Qt.QIcon("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)
def defineStyle(self):
self.setWindowTitle('TaurusDevTree')
self.setHeaderLabel(
'Device Browser (right-click on any element to search/show options)')
self.setGeometry(Qt.QRect(90, 60, 256, 192))
self.actionFindInTree = Qt.QAction(self)
self.actionFindInTree.setShortcut(Qt.QKeySequence.Find)
self.actionFindInTree.triggered[()].connect(self.findDialog)
#self.connect(self, Qt.SIGNAL("itemClicked"), self.clickedEvent)
from taurus.qt.qtgui.table.qdictionary import QDictionaryEditor, QListEditor
self.ExpertMenu.append(
('Edit Model Filters',
lambda: QListEditor.main(
self._filters,
modal=True,
title='Edit Model Filters',
callback=lambda d: self.loadTree(d)
)
# lambda:self.loadTree(
#str(Qt.QInputDialog.getText(None,'Set Tree Model','Enter a list of regexp separated by comma:',Qt.QLineEdit.Normal,','.join(str(f) for f in self._filters))[0])
# or None)
))