Beispiel #1
0
    def _setup_ui(self):

        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)

        form_vbox = self.vbox = QtGui.QVBoxLayout(self)

        hbox2 = QtGui.QVBoxLayout(self)
        self.device_and_state = DevnameAndState(self)
        hbox2.addWidget(self.device_and_state)
        self.magnet_type_label = QtGui.QLabel("Magnet type:")
        hbox2.addWidget(self.magnet_type_label)
        form_vbox.addLayout(hbox2)

        # attributes
        self.form = MAXForm(withButtons=False)
        form_vbox.addWidget(self.form, stretch=1)
        self.status_area = StatusArea(self)
        form_vbox.addWidget(self.status_area)
        hbox.addLayout(form_vbox)

        # value bar
        self.valuebar = MAXValueBar(self)
        slider_vbox = QtGui.QVBoxLayout(self)
        slider_vbox.setContentsMargins(10, 10, 10, 10)
        hbox.addLayout(slider_vbox)
        self.current_label = TaurusLabel()
        self.current_label.setAlignment(QtCore.Qt.AlignCenter)
        slider_vbox.addWidget(self.valuebar, 1)
        slider_vbox.addWidget(self.current_label)
Beispiel #2
0
    def defineStyle(self):
        """ Defines the initial style for the widget """
        self.setWindowTitle('Properties')
        self.setColumnCount(2)
        self.setRowCount(0)
        self.setGeometry(QtCore.QRect(0, 0, 400, 500))

        self.setColumnWidth(0, 124)
        self.setColumnWidth(1, 254)

        headerItem = QtGui.QTableWidgetItem()
        headerItem.setText(
            QtGui.QApplication.translate("PLCTabWidget", "Property Name", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.setHorizontalHeaderItem(0, headerItem)

        headerItem1 = QtGui.QTableWidgetItem()
        headerItem1.setText(
            QtGui.QApplication.translate("PLCTabWidget", "Value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.setHorizontalHeaderItem(1, headerItem1)
        hh = self.horizontalHeader()
        if hh.length() > 0:
            try:
                hh.setSectionResizeMode(hh.ResizeToContents)
            except AttributeError:  # PyQt4
                hh.setResizeMode(hh.ResizeToContents)
Beispiel #3
0
    def _setup_ui(self):
        vbox = QtGui.QVBoxLayout(self)
        self.setLayout(vbox)

        grid = QtGui.QGridLayout()
        self.form = MAXForm(withButtons=False)

        grid.addWidget(self.form, 0, 0, 2, 1)
        # rescale taurus form methode
        self.form.scrollArea.sizeHint = self.scaleSize
        self.status_label = StatusArea()
        grid.addWidget(self.status_label, 0, 1, 1, 1)

        commandbox = QtGui.QVBoxLayout(self)
        self.start_button = TaurusCommandButton(command="StartCycle")
        self.start_button.setUseParentModel(True)
        self.stop_button = TaurusCommandButton(command="StopCycle")
        self.stop_button.setUseParentModel(True)
        commandbox.addWidget(self.start_button)
        commandbox.addWidget(self.stop_button)
        grid.addLayout(commandbox, 1, 1, 1, 1)

        vbox.addLayout(grid)

        self.trend = TaurusTrend()
        vbox.addWidget(self.trend, stretch=1)
        self.trend_trigger.connect(self.set_trend_paused)

        self.cyclingState = None
Beispiel #4
0
 def build_diff_table(self, data):
     self.comp._wi.tableWidget.clear()
     cols=7
     self.comp._wi.tableWidget.setColumnCount(cols)
     self.comp._wi.tableWidget.setHorizontalHeaderLabels(["Attribute Name", "RV1", "WV1", "RV2", "WV2", "diff1", "diff2"])
     self.comp._wi.tableWidget.setGeometry(QtCore.QRect(20, 190, 500, 400))
     if data:
         rows=len(data)
         self.comp._wi.tableWidget.setRowCount(rows)
         for row in range(0, rows):
                 for col in range(0, cols):
                     item=QtGui.QTableWidgetItem("%s" % data[row][col])
                     if (data[row][col]==None or data[row][col]=='None'):
                         item=QtGui.QTableWidgetItem("%s" %"X")
                         item.setTextColor(QtGui.QColor(255,0,0))
                     if row%2==0:
                         item.setBackgroundColor(QtGui.QColor(225,225,225))
                     if (col==5 or col==6) and (data[row][col]!=0) and (data[row][col]!='None') and (data[row][col]!=None):
                         item.setBackgroundColor(QtGui.QColor(45,150,255))
                     elif (col==1 or col==2):
                         if (data[row][col]>data[row][col+2]):
                             item.setBackgroundColor(QtGui.QColor(255,0,0))
                         elif(data[row][col]<data[row][col+2]):
                             item.setBackgroundColor(QtGui.QColor(255,255,0))
                     elif (col==3 or col==4):
                         if (data[row][col]>data[row][col-2]):
                             item.setBackgroundColor(QtGui.QColor(255,0,0))
                         elif (data[row][col]<data[row][col-2]):
                             item.setBackgroundColor(QtGui.QColor(255,255,0))
                     self.comp._wi.tableWidget.setItem(row,col,item)
     else:
         self.comp._wi.tableWidget.setRowCount(1)
         item=QtGui.QTableWidgetItem("%s" % QtCore.QString('No Data!'))
         self.comp._wi.tableWidget.setItem(0, 0, item)
     self.comp._wi.tableWidget.resizeColumnsToContents()
Beispiel #5
0
 def setPropertyValue(self, value, i, j):
     ''' This method inserts a new table widget inside the cell
     @deprecated ... use setText() and editProperty() event call instead!!!
     '''
     if len(value) == 1 and isinstance(value[0], string_types):
         value = value[0]
     if isinstance(value, string_types):  # and '\n' in value:
         value = value.split('\n')
     if False:  # isinstance(value,str):
         item = QtGui.QTableWidgetItem()
         item.setText(
             QtGui.QApplication.translate("PLCTabWidget", value, None,
                                          QtGui.QApplication.UnicodeUTF8))
         self.setItem(i, j, item)
     else:
         item = QtGui.QTableWidget(len(value), 1)
         item.setItemDelegate(Delegate(item))
         item.horizontalHeader().hide()
         item.verticalHeader().hide()
         # item.setGridStyle(Qt.Qt.DashLine)
         for k, v in enumerate(value):
             cell = QtGui.QTableWidgetItem()
             cell.setText(
                 QtGui.QApplication.translate(
                     "PLCTabWidget", v, None,
                     QtGui.QApplication.UnicodeUTF8))
             item.setItem(k, 0, cell)
         item.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
                            QtGui.QSizePolicy.MinimumExpanding)
         self.setCellWidget(i, j, item)
         self.resizeColumnsToContents()
         self.resizeRowsToContents()
     return
Beispiel #6
0
    def __init__(self,
                 parent=None,
                 period=0,
                 text="Forced read",
                 autoconnect=True):
        BaseConfigurableClass.__init__(self)
        QtGui.QWidgetAction.__init__(self, parent)

        # defining the widget
        self._w = QtGui.QWidget()
        self._w.setLayout(QtGui.QHBoxLayout())
        tt = "Period between forced readings.\nSet to 0 to disable"
        self._w.setToolTip(tt)
        self._label = QtGui.QLabel(text)
        self._w.layout().addWidget(self._label)
        self._sb = QtGui.QSpinBox()
        self._w.layout().addWidget(self._sb)
        self._sb.setRange(0, 604800000)
        self._sb.setValue(period)
        self._sb.setSingleStep(500)
        self._sb.setSuffix(" ms")
        self._sb.setSpecialValueText("disabled")
        self._autoconnect = autoconnect

        self.setDefaultWidget(self._w)

        # register config properties
        self.registerConfigProperty(self.period, self.setPeriod, "period")
        self.registerConfigProperty(self.autoconnect, self.setAutoconnect,
                                    "autoconnect")

        # internal conections
        self._sb.valueChanged[int].connect(self._onValueChanged)
Beispiel #7
0
    def _setup_ui(self):
        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)
        form_vbox = QtGui.QVBoxLayout(self)

        # devicename label
        hbox2 = QtGui.QVBoxLayout(self)
        self.device_and_state = DevnameAndState(self)
        hbox2.addWidget(self.device_and_state, stretch=2)

        # commands
        commandbox = QtGui.QHBoxLayout(self)
        self.start_button = TaurusCommandButton(command="Start")
        self.start_button.setUseParentModel(True)
        self.stop_button = TaurusCommandButton(command="Stop")
        self.stop_button.setUseParentModel(True)
        self.init_button = TaurusCommandButton(command="Init")
        self.init_button.setUseParentModel(True)
        self.on_button = TaurusCommandButton(command="On")
        self.on_button.setUseParentModel(True)
        self.off_button = TaurusCommandButton(command="Off")
        self.off_button.setUseParentModel(True)
        self.enable_trigger_button = TaurusCommandButton(
            command="EnableTrigger")
        self.enable_trigger_button.setUseParentModel(True)
        self.disable_trigger_button = TaurusCommandButton(
            command="DisableTrigger")
        self.disable_trigger_button.setUseParentModel(True)
        self.reset_button = TaurusCommandButton(command="Reset")
        self.reset_button.setUseParentModel(True)
        commandbox.addWidget(self.start_button)
        commandbox.addWidget(self.stop_button)
        commandbox.addWidget(self.init_button)
        commandbox.addWidget(self.on_button)
        commandbox.addWidget(self.off_button)
        commandbox.addWidget(self.enable_trigger_button)
        commandbox.addWidget(self.disable_trigger_button)
        commandbox.addWidget(self.reset_button)
        hbox2.addLayout(commandbox, stretch=1)
        form_vbox.addLayout(hbox2)

        # attributes
        self.form = MAXForm(withButtons=False)

        form_vbox.addLayout(commandbox)
        form_vbox.addWidget(self.form, stretch=1)
        self.status_area = StatusArea()
        form_vbox.addWidget(self.status_area)
        hbox.addLayout(form_vbox)

        # value bar
        self.valuebar = MAXValueBar(self)
        slider_vbox = QtGui.QVBoxLayout(self)
        slider_vbox.setContentsMargins(10, 10, 10, 10)
        hbox.addLayout(slider_vbox)
        self.current_label = TaurusLabel()
        self.current_label.setAlignment(QtCore.Qt.AlignCenter)
        slider_vbox.addWidget(self.valuebar, 1)
        slider_vbox.addWidget(self.current_label)
Beispiel #8
0
 def create_frame_with_gridlayout(self):
     """ Just a 'macro' to create the layouts that seem to fit better. """
     frame = QtGui.QFrame()
     frame.setLayout(QtGui.QGridLayout())
     frame.layout().setContentsMargins(2, 2, 2, 2)
     frame.layout().setSpacing(0)
     frame.layout().setSpacing(0)
     return frame
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.setLayout(QtGui.QHBoxLayout())
     self.layout().setMargin(0)
     self.layout().setSpacing(0)
     self.emptyLabel = QtGui.QLabel("")
     self.layout().addWidget(self.emptyLabel)
     self._qlineedits = []
Beispiel #10
0
    def _setup_ui(self):
        vbox = QtGui.QVBoxLayout(self)
        self.setLayout(vbox)

        label = QtGui.QLabel("All magnets in the circuit")
        label.setAlignment(QtCore.Qt.AlignCenter)
        vbox.addWidget(label)

        self.table = DeviceRowsTable()
        vbox.addWidget(self.table)
Beispiel #11
0
 def initComponents(self):
     widgetLayout = QtGui.QVBoxLayout(self)
     widgetLayout.setContentsMargins(10, 10, 10, 10)
     self.editText = QtGui.QTextEdit()
     self.buttonBox = QtGui.QDialogButtonBox()
     self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
     self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                       | QtGui.QDialogButtonBox.NoButton
                                       | QtGui.QDialogButtonBox.Ok)
     widgetLayout.addWidget(self.editText)
     widgetLayout.addWidget(self.buttonBox)
Beispiel #12
0
    def _setup_ui(self):
        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)

        self.button = QtGui.QPushButton()
        #self.button.setText()
        self.button.setCheckable(True)
        hbox.addWidget(self.button)

        self.button.clicked.connect(self.onClick)
        self.state_trigger.connect(self.change_state)
