How to use the taurus.external.qt.Qt.QObject.connect function in taurus

To help you get started, we’ve selected a few taurus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / panel / taurusfilterpanel.py View on Github external
def insertFilterItem(self, row=None):

        sl = self.layout()

        comboBox = Qt.QComboBox()
        self._fillComboBox(comboBox)
        Qt.QObject.connect(comboBox, Qt.SIGNAL("currentIndexChanged(int)"), self.onFilterComboBoxItemSelected)
        
        edit = Qt.QLineEdit()
        
        addButton = Qt.QPushButton(Qt.QIcon(":/actions/list-add.svg"),"")
        Qt.QObject.connect(addButton, Qt.SIGNAL("clicked()"), self.onAddFilterButtonClicked)
        
        removeButton = Qt.QPushButton(Qt.QIcon(":/actions/list-remove.svg"),"")
        Qt.QObject.connect(removeButton, Qt.SIGNAL("clicked()"), 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)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / panel / taurusfilterpanel.py View on Github external
def insertFilterItem(self, row=None):

        sl = self.layout()

        comboBox = Qt.QComboBox()
        self._fillComboBox(comboBox)
        Qt.QObject.connect(comboBox, Qt.SIGNAL("currentIndexChanged(int)"), self.onFilterComboBoxItemSelected)
        
        edit = Qt.QLineEdit()
        
        addButton = Qt.QPushButton(Qt.QIcon(":/actions/list-add.svg"),"")
        Qt.QObject.connect(addButton, Qt.SIGNAL("clicked()"), self.onAddFilterButtonClicked)
        
        removeButton = Qt.QPushButton(Qt.QIcon(":/actions/list-remove.svg"),"")
        Qt.QObject.connect(removeButton, Qt.SIGNAL("clicked()"), 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:
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / dialog / taurusmessagebox.py View on Github external
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)
    Qt.QObject.connect(m4, Qt.SIGNAL("clicked()"), py_tg_serv_exc)
    layout.addWidget(m4)

    panel.show()
    return panel
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / model / qbasemodel.py View on Github external
def createToolArea(self):
        tb = [] # tb = self._toolArea = QToolArea(self)
        if self._with_filter_widget:
            f_bar = self._filterBar = self._with_filter_widget(view=self, parent=self)
            Qt.QObject.connect(f_bar, Qt.SIGNAL("filterChanged"),
                               self.onFilterChanged)
            tb.append(f_bar)
        else:
            self._filterBar = None
        
        if self._with_selection_widget:
            s_bar = self._selectionBar = self._with_selection_widget(view=self, parent=self)
            Qt.QObject.connect(s_bar, Qt.SIGNAL("selectAllTriggered"),
                               self.onSelectAll)
            Qt.QObject.connect(s_bar, Qt.SIGNAL("clearSelectionTriggered"),
                               self.onClearSelection)
            tb.append(s_bar)
        else:
            self._selectionBar = None
        
        if self._with_refresh_widget:
            r_bar = self._refreshBar = self._with_refresh_widget(view=self, parent=self)
            Qt.QObject.connect(r_bar, Qt.SIGNAL("refreshTriggered"),
                               self.onRefreshModel)
            tb.append(r_bar)
        else:
            self._refreshBar = None

        return tb
github taurus-org / taurus / src / sardana / taurus / qt / qtgui / extra_macroexecutor / macrobutton.py View on Github external
result_label = Qt.QLabel()
    w.layout().addWidget(result_label, 4, 1, 1, 5)

    show_progress = Qt.QCheckBox('Progress')
    show_progress.setChecked(True)
    w.layout().addWidget(show_progress, 5, 0)

    mb_abort = TaurusCommandButton(command = 'StopMacro',
                                   icon=':/actions/media_playback_stop.svg')
    mb_abort.setModel(door_name)

    w.layout().addWidget(mb_abort, 5, 1)

    # Change macro name
    Qt.QObject.connect(macro_name, Qt.SIGNAL('textChanged(QString)'), mb.setMacroName)
    Qt.QObject.connect(macro_name, Qt.SIGNAL('textChanged(QString)'), mb.setButtonText)
    
    # connect the argument editors
    signals = [(e, 'textChanged(QString)') for e in _argEditors]
    mb.connectArgEditors(signals)

    def update_result(result):
        result_label.setText(str(result))

    def toggle_progress(showProgress):
        visible = show_progress.isChecked()
        mb.toggleProgress(visible)

    # Toggle progressbar
    Qt.QObject.connect(show_progress, Qt.SIGNAL('stateChanged(int)'), toggle_progress)
    # Update possible macro result
    Qt.QObject.connect(mb, Qt.SIGNAL('resultUpdated'), update_result)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / display / demo / qpixmapwidgetdemo.py View on Github external
