def __init__(self,
                 sizes=None,
                 colors=None,
                 parent=None,
                 slider_style=2,
                 show_write_label=False):
        QTangoAttributeBase.__init__(self, sizes, colors, parent)
        self.unit = None
        self.prefixDict = {
            'k': 1e3,
            'M': 1e6,
            'G': 1e9,
            'T': 1e12,
            'P': 1e15,
            'm': 1e-3,
            'u': 1e-6,
            'n': 1e-9,
            'p': 1e-12,
            'f': 1e-15,
            'c': 1e-2
        }
        self.prefix = None
        self.prefixFactor = 1.0

        self.setupLayout(slider_style, show_write_label)
Пример #2
0
    def __init__(self,
                 name=None,
                 sizes=None,
                 colors=None,
                 chronological=True,
                 parent=None):
        QTangoAttributeBase.__init__(self, sizes, colors, parent)
        pg.PlotWidget.__init__(self, useOpenGL=True)

        self.unselected_pen_width = 1.5
        self.selected_pen_width = 3.0

        self.values_size = 1000
        self.duration = 600.0
        self.x_values = list()
        self.y_values = list()

        self.legend = None
        self.curve_focus = 0
        self.curve_name_list = list()
        self.curve_vb_list = list()
        self.curve_ax_list = list()
        self.value_trend_curves = list()
        self.current_data_index = list()

        self.trend_menu = None

        self.chronological = chronological

        self.setupLayout(name)
        self.setupTrendMenu()
        self.addCurve(name)
        self.setCurveFocus(0)
Пример #3
0
 def __init__(self, sizes=None, colors=None, parent=None):
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     self.startLabel = None
     self.endLabel = None
     self.nameLabel = None
     self.stateLabel = None
     self.statusLabel = None
     self.setupLayout()
Пример #4
0
 def __init__(self, sizes=None, colors=None, precision=4, parent=None):
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     QtWidgets.QLabel.__init__(self, parent)
     self.precision = precision
     self.data_format = "%6.3f"
     self.suffix = ""
     self.current_value = 0.0
     self.currentAttrColor = self.attrColors.secondaryColor0
     self.setupLayout()
Пример #5
0
    def __init__(self, sizes=None, colors=None, precision=4, parent=None):
        QTangoAttributeBase.__init__(self, sizes, colors, parent)

        self.writeValueInitialized = False
        self.unit = None
        self.precision = precision
        self.prefix = None

        self.setupLayout()
Пример #6
0
    def __init__(self, title, slot=None, sizes=None, colors=None, parent=None):
        QTangoAttributeBase.__init__(self, sizes, colors, parent)
        QtWidgets.QPushButton.__init__(self, parent)
        self.name = title

        if slot is not None:
            self.clicked.connect(slot)

        self.setupLayout()
 def configureAttribute(self, attr_info):
     QTangoAttributeBase.configureAttribute(self, attr_info)
     try:
         min_warning = float(self.attrInfo.alarms.min_warning)
     except ValueError:
         min_warning = -np.inf
     try:
         max_warning = float(self.attrInfo.alarms.max_warning)
     except ValueError:
         max_warning = np.inf
     self.setAttributeWarningLimits((min_warning, max_warning))
     self.valueSpinbox.setSuffix(''.join((' ', self.attrInfo.unit)))
Пример #8
0
    def __init__(self, sizes=None, colors=None, parent=None):
        QTangoAttributeBase.__init__(self, sizes, colors, parent)
        QtWidgets.QLineEdit.__init__(self, parent)

        self.storedCursorPos = 0
        self.lastKey = QtCore.Qt.Key_0

        self.dataValue = 1.0
        self.dataFormat = "{:.4g}"
        self.dataFormat = "%.4g"

        self.setupLayout()
Пример #9
0
 def configureAttribute(self, attr_info):
     QTangoAttributeBase.configureAttribute(self, attr_info)
     try:
         min_warning = float(self.attrInfo.alarms.min_warning)
     except ValueError:
         min_warning = -np.inf
     try:
         max_warning = float(self.attrInfo.alarms.max_warning)
     except ValueError:
         max_warning = np.inf
     self.setWarningLimits((min_warning, max_warning))
     self.setUnit(self.attrInfo.unit)