Beispiel #13
0
    def __init__(self, parent=None, **kwargs):

        TaurusBaseComponent.__init__(self, 'TaurusTrend')
        PlotWidget.__init__(self, parent=parent, **kwargs)

        # set up cyclic color generator
        self._curveColors = LoopList(CURVE_COLORS)
        self._curveColors.setCurrentIndex(-1)

        plot_item = self.getPlotItem()
        menu = plot_item.getViewBox().menu

        # add save & retrieve configuration actions
        saveConfigAction = QtGui.QAction('Save configuration', menu)
        saveConfigAction.triggered.connect(self.saveConfigFile)
        menu.addAction(saveConfigAction)

        loadConfigAction = QtGui.QAction('Retrieve saved configuration', menu)
        loadConfigAction.triggered.connect(self.loadConfigFile)
        menu.addAction(loadConfigAction)

        self.registerConfigProperty(self._getState,
                                    self.restoreState, 'state')

        # add legend tool
        legend_tool = PlotLegendTool(self)
        legend_tool.attachToPlotItem(plot_item)

        # add model chooser
        self._model_chooser_tool = TaurusModelChooserTool(
            self, itemClass=TaurusTrendSet)
        self._model_chooser_tool.attachToPlotItem(plot_item)

        # add Y2 axis
        self._y2 = Y2ViewBox()
        self._y2.attachToPlotItem(plot_item)

        # Add time X axis
        axis = DateAxisItem(orientation='bottom')
        axis.attachToPlotItem(plot_item)

        # add plot configuration dialog
        cprop_tool = CurvesPropertiesTool(self)
        cprop_tool.attachToPlotItem(plot_item, y2=self._y2)

        # add force read tool
        fr_tool = ForcedReadTool(self)
        fr_tool.attachToPlotItem(self.getPlotItem())

        # Register config properties
        self.registerConfigDelegate(self._y2, 'Y2Axis')
        self.registerConfigDelegate(legend_tool, 'legend')
        self.registerConfigDelegate(fr_tool, 'forceread')
