Python gi.repository.Gdk 模块,KEY_Escape() 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用gi.repository.Gdk.KEY_Escape()

项目:ukui-menu    作者:ukui    | 项目源码 | 文件源码
def on_key_release(self, widget, event):
        self.disconnect(self.event_id)
        self.ungrab()
        self.event_id = None
        if event.keyval == Gdk.KEY_Escape:
            self.set_button_text()
            self.teaching = False
            return True
        if event.keyval == Gdk.KEY_BackSpace:
            self.teaching = False
            self.value = ""
            self.set_button_text()
            self.emit("accel-edited")
            return True
        accel_string = Gtk.accelerator_name( event.keyval, event.state )
        accel_string = self.sanitize(accel_string)
        self.value = accel_string
        self.set_button_text()
        self.teaching = False
        self.emit("accel-edited")
        return True
项目:mate-menu    作者:ubuntu-mate    | 项目源码 | 文件源码
def on_key_release(self, widget, event):
        self.disconnect(self.event_id)
        self.ungrab(widget.get_display())
        self.event_id = None
        if event.keyval == Gdk.KEY_Escape:
            self.set_button_text()
            self.teaching = False
            return True
        if event.keyval == Gdk.KEY_BackSpace:
            self.teaching = False
            self.value = ""
            self.set_button_text()
            self.emit("accel-edited")
            return True
        accel_string = Gtk.accelerator_name( event.keyval, event.state )
        accel_string = self.sanitize(accel_string)
        self.value = accel_string
        self.set_button_text()
        self.teaching = False
        self.emit("accel-edited")
        return True
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def on_window_key_press_event(self, trash, event):
        """ Checks if pressed key was escape and if yes, closes window """
        if event.keyval == Gdk.KEY_Escape:
            self.close()
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def on_ConditionEditor_key_press_event(self, w, event):
        """ Checks if pressed key was escape and if yes, closes window """
        if event.keyval == Gdk.KEY_Escape:
            self.hide_dont_destroy(w)
项目:ez_gpg    作者:sgnn7    | 项目源码 | 文件源码
def _on_key_pressed(self, widget, event):
        # TODO: Maybe use accelerators?
        if event.keyval == Gdk.KEY_Escape:
            self._close_window()

        return False
项目:ukui-menu    作者:ukui    | 项目源码 | 文件源码
def onKeyPress( self, widget, event ):
        if event.keyval == Gdk.KEY_Escape:
            self.hide()
            return True
        return False
项目:keepass-menu    作者:frostidaho    | 项目源码 | 文件源码
def handler_key(event):
        if event.key.keyval == Gdk.KEY_Escape:
            return QuitLoop('Escape key', event)
        return None
项目:labnote    作者:phragment    | 项目源码 | 文件源码
def on_search_key(self, widget, event):

        if event.keyval == Gdk.KEY_Escape:
            self.lock_line = 0
            self.searchr.set_reveal_child(False)
            self.search_results_sw.hide()
            self.webview.show()
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def _on_key_press_event(self, widget, event):
        if event.keyval == Gdk.KEY_Escape:
            self._confirm_cancellation()
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def _on_key_press_event(self, widget, event):
        if event.keyval == Gdk.KEY_Escape:
            self._confirm_cancellation()
项目:PyTouhou    作者:GovanifY    | 项目源码 | 文件源码
def on_start_window_key_press_event(self, window, event_key):
        if (event_key.keyval == Gdk.KEY_Escape or
                event_key.state == Gdk.ModifierType.CONTROL_MASK and event_key.keyval == Gdk.KEY_q):
            self.on_quit()
项目:PyTouhou    作者:GovanifY    | 项目源码 | 文件源码
def on_game_window_key_press_event(self, window, event_key):
        if event_key.keyval == Gdk.KEY_Escape:
            self.game_window.hide()
            self.start_window.show()
        elif event_key.state == Gdk.ModifierType.CONTROL_MASK and event_key.keyval == Gdk.KEY_q:
            self.on_quit()
项目:PyTouhou    作者:GovanifY    | 项目源码 | 文件源码
def on_replay_filechooserdialog_key_press_event(self, window, event_key):
        if event_key.keyval == Gdk.KEY_Escape:
            self.replay_filechooserdialog.hide()
            self.start_window.show()
        elif event_key.state == Gdk.ModifierType.CONTROL_MASK and event_key.keyval == Gdk.KEY_q:
            self.on_quit()


    # Options menu
项目:PyTouhou    作者:GovanifY    | 项目源码 | 文件源码
def on_options_window_key_press_event(self, window, event_key):
        if event_key.keyval == Gdk.KEY_Escape:
            self.options_window.hide()
            self.start_window.show()
        elif event_key.state == Gdk.ModifierType.CONTROL_MASK and event_key.keyval == Gdk.KEY_q:
            self.on_quit()
项目:mate-menu    作者:ubuntu-mate    | 项目源码 | 文件源码
def onWindowKeyPress( self, widget, event ):
        if event.keyval == Gdk.KEY_Escape:
            self.hide()
            return True
        return False
项目:bokken    作者:thestr4ng3r    | 项目源码 | 文件源码
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