Пример #10
0
    def __init__(self, sizes=None, colors=None, parent=None):
        QtWidgets.QDoubleSpinBox.__init__(self, parent)
        QTangoAttributeBase.__init__(self, sizes, colors, parent)
        self.attrColors = colors
        self.sizes = sizes
        self.state = 'UNKNOWN'
        self.quality = 'UNKNOWN'
        self.current_attr_color = self.attrColors.secondaryColor0
        self.current_attr_color = self.attrColors.unknownColor

        logger.debug("QTangoReadAttributeSpinBox: init")
        self.setupLayout()
        logger.debug("QTangoReadAttributeSpinBox: init done")
Пример #11
0
 def __init__(self,
              position="bottom",
              sizes=None,
              colors=None,
              parent=None):
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     self.position = position
     self.items = OrderedDict()
     self.item_name_list = list()
     self.legend_gridlayout = QtWidgets.QGridLayout()
     self.max_col = None
     self.set_position(position)
     self.current_focus_item = None
 def configureAttribute(self, attr_info):
     logger.debug("Configuring attribute {0}".format(attr_info.name))
     QTangoAttributeBase.configureAttribute(self, attr_info)
     try:
         min_warning = float(self.attrInfo.alarms.min_warning)
     except ValueError:
         min_warning = -np.inf
     try:
         max_warning = float(self.attrInfo.alarms.max_warning)
     except ValueError:
         max_warning = np.inf
     logger.debug("min_warning {0}, max_warning {1}".format(
         min_warning, max_warning))
     self.setAttributeWarningLimits((min_warning, max_warning))
Пример #13
0
    def __init__(self,
                 name=None,
                 legend_pos="bottom",
                 sizes=None,
                 colors=None,
                 chronological=True,
                 parent=None):
        QTangoAttributeBase.__init__(self, sizes, colors, parent)
        self.setObjectName(self.__class__.__name__)
        self.colors = colors  # type: QTangoColors
        self.sizes = sizes
        self.name = name

        self.plot_widget = QTangoStripToolPlotWidget(name, sizes, colors,
                                                     chronological)
        self.plot_widget.get_curve(0).sigClicked.connect(self.set_curve_focus)
        logger.debug("Plot widget created")
        self.legend_widget = QTangoStripToolLegendWidget(
            legend_pos, sizes, colors)
        legend_item = QTangoStripToolLegendItem(name,
                                                unit="m",
                                                sizes=self.sizes,
                                                colors=self.colors)
        legend_item.clicked.connect(self.set_curve_focus)
        self.legend_widget.addItem(legend_item)
        logger.debug("Legend widget created")

        self.set_legend_position(legend_pos)

        s = str(self.styleSheet())
        use_background_color = True
        color = self.attrColors.backgroundColor
        st = """QTangoStripTool {{
                      border-width: 0px;
                      border-color: {0};
                      border-style: solid;
                      border-radius: 0px;
                      adding: 2px;
                      margin: 1px;
                      color: {0};
                      background-color: #555500;
                      }}""".format(self.attrColors.secondaryColor0,
                                   self.attrColors.backgroundColor)
        self.setStyleSheet(st)
        legend_item.clicked.emit()
Пример #14
0
 def __init__(self, sizes=None, colors=None, parent=None):
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     self.unit = None
     self.prefixDict = {
         'k': 1e-3,
         'M': 1e-6,
         'G': 1e-9,
         'T': 1e-12,
         'P': 1e-15,
         'm': 1e3,
         'u': 1e6,
         'n': 1e9,
         'p': 1e12,
         'f': 1e15,
         'c': 1e2
     }
     self.prefix = None
     self.prefixFactor = 1.0
     self.setupLayout()
    def configureAttribute(self, attr_info):
        logger.debug("Configuring attribute {0}".format(attr_info.name))
        QTangoAttributeBase.configureAttribute(self, attr_info)
        try:
            min_warning = float(self.attrInfo.alarms.min_warning)
        except ValueError:
            min_warning = -np.inf
        try:
            max_warning = float(self.attrInfo.alarms.max_warning)
        except ValueError:
            max_warning = np.inf
        logger.debug("min_warning {0}, max_warning {1}".format(
            min_warning, max_warning))
        self.setAttributeWarningLimits((min_warning, max_warning))
        logger.debug("unit {0}".format(self.attrInfo.unit))
        self.setUnit(self.attrInfo.unit)

        self.valueLabel.data_format = attr_info.format
        if self.is_write_widget is True:
            self.writeValueEdit.dataFormat = attr_info.format
    def __init__(self,
                 sizes=None,
                 colors=None,
                 parent=None,
                 slider_style=2,
                 show_write_widget=False):
        QTangoAttributeBase.__init__(self, sizes, colors, parent)
        self.newValueSignal = None

        self.nameLabel = None
        self.startLabel = None
        self.endLabel = None
        self.unitLabel = None
        self.valueLabel = None

        self.writeValueInitialized = False
        self.is_write_widget = show_write_widget

        self.unit = None
        self.prefixDict = {
            'k': 1e3,
            'M': 1e6,
            'G': 1e9,
            'T': 1e12,
            'P': 1e15,
            'm': 1e-3,
            'u': 1e-6,
            'n': 1e-9,
            'p': 1e-12,
            'f': 1e-15,
            'c': 1e-2
        }
        self.prefix = None
        self.prefixFactor = 1.0

        # self.setup_horizontal(1, False)
        self.setupLayout(slider_style, show_write_widget)