control_l.addRow("Horiz. alignment:", halign_widget)
            control_l.addRow("Vert. alignment:", valign_widget)

            panel_l.addWidget(display_panel, 1)
            panel_l.addWidget(control_panel, 0)

            aspect_ratio_widget.addItems(["Ignore", "Keep", "Keep by expanding"])
            transformation_widget.addItems(["Fast", "Smooth"])
            halign_widget.addItem("Left", Qt.QVariant(Qt.Qt.AlignLeft))
            halign_widget.addItem("Center", Qt.QVariant(Qt.Qt.AlignHCenter))
            halign_widget.addItem("Right", Qt.QVariant(Qt.Qt.AlignRight))
            valign_widget.addItem("Top", Qt.QVariant(Qt.Qt.AlignTop))
            valign_widget.addItem("Center", Qt.QVariant(Qt.Qt.AlignVCenter))
            valign_widget.addItem("Bottom", Qt.QVariant(Qt.Qt.AlignBottom))

            Qt.QObject.connect(pixmap_widget, Qt.SIGNAL("textChanged(const QString &)"), self.changePixmap)
            Qt.QObject.connect(aspect_ratio_widget, Qt.SIGNAL("currentIndexChanged(int)"), self.changeAspectRatio)
            Qt.QObject.connect(transformation_widget, Qt.SIGNAL("currentIndexChanged(int)"), self.changeTransformationMode)
            Qt.QObject.connect(halign_widget, Qt.SIGNAL("currentIndexChanged(int)"), self.changeAlignment)
            Qt.QObject.connect(valign_widget, Qt.SIGNAL("currentIndexChanged(int)"), self.changeAlignment)

            self.w = w
            self.w_pixmap = pixmap_widget
            self.w_aspect_ratio = aspect_ratio_widget
            self.w_transformation = transformation_widget
            self.w_halign = halign_widget
            self.w_valign = valign_widget

            pixmap_widget.setText(":leds/images256/led_red_on.png")
            aspect_ratio_widget.setCurrentIndex(1)
            transformation_widget.setCurrentIndex(1)
            halign_widget.setCurrentIndex(0)
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / display / demo / taurusleddemo.py View on Github external
control_l.addRow("foreground role:", fg_widget)
            control_l.addRow("ON color:", on_color_widget)
            control_l.addRow("OFF color:", off_color_widget)
            panel_l.addWidget(display_panel, 1)
            panel_l.addWidget(control_panel, 0)
            
            fg_widget.addItems(["value", "w_value", "quality"])
            colors = ["green", "blue", "orange", "red", "yellow", "magenta", "grenoble", "black"]
            on_color_widget.addItems(colors)
            off_color_widget.addItems(colors)
            
            Qt.QObject.connect(inverted_widget, Qt.SIGNAL("toggled(bool)"), w.setLedInverted)
            Qt.QObject.connect(model_widget, Qt.SIGNAL("textChanged(const QString &)"), w.setModel)
            Qt.QObject.connect(fg_widget, Qt.SIGNAL("currentIndexChanged(const QString &)"), w.setFgRole)
            Qt.QObject.connect(model_index_widget, Qt.SIGNAL("textChanged(const QString &)"), w.setModelIndex)
            Qt.QObject.connect(on_color_widget, Qt.SIGNAL("currentIndexChanged(const QString &)"), w.setOnColor)
            Qt.QObject.connect(off_color_widget, Qt.SIGNAL("currentIndexChanged(const QString &)"), w.setOffColor)
            
            inverted_widget.setChecked(False)
            model_widget.setText("sys/tg_test/1/state")
            fg_widget.setCurrentIndex(0)
            on_color_widget.setCurrentIndex(0)
            off_color_widget.setCurrentIndex(7)
            
            self.w_led = w
            self.w_model = model_widget
            self.w_fg = fg_widget
            self.w_model_index = model_index_widget
            self.w_on_color = on_color_widget
            self.w_off_color = off_color_widget
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / display / demo / taurusleddemo.py View on Github external
control_l.addRow("ON color:", on_color_widget)
            control_l.addRow("OFF color:", off_color_widget)
            panel_l.addWidget(display_panel, 1)
            panel_l.addWidget(control_panel, 0)
            
            fg_widget.addItems(["value", "w_value", "quality"])
            colors = ["green", "blue", "orange", "red", "yellow", "magenta", "grenoble", "black"]
            on_color_widget.addItems(colors)
            off_color_widget.addItems(colors)
            
            Qt.QObject.connect(inverted_widget, Qt.SIGNAL("toggled(bool)"), w.setLedInverted)
            Qt.QObject.connect(model_widget, Qt.SIGNAL("textChanged(const QString &)"), w.setModel)
            Qt.QObject.connect(fg_widget, Qt.SIGNAL("currentIndexChanged(const QString &)"), w.setFgRole)
            Qt.QObject.connect(model_index_widget, Qt.SIGNAL("textChanged(const QString &)"), w.setModelIndex)
            Qt.QObject.connect(on_color_widget, Qt.SIGNAL("currentIndexChanged(const QString &)"), w.setOnColor)
            Qt.QObject.connect(off_color_widget, Qt.SIGNAL("currentIndexChanged(const QString &)"), w.setOffColor)
            
            inverted_widget.setChecked(False)
            model_widget.setText("sys/tg_test/1/state")
            fg_widget.setCurrentIndex(0)
            on_color_widget.setCurrentIndex(0)
            off_color_widget.setCurrentIndex(7)
            
            self.w_led = w
            self.w_model = model_widget
            self.w_fg = fg_widget
            self.w_model_index = model_index_widget
            self.w_on_color = on_color_widget
            self.w_off_color = off_color_widget
