How to use the sardana.taurus.core.tango.sardana.macro function in sardana

To help you get started, we’ve selected a few sardana examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_macroexecutor / sequenceeditor / model.py View on Github external
def __init__(self, parent=None):
        Qt.QAbstractItemModel.__init__(self, parent)
        self.columns = 4
        self.setRoot(macro.SequenceNode())
        self.headers = ["Macro", "Parameters", "Progress", "Pause"]
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_macroexecutor / macroparameterseditor / macroparameterseditor.py View on Github external
def manageActions(self, currentIndex):
        self.disableActions()
        if currentIndex is None:
            return
        node = self.model().nodeFromIndex(currentIndex)
        if isinstance(node, macro.RepeatNode):
            self.deleteAction.setEnabled(not node.parent().isReachedMin())
            self.addAction.setEnabled(False)
            self.moveUpAction.setEnabled(node.isAllowedMoveUp())
            self.moveDownAction.setEnabled(node.isAllowedMoveDown())
        elif isinstance(node, macro.RepeatParamNode):
            self.addAction.setEnabled(not node.isReachedMax())
            self.deleteAction.setEnabled(False)
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_macroexecutor / macroexecutor.py View on Github external
def getParamItems(self, index):
        #Returns list of items that can be chosen for the node corresponding to the given index. Used by {next,prev}Value methods

        node = self.model().nodeFromIndex(index)
        if isinstance(node, macro.MacroNode):
            return None
        type = node.type()
        ms = self.getParentModelObj()
        items = ms.getElementsWithInterface(type).keys()
        return items, type
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_macroexecutor / sequenceeditor / model.py View on Github external
def __assignIds(self, parentNode):
        ids = []
        for childNode in parentNode.children():
            if isinstance(childNode, macro.MacroNode):
                id = childNode.assignId()
                ids.append(id)
                ids.extend(self.__assignIds(childNode))
        return ids
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_macroexecutor / macroparameterseditor / model.py View on Github external
def setRoot(self, node=None):
        if node == None: node = macro.MacroNode()
        self._root = node
        self.reset()
github taurus-org / taurus / src / sardana / taurus / qt / qtcore / tango / sardana / macroserver.py View on Github external
def registerExtensions():
    """Registers the macroserver extensions in the :class:`taurus.core.tango.TangoFactory`"""
    import taurus
    factory = taurus.Factory()
    factory.registerDeviceClass('MacroServer', QMacroServer)
    factory.registerDeviceClass('Door', QDoor)

    # ugly access to qtgui level: in future find a better way to register error
    # handlers, maybe in TangoFactory & TaurusManager
    import sardana.taurus.core.tango.sardana.macro
    import taurus.qt.qtgui.panel
    MacroRunException = sardana.taurus.core.tango.sardana.macro.MacroRunException
    TaurusMessagePanel = taurus.qt.qtgui.panel.TaurusMessagePanel

    TaurusMessagePanel.registerErrorHandler(MacroRunException, MacroServerMessageErrorHandler)
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_macroexecutor / sequenceeditor / model.py View on Github external
def __createIdIndexDictionary(self, parentIndex, parentNode):
        d = {}
        for row, child in enumerate(parentNode.children()):
            if isinstance(child, macro.MacroNode):
                index = self.index(row, 0, parentIndex)
                d[child.id()] = index
                d.update(self.__createIdIndexDictionary(index, child))
        return d
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_macroexecutor / macroparameterseditor / macroparameterseditor.py View on Github external
def manageActions(self, currentIndex):
        self.disableActions()
        if currentIndex is None:
            return
        node = self.model().nodeFromIndex(currentIndex)
        if isinstance(node, macro.RepeatNode):
            self.deleteAction.setEnabled(not node.parent().isReachedMin())
            self.addAction.setEnabled(False)
            self.moveUpAction.setEnabled(node.isAllowedMoveUp())
            self.moveDownAction.setEnabled(node.isAllowedMoveDown())
            self.duplicateAction.setEnabled(True)
        elif isinstance(node, macro.RepeatParamNode):
            self.addAction.setEnabled(not node.isReachedMax())
            self.deleteAction.setEnabled(False)
            self.duplicateAction.setEnabled(False)
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_macroexecutor / macroparameterseditor / model.py View on Github external
def parent(self, child):
        node = self.nodeFromIndex(child)
        if node is None:
            return Qt.QModelIndex()
        parent = node.parent()
        if parent is None or isinstance(parent, macro.SequenceNode):
            return Qt.QModelIndex()
        grandparent = parent.parent()
        if grandparent is None:
            return Qt.QModelIndex()
        row = grandparent.rowOfChild(parent)
        return self.createIndex(row, 0, parent)