Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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',
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)
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)
@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)
# '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)
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',
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)
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)
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)
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()