Beispiel #14
0
    def _setup_ui(self):
        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)

        self.table = QtGui.QTableWidget(parent=self)

        hbox.addWidget(self.table)

        self.trigger.connect(self.update_item)
        self.table.itemClicked.connect(self.on_item_clicked)

        self._items = {}
        self.attributes = {}
Beispiel #15
0
    def _setup_ui(self):
        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)

        self.table = QtGui.QTableWidget()
        self.table.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)

        hbox.addWidget(self.table)

        self.trigger.connect(self.updateColumn)
        self.attributes = []
        self._columns = []
        self._values = {}
        self._config = {}
Beispiel #16
0
 def _getWarningWidget(self):
     w = Qt.QWidget()
     layout = QtGui.QHBoxLayout()
     w.setLayout(layout)
     icon = QtGui.QIcon.fromTheme('dialog-warning')
     pixmap = QtGui.QPixmap(icon.pixmap(QtCore.QSize(32, 32)))
     label_icon = QtGui.QLabel()
     label_icon.setPixmap(pixmap)
     label = QtGui.QLabel('This experiment configuration dialog '
                          'updates automatically on external changes!')
     layout.addWidget(label_icon)
     layout.addWidget(label)
     layout.addStretch(1)
     return w
Beispiel #17
0
 def buildTable(self, snap):
     self.tableWidget.clear()
     self.tableWidget.setColumnCount(3)
     self.tableWidget.setRowCount(len(snap))
     self.tableWidget.setHorizontalHeaderLabels(
         ["Attribute Name", "Read Value", "Write Value"])
     i = 0
     for value in sorted(snap):
         item = QtGui.QTableWidgetItem("%s" % value[0])
         self.tableWidget.setItem(i, 0, item)
         if (type(value[1]) is not tuple):
             item1 = QtGui.QTableWidgetItem("%s" % value[1])
             self.tableWidget.setItem(i, 1, item1)
             item2 = QtGui.QTableWidgetItem("%s" % 'None')
         else:
             item1 = QtGui.QTableWidgetItem("%s" % value[1][0])
             self.tableWidget.setItem(i, 1, item1)
             item2 = QtGui.QTableWidgetItem("%s" % value[1][1])
         self.tableWidget.setItem(i, 2, item2)
         if i % 2 == 0:
             item.setBackgroundColor(QtGui.QColor(225, 225, 225))
             item1.setBackgroundColor(QtGui.QColor(225, 225, 225))
             item2.setBackgroundColor(QtGui.QColor(225, 225, 225))
         i = i + 1
     self.tableWidget.resizeColumnsToContents()
