How to use taurus - 10 common examples

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 / taurusdbtree.py View on Github external
def init(self, designMode):
        l = Qt.QGridLayout()
        l.setContentsMargins(0, 0, 0, 0)
        self.setLayout(l)

#        tb = self._toolbar = Qt.QToolBar("Taurus tree panel toolbar")
#        tb.setFloatable(False)
#        refreshAction = self._refreshAction = tb.addAction(Qt.QIcon.fromTheme("view-refresh"),"Refresh", self.refresh)

#        l.addWidget(tb, 0, 0)

        main_panel = Qt.QTabWidget()
        self._device_tree_view = TaurusDbTreeWidget(
            perspective=TaurusElementType.Device)
        self._device_table_view = Qt.QTableView()
        self._device_table_view.setModel(TaurusDbBaseModel())
        self._device_list_view = Qt.QListView()
        self._device_list_view.setModel(TaurusDbSimpleDeviceModel())
github sardana-org / sardana / taurus / lib / taurus / qt / qtgui / tree / taurusdevicetree.py View on Github external
def __init__(self,parent=None,icon=None):
        Qt.QWidget.__init__(self,parent)
        
        self.setLayout(Qt.QHBoxLayout())
        try:
            self._pixmap = Qt.QPixmap(icon or 'image/icons/search.png')
            self._label = Qt.QLabel(self)
            self._label.setPixmap(self._pixmap)
            self.layout().addWidget(self._label)    
        except:
            pass
        
        self._edit = Qt.QLineEdit()
        self._button = Qt.QPushButton()
        self._button.setText('Search')
        self.connect(self._edit,Qt.SIGNAL('returnPressed()'),self._button.animateClick)
        self.connect(self._button,Qt.SIGNAL('clicked()'),self._emitSearch)
        self.layout().addWidget(self._edit)
        self.layout().addWidget(self._button)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / graphic / jdraw / jdraw_view.py View on Github external
def get_item_colors(self,emit = False):
        item_colors = {}
        try:
            for item in self.scene().items():
                if not getattr(item,'_name','') or not getattr(item,'_currBgBrush',None):
                    continue
                item_colors[item._name] = item._currBgBrush.color().name()
            if emit: self.emit(Qt.SIGNAL("itemsChanged"),self.modelName.split('/')[-1].split('.')[0],item_colors)
        except:
            self.warning('Unable to emitColors: %s'%traceback.format_exc())
        return item_colors
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_macroexecutor / sequenceeditor / model.py View on Github external
if isinstance(node, macro.SingleParamNode):
                node.setValue(Qt.from_qvariant(value, str))
                self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
                while True:
                    index = index.parent()
                    node = self.nodeFromIndex(index)
                    if isinstance(node, macro.MacroNode):
                        self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index.sibling(index.row(), self.columnCount(index)))
                        break
        elif index.column() == 2:
            progress = Qt.from_qvariant(value, float)
            node.setProgress(progress)
            self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
        elif index.column() == 3:
            node.setPause(Qt.from_qvariant(value, bool))
            self.emit(Qt.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index)
        return True
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / tree / taurusdevicetree.py View on Github external
def deviceSelected(self,device_name=''):
        '''QSIGNAL: this method is used to emit deviceSelected(QString) signal'''
        self.trace("In TaurusDevTree.deviceSelected(%s)"%device_name)
        try:
            #item = self.currentItem()
            device_name = device_name or self.getNodeDeviceName()#item.text(0)
            if str(device_name).count('/')!=2: return
            #Signal
            self.trace('TaurusTree emit deviceSelected(%s) signal ...'%device_name)
            self.emit(Qt.SIGNAL("deviceSelected(QString)"), Qt.QString(device_name))
        except:
            self.error(traceback.format_exc())
            pass
github taurus-org / taurus / lib / taurus / qt / qtgui / taurusgui / appsettingswizard.py View on Github external
self._execFileButton.setIcon(Qt.QIcon.fromTheme("folder-open"))
        self._execFileButton.setToolTip("Browse...")
        self._execFileButton.setMaximumSize(80, 25)
        self._layout1.addWidget(self._execFileLabel, 2, 0, Qt.Qt.AlignRight)
        self._layout1.addWidget(self._execFileLineEdit, 2, 1, Qt.Qt.AlignRight)
        self._layout1.addWidget(self._execFileButton, 2, 2, Qt.Qt.AlignLeft)
        self._paramsLabel = Qt.QLabel("Parameters:")
        self._paramsLineEdit = Qt.QLineEdit()
        self._paramsLineEdit.setMinimumSize(150, 25)
        self._layout1.addWidget(self._paramsLabel, 3, 0, Qt.Qt.AlignRight)
        self._layout1.addWidget(self._paramsLineEdit, 3, 1, Qt.Qt.AlignRight)
        self._textLabel = Qt.QLabel("Text:")
        self._textLineEdit = Qt.QLineEdit()
        self._textLineEdit.setMinimumSize(150, 25)
        self._layout1.addWidget(self._textLabel, 4, 0, Qt.Qt.AlignRight)
        self._layout1.addWidget(self._textLineEdit, 4, 1, Qt.Qt.AlignRight)

        self._iconLabel = Qt.QLabel("Icon:")
        self._iconLogo = Qt.QPushButton()
        self._iconLogo.setIcon(Qt.QIcon("status:image-missing.svg"))
        self._iconLogo.setIconSize(Qt.QSize(60, 60))
        self._layout1.addWidget(self._iconLabel, 5, 0, Qt.Qt.AlignRight)
        self._layout1.addWidget(self._iconLogo, 5, 1, Qt.Qt.AlignCenter)
        self._spacerItem1 = Qt.QSpacerItem(
            10, 0, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding)
        self._layout1.addItem(self._spacerItem1, 8, 0, 1, 1, Qt.Qt.AlignCenter)

        # connections
        self._execFileButton.clicked.connect(self._selectExecFile)
        self._execFileLineEdit.textChanged.connect(self._setDefaultText)
        self._iconLogo.clicked.connect(self._selectIcon)
        self._dlgBox.accepted.connect(self.accept)
