当前位置: 首页>>代码示例>>Python>>正文


Python Gdk.KEY_Escape方法代码示例

本文整理汇总了Python中gi.repository.Gdk.KEY_Escape方法的典型用法代码示例。如果您正苦于以下问题:Python Gdk.KEY_Escape方法的具体用法?Python Gdk.KEY_Escape怎么用?Python Gdk.KEY_Escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gdk的用法示例。


在下文中一共展示了Gdk.KEY_Escape方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _on_key_press

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def _on_key_press(self, _, event):
        _, key_val = event.get_keyval()
        modifiers = event.get_state()

        if key_val == Gdk.KEY_Escape:
            self._on_quit()

        # CTRL + Q
        if modifiers == Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD2_MASK:
            if key_val == Gdk.KEY_q:
                self._on_scan() 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:13,代码来源:add.py

示例2: _on_key_press

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def _on_key_press(self, _, event):
        """
            KeyPress event handler.
        """
        _, key_val = event.get_keyval()
        if key_val == Gdk.KEY_Escape:
            self._on_quit() 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:9,代码来源:edit.py

示例3: on_key_press_event

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def on_key_press_event(self, widget, event):
        """
        Handle 'Esc' and 'Down' keys.
        """
        key = event.keyval
        if key == Gdk.KEY_Escape:
            self.set_text("")
            self.emit('empty-search')
        elif key == Gdk.KEY_Down:
            self.emit('focus-to-result')
            return True 
开发者ID:gramps-project,项目名称:addons-source,代码行数:13,代码来源:search_widget.py

示例4: goto_other_btn_key_press_event

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def goto_other_btn_key_press_event(self, _widget, event):
        """
        Handle 'Esc' key on bookmarks button to hide popup.
        """
        key = event.keyval
        if event.keyval == Gdk.KEY_Escape:
            self.hide_bkmark_popover()
        elif key == Gdk.KEY_Down:
            self.bkmark_popover.grab_focus()
            return True 
开发者ID:gramps-project,项目名称:addons-source,代码行数:12,代码来源:graphview.py

示例5: on_find_bar_key_press

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def on_find_bar_key_press(self, widget, event):
        if event.keyval == Gdk.KEY_Escape:
            self.hide() 
开发者ID:jamiemcg,项目名称:Remarkable,代码行数:5,代码来源:findBar.py

示例6: on_find_entry_key_press

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def on_find_entry_key_press(self, widget, event):
        if event.keyval == Gdk.KEY_Return:
            self._find_text(backwards=self.is_searching_backwards)
        elif event.keyval == Gdk.KEY_Shift_R or event.keyval == Gdk.KEY_Shift_L:
            self.is_searching_backwards = True
        elif event.keyval == Gdk.KEY_Escape:
            self.hide() 
开发者ID:jamiemcg,项目名称:Remarkable,代码行数:9,代码来源:findBar.py

示例7: initialize

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def initialize(widgets):
    """ :Description: Initialises the various tabs for each section of configurable artifacts
    """
    global general_tab
    general_tab = GeneralTab(widgets)

    # All side panels can be show/hide from View menu now, so no need to do the same from preferences
    # We can re enable this after implementing install/uninstall functionality in the future...
    # PanelTab(widgets)

    uistuff.keepWindowSize("preferencesdialog", widgets["preferences_dialog"])

    notebook = widgets["preferences_notebook"]

    def switch_page(widget, page, page_num):
        global hint_tab, theme_tab, sound_tab, save_tab

        if page_num == 1 and hint_tab is None:
            hint_tab = HintTab(widgets)
        elif page_num == 3 and theme_tab is None:
            theme_tab = ThemeTab(widgets)
        elif page_num == 4 and sound_tab is None:
            sound_tab = SoundTab(widgets)
        elif page_num == 5 and save_tab is None:
            save_tab = SaveTab(widgets)

    notebook.connect("switch_page", switch_page)

    def delete_event(widget, _):
        widgets["preferences_dialog"].hide()
        return True

    widgets["preferences_dialog"].connect("delete-event", delete_event)
    widgets["preferences_dialog"].connect(
        "key-press-event",
        lambda w, e: w.event(Gdk.Event(Gdk.EventType.DELETE)) if e.keyval == Gdk.KEY_Escape else None)