Beispiel #18
0
    def __init__(self, parent=None, **kwargs):
        if Qt.QT_VERSION < 0x050000:
            # Workaround for issue when using super with pyqt<5
            BaseConfigurableClass.__init__(self)
            PlotWidget.__init__(self, parent=parent, **kwargs)
        else:
            super(TaurusPlot, self).__init__(parent=None, **kwargs)

        # set up cyclic color generator
        self._curveColors = LoopList(CURVE_COLORS)
        self._curveColors.setCurrentIndex(-1)

        # add save & retrieve configuration actions
        menu = self.getPlotItem().getViewBox().menu
        saveConfigAction = QtGui.QAction("Save configuration", menu)
        saveConfigAction.triggered.connect(self.saveConfigFile)
        menu.addAction(saveConfigAction)

        loadConfigAction = QtGui.QAction("Retrieve saved configuration", menu)
        loadConfigAction.triggered.connect(self.loadConfigFile)
        menu.addAction(loadConfigAction)

        self.registerConfigProperty(self._getState, self.restoreState, "state")

        # add legend tool
        legend_tool = PlotLegendTool(self)
        legend_tool.attachToPlotItem(self.getPlotItem())

        # add model chooser
        self._model_chooser_tool = TaurusXYModelChooserTool(self)
        self._model_chooser_tool.attachToPlotItem(self.getPlotItem(), self,
                                                  self._curveColors)

        # add Y2 axis
        self._y2 = Y2ViewBox()
        self._y2.attachToPlotItem(self.getPlotItem())

        # add plot configuration dialog
        cprop_tool = CurvesPropertiesTool(self)
        cprop_tool.attachToPlotItem(self.getPlotItem(), y2=self._y2)

        # add a data inspector
        inspector_tool = DataInspectorTool(self)
        inspector_tool.attachToPlotItem(self.getPlotItem())

        # Register config properties
        self.registerConfigDelegate(self._y2, "Y2Axis")
        self.registerConfigDelegate(legend_tool, "legend")
        self.registerConfigDelegate(inspector_tool, "inspector")
