How to use the pyface.qt.QtCore.SIGNAL function in pyface

To help you get started, we’ve selected a few pyface 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 robmcmullen / omnivore / omnimon / tasks / text_edit / styled_text_editor_qt4.py View on Github external
def eventFilter(self, obj, event):
        """ Reimplemented to trap key presses.
        """
        if self.__editor.control and obj == self.__editor.control and \
               event.type() == QtCore.QEvent.FocusOut:
            # Hack for Traits UI compatibility.
            self.control.emit(QtCore.SIGNAL('lostFocus'))

        elif self.__editor.control and obj == self.__editor.control.code and \
               event.type() == QtCore.QEvent.KeyPress:
            # Pyface doesn't seem to be Unicode aware.  Only keep the key code
            # if it corresponds to a single Latin1 character.
            kstr = event.text()
            try:
                kcode = ord(str(kstr))
            except:
                kcode = 0

            mods = event.modifiers()
            self.key_pressed = KeyPressedEvent(
                alt_down     = ((mods & QtCore.Qt.AltModifier) ==
                                QtCore.Qt.AltModifier),
                control_down = ((mods & QtCore.Qt.ControlModifier) ==
github enthought / traitsui / traitsui / qt4 / editor_factory.py View on Github external
def init ( self, parent ):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        self.control = QtGui.QLineEdit(self.str_value)
        QtCore.QObject.connect(self.control,
                QtCore.SIGNAL('editingFinished()'), self.update_object)
        self.set_tooltip()
github enthought / traitsui / traitsui / qt4 / button_editor.py View on Github external
def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        # FIXME: We ignore orientation, width_padding and height_padding.

        factory = self.factory

        btype = self._STYLE_MAP.get(factory.style, QtGui.QPushButton)
        self.control = btype()
        self.control.setText(self.string_value(factory.label))

        if factory.image is not None:
            self.control.setIcon(factory.image.create_icon())

        QtCore.QObject.connect(self.control, QtCore.SIGNAL('clicked()'),
                               self.update_object)
        self.set_tooltip()
github aestrivex / cvu / cvu / custom_file_editor.py View on Github external
def qt4_editor_factory(parent, editor, use_dir=False, *args):
    from pyface.qt import QtCore, QtGui
    from traitsui.qt4.helper import IconButton

    editor.control = panel =  QtGui.QWidget()
    layout = QtGui.QHBoxLayout( panel )
    layout.setContentsMargins(0,0,0,0)

    editor.use_dir = use_dir

    editor.text_control = text_control = QtGui.QLineEdit()
    layout.addWidget(text_control)
    signal = QtCore.SIGNAL('editingFinished()')
    QtCore.QObject.connect(text_control, signal, lambda:update_file_obj(editor))

    button = IconButton(QtGui.QStyle.SP_DirIcon, lambda:button_click(editor))
    layout.addWidget(button)

    return panel
github enthought / traitsui / traitsui / qt4 / file_editor.py View on Github external
def init ( self, parent ):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        self.control = QtGui.QWidget()
        layout = QtGui.QHBoxLayout(self.control)
        layout.setContentsMargins(0, 0, 0, 0)

        self._file_name = control = QtGui.QLineEdit()
        layout.addWidget(control)

        if self.factory.auto_set:
            signal = QtCore.SIGNAL('textEdited(QString)')
        else:
            # Assume enter_set is set, or else the value will never get updated.
            signal = QtCore.SIGNAL('editingFinished()')
        QtCore.QObject.connect(control, signal, self.update_object)

        button = IconButton(QtGui.QStyle.SP_DirIcon, self.show_file_dialog)
        layout.addWidget(button)

        self.set_tooltip(control)
github enthought / traitsui / traitsui / qt4 / history_editor.py View on Github external
""" Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        self.control = control = QtGui.QComboBox()
        control.setEditable(True)
        control.setInsertPolicy(QtGui.QComboBox.InsertAtTop)

        if self.factory.entries > 0:
            signal = QtCore.SIGNAL(
                'rowsInserted(const QModelIndex&, int, int)')
            QtCore.QObject.connect(control.model(), signal, self._truncate)

        if self.factory.auto_set:
            signal = QtCore.SIGNAL('editTextChanged(QString)')
        else:
            signal = QtCore.SIGNAL('activated(QString)')
        QtCore.QObject.connect(control, signal, self.update_object)

        self.set_tooltip()
github enthought / traitsui / traitsui / qt4 / date_editor.py View on Github external
self.factory.minimum_date_name)
            self.factory.minimum_date = func()

        if getattr(self.factory, 'minimum_date', None):
            min_date = QtCore.QDate(self.factory.minimum_date.year,
                                    self.factory.minimum_date.month,
                                    self.factory.minimum_date.day)
            self.control.setMinimumDate(min_date)

        if getattr(self.factory, 'maximum_date', None):
            max_date = QtCore.QDate(self.factory.maximum_date.year,
                                    self.factory.maximum_date.month,
                                    self.factory.maximum_date.day)
            self.control.setMaximumDate(max_date)

        signal = QtCore.SIGNAL('dateChanged(QDate)')
        QtCore.QObject.connect(self.control, signal, self.update_object)
github bpteague / cytoflow / cytoflowgui / import_dialog.py View on Github external
def _create_buttons(self, parent):
        """ 
        Create the buttons at the bottom of the dialog box.
        
        We're overriding (and stealing code from) pyface.qt._create_buttons in
        order to add "Add tube.... " and "Add plate..." buttons.
        """
         
        buttons = QtGui.QWidget()
        #layout = QtGui.QHBoxLayout()
        layout = QtGui.QGridLayout()
        
        btn_add_tube = QtGui.QPushButton("Add tubes...")
        layout.addWidget(btn_add_tube, 0, 0)
        QtCore.QObject.connect(btn_add_tube, QtCore.SIGNAL('clicked()'),
                               self.handler._on_add_tubes)
        
        btn_remove_tubes = QtGui.QPushButton("Remove tubes")
        layout.addWidget(btn_remove_tubes, 1, 0)
        QtCore.QObject.connect(btn_remove_tubes, QtCore.SIGNAL('clicked()'),
                               self.handler._on_remove_tubes)
        btn_remove_tubes.setEnabled(len(self.model.tubes) > 0)
        self.handler.btn_remove_tubes = btn_remove_tubes

        
        # start disabled if there aren't any tubes in the model
        btn_add_cond = QtGui.QPushButton("Add condition...")
        layout.addWidget(btn_add_cond, 0, 1)
        QtCore.QObject.connect(btn_add_cond, QtCore.SIGNAL('clicked()'),
                               self.handler._on_add_condition)
        btn_add_cond.setEnabled(len(self.model.tubes) > 0)
github JannickWeisshaupt / OpenDFT / qt_widgets.py View on Github external
def __init__(self, parent=None, delay=500, callback=None):
        super(MySearchLineEdit, self).__init__(parent)
        self.delay = delay
        self.callback = callback
        self.timer = QtCore.QTimer(self)
        self.timer.setSingleShot(True)
        self.setTextMargins(20, 0, 0, 0)
        self.connect(self, QtCore.SIGNAL("textEdited(QString)"),
                self.eventDelay)
        self.connect(self.timer, QtCore.SIGNAL("timeout()"),
                self.startCallback)
github NMGRL / pychron / pychron / core / ui / qt / toggle_button_editor.py View on Github external
control.setIcon(self.icon_on)
        # control.setIconSize(QtCore.QSize(self.factory.width, self.factory.height))

        self.tooltip_on = self.factory.tooltip_on
        self.tooltip_off = self.factory.tooltip_off

        control.setToolTip(self.tooltip_on)

        control.setCheckable(True)
        control.toggled.connect(self._toggle_button)
        # if self.factory.label:
        #     control.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        # else:
        #     control.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)

        QtCore.QObject.connect(control, QtCore.SIGNAL('clicked()'),
                               self.update_object)