Python gi.repository.Gdk.KEY_Return() Examples
The following are 21
code examples of gi.repository.Gdk.KEY_Return().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gdk
, or try the search function
.
Example #1
Source File: set_account.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def add_account(self, widget=None, event=None): if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: kdialog = None if not self.add_account_dialog(): return try: # add new user command add_user() except UserError as e: kdialog = kano_dialog.KanoDialog( _("Error creating new user"), str(e), parent_window=self.win ) kdialog.run() self.disable_buttons() else: os.system("sudo systemctl reboot") # Gets executed when REMOVE button is clicked
Example #2
Source File: set_audio.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def apply_changes(self, widget, event): # If enter key is pressed or mouse button is clicked if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: audio_overdrive_changes = self._compare_and_set_audio_overdrive() common.need_reboot = audio_overdrive_changes if (get_setting('Audio') == _('HDMI') and self.HDMI is True) or \ (get_setting('Audio') == _('Analogue') and self.HDMI is False): logger.debug("set_audio / apply_changes: audio settings haven't changed, don't apply new changes") self.win.go_to_home() return set_to_HDMI(self.HDMI) # Tell user to reboot to see changes common.need_reboot = True self.win.go_to_home()
Example #3
Source File: gtk.py From encompass with GNU General Public License v3.0 | 6 votes |
def treeview_key_press(self, treeview, event): c = treeview.get_cursor()[0] if event.keyval == Gdk.KEY_Up: if c and c[0] == 0: treeview.parent.grab_focus() treeview.set_cursor((0,)) elif event.keyval == Gdk.KEY_Return: if treeview == self.history_treeview: tx_details = self.history_list.get_value( self.history_list.get_iter(c), 8) self.show_message(tx_details) elif treeview == self.contacts_treeview: m = self.addressbook_list.get_value( self.addressbook_list.get_iter(c), 0) #a = self.wallet.aliases.get(m) #if a: # if a[0] in self.wallet.authorities.keys(): # s = self.wallet.authorities.get(a[0]) # else: # s = "self" # msg = 'Alias:'+ m + '\n\nTarget: '+ a[1] + '\nSigned by: ' + s + '\nSigning address:' + a[0] # self.show_message(msg) return False
Example #4
Source File: set_screensaver.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def apply_changes(self, button, event): # If enter key is pressed or mouse button is clicked if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: # Change program name in the kdesk config to change to the program # name in the dictionary name = self.table.get_selected() program = self.table.images[name]['program'] set_screensaver_program(program) self.table.unselect_all() self.kano_button.set_sensitive(False)
Example #5
Source File: yubi_enroll.py From python-eduvpn-client with GNU General Public License v3.0 | 5 votes |
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
Example #6
Source File: totp_enroll.py From python-eduvpn-client with GNU General Public License v3.0 | 5 votes |
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
Example #7
Source File: main.py From gagar with GNU General Public License v3.0 | 5 votes |
def on_key_pressed(self, val, char): if char == 's': self.client.send_spectate() elif char == 'q': self.client.send_spectate_toggle() elif char == 'r' or val == Gdk.KEY_Return: self.client.send_respawn() elif char == 'w': self.send_mouse() self.client.send_shoot() elif val == Gdk.KEY_space: self.send_mouse() self.client.send_split() elif char == 'k': self.client.send_explode()
Example #8
Source File: keyboard.py From hazzy with GNU General Public License v2.0 | 5 votes |
def enter(self, widget): self.emulate_key(widget, None, Gdk.KEY_Return) if not self.persistent: self.keyboard.hide()
Example #9
Source File: keyboard.py From hazzy with GNU General Public License v2.0 | 5 votes |
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
Example #10
Source File: taskview.py From gtg with GNU General Public License v3.0 | 5 votes |
def _keypress(self, widget, event): # Check for Ctrl-Return/Enter if event.get_state() & Gdk.ModifierType.CONTROL_MASK and \ event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter): buff = self.buff cursor_mark = buff.get_insert() cursor_iter = buff.get_iter_at_mark(cursor_mark) local_start = cursor_iter.copy() # If we are at a task indent arrow, prepare the iterator for the # next loop to get the link for tag in local_start.get_tags(): if hasattr(tag, 'is_indent'): local_start.forward_to_line_end() break tags = local_start.get_tags() + local_start.get_toggled_tags(False) for tag in tags: if hasattr(tag, 'link'): anchor = tag.link typ = tag.type if(anchor): if typ == "subtask": self.open_task(anchor) elif typ == "http" and self.check_link(anchor): openurl(anchor) return True # Deindent the current line of one level # If newlevel is set, force to go to that level
Example #11
Source File: findBar.py From Remarkable with MIT License | 5 votes |
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()
Example #12
Source File: set_style.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def reset_button_cb(self, widget, event): # If enter key is pressed or mouse button is clicked if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: kdialog = KanoDialog( title_text=_("This will reset your wallpaper and toolbar."), description_text=_("Do you want to continue?"), button_dict=[ { 'label': _("YES"), 'color': 'green', 'return_value': 'yes' }, { 'label': _("NO"), 'color': 'red', 'return_value': 'no' } ], parent_window=self.win ) response = kdialog.run() if response == 'yes': self.reset_desktop() self.win.go_to_home()
Example #13
Source File: set_display.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def apply_changes(self, button, event): # If enter key is pressed or mouse button is clicked if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: # Check if there was a change to the Flip Screen state. if self.flip_preference_start != self.flip_preference_end: set_flip(self.flip_preference_end) end_config_transaction() common.need_reboot = True # Check if there was resolution change. if self.init_item != self.mode_index: # Set HDMI mode # Get mode:group string # Of the form "auto" or "cea:1" or "dmt:1" etc. parse_mode = self.mode.split(" ")[0] self.set_hdmi_mode_from_str(parse_mode) # Track the user's screen resolution track_data('screen-mode-changed', { 'mode': parse_mode }) end_config_transaction() common.need_reboot = True self.win.go_to_home()
Example #14
Source File: set_notifications.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def apply_changes(self, widget, event): if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: self.configure_all_notifications() self.configure_world_notifications() self.configure_cpu_monitor_animation() self.win.go_to_home()
Example #15
Source File: set_wallpaper.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def set_wallpaper(self, button, event): if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: image_name = self.get_selected() self.set_wallpaper_by_image_name(image_name) self.left_button.set_sensitive(False)
Example #16
Source File: set_wallpaper.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def apply_changes(self, button, event): self.set_wallpaper(button, event) if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: self.update_config() self.table.unselect_all() self.right_button.set_sensitive(False) # This is the callback linked to the left button
Example #17
Source File: set_account.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def go_to_password_screen(self, widget, event): if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: self.win.clear_win() SetPassword(self.win)
Example #18
Source File: set_advanced.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def apply_changes(self, button, event): # If enter key is pressed or mouse button is clicked if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: if self.ssh_preference is not is_ssh_enabled(): set_ssh_enabled(self.ssh_preference) old_debug_mode = self.get_stored_debug_mode() new_debug_mode = self.debug_button.get_active() if new_debug_mode == old_debug_mode: logging.Logger().debug('skipping debug mode change') self.win.go_to_home() return if new_debug_mode: # set debug on: logging.set_system_log_level('debug') logging.Logger().info("setting logging to debug") msg = _("Activated") else: # set debug off: logging.set_system_log_level('error') logging.Logger().info("setting logging to error") msg = _("De-activated") kdialog = KanoDialog(_("Debug mode"), msg, parent_window=self.win) kdialog.run() self.kano_button.set_sensitive(False) self.win.go_to_home()
Example #19
Source File: PasswordScreen.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def _on_connect_key_wrapper(self, widget, event): if event.keyval == Gdk.KEY_Return: self._on_connect()
Example #20
Source File: set_overclock.py From kano-settings with GNU General Public License v2.0 | 4 votes |
def set_overclock(self, widget, event): # If enter key is pressed or mouse button is clicked if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: # Mode has no changed if self.initial_button == self.selected_button: self.win.go_to_home() return config = self._board_clocking['modes'][self.selected_button] change_overclock = True if is_dangerous_overclock_value(config): kdialog = KanoDialog( title_text=_("Warning"), description_text=( _("For a small percentage of users, this setting makes " \ "the Pi behave unpredictably. Do you want to " \ "continue?") ), button_dict=[ { 'label': _("NO"), 'color': 'red', 'return_value': False }, { 'label': _("YES"), 'color': 'green', 'return_value': True } ], parent_window=self.win ) change_overclock = kdialog.run() if change_overclock: change_overclock_value(config) # Tell user to reboot to see changes end_config_transaction() common.need_reboot = True self.win.go_to_home()
Example #21
Source File: set_account.py From kano-settings with GNU General Public License v2.0 | 4 votes |
def apply_changes(self, button, event): # If enter key is pressed or mouse button is clicked if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return: # This is a callback called by the main loop, so it's safe to # manipulate GTK objects: watch_cursor = Gdk.Cursor(Gdk.CursorType.WATCH) self.win.get_window().set_cursor(watch_cursor) self.kano_button.start_spinner() self.kano_button.set_sensitive(False) def lengthy_process(): old_password = self.entry1.get_text() new_password1 = self.entry2.get_text() new_password2 = self.entry3.get_text() success = False password_verified = verify_current_password(old_password) if not password_verified: title = _("Could not change password") description = _("Your old password is incorrect!") elif new_password1 == new_password2: title, description, success = self.try_change_password(new_password1) else: title = _("Could not change password") description = _("Your new passwords don't match! Try again.") def done(title, description, success): if success: create_success_dialog(title, description, self.win) do_try_again = False else: do_try_again = create_error_dialog(title, description, self.win) self.win.get_window().set_cursor(None) self.kano_button.stop_spinner() self.clear_text() if not do_try_again: self.go_to_accounts() GObject.idle_add(done, title, description, success) thread = threading.Thread(target=lengthy_process) thread.start() # Returns a title, description and whether the process was successful or not