Beispiel #19
0
 def _setup_ui(self):
     # layout
     hbox = QtGui.QHBoxLayout(self)
     self.setLayout(hbox)
     # tabs
     tabs = self.tabs = TaurusLazyQTabWidget()
     hbox.addWidget(tabs)
     # magnet
     self.circuit_widget = MagnetCircuitPanel()
     self.circuit_tab = tabs.addTab(self.circuit_widget, "Circuit")
     # ps
     self.ps_widget = PowerSupplyPanel()
     self.ps_tab = tabs.addTab(self.ps_widget, "Power supply")
     # magnet
     self.magnets_widget = MagnetListPanel()
     self.magnets_tab = tabs.addTab(self.magnets_widget, "Magnets")
     # field
     self.field_widget = FieldPanel()
     self.field_tab = tabs.addTab(self.field_widget, "Field")
     # switchboard
     print('------------- Just before SwitchBoard -------------')
     self.switchboard_widget = SwitchBoardPanel()
     tab = tabs.addTab(self.switchboard_widget, "Switchboard")
     self.switchboard_tab = tab
     # make the PS tab default for now...
     tabs.setCurrentIndex(self.ps_tab)
     self.resize(700, 400)
Beispiel #20
0
 def retranslateUi(self, Form):
     Form.setWindowTitle(
         QtGui.QApplication.translate("Form", "Form", None,
                                      QtGui.QApplication.UnicodeUTF8))
     self.diffSnapLabel.setText(
         QtGui.QApplication.translate("Form", "Snapshot 2:", None,
                                      QtGui.QApplication.UnicodeUTF8))
     self.diffButtonCompare.setText(
         QtGui.QApplication.translate("Form", "Compare", None,
                                      QtGui.QApplication.UnicodeUTF8))
     self.diffButtonCompare.setToolTip(
         QtGui.QApplication.translate("Form", "Compare Snapshots", None,
                                      QtGui.QApplication.UnicodeUTF8))
     icon_compare = QtGui.QIcon(":/actions/view-refresh.svg")
     self.diffButtonCompare.setIcon(icon_compare)
     self.minLabel.setText(
         QtGui.QApplication.translate("Form", "min:", None,
                                      QtGui.QApplication.UnicodeUTF8))
     self.maxLabel.setText(
         QtGui.QApplication.translate("Form", "max:", None,
                                      QtGui.QApplication.UnicodeUTF8))
     self.diffLabel.setText(
         QtGui.QApplication.translate("Form", "diff:", None,
                                      QtGui.QApplication.UnicodeUTF8))
     #self.minLogo.setPixmap(QtGui.QPixmap("img/min.gif"))
     #self.maxLogo.setPixmap(QtGui.QPixmap("img/max.gif"))
     #self.diffLogo.setPixmap(QtGui.QPixmap("img/diff.gif"))
     self.minLogo.setStyleSheet(
         "QLabel { background-color: rgb(255,255,0) }")
     self.maxLogo.setStyleSheet("QLabel { background-color: rgb(255,0,0) }")
     self.diffLogo.setStyleSheet(
         "QLabel { background-color: rgb(45,150,255) }")