# General initing 
开发者ID:pychess,项目名称:pychess,代码行数:40,代码来源:preferencesDialog.py

示例8: _on_key_release

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def _on_key_release(self, widget, ev, data=None):
        if ev.keyval == Gdk.KEY_Escape:
            self._close() 
开发者ID:bluppfisk,项目名称:coinprice-indicator,代码行数:5,代码来源:asset_selection.py

示例9: on_file_treeview_key_press_event

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def on_file_treeview_key_press_event(self, widget, event):
        kv = event.keyval
        # Events that don't need to know about modifiers
        if kv == Gdk.KEY_Escape:
            self.file_treeview.get_selection().unselect_all()
            self.builder.get_object('edit_button').set_sensitive(False)
            self.builder.get_object('cut_button').set_sensitive(False)
            self.builder.get_object('copy_button').set_sensitive(False)
            self.builder.get_object('delete_button').set_sensitive(False)
            return True
        elif kv == Gdk.KEY_Delete:
            self.delete_selected()
            return True
        elif kv == Gdk.KEY_F2:
            self.edit_selected()
            return True

        # Handle other events
        # Determine the actively pressed modifier
        modifier = event.get_state() & Gtk.accelerator_get_default_mod_mask()

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

        if control and kv == Gdk.KEY_c:
            return self.copy_selected()
        elif control and kv == Gdk.KEY_x:
            return self.cut_selected()
        elif control and kv == Gdk.KEY_v:
            return self.paste() 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:33,代码来源:filechooser.py

示例10: on_window_key_press_event

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def on_window_key_press_event(self, widget, event, data=None):
        kv = event.keyval
        if kv == Gdk.KEY_Escape:
            self.escape() # Close the keyboard
        elif kv == Gdk.KEY_Return or kv == Gdk.KEY_KP_Enter:
            self.enter(widget)
        else: # Pass other keypresses on to the entry widget
            try:
                self.entry.emit("key-press-event", event)
            except:
                pass

    # Escape action 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:15,代码来源:keyboard.py

示例11: escape

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def escape(self):
        try:
            event = Gdk.Event(Gdk.KEY_PRESS)
            event.keyval = Gdk.KEY_Escape
            event.window = self.entry.window
            self.entry.event(event)
            self.entry.emit("key-press-event", event)
        except:
            pass
        self.entry.disconnect(self.focus_out_sig)
        self.entry.disconnect(self.key_press_sig)
        self.keyboard.hide() 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:14,代码来源:keyboard.py

示例12: on_entry_key_press

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def on_entry_key_press(self, widget, event, data=None):
        kv = event.keyval
        if kv == Gdk.KEY_Escape:
            self.keyboard.hide() # Close the keyboard

# ==========================================================
# Show the keyboard
# ========================================================== 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:10,代码来源:keyboard.py

示例13: on_key_press

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def on_key_press(self, widget, event, data=None):
        if event.keyval == Gdk.KEY_Escape:
            self.set_text(self.value) # Revert
            self.get_toplevel().set_focus(None) 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:6,代码来源:pref_widgets.py

示例14: on_key_press

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def on_key_press(self, widget, event):
        if event.keyval == Gdk.KEY_Escape:
            self.set_text(self.previous_value) # Revert
            self.get_toplevel().set_focus(None) 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:6,代码来源:entry_widgets.py

示例15: key_pressed

# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Escape [as 别名]
def key_pressed(self, _widget, event, _data=None):
        """hide the search and replace content box when ESC is pressed
        """
        if event.keyval == Gdk.KEY_Escape:
            self.hide() 
开发者ID:ApostropheEditor,项目名称:Apostrophe,代码行数:7,代码来源:search_and_replace.py


注:本文中的gi.repository.Gdk.KEY_Escape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。