Пример #17
0
 def __init__(self,
              name,
              range=[0, 1],
              color=None,
              unit=None,
              sizes=None,
              colors=None,
              parent=None):
     QtWidgets.QFrame.__init__(self)
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     self.setObjectName(self.__class__.__name__)
     logger.debug("New legend item: {0}, {1}".format(
         name, self.objectName()))
     self.name = name
     self.range = range
     self.unit = unit
     if color is None:
         self.color = self.attrColors.secondaryColor0
     else:
         self.color = color
     self.border_width = 1
     lay = QtWidgets.QHBoxLayout()
     self.name_label = QtWidgets.QLabel(name)
     self.range_label = QtWidgets.QLabel("[{0}-{1}] ".format(
         to_precision2(range[0], 2, 4, True),
         to_precision2(range[1], 2, 4, True)))
     self.unit_label = QtWidgets.QLabel(unit)
     lay.addWidget(self.name_label)
     lay.addSpacerItem(
         QtWidgets.QSpacerItem(3, 0, QtWidgets.QSizePolicy.Expanding,
                               QtWidgets.QSizePolicy.Fixed))
     lay.addWidget(self.range_label)
     lay.addWidget(self.unit_label)
     self.setLayout(lay)
     self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                        QtWidgets.QSizePolicy.Fixed)
     self.update_stylesheet()
Пример #18
0
 def __init__(self):
     QtWidgets.QFrame.__init__(self)
     QTangoAttributeBase.__init__(self)
     self.setObjectName(self.__class__.__name__)
     self.l1 = QtWidgets.QLabel("test")
     self.l2 = QtWidgets.QLabel("apa")
     self.setLayout(QtWidgets.QHBoxLayout())
     self.layout().addWidget(self.l1)
     self.layout().addWidget(self.l2)
     self.attrColors = QTangoColors()
     st = ''.join(
         ("DummyLabel {\n", 'border-width: 2px; \n', 'border-color: ',
          self.attrColors.secondaryColor0, '; \n',
          'border-style: solid; \n', 'border-radius: 0px; \n',
          'padding: 2px; \n', 'margin: 1px; \n', 'color: ',
          self.attrColors.secondaryColor0, "; \n", 'background-color: ',
          self.attrColors.backgroundColor, ';}\n', "QLabel {\n",
          'border-width: 0px; \n', 'border-color: ',
          self.attrColors.secondaryColor0, '; \n',
          'border-style: solid; \n', 'border-radius: 0px; \n',
          'padding: 2px; \n', 'margin: 1px; \n', 'color: ',
          self.attrColors.secondaryColor0, "; \n", 'background-color: ',
          self.attrColors.backgroundColor, ';}'))
     self.setStyleSheet(st)
Пример #19
0
 def __init__(self, sizes=None, colors=None, parent=None):
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     self.setupLayout()
Пример #20
0
 def __init__(self, sizes=None, colors=None, parent=None):
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     QtWidgets.QComboBox.__init__(self, parent)
     self.setupLayout()
Пример #21
0
 def __init__(self, title, sizes=None, colors=None, parent=None):
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     self.cmdButtons = OrderedDict()
     self.title = title
     self.layout = None
     self.setupLayout()
Пример #22
0
 def setState(self, state):
     QTangoAttributeBase.setState(self, state)
     self.setText(self.state)
Пример #23
0
 def __init__(self, sizes=None, colors=None, parent=None):
     QTangoAttributeBase.__init__(self, sizes, colors, parent)
     QtWidgets.QLabel.__init__(self, parent)
     self.unit_text = ''
     self.currentAttrColor = self.attrColors.secondaryColor0
     self.setupLayout()
Пример #24
0
 def setState(self, state):
     QTangoAttributeBase.setState(self, state, use_background_color=True)
Пример #25
0
 def setQuality(self, quality):
     QTangoAttributeBase.setQuality(self, quality, use_background_color=True)