本文整理汇总了Python中gi.repository.Gdk.KEY_Return方法的典型用法代码示例。如果您正苦于以下问题:Python Gdk.KEY_Return方法的具体用法?Python Gdk.KEY_Return怎么用?Python Gdk.KEY_Return使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gdk
的用法示例。
在下文中一共展示了Gdk.KEY_Return方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_account
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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
示例2: apply_changes
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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()
示例3: treeview_key_press
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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
示例4: _on_connect_key_wrapper
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
def _on_connect_key_wrapper(self, widget, event):
if event.keyval == Gdk.KEY_Return:
self._on_connect()
示例5: apply_changes
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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)
示例6: apply_changes
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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()
示例7: go_to_password_screen
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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)
示例8: apply_changes
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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
示例9: set_wallpaper
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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)
示例10: apply_changes
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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()
示例11: apply_changes
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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()
示例12: reset_button_cb
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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()
示例13: on_find_entry_key_press
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [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()
示例14: _keypress
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [as 别名]
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
示例15: on_window_key_press_event
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Return [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