How to use the taurus.qt.qtgui.base.TaurusBaseWidget function in taurus

To help you get started, we’ve selected a few taurus 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 taurus-org / taurus / lib / taurus / qt / qtgui / tree / taurusdevicetree.py View on Github external
items = self.getSelectedNodes()
        for item in items:
            item = self.currentItem()
            attr = getattr(item, 'AttributeAlias',
                           '') or self.getNodeText(item)
            self.removeAttrFromPlot(attr)
        return

    def removeAttrFromPlot(self, attr):
        """ This method will send a signal with the given attr name, in a separate method to be called with a pre-filled list """
        self.removeAttrSelected.emit(Qt.QStringList([str(attr)]))


###############################################################################

class TaurusDevTree(TaurusTreeNodeContainer, Qt.QTreeWidget, TaurusBaseWidget):
    '''
    This widget displays a list of servers, devices or instances.
    To set a new Model use either setModel(filters), addModels(list), setFilters(...) or loadTree(filters)
    setModel and loadTree are equivalent; adding a new branch to the tree
    addModels merges the tree with new models
    setFilters clears previous models and adds new one
    '''

    # TODO: tango-centric
    __properties__ = (
        'ModelInConfig',
        'modifiableByUser',
        #'useParentModel',
        'Filters',
        'Source',
        'ShowAlias',
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_sardana / expdescription.py View on Github external
def setModel(self, model):
        '''reimplemented from :class:`TaurusBaseWidget`'''
        TaurusBaseWidget.setModel(self, model)
        self._reloadConf(force=True)
        #set the model of some child widgets
        door = self.getModelObj()
        if door is None: return
        tghost = taurus.Database().getNormalName()  #@todo: get the tghost from the door model instead
        msname = door.macro_server.getFullName()
        self.ui.taurusModelTree.setModel(tghost)
        self.ui.sardanaElementTree.setModel(msname)
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_hkl / hklscan.py View on Github external
def __init__(self, parent=None):
        name = self.__class__.__name__
        self.call__init__wo_kw(Qt.QComboBox, parent)
        self.call__init__(TaurusBaseWidget, name)
        self.setSizeAdjustPolicy(Qt.QComboBox.AdjustToContentsOnFirstShow)
        self.setToolTip("Choose a engine mode ...")
        QtCore.QMetaObject.connectSlotsByName(self)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / gauge / taurusgauge.py View on Github external
    @classmethod
    def getQtDesignerPluginInfo(cls):
        ret = TaurusBaseWidget.getQtDesignerPluginInfo()
        ret['group'] = 'Taurus Display'
        ret['module'] = 'taurus.qt.qtgui.gauge'
        ret['icon'] = ":/designer/circular_gauge.png"
        return ret
    
    logScale  = Qt.pyqtProperty("bool", getLogScale, setLogScale, resetLogScale)
    
    model = Qt.pyqtProperty("QString", TaurusBaseWidget.getModel,
                            TaurusBaseWidget.setModel, TaurusBaseWidget.resetModel)
                                
    useParentModel = Qt.pyqtProperty("bool", TaurusBaseWidget.getUseParentModel,
                                     TaurusBaseWidget.setUseParentModel,
                                     TaurusBaseWidget.resetUseParentModel)

def main():
    import sys
    import taurus
    attr_name = sys.argv[1]
    attr = taurus.Attribute(attr_name)
    
    a = Qt.QApplication([])
    panel = Qt.QWidget()
    l = Qt.QGridLayout()
    w1 = TaurusCircularGauge()
    w2 = TaurusLinearGauge()
    w1.setModel(attr_name)
    w2.setModel(attr_name)
github sardana-org / sardana / src / sardana / taurus / qt / qtgui / extra_sardana / expdescription.py View on Github external
#                     'PseudoCounter']

    from sardana.sardanadefs import ElementType, TYPE_ACQUIRABLE_ELEMENTS
    ALLOWED_TYPES = [ElementType[t] for t in TYPE_ACQUIRABLE_ELEMENTS]

    def filterAcceptsRow(self, sourceRow, sourceParent):
        sourceModel = self.sourceModel()
        idx = sourceModel.index(sourceRow, 0, sourceParent)
        treeItem = idx.internalPointer()
        if isinstance(treeItem, SardanaTypeTreeItem):
            return treeItem.itemData() in self.ALLOWED_TYPES
        return True


@UILoadable(with_ui='ui')
class ExpDescriptionEditor(Qt.QWidget, TaurusBaseWidget):
    '''
    A widget for editing the configuration of a experiment (measurement groups,
    plot and storage parameters, etc).

    It receives a Sardana Door name as its model and gets/sets the configuration
    using the `ExperimentConfiguration` environmental variable for that Door.
    '''

    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)
github taurus-org / taurus / lib / taurus / qt / qtgui / image / taurusqub.py View on Github external
try:
    import EdfFile
except ImportError:
    EdfFile = None


class _EDFFileSavePlug:

    def setData(self, data):
        if data is not None:
            self._data = weakref.ref(data)
        else:
            self._data = None