Beispiel #21
0
    def _setup_ui(self):
        # layout
        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)
        # tabs
        tabs = self.tabs = TaurusLazyQTabWidget()
        hbox.addWidget(tabs)
        # circuit panel
        self.circuit_widget = MagnetCircuitPanel()
        self.circuit_tab = tabs.addTab(self.circuit_widget, "Circuit")
        # ps panel
        self.ps_widget = PowerSupplyPanel()
        self.ps_tab = tabs.addTab(self.ps_widget, "Power supply")
        # magnet panel
        self.magnets_widget = MagnetListPanel()
        self.magnets_tab = tabs.addTab(self.magnets_widget, "Magnets")
        # cycle panel
        self.cycle_widget = CyclePanel()
        self.cycle_tab = tabs.addTab(self.cycle_widget, "Cycle")
        # field panel
        self.field_widget = FieldPanel()
        self.field_tab = tabs.addTab(self.field_widget, "Field")
        # make the PS tab default for now...
        tabs.setCurrentIndex(self.ps_tab)

        self.resize(700, 450)
Beispiel #22
0
    def build_table(self, values):
        """
        This is a builder. For all the elements in widgets matrix,
        just set the corresponding cells of the QTableWidget.
        """
        self.trace('In TaurusGrid.build_table(%s)' % values)
        widgets_matrix = self.build_widgets(values, self.showLabels)
        rows = len(widgets_matrix)
        cols = rows and len(widgets_matrix[0]) or 0

        table = QtGui.QTableWidget()
        table.setItemDelegate(Delegate(table))
        # This example replaces the blue background of selected cells in tables
        palette = Qt.QPalette()
        palette.setBrush(palette.Active, palette.Highlight,
                         Qt.QBrush(Qt.Qt.white))
        table.setPalette(palette)

        table.setRowCount(rows)
        table.setColumnCount(cols)
        for row in range(len(widgets_matrix)):
            for col in range(len(widgets_matrix[row])):
                table.setCellWidget(row, col, widgets_matrix[row][col])

        # table.resizeColumnsToContents()
        # table.resizeRowsToContents()
        table.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
        # table.verticalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
        # table.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        table.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)

        return table
Beispiel #23
0
 def defineStyle(self):
     """ Defines the initial style for the widget """
     # ----------------------------------------------------------------------
     # Write your own code here to set the initial style of your widget
     #
     self.setLayout(QtGui.QGridLayout())
     # self.layout().setContentsMargins(0,0,0,0)
     self.updateStyle()
Beispiel #24
0
 def _setup_ui(self):
     vbox = QtGui.QHBoxLayout(self)
     self.valuebar = ValueBarWidget()
     vbox.addWidget(self.valuebar)
     self.setLayout(vbox)
     self.value_trigger.connect(self.valuebar.setValue)
     self.conf_trigger.connect(self.updateConfig)
     self.setFocusPolicy(QtCore.Qt.WheelFocus)
