コード例 #1
0
ファイル: mdi_line.py プロジェクト: LinuxCNC/linuxcnc
class MDILine(MDI):
    def __init__(self, parent=None):
        super(MDILine, self).__init__(parent)
        self._PARENT_WIDGET = parent
        self.soft_keyboard = True
        self._input_panel_full = SoftInputWidget(self, 'default')
        self.installEventFilter(self)

    # try/except is so designer will load
    def eventFilter(self, widget, event):
        if self.focusWidget() == widget and event.type() == QEvent.MouseButtonPress:
            if self.soft_keyboard:
                self._input_panel_full.show_input_panel(widget)
                try:
                    ACTION.SET_MDI_MODE()
                except:
                    pass
        return False

    #########################################################################
    # This is how designer can interact with our widget properties.
    # designer will show the pyqtProperty properties in the editor
    # it will use the get set and reset calls to do those actions
    #########################################################################

    def set_soft_keyboard(self, data):
        self.soft_keyboard = data
    def get_soft_keyboard(self):
        return self.soft_keyboard
    def reset_soft_keyboard(self):
        self.soft_keyboard = True

    # designer will show these properties in this order:
    soft_keyboard_option = pyqtProperty(bool, get_soft_keyboard, set_soft_keyboard, reset_soft_keyboard)
コード例 #2
0
class MDILine(MDI):
    def __init__(self, parent=None):
        super(MDILine, self).__init__(parent)
        self._PARENT_WIDGET = parent
        self.soft_keyboard = True
        self._input_panel_full = SoftInputWidget(self, 'default')
        self.installEventFilter(self)

    # try/except is so designer will load
    def eventFilter(self, widget, event):
        if self.focusWidget() == widget and event.type() == QEvent.MouseButtonPress:
            if self.soft_keyboard:
                self._input_panel_full.show_input_panel(widget)
                try:
                    ACTION.SET_MDI_MODE()
                except:
                    pass
        return False

    #########################################################################
    # This is how designer can interact with our widget properties.
    # designer will show the pyqtProperty properties in the editor
    # it will use the get set and reset calls to do those actions
    #########################################################################

    def set_soft_keyboard(self, data):
        self.soft_keyboard = data
    def get_soft_keyboard(self):
        return self.soft_keyboard
    def reset_soft_keyboard(self):
        self.soft_keyboard = True

    # designer will show these properties in this order:
    soft_keyboard_option = pyqtProperty(bool, get_soft_keyboard, set_soft_keyboard, reset_soft_keyboard)
コード例 #3
0
ファイル: mdi_line.py プロジェクト: zym1rm/linuxcnc
 def __init__(self, parent=None):
     super(MDILine, self).__init__(parent)
     self._PARENT_WIDGET = parent
     self.dialog_code = 'KEYBOARD'
     self.soft_keyboard = False
     self.dialog_keyboard = False
     self._input_panel_full = SoftInputWidget(self, 'default')
     self.installEventFilter(self)
コード例 #4
0
ファイル: mdi_line.py プロジェクト: LinuxCNC/linuxcnc
 def __init__(self, parent=None):
     super(MDILine, self).__init__(parent)
     self._PARENT_WIDGET = parent
     self.soft_keyboard = True
     self._input_panel_full = SoftInputWidget(self, 'default')
     self.installEventFilter(self)
コード例 #5
0
ファイル: mdi_line.py プロジェクト: zym1rm/linuxcnc
class MDILine(MDI):
    def __init__(self, parent=None):
        super(MDILine, self).__init__(parent)
        self._PARENT_WIDGET = parent
        self.dialog_code = 'KEYBOARD'
        self.soft_keyboard = False
        self.dialog_keyboard = False
        self._input_panel_full = SoftInputWidget(self, 'default')
        self.installEventFilter(self)

    # try/except is so designer will load
    def eventFilter(self, widget, event):
        if self.focusWidget() == widget and event.type(
        ) == QEvent.MouseButtonPress:
            if self.soft_keyboard:
                self._input_panel_full.show_input_panel(widget)
            elif self.dialog_keyboard:
                self.request_keyboard()
            try:
                ACTION.SET_MDI_MODE()
            except:
                pass
        return False

    def request_keyboard(self):
        mess = {
            'NAME': self.dialog_code,
            'ID': '%s__' % self.objectName(),
            'TITLE': 'MDI',
            'GEONAME': 'MDI_Keyboard_Dialog_{}'.format(self.dialog_code),
        }
        STATUS.emit('dialog-request', mess)
        LOG.debug('message sent:{}'.format(mess))

    # process the STATUS return message
    def return_value(self, w, message):
        text = message['RETURN']
        code = bool(message.get('ID') == '%s__' % self.objectName())
        name = bool(message.get('NAME') == self.dialog_code)
        if code and name and text is not None:
            self.setFocus()
            self.setText(text)
            self.submit()
            LOG.debug('message return:{}'.format(message))
            STATUS.emit('update-machine-log', 'Set MDI {}'.format(text),
                        'TIME')

    #########################################################################
    # This is how designer can interact with our widget properties.
    # designer will show the pyqtProperty properties in the editor
    # it will use the get set and reset calls to do those actions
    #########################################################################

    def set_soft_keyboard(self, data):
        self.soft_keyboard = data

    def get_soft_keyboard(self):
        return self.soft_keyboard

    def reset_soft_keyboard(self):
        self.soft_keyboard = False

    # designer will show these properties in this order:
    soft_keyboard_option = pyqtProperty(bool, get_soft_keyboard,
                                        set_soft_keyboard, reset_soft_keyboard)

    def set_dialog_keyboard(self, data):
        self.dialog_keyboard = data

    def get_dialog_keyboard(self):
        return self.dialog_keyboard

    def reset_dialog_keyboard(self):
        self.dialog_keyboard = False

    # designer will show these properties in this order:
    dialog_keyboard_option = pyqtProperty(bool, get_dialog_keyboard,
                                          set_dialog_keyboard,
                                          reset_dialog_keyboard)