Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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())
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)
elif style == 2:
f.setItalic(True)
elif style == 3:
f.setWeight(Qt.QFont.DemiBold)
f.setItalic(True)
#TODO: Improve code in order to be able to set a suitable font
item.setFont(f)
fg = params.get("foreground", (0,0,0))
color = Qt.QColor(fg[0],fg[1],fg[2])
item.setDefaultTextColor(color)
txt = params.get('text')
if txt:
if any(isinstance(txt,t) for t in (list,tuple,set)): #Parsing several lines of text
txt = '\n'.join(txt)
item.setPlainText(Qt.QString(txt))
item._currText = txt
## You should have received a copy of the GNU Lesser General Public License
## along with Taurus. If not, see .
##
###########################################################################
'''An example of usage of TaurusGui in which no configuration file is used
(everything is done programmatically)
This can be launched directly as a stand-alone python script'''
if __name__ == '__main__':
from taurus.qt.qtgui.application import TaurusApplication
from taurus.qt.qtgui.taurusgui import TaurusGui
from taurus.external.qt import Qt
app = TaurusApplication(app_name='MyGui') #if app_name name not given, it uses the file name
gui = TaurusGui()
panel = Qt.QWidget()
gui.createPanel(panel, 'Foo')
gui.show()
app.exec_()
return None
# ret = TaurusBaseWidget.getQtDesignerPluginInfo()
# ret['module'] = 'taurus.qt.qtgui.display'
# ret['group'] = 'Taurus Widgets [Old]'
# ret['icon'] = ":/designer/lcdnumber.png"
# return ret
#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
# QT properties
#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
model = Qt.pyqtProperty("QString", TaurusBaseWidget.getModel,
TaurusBaseWidget.setModel,
TaurusBaseWidget.resetModel)
useParentModel = Qt.pyqtProperty("bool", TaurusBaseWidget.getUseParentModel,
TaurusBaseWidget.setUseParentModel,
TaurusBaseWidget.resetUseParentModel)
showQuality = Qt.pyqtProperty("bool", TaurusBaseWidget.getShowQuality,
TaurusBaseWidget.setShowQuality,
TaurusBaseWidget.resetShowQuality)
def main():
"""hello"""
import sys
import taurus.qt.qtgui.application
Application = taurus.qt.qtgui.application.TaurusApplication
app = Application.instance()
owns_app = app is None
# 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)
actionsLayout.addWidget(self.fullSequencePlotCheckBox)
spacerItem = Qt.QSpacerItem(
0, 0, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed)
actionsLayout.addItem(spacerItem)
sequenceEditor.layout().addLayout(actionsLayout)
macroLayout = Qt.QHBoxLayout()
macroLayout.setContentsMargins(0, 0, 0, 0)
macroLabel = Qt.QLabel("Macro:")
macroLayout.addWidget(macroLabel)
self.macroComboBox = MacroComboBox(self)
self.macroComboBox.setUseParentModel(True)
self.macroComboBox.setModelColumn(0)
self.macroComboBox.setSizePolicy(
Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum)
macroLayout.addWidget(self.macroComboBox)
self.addMacroAction = Qt.QAction(
Qt.QIcon.fromTheme("list-add"), "Add macro...", self)
self.addMacroAction.triggered.connect(self.onAdd)
self.addMacroAction.setToolTip(
"Clicking this button will add selected macro")
self.addMacroAction.setEnabled(False)
addButton = Qt.QToolButton()
addButton.setDefaultAction(self.addMacroAction)
def __init__(self, name, qt_parent=None, **kw):
self.call__init__wo_kw(Qt.QObject, qt_parent)
self.call__init__(TangoDevice, name, **kw)
def getClass(self,clName):
if not clName or clName == 'noPanel':
return None
elif clName in ('atkpanel.MainPanel','atkpanel'):
clName = 'TaurusDevicePanel'
#TODO: allow passing class names including module, e.g.: 'foo.Bar'
if clName in globals():
return globals()[clName]
elif clName in locals():
return locals()[clName]
elif clName in dir(Qt):
return getattr(Qt,clName)
else:
wf = TaurusWidgetFactory()
try:
return wf.getTaurusWidgetClass(clName)
except:
return None
TaurusModelType.Attribute : TaurusLCDControllerAttributeDesignMode,
TaurusModelType.Configuration : TaurusLCDControllerConfigurationDesignMode,
}
def Controller(lcd):
ctrl_map = _CONTROLLER_MAP
if lcd._designMode:
ctrl_map = _DESIGNER_CONTROLLER_MAP
model_type = lcd.getModelType()
ctrl_klass = ctrl_map.get(model_type, TaurusLCDController)
return ctrl_klass(lcd)
class TaurusLCD(Qt.QLCDNumber, TaurusBaseWidget):
DefaultBgRole = 'quality'
DefaultFgRole = 'value'
DefaultShowText = True
DefaultModelIndex = None
def __init__(self, parent=None, designMode=False):
self._bgRole = self.DefaultBgRole
self._fgRole = self.DefaultFgRole
self._modelIndex = self.DefaultModelIndex
self._modelIndexStr = ''
self._controller = None
name = self.__class__.__name__
self.call__init__wo_kw(Qt.QLCDNumber, parent)
self.call__init__(TaurusBaseWidget, name, designMode=designMode)
def changeColor(self, ledColor):
self.ledcolor = ledColor
off_pixmap_name = self.toCompleteLedName(
self.ledsize, LedStatus.OFF, ledColor)
self.offled = Qt.QPixmap(off_pixmap_name)
on_pixmap_name = self.toCompleteLedName(
self.ledsize, LedStatus.ON, ledColor)
self.onled = Qt.QPixmap(on_pixmap_name)
if self.status == LedStatus.OFF:
self.setPixmap(self.offled)
else:
self.setPixmap(self.onled)