class TaurusQubDataImageDisplay(QubDataImageDisplay, TaurusBaseWidget):

    def __init__(self, parent=None, **kwargs):
        designMode = kwargs.get('designMode', False)
        kwargs['forcePopupSubWindow'] = True
        kwargs['parent'] = parent
        self.call__init__(QubDataImageDisplay, **kwargs)
        name = self.__class__.__name__
        self._image_attr_name = ''
        self.call__init__(TaurusBaseWidget, name, designMode=designMode)
        self.statusBar().setSizeGripEnabled(False)
        self.setModifiableByUser(True)  # to allow drop of models
        self.__addActions()

    def __addActions(self):
        updateAction = QubToolbarToggleButtonAction(name='update', iconName='update',
                                                    initState=True, group='image',
github taurus-org / taurus / lib / taurus / qt / qtgui / container / taurusbasecontainer.py View on Github external
def updateStyle(self):
        if self.getShowQuality():
            self.setAutoFillBackground(True)
            # TODO: get quality/state from model and update accordingly
        else:
            self.setAutoFillBackground(False)
            # TODO: restore colors
        TaurusBaseWidget.updateStyle(self)
github sardana-org / sardana / lib / taurus / qt / qtgui / extra_sardana / sardanaeditor.py View on Github external
return True


class SardanaLibTreeWidget(SardanaElementTreeWidget):
    
    KnownPerspectives = { "Type" : {
                          "label" : "By lib",
                          "icon" : ":/python-package.png",
                          "tooltip" : "View elements by library",
                          "model" : [SardanaLibProxyModel, SardanaElementTypeModel],
                        },
    }
    DftPerspective = "Type"
    

class SardanaEditor(TaurusBaseEditor, TaurusBaseWidget):

    def __init__(self, parent=None, designMode=None):
        name = self.__class__.__name__
        self._base_tmp_dir = None
        self._tmp_dir = None
        self._is_filesystem_prepared = False
        self.call__init__wo_kw(TaurusBaseEditor, parent)
        self.call__init__(TaurusBaseWidget, name, designMode=designMode)
        self._elementTree = elementTree = \
            SardanaLibTreeWidget(self, with_navigation_bar=False,
                                 with_filter_widget=False,)
        elementTree.treeView().setColumnHidden(1, True)
        self.connect(self._elementTree, Qt.SIGNAL("itemDoubleClicked"),
                     self.on_element_clicked)
        self.insertWidget(0, self._elementTree)
        self.setAutoTooltip(False)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / gauge / taurusgauge.py View on Github external
self.updateStyle()

    @classmethod
    def getQtDesignerPluginInfo(cls):
        ret = TaurusBaseWidget.getQtDesignerPluginInfo()
        ret['group'] = 'Taurus Display'
        ret['module'] = 'taurus.qt.qtgui.gauge'
        ret['icon'] = ":/designer/circular_gauge.png"
        return ret
    
    logScale  = Qt.pyqtProperty("bool", getLogScale, setLogScale, resetLogScale)
    
    model = Qt.pyqtProperty("QString", TaurusBaseWidget.getModel,
                            TaurusBaseWidget.setModel, TaurusBaseWidget.resetModel)
                                
    useParentModel = Qt.pyqtProperty("bool", TaurusBaseWidget.getUseParentModel,
                                     TaurusBaseWidget.setUseParentModel,
                                     TaurusBaseWidget.resetUseParentModel)

def main():
    import sys
    import taurus
    attr_name = sys.argv[1]
    attr = taurus.Attribute(attr_name)
    
    a = Qt.QApplication([])
    panel = Qt.QWidget()
    l = Qt.QGridLayout()
    w1 = TaurusCircularGauge()
    w2 = TaurusLinearGauge()
    w1.setModel(attr_name)
    w2.setModel(attr_name)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / gauge / taurusgauge.py View on Github external
def resetLogScale(self):
        self._logScale = False
        self.updateStyle()

    @classmethod
    def getQtDesignerPluginInfo(cls):
        ret = TaurusBaseWidget.getQtDesignerPluginInfo()
        ret['group'] = 'Taurus Display'
        ret['module'] = 'taurus.qt.qtgui.gauge'
        ret['icon'] = ":/designer/circular_gauge.png"
        return ret
    
    logScale  = Qt.pyqtProperty("bool", getLogScale, setLogScale, resetLogScale)
    
    model = Qt.pyqtProperty("QString", TaurusBaseWidget.getModel,
                            TaurusBaseWidget.setModel, TaurusBaseWidget.resetModel)
                                
    useParentModel = Qt.pyqtProperty("bool", TaurusBaseWidget.getUseParentModel,
                                     TaurusBaseWidget.setUseParentModel,
                                     TaurusBaseWidget.resetUseParentModel)

def main():
    import sys
    import taurus
    attr_name = sys.argv[1]
    attr = taurus.Attribute(attr_name)
    
    a = Qt.QApplication([])
    panel = Qt.QWidget()
    l = Qt.QGridLayout()
    w1 = TaurusCircularGauge()
    w2 = TaurusLinearGauge()