github taurus-org / taurus / lib / taurus / qt / qtgui / plot / taurustrend.py View on Github external
'''
        self._scrollStep = scrollStep
        
    def getScrollStep(self):
        '''returns the value of the scroll step
        
        :return: (float)
        '''
        return self._scrollStep 
    
    def resetScrollStep(self):
        '''equivalent to setScrollStep(0.2)'''
        self.setScrollStep(0.2)
    
    useArchiving = Qt.pyqtProperty("bool", getUseArchiving, setUseArchiving, resetUseArchiving)
    usePollingBuffer = Qt.pyqtProperty("bool", getUsePollingBuffer, setUsePollingBuffer, resetUsePollingBuffer)
    maxDataBufferSize = Qt.pyqtProperty("int", getMaxDataBufferSize, setMaxDataBufferSize, resetMaxDataBufferSize)
    scrollstep = Qt.pyqtProperty("double", getScrollStep, setScrollStep, resetScrollStep)
    forcedReadingPeriod = Qt.pyqtProperty("int", getForcedReadingPeriod, setForcedReadingPeriod, resetForcedReadingPeriod)
    
    

def test():
    import sys
    import taurus.qt.qtgui.application
    app = taurus.qt.qtgui.application.TaurusApplication()
    w=Qt.QWidget()
    w.setLayout(Qt.QVBoxLayout())
    s=Qt.QSplitter()
    w.layout().addWidget(s)
    t=TaurusTrend()
    l=Qt.QLabel('asdasdasdasdasd')
github taurus-org / taurus / lib / taurus / qt / qtgui / panel / taurusmodelchooser.py View on Github external
layout.addWidget(w)
        dlg.setLayout(layout)
        w.updateModels.connect(dlg.accept)
        dlg.exec_()
        return w.getListedModels(asMimeData=asMimeData), (dlg.result() == dlg.Accepted)

    @classmethod
    def getQtDesignerPluginInfo(cls):
        ret = TaurusWidget.getQtDesignerPluginInfo()
        ret['module'] = 'taurus.qt.qtgui.panel'
        ret['icon'] = "designer:listview.png"
        ret['container'] = False
        ret['group'] = 'Taurus Views'
        return ret

    singleModelMode = Qt.pyqtProperty(
        "bool", isSingleModelMode, setSingleModelMode, resetSingleModelMode)


def main(args):
    if len(sys.argv) > 1:
        host = sys.argv[1]
    else:
        host = None

    app = Qt.QApplication(args)
    print(TaurusModelChooser.modelChooserDlg(host=host))
    sys.exit()

if __name__ == "__main__":
    main(sys.argv)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / panel / taurusfilterpanel.py View on Github external
def init(self):
        l = Qt.QVBoxLayout()
        self.setLayout(l)
        
        panel = self._mainPanel = Qt.QWidget()
        l.addWidget(panel, 1)
        this_dir = os.path.dirname(os.path.abspath(__file__))
        ui_filename = os.path.join(this_dir, 'ui', 'TaurusFilterPanel.ui')
        self.ui = ui = loadUi(ui_filename, baseinstance=panel)
        
        comboBox = ui.filterTypeCombo
        comboBox.addItem(getElementTypeIcon(ElemType.Attribute), "Attribute", ElemType.Attribute)
        comboBox.addItem(getElementTypeIcon(ElemType.Device), "Device", ElemType.Device)
        comboBox.addItem(getElementTypeIcon(ElemType.DeviceClass), "Device type", ElemType.DeviceClass)
        comboBox.addItem(getElementTypeIcon(ElemType.Server), "Server", ElemType.Server)

        clickedSig = Qt.SIGNAL("clicked()")
        idxChangedSig = Qt.SIGNAL("currentIndexChanged(int)")
        Qt.QObject.connect(ui.serverNameCombo, idxChangedSig, self._updateServerInstanceCombo)
        Qt.QObject.connect(ui.deviceDomainCombo, idxChangedSig, self._updateDeviceFamilyCombo)
        Qt.QObject.connect(ui.deviceFamilyCombo, idxChangedSig, self._updateDeviceMemberCombo)