本文整理汇总了Python中gi.repository.Gdk.KEY_Delete方法的典型用法代码示例。如果您正苦于以下问题:Python Gdk.KEY_Delete方法的具体用法?Python Gdk.KEY_Delete怎么用?Python Gdk.KEY_Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gdk
的用法示例。
在下文中一共展示了Gdk.KEY_Delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: signal_key_press_event
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Delete [as 别名]
def signal_key_press_event(self, treeview, event):
if event.type != Gdk.EventType.KEY_PRESS:
return
keyval = event.get_keyval()[1]
if event.get_state() == Gdk.ModifierType.CONTROL_MASK:
if keyval == Gdk.KEY_c and self.column_titles:
gui_utilities.gtk_treeview_selection_to_clipboard(treeview, list(self.column_titles.values())[0])
elif keyval == Gdk.KEY_F5 and self.cb_refresh:
self.cb_refresh()
elif keyval == Gdk.KEY_Delete:
self._call_cb_delete()
示例2: signal_tv_key_press
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Delete [as 别名]
def signal_tv_key_press(self, _, event):
if event.type != Gdk.EventType.KEY_PRESS:
return
keyval = event.get_keyval()[1]
if keyval == Gdk.KEY_F2:
self._rename_selection()
elif keyval == Gdk.KEY_F5:
self.refresh()
elif keyval == Gdk.KEY_Delete:
self._delete_selection()
示例3: on_file_treeview_key_press_event
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Delete [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()
示例4: _on_key_press_event
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Delete [as 别名]
def _on_key_press_event(self, _widget, event):
if self.hemingway_mode:
return event.keyval == Gdk.KEY_BackSpace or event.keyval == Gdk.KEY_Delete
if event.state & Gdk.ModifierType.SHIFT_MASK == Gdk.ModifierType.SHIFT_MASK \
and event.keyval == Gdk.KEY_ISO_Left_Tab: # Capure Shift-Tab
self._on_shift_tab()
return True
示例5: _parse_user_input
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Delete [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
示例6: _parse_user_input
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Delete [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
示例7: button_press_event
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Delete [as 别名]
def button_press_event(self,obj,event):
from gramps.gui.editors import EditPlace
if (event.type == Gdk.EventType._2BUTTON_PRESS and
event.button.button == 1):
store, node = self.tree.get_selection().get_selected()
if node:
#only when non empty tree view you are here
place_handle = store.get_value(node, 1)
place = self.db.get_place_from_handle(place_handle)
action = store.get_value(node,2)
if action :
if action[1] != None :
place = self.group_set(place, action[0], action[1] )
else :
#we are in a parent node, go over children nodes if present
index = 0
while store.iter_nth_child(node, index):
nodechild = store.iter_nth_child(node, index)
action = store.get_value(nodechild,2)
if action :
if action[1] != None :
place = self.group_set(place,
action[0], action[1] )
index += 1
try :
EditPlace(self.dbstate, self.uistate, self.track, place,
self.this_callback)
except WindowActiveError :
pass
if event.type == Gdk.EventType.KEY_PRESS and \
event.keyval == Gdk.KEY_Delete:
selection = self.tree.get_selection()
store, node = selection.get_selected()
if node :
path = store.get_path(node)
store.remove(node)
# set selection to the next item
selection.select_path(path)
# if last of a path was deleted, the above gave no result
# select next item if not empty list
if not selection.path_is_selected(path):
row = path[0]-1
# test case for empty lists
if row >= 0:
selection.select_path((row,))
if event.type == Gdk.EventType.KEY_PRESS and \
event.keyval == Gdk.KEY_Tab:
#call up google maps
self.google()
示例8: on_key_press
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import KEY_Delete [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
#===================================