Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
self.layout().addWidget(self._splitter, 0, 0)
self._header = Qt.QFrame()
self._header.setFixedHeight(1.1 * IMAGE_SIZE[1])
self._header.setLayout(Qt.QGridLayout())
self._dup = Qt.QPushButton()
qpixmap = Qt.QIcon("actions:window-new.svg")
self._dup.setIcon(Qt.QIcon(qpixmap))
self._dup.setIconSize(Qt.QSize(15, 15))
self._dup.pressed.connect(self.duplicate)
self._image = Qt.QLabel()
self._header.layout().addWidget(self._image, 0, 0, 2, 1, Qt.Qt.AlignCenter)
self._header.layout().addWidget(self._label, 0, 1, Qt.Qt.AlignLeft)
self._header.layout().addWidget(self._stateframe, 1, 1, 1, 2, Qt.Qt.AlignLeft)
self._header.layout().addWidget(self._dup, 0, 2, Qt.Qt.AlignRight)
self._splitter.insertWidget(0, self._header)
self._splitter.insertWidget(1, self._attrsframe)
self._splitter.insertWidget(2, self._statusframe)
self._splitter.setSizes(SPLIT_SIZES)
[self._splitter.setStretchFactor(i, v)
for i, v in enumerate(SPLIT_SIZES)]
self._splitter.setCollapsible(0, False)
self._splitter.setCollapsible(1, False)
if model:
self.setModel(model)
def keyPressEvent(self, key_event):
if key_event.key() == Qt.Qt.Key_Escape:
self.abort()
key_event.accept()
TaurusWidget.keyPressEvent(self, key_event)
return None
item = index.internalPointer()
row, column, depth = index.row(), index.column(), item.depth()
item_role = self.role(column, depth)
ret = None
if role == Qt.Qt.DisplayRole:
ret = Qt.QString(item.data(index))
elif role == Qt.Qt.DecorationRole:
ret = item.icon()
elif role == Qt.Qt.ToolTipRole:
ret = item.toolTip()
# elif role == Qt.Qt.SizeHintRole:
# ret = self.columnSize(column)
elif role == Qt.Qt.FontRole:
ret = self.DftFont
return ret
def __init__(self, parent=None, designMode=False, taurusparam=None, toolbar=True, **kwargs):
'''see :class:`guiqwt.plot.CurveDialog` for other valid initialization parameters'''
CurveDialog.__init__(self, parent=parent, toolbar=toolbar, **kwargs)
TaurusBaseWidget.__init__(self, 'TaurusTrendDialog')
self.deprecated(rel='4.1', dep='TaurusTrendDialog', alt='TaurusTrend / taurus tpg trend launcher')
self.setWindowFlags(Qt.Qt.Widget)
self._designMode = designMode
self._modelNames = CaselessList()
from guiqwt.styles import style_generator
self.style = style_generator()
self.setSupportedMimeTypes(
[TAURUS_MODEL_LIST_MIME_TYPE, TAURUS_ATTR_MIME_TYPE])
from taurus.qt.qtgui.extra_guiqwt.tools import TaurusModelChooserTool, AutoScrollTool
self.add_tool(TaurusModelChooserTool, singleModel=False)
self.add_tool(AutoScrollTool)
self.setModifiableByUser(self._modifiableByUser)
if taurusparam is None:
taurusparam = TaurusTrendParam()
self.defaultTaurusparam = taurusparam
self.setContextMenuPolicy(Qt.Qt.CustomContextMenu)
self.registerConfigDelegate(self.get_tool(AutoScrollTool))
self._rect = Qt.QGraphicsRectItem(self)
if scene is not None:
scene.addItem(self._rect)
self._rect.setBrush(Qt.QBrush(Qt.Qt.NoBrush))
self._rect.setPen(Qt.QPen(Qt.Qt.NoPen))
self._text = Qt.QGraphicsTextItem(self)
if scene is not None:
scene.addItem(self._text)
self._text.setTransform(
Qt.QTransform.fromScale(self._TEXT_RATIO, self._TEXT_RATIO),
True)
self._validBackground = None
# using that like the previous code create a worst result
self.__layoutValide = True
self._alignment = Qt.Qt.AlignCenter | Qt.Qt.AlignVCenter
def __init__(self, qt_parent=None, designMode=False):
Qt.QWidget.__init__(self, qt_parent)
layout = Qt.QGridLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
self.setLayout(layout)
self.setStyleSheet(_S)
self.__dict__['spinBox'] = spin = TaurusValueSpinBox(
qt_parent=self, designMode=designMode)
self.__dict__['sliderButton1'] = b1 = Qt.QToolButton(self)
self.__dict__['sliderButton2'] = b2 = Qt.QToolButton(self)
b1.setIcon(getStandardIcon(Qt.QStyle.SP_TitleBarShadeButton, b1))
b2.setIcon(getStandardIcon(Qt.QStyle.SP_TitleBarUnshadeButton, b2))
layout.addWidget(spin, 0, 0, 2, 1)
layout.addWidget(b1, 0, 1, 1, 1, Qt.Qt.AlignBottom)
layout.addWidget(b2, 1, 1, 1, 1, Qt.Qt.AlignTop)
layout.setColumnStretch(0, 1)
layout.setColumnStretch(1, 0)
policy = self.sizePolicy()
policy.setHorizontalPolicy(Qt.QSizePolicy.Minimum)
policy.setVerticalPolicy(Qt.QSizePolicy.Fixed)
self.setSizePolicy(policy)
def changeAspectRatio(self, i):
v = Qt.Qt.IgnoreAspectRatio
if i == 1:
v = Qt.Qt.KeepAspectRatio
elif i == 2:
v = Qt.Qt.KeepAspectRatioByExpanding
self.w.setAspectRatioMode(v)
down = _DownArrowButton(id-i-1)
d.setButtons(up, down)
up.setFocusProxy(d)
down.setFocusProxy(d)
self._upButtons.addButton(up, col)
self._downButtons.addButton(down, col)
self._digitLabels.append(d)
if self.getShowArrowButtons():
l.addWidget(up, 0, col)
l.addWidget(down, 2, col)
l.addWidget(d, 1, col)
if showDot:
dotLabel = _DigitLabel('.')
dotLabel.setFocusPolicy(Qt.Qt.NoFocus)
dotLabel.setAlignment(Qt.Qt.AlignCenter)
self._digitLabels.append(dotLabel)
l.addWidget(dotLabel, 1, id + 1)
for i in xrange(id, digits):
col = i + 1
if showDot: col += 1
d = _DigitLabel('0')
up = _UpArrowButton(id-i-1)
down = _DownArrowButton(id-i-1)
d.setButtons(up, down)
up.setFocusProxy(d)
down.setFocusProxy(d)
self._upButtons.addButton(up, col)
self._downButtons.addButton(down, col)
self._digitLabels.append(d)
if self.getShowArrowButtons():