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):
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)
self.w.setAspectRatioMode(v)
def changeTransformationMode(self, i):
v = Qt.Qt.FastTransformation
if i == 1:
v = Qt.Qt.SmoothTransformation
self.w.setTransformationMode(v)
def changeAlignment(self, i):
halign = self.w_halign.itemData(self.w_halign.currentIndex())
halign = Qt.from_qvariant(halign, int)
valign = self.w_valign.itemData(self.w_valign.currentIndex())
valign = Qt.from_qvariant(valign, int)
self.w.alignment = halign | valign
panel = Qt.QWidget()
layout=Qt.QGridLayout()
panel.setLayout(layout)
layout.setContentsMargins(M, M, M, M)
layout.setSpacing(M)
p1 = QPixmapWidgetTestPanel()
layout.addWidget(p1, 0, 0)
panel.show()
if owns_app:
sys.exit(app.exec_())
else:
return panel
sl = self.layout()
comboBox = Qt.QComboBox()
self._fillComboBox(comboBox)
comboBox.currentIndexChanged.connect(self.onFilterComboBoxItemSelected)
edit = Qt.QLineEdit()
addButton = Qt.QPushButton(Qt.QIcon(":/actions/list-add.svg"), "")
addButton.clicked.connect(self.onAddFilterButtonClicked)
removeButton = Qt.QPushButton(
Qt.QIcon(":/actions/list-remove.svg"), "")
removeButton.clicked.connect(self.onRemoveFilterButtonClicked)
field = Qt.QWidget()
l = Qt.QHBoxLayout()
field.setLayout(l)
l.addWidget(Qt.QLabel("Filter by"))
l.addWidget(comboBox)
l.addWidget(edit)
l.addWidget(addButton)
l.addWidget(removeButton)
if row is None:
sl.addWidget(field)
else:
sl.insertWidget(row, field)
import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.application import TaurusApplication
app = TaurusApplication(sys.argv, cmd_line_parser=None)
panel = Qt.QWidget()
layout = Qt.QHBoxLayout()
panel.setLayout(layout)
from taurus.qt.qtgui.display import TaurusLabel
w1 = TaurusLabel()
w2 = TaurusLabel()
layout.addWidget(w1)
layout.addWidget(w2)
w1.model = 'sys/tg_test/1/double_scalar#label'
w1.bgRole = ''
w2.model = 'sys/tg_test/1/double_scalar#rvalue.magnitude'
panel.show()
sys.exit(app.exec_())
model_widget.setText("sys/tg_test/1/double_scalar")
format_widget.setText(w.getFormat())
fg_widget.setCurrentIndex(0)
fg_widget.setEditable(True)
bg_widget.setCurrentIndex(0)
bg_widget.setEditable(True)
self.w_label = w
self.w_model = model_widget
self.w_model_index = model_index_widget
self.w_fg = fg_widget
self.w_bg = bg_widget
self.w_prefix = prefix_widget
self.w_suffix = suffix_widget
panel = Qt.QWidget()
panel.setWindowTitle(app.applicationName())
layout = Qt.QGridLayout()
panel.setLayout(layout)
layout.setContentsMargins(M, M, M, M)
layout.setSpacing(M)
p1 = TaurusLabelTestPanel()
p1.w_model.setText("sys/tg_test/1/double_scalar")
p2 = TaurusLabelTestPanel()
p2.w_model.setText("sys/tg_test/1/double_scalar#label")
p2.w_bg.setCurrentIndex(3) # bgRole='none'
layout.addWidget(p1, 0, 0)
layout.addWidget(p2, 0, 1)
layout.addItem(Qt.QSpacerItem(10, 10), 1, 0, 1, 2)
layout.setRowStretch(1, 1)
panel.show()
if owns_app:
AttributeChooser.py: widget for choosing (a list of) attributes from a tango DB
"""
__all__ = ["TaurusAttributeChooser"]
__docformat__ = 'restructuredtext'
from taurus.external.qt import Qt
from taurus.qt.qtgui.base import TaurusBaseWidget
from taurus.core.util.containers import CaselessList
from taurus.qt.qtgui.util.ui import UILoadable
@UILoadable(with_ui='ui')
class TaurusAttributeChooser(Qt.QWidget, TaurusBaseWidget):
__pyqtSignals__ = ("modelChanged(const QString &)",) ##
def __init__(self, parent = None, designMode = False):
"""Initialize the MainWindow"""
##
self.call__init__wo_kw(Qt.QWidget, parent)
self.call__init__(TaurusBaseWidget, str(self.objectName()))
##
self.loadUi()
#Create global variables
self.dev_name = ""
self.selectedItems = CaselessList([])
self.selectedItemsComplete = CaselessList([])
#self.ui.attrList.setSortingEnabled(True)
self._singleAttrMode = False
def getSceneObj(self, items):
scene = TaurusGraphicsScene(self.myparent)
for item in items:
try:
if isinstance(item, Qt.QWidget):
scene.addWidget(item)
elif isinstance(item, Qt.QGraphicsItem):
scene.addItem(item)
except:
self.warning("Unable to add item %s to scene" % str(item))
self.debug("Details:", exc_info=1)
return scene
def __init__(self, parent=None, designMode=False):
Qt.QWidget.__init__(self, parent)
self.loadUi()
Qt.QObject.connect(self._ui.pushButtonOk, Qt.SIGNAL("clicked()"), self._onOk)
Qt.QObject.connect(self._ui.pushButtonApply, Qt.SIGNAL("clicked()"), self._onApply)
Qt.QObject.connect(self._ui.pushButtonCancel, Qt.SIGNAL("clicked()"), self._onCancel)
Qt.QObject.connect(self._ui.pushButtonRestore, Qt.SIGNAL("clicked()"), self._onRestore)
def demo():
"""Message dialog"""
panel = Qt.QWidget()
layout = Qt.QVBoxLayout()
panel.setLayout(layout)
m1 = Qt.QPushButton("Python exception")
layout.addWidget(m1)
Qt.QObject.connect(m1, Qt.SIGNAL("clicked()"), py_exc)
m2 = Qt.QPushButton("Tango exception")
layout.addWidget(m2)
Qt.QObject.connect(m2, Qt.SIGNAL("clicked()"), tg_exc)
layout.addWidget(m2)
m3 = Qt.QPushButton("Tango server exception")
layout.addWidget(m3)
Qt.QObject.connect(m3, Qt.SIGNAL("clicked()"), tg_serv_exc)
layout.addWidget(m3)
m4 = Qt.QPushButton("Python tango server exception")
layout.addWidget(m4)
return self.ui.TaurusGroupBox.getShowText()
@Qt.pyqtSignature("setShowText(bool)")
def setShowText(self, showText):
self.ui.TaurusGroupBox.setShowText(showText)
@Qt.pyqtSignature("resetShowText()")
def resetShowText(self):
self.ui.TaurusGroupBox.resetShowText()
model = Qt.pyqtProperty("QString", getModel, setModel, resetModel)
showText = Qt.pyqtProperty("bool", getShowText, setShowText, resetShowText)
@UILoadable(with_ui='ui')
class TaurusMotorH2(Qt.QWidget, TaurusBaseWidget):
__pyqtSignals__ = ("modelChanged(const QString &)",)
def __init__(self, parent=None, designMode=False):
self.call__init__wo_kw(Qt.QWidget, parent)
self.call__init__(TaurusBaseWidget, str(
self.objectName()), designMode=designMode)
self.loadUi()
Qt.QObject.connect(self.ui.config, Qt.SIGNAL(
"clicked()"), self.configureMotor)
def sizeHint(self):
return Qt.QSize(215, 85)
def configureMotor(self):
showDialogConfigureMotor(self.ui.TaurusGroupBox)