當前位置: 首頁>>代碼示例>>Python>>正文


Python Gdk.KEY_Right方法代碼示例

本文整理匯總了Python中gi.repository.Gdk.KEY_Right方法的典型用法代碼示例。如果您正苦於以下問題:Python Gdk.KEY_Right方法的具體用法?Python Gdk.KEY_Right怎麽用?Python Gdk.KEY_Right使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gi.repository.Gdk的用法示例。


在下文中一共展示了Gdk.KEY_Right方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: on_key_press

# 需要導入模塊: from gi.repository import Gdk [as 別名]
# 或者: from gi.repository.Gdk import KEY_Right [as 別名]
def on_key_press(self, widget, event):
        # Right arrow (65363)
        if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Right:
            self.overscan_values['top'] += 1
            self.overscan_values['bottom'] += 1
            self.overscan_values['left'] += 1
            self.overscan_values['right'] += 1
            set_overscan_status(self.overscan_values)
            self.t_scale.set_value(self.overscan_values['top'])
            return
        # Left arrow (65361)
        if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Left:
            self.overscan_values['top'] -= 1
            self.overscan_values['bottom'] -= 1
            self.overscan_values['left'] -= 1
            self.overscan_values['right'] -= 1
            set_overscan_status(self.overscan_values)
            self.t_scale.set_value(self.overscan_values['top'])
            return 
開發者ID:KanoComputing,項目名稱:kano-settings,代碼行數:21,代碼來源:set_display.py

示例2: cursor_ctrl_arrow_rtl_fix

# 需要導入模塊: from gi.repository import Gdk [as 別名]
# 或者: from gi.repository.Gdk import KEY_Right [as 別名]
def cursor_ctrl_arrow_rtl_fix(self, widget, event):
        if event.keyval in [Gdk.KEY_Left, Gdk.KEY_Right]:
            if event.state & Gdk.ModifierType.CONTROL_MASK:
                is_rtl = self.remarkable_settings['rtl']

                dirs = {
                    Gdk.KEY_Left: is_rtl and 1 or -1,
                    Gdk.KEY_Right: is_rtl and -1 or 1,
                }

                widget.emit('move-cursor',
                            Gtk.MovementStep.WORDS,
                            dirs[event.keyval],
                            event.state & Gdk.ModifierType.SHIFT_MASK != 0)

                return True

        return False 
開發者ID:jamiemcg,項目名稱:Remarkable,代碼行數:20,代碼來源:RemarkableWindow.py

示例3: on_arrow_right_pressed

# 需要導入模塊: from gi.repository import Gdk [as 別名]
# 或者: from gi.repository.Gdk import KEY_Right [as 別名]
def on_arrow_right_pressed(self, widget, event):
        self.emulate_key(widget, None, Gdk.KEY_Right)

    # Up Arrow 
開發者ID:KurtJacobson,項目名稱:hazzy,代碼行數:6,代碼來源:keyboard.py

示例4: _parse_user_input

# 需要導入模塊: from gi.repository import Gdk [as 別名]
# 或者: from gi.repository.Gdk import KEY_Right [as 別名]
def _parse_user_input(builder, oauth, meta, config_dict, lets_connect, secret=None):
    # type: (Gtk.builder, str, Metadata, dict, bool, str) -> None
    dialog = builder.get_object('totp-enroll-dialog')
    code_entry = builder.get_object('totp-code-entry')
    cancel_button = builder.get_object('totp-cancel-button')
    submit_button = builder.get_object('totp-submit-button')

    def callback(_, event):
        valid = chr(event.keyval).isdigit()
        logger.debug(u"user pressed {}, valid: {}".format(event.keyval, valid))
        if event.keyval in (Gdk.KEY_Left, Gdk.KEY_Right, Gdk.KEY_BackSpace, Gdk.KEY_End, Gdk.KEY_Home,
                            Gdk.KEY_Delete, Gdk.KEY_Return, Gdk.KEY_Escape):
            return False
        return not chr(event.keyval).isdigit()

    code_entry.connect("key-press-event", callback)
    code_entry.set_max_length(6)

    cancel_button.set_sensitive(True)
    submit_button.set_sensitive(True)
    while True:
        response = dialog.run()
        if response == 0:
            key = code_entry.get_text()
            cancel_button.set_sensitive(False)
            submit_button.set_sensitive(False)
            thread_helper(lambda: _enroll(builder, oauth, meta, config_dict, secret, key, lets_connect))
        else:
            dialog.hide()
            break


# background tread 
開發者ID:eduvpn,項目名稱:python-eduvpn-client,代碼行數:35,代碼來源:totp_enroll.py

示例5: _parse_user_input

# 需要導入模塊: from gi.repository import Gdk [as 別名]
# 或者: from gi.repository.Gdk import KEY_Right [as 別名]
def _parse_user_input(builder, oauth, meta, config_dict, lets_connect):
    # type: (Gtk.builder, str, Metadata, dict, bool) -> None
    dialog = builder.get_object('yubi-enroll-dialog')
    code_entry = builder.get_object('yubi-code-entry')
    cancel_button = builder.get_object('yubi-cancel-button')
    submit_button = builder.get_object('yubi-submit-button')

    def callback(_, event):
        valid = chr(event.keyval).isdigit()
        logger.debug(u"user pressed {}, valid: {}".format(event.keyval, valid))
        if event.keyval in (Gdk.KEY_Left, Gdk.KEY_Right, Gdk.KEY_BackSpace, Gdk.KEY_End, Gdk.KEY_Home,
                            Gdk.KEY_Delete, Gdk.KEY_Return, Gdk.KEY_Escape):
            return False
        return event.keyval not in range(0x20, 0x7e)

    code_entry.connect("key-press-event", callback)
    cancel_button.set_sensitive(True)
    submit_button.set_sensitive(True)
    while True:
        response = dialog.run()
        if response == 0:
            key = code_entry.get_text()
            cancel_button.set_sensitive(False)
            submit_button.set_sensitive(False)
            thread_helper(lambda: _enroll(builder, oauth, meta, config_dict, key, lets_connect=lets_connect))
        else:
            dialog.hide()
            break


