Ejemplo n.º 1
0
    def __init__(self, img):

        QLabel.__init__(self)
        self._ratio = img.size[0] / img.size[1]
        self._pixmap = QPixmap.fromImage(ImageQt(img))
        self.setMinimumSize(QSize(10, 10))
        self.setScaledContents(True)
        self.setPixmap(self._pixmap)
Ejemplo n.º 2
0
 def __init__(self, parent=None, init_channel=None):
     QLabel.__init__(self, parent)
     PyDMWidget.__init__(self, init_channel=init_channel)
     self.app = QApplication.instance()
     self.setTextFormat(Qt.PlainText)
     self.setTextInteractionFlags(Qt.NoTextInteraction)
     self.setText("PyDMLabel")
     self._display_format_type = self.DisplayFormat.Default
     self._string_encoding = "utf_8"
     if is_pydm_app():
         self._string_encoding = self.app.get_string_encoding()
Ejemplo n.º 3
0
    def __init__(self, model, help_link=""):
        QLabel.__init__(self)

        addHelpToWidget(self, help_link)
        self._model = model

        font = self.font()
        font.setWeight(QFont.Bold)
        self.setFont(font)

        self._model.valueChanged.connect(self.updateLabel)

        self.updateLabel()
Ejemplo n.º 4
0
 def __init__(self, parent=None, init_channel=None):
     QLabel.__init__(self, parent)
     PyDMWidget.__init__(self, init_channel=init_channel)
     if 'Text' not in PyDMLabel.RULE_PROPERTIES:
         PyDMLabel.RULE_PROPERTIES = PyDMWidget.RULE_PROPERTIES.copy()
         PyDMLabel.RULE_PROPERTIES.update({'Text': ['value_changed', str]})
     self.app = QApplication.instance()
     self.setTextFormat(Qt.PlainText)
     self.setTextInteractionFlags(Qt.NoTextInteraction)
     self.setText("PyDMLabel")
     self._display_format_type = self.DisplayFormat.Default
     self._string_encoding = "utf_8"
     if is_pydm_app():
         self._string_encoding = self.app.get_string_encoding()
Ejemplo n.º 5
0
 def __init__(self, parent=None, scale=1):
     QLabel.__init__(self, parent)
     # self.setText("")
     self.red_icon = QtGui.QPixmap(":/icons/Icon_Library/red_light.png")
     self.green_icon = QtGui.QPixmap(":/icons/Icon_Library/greenLight2.png")
     self.setPixmap(self.red_icon)
     self.state = False
     self.clickable = True  # set the possibility to click and control the state of the LED otherwise it behaves as an indicator
     clickable(self).connect(
         self.LED_Clicked)  # clickable is a function importing a filter class to deal with mouse down event as a signal see GUI_utils
     self.setText("empty")
     self.setMaximumWidth(self.height())
     if scale != 1:
         self.scale(scale)
     self.set_as_false()
Ejemplo n.º 6
0
 def __init__(self, parent=None, init_channel=None):
     QLabel.__init__(self, parent)
     PyDMWidget.__init__(self, init_channel=init_channel)
     if 'Text' not in PyDMLabel.RULE_PROPERTIES:
         PyDMLabel.RULE_PROPERTIES = PyDMWidget.RULE_PROPERTIES.copy()
         PyDMLabel.RULE_PROPERTIES.update(
             {'Text': ['value_changed', str]})
     self.app = QApplication.instance()
     self.setTextFormat(Qt.PlainText)
     self.setTextInteractionFlags(Qt.NoTextInteraction)
     self.setText("PyDMLabel")
     self._display_format_type = self.DisplayFormat.Default
     self._string_encoding = "utf_8"
     if is_pydm_app():
         self._string_encoding = self.app.get_string_encoding()
Ejemplo n.º 7
0
 def __init__(
     self,
     text,
     parent=None,
     angle=270,
     family=None,
     bold=False,
     italic=False,
     color=None,
 ):
     QLabel.__init__(self, text, parent)
     font = self.font()
     if family is not None:
         font.setFamily(get_family(family))
     font.setBold(bold)
     font.setItalic(italic)
     self.setFont(font)
     self.color = color
     self.angle = angle
     self.setAlignment(Qt.AlignCenter)
Ejemplo n.º 8
0
    def __init__(self, parent, arr):
        QLabel.__init__(self)

        # we need to hold a reference to
        # arr because QImage doesn't copy the data
        # and the buffer must be alive as long
        # as the image is alive.
        self.arr = arr

        # we also need to pass in the row-stride to
        # the constructor, because we can't guarantee
        # that every row of the numpy data is
        # 4-byte aligned. Which Qt would require
        # if we didn't pass the stride.
        self.img = QImage(arr.data, arr.shape[1], arr.shape[0], arr.strides[0],
                          QImage.Format_RGB888)
        self.pm = QPixmap.fromImage(self.img)
        self.setPixmap(self.pm)
        self.setAlignment(QtCore.Qt.AlignTop)
        self.setMinimumSize(100, 100)
Ejemplo n.º 9
0
    def __init__(self, parent, arr):
        QLabel.__init__(self)

        # we need to hold a reference to
        # arr because QImage doesn't copy the data
        # and the buffer must be alive as long
        # as the image is alive.
        self.arr = arr

        # we also need to pass in the row-stride to
        # the constructor, because we can't guarantee
        # that every row of the numpy data is
        # 4-byte aligned. Which Qt would require
        # if we didn't pass the stride.
        self.img = QImage(arr.data, arr.shape[1], arr.shape[0],
                          arr.strides[0], QImage.Format_RGB888)
        self.pm = QPixmap.fromImage(self.img)
        self.setPixmap(self.pm)
        self.setAlignment(QtCore.Qt.AlignTop)
        self.setMinimumSize(100, 100)
Ejemplo n.º 10
0
    def __init__(self, params):
        MWB.__init__(self, params)
        QLabel.__init__(self)

        self.resize(200, 200)
Ejemplo n.º 11
0
 def __init(self, parent):
     QLabel.__init__(self, parent)