Beispiel #25
0
    def _setup_ui(self):

        hbox = QtGui.QVBoxLayout(self)
        self.setLayout(hbox)

        self.status_label = QtGui.QLabel("(No status has been read.)")
        self.status_label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        self.status_label.setWordWrap(True)
        self.status_label.setAlignment(QtCore.Qt.AlignTop)
        status_scroll_area = QtGui.QScrollArea()
        status_scroll_area.setMaximumSize(QtCore.QSize(100000, 100))
        status_scroll_area.setWidgetResizable(True)
        status_scroll_area.setWidget(self.status_label)
        hbox.addWidget(status_scroll_area)
        self.status = None

        self.statusTrigger.connect(self.updateStatus)
Beispiel #26
0
 def setText(self, value, i=None, j=None):
     item = QtGui.QTableWidgetItem()
     item.setFlags(Qt.Qt.ItemIsEnabled)
     item.setText(
         QtGui.QApplication.translate("PLCTabWidget", value, None,
                                      QtGui.QApplication.UnicodeUTF8))
     if i is not None and j is not None:
         self.setItem(i, j, item)
Beispiel #27
0
    def _setup_ui(self):
        vbox = QtGui.QVBoxLayout(self)
        self.setLayout(vbox)

        hbox = QtGui.QHBoxLayout(self)
        label = QtGui.QLabel("Magnetic field components", parent=self)
        label.setAlignment(QtCore.Qt.AlignCenter)
        hbox.addWidget(label)

        # the dropdown to select which magnet's fields to show
        self.magnet_combobox = QtGui.QComboBox(parent=self)
        self.magnet_combobox.currentIndexChanged.connect(self._magnet_selected)
        hbox.addWidget(self.magnet_combobox)
        vbox.addLayout(hbox)

        # the actual field table for the chosen magnet
        self.table = AttributeColumnsTable(parent=self)
        vbox.addWidget(self.table)
Beispiel #28
0
 def __init__(self, parent=None):
     BaseConfigurableClass.__init__(self)
     QtGui.QWidgetAction.__init__(self, parent)
     self._cb = QtGui.QCheckBox()
     self._cb.setText("Show legend")
     self.setDefaultWidget(self._cb)
     self.registerConfigProperty(self._cb.isChecked, self._cb.setChecked,
                                 "checked")
     # TODO: register config prop for legend position
     self._cb.toggled.connect(self._onToggled)
     self._legend = None
Beispiel #29
0
    def __init__(self, parent=None, **kwargs):

        TaurusBaseComponent.__init__(self, 'TaurusPlot')
        PlotWidget.__init__(self, parent=parent, **kwargs)

        # set up cyclic color generator
        self._curveColors = LoopList(CURVE_COLORS)
        self._curveColors.setCurrentIndex(-1)

        # add save & retrieve configuration actions
        menu = self.getPlotItem().getViewBox().menu
        saveConfigAction = QtGui.QAction('Save configuration', menu)
        saveConfigAction.triggered[()].connect(self.saveConfigFile)
        menu.addAction(saveConfigAction)

        loadConfigAction = QtGui.QAction('Retrieve saved configuration', menu)
        loadConfigAction.triggered[()].connect(self.loadConfigFile)
        menu.addAction(loadConfigAction)

        self.registerConfigProperty(self._getState, self.restoreState, 'state')

        # add legend tool
        legend_tool = PlotLegendTool(self)
        legend_tool.attachToPlotItem(self.getPlotItem())

        # add model chooser
        model_chooser_tool = TaurusXYModelChooserTool(self)
        model_chooser_tool.attachToPlotItem(self.getPlotItem(), self,
                                            self._curveColors)

        # add Y2 axis
        self._y2 = Y2ViewBox()
        self._y2.attachToPlotItem(self.getPlotItem())

        # add plot configuration dialog
        cprop_tool = CurvesPropertiesTool(self)
        cprop_tool.attachToPlotItem(self.getPlotItem(), y2=self._y2)

        # Register config properties
        self.registerConfigDelegate(self._y2, 'Y2Axis')
        self.registerConfigDelegate(legend_tool, 'legend')
Beispiel #30
0
def SnapsTool(context=None,show=True):
    Form=QtGui.QWidget()
    ui=SnapForm()
    ui.setupUi(Form)
    taurus.changeDefaultPollingPeriod(3000)
    if context:
        print 'Setting Context ...'
        ui.filterComboBox2.setEditText(context)
        print 'Refresh ...'
        ui.onRefreshPressed()
    if show: Form.show()
    return ui