# background tread 
開發者ID:eduvpn,項目名稱:python-eduvpn-client,代碼行數:33,代碼來源:yubi_enroll.py

示例6: on_key_press

# 需要導入模塊: from gi.repository import Gdk [as 別名]
# 或者: from gi.repository.Gdk import KEY_Right [as 別名]
def on_key_press(self, widget, event):

        # Events that don't need to know about modifiers
        if event.keyval == Gdk.KEY_Escape:
            self.get_toplevel().set_focus(None)
            return True
        if event.keyval == Gdk.KEY_Delete:
            self.destroy()  # Remove the widget
            return True
        if event.keyval == Gdk.KEY_Tab:
            # TODO Implement move focus to next widget
            pass

        # Get any active, but not pressed modifiers, like CapsLock and NumLock
        persistant_modifiers = Gtk.accelerator_get_default_mod_mask()

        # Determine the actively pressed modifier
        modifier = event.get_state() & persistant_modifiers

        # Bool of Control or Shift modifier states
        control = modifier == Gdk.ModifierType.CONTROL_MASK
        shift = modifier == Gdk.ModifierType.SHIFT_MASK

        # If neither Shift or Control we want to move the Widget
        if event.keyval == Gdk.KEY_Up and not (shift or control):
            self.parent.child_incremental_move(self, self.parent.Incremental.Move.UP)
        elif event.keyval == Gdk.KEY_Down and not (shift or control):
            self.parent.child_incremental_move(self, self.parent.Incremental.Move.DOWN)
        elif event.keyval == Gdk.KEY_Left and not (shift or control):
            self.parent.child_incremental_move(self, self.parent.Incremental.Move.LEFT)
        elif event.keyval == Gdk.KEY_Right and not (shift or control):
            self.parent.child_incremental_move(self, self.parent.Incremental.Move.RIGHT)

        # If either Shift or Control we want to resize the Widget
        elif event.keyval == Gdk.KEY_Up and (shift or control):
            self.parent.child_incremental_move(self, self.parent.Incremental.Resize.Height.SMALLER)
        elif event.keyval == Gdk.KEY_Down and (shift or control):
            self.parent.child_incremental_move(self, self.parent.Incremental.Resize.Height.BIGGER)
        elif event.keyval == Gdk.KEY_Left and (shift or control):
            self.parent.child_incremental_move(self, self.parent.Incremental.Resize.Width.SMALLER)
        elif event.keyval == Gdk.KEY_Right and (shift or control):
            self.parent.child_incremental_move(self, self.parent.Incremental.Resize.Width.BIGGER)

        # Indicate the event was handled
        return True


#===================================
#  Drag to Move / Resize
#=================================== 
開發者ID:KurtJacobson,項目名稱:hazzy,代碼行數:52,代碼來源:widget_window.py

示例7: on_key_press_event

# 需要導入模塊: from gi.repository import Gdk [as 別名]
# 或者: from gi.repository.Gdk import KEY_Right [as 別名]
def on_key_press_event(self, widget, event):
        if event.keyval == Gdk.KEY_Left:
            self.x -= self.POS_INCREMENT/self.zoom_ratio
            self.queue_draw()
            return True
        if event.keyval == Gdk.KEY_Right:
            self.x += self.POS_INCREMENT/self.zoom_ratio
            self.queue_draw()
            return True
        if event.keyval == Gdk.KEY_Up:
            self.y -= self.POS_INCREMENT/self.zoom_ratio
            self.queue_draw()
            return True
        if event.keyval == Gdk.KEY_Down:
            self.y += self.POS_INCREMENT/self.zoom_ratio
            self.queue_draw()
            return True
        if event.keyval in (Gdk.KEY_Page_Up,
                            Gdk.KEY_plus,
                            Gdk.KEY_equal,
                            Gdk.KEY_KP_Add):
            self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT)
            self.queue_draw()
            return True
        if event.keyval in (Gdk.KEY_Page_Down,
                            Gdk.KEY_minus,
                            Gdk.KEY_KP_Subtract):
            self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT)
            self.queue_draw()
            return True
        if event.keyval == Gdk.KEY_Escape:
            self.drag_action.abort()
            self.drag_action = NullAction(self)
            return True
        if event.keyval == Gdk.KEY_r:
            self.reload()
            return True
        if event.keyval == Gdk.KEY_f:
            win = widget.get_toplevel()
            find_toolitem = win.uimanager.get_widget('/ToolBar/Find')
            textentry = find_toolitem.get_children()
            win.set_focus(textentry[0])
            return True
        if event.keyval == Gdk.KEY_q:
            Gtk.main_quit()
            return True
        if event.keyval == Gdk.KEY_p:
            self.on_print()
            return True
        return False 
開發者ID:inguma,項目名稱:bokken,代碼行數:52,代碼來源:xdot.py


注:本文中的gi.repository.Gdk.KEY_Right方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。