github taurus-org / taurus / taurus / lib / taurus / qt / qtgui / display / demo / tauruslabeldemo.py View on Github external
control_l.addRow("model index:", model_index_widget)
            control_l.addRow("foreground role:", fg_widget)
            control_l.addRow("background role:", bg_widget)
            control_l.addRow("prefix text:", prefix_widget)
            control_l.addRow("suffix text:", suffix_widget)

            panel_l.addWidget(display_panel)
            panel_l.addWidget(control_panel)

            fg_widget.addItems(["value", "w_value", "state", "quality", "none"])
            bg_widget.addItems(["quality", "state", "none"])
            
            Qt.QObject.connect(model_widget, Qt.SIGNAL("textChanged(const QString &)"), w.setModel)
            Qt.QObject.connect(fg_widget, Qt.SIGNAL("currentIndexChanged(const QString &)"), w.setFgRole)
            Qt.QObject.connect(bg_widget, Qt.SIGNAL("currentIndexChanged(const QString &)"), w.setBgRole)
            Qt.QObject.connect(prefix_widget, Qt.SIGNAL("textChanged(const QString &)"), w.setPrefixText)
            Qt.QObject.connect(suffix_widget, Qt.SIGNAL("textChanged(const QString &)"), w.setSuffixText)
            Qt.QObject.connect(model_index_widget, Qt.SIGNAL("textChanged(const QString &)"), w.setModelIndex)
            
            model_widget.setText("sys/tg_test/1/double_scalar")
            fg_widget.setCurrentIndex(0)
            bg_widget.setCurrentIndex(0)
            
            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
github taurus-org / taurus / lib / taurus / qt / qtgui / model / qbasemodel.py View on Github external
view = self.viewWidget()
        old_selection_model = view.selectionModel()
        CC = 'currentChanged(const QModelIndex &,const QModelIndex &)'
        SC = 'selectionChanged(QItemSelection &, QItemSelection &)'
        if old_selection_model is not None:
            Qt.QObject.disconnect(old_selection_model, Qt.SIGNAL(CC),
                                  self.viewCurrentIndexChanged)
            Qt.QObject.disconnect(old_selection_model, Qt.SIGNAL(SC),
                                  self.viewSelectionChanged)
        view.setModel(qmodel)
        new_selection_model = view.selectionModel()
        if new_selection_model is not None:
            Qt.QObject.connect(new_selection_model, Qt.SIGNAL(CC),
                               self.viewCurrentIndexChanged)
            Qt.QObject.connect(new_selection_model, Qt.SIGNAL(SC),
                               self.viewSelectionChanged)
        view.setCurrentIndex(view.rootIndex())
        self._updateToolBar()