本文整理汇总了Python中curses.KEY_IC属性的典型用法代码示例。如果您正苦于以下问题:Python curses.KEY_IC属性的具体用法?Python curses.KEY_IC怎么用?Python curses.KEY_IC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类curses
的用法示例。
在下文中一共展示了curses.KEY_IC属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: modal
# 需要导入模块: import curses [as 别名]
# 或者: from curses import KEY_IC [as 别名]
def modal(self):
"""run the modal getch-loop for this dialog"""
if self.win:
done = False
while not done:
key_pressed = self.win.getch()
if key_pressed in [27, ord("q"), curses.KEY_F10]:
done = True
if key_pressed == curses.KEY_DOWN:
self.down(1)
if key_pressed == curses.KEY_UP:
self.down(-1)
if key_pressed in [curses.KEY_IC, ord("=")]:
self.toggle_select()
self.down(1)
for key, func in self.dlg_keys:
if key == key_pressed:
func()
done = True
# help the garbage collector clean up circular references
# to make sure __del__() will be called to close the dialog
del self.dlg_keys
示例2: get_keyboard_codes
# 需要导入模块: import curses [as 别名]
# 或者: from curses import KEY_IC [as 别名]
def get_keyboard_codes():
"""get_keyboard_codes() -> dict
Returns dictionary of (code, name) pairs for curses keyboard constant
values and their mnemonic name. Such as key ``260``, with the value of
its identity, ``KEY_LEFT``. These are derived from the attributes by the
same of the curses module, with the following exceptions:
* ``KEY_DELETE`` in place of ``KEY_DC``
* ``KEY_INSERT`` in place of ``KEY_IC``
* ``KEY_PGUP`` in place of ``KEY_PPAGE``
* ``KEY_PGDOWN`` in place of ``KEY_NPAGE``
* ``KEY_ESCAPE`` in place of ``KEY_EXIT``
* ``KEY_SUP`` in place of ``KEY_SR``
* ``KEY_SDOWN`` in place of ``KEY_SF``
"""
keycodes = OrderedDict(get_curses_keycodes())
keycodes.update(CURSES_KEYCODE_OVERRIDE_MIXIN)
# invert dictionary (key, values) => (values, key), preferring the
# last-most inserted value ('KEY_DELETE' over 'KEY_DC').
return dict(zip(keycodes.values(), keycodes.keys()))
示例3: get_keyboard_codes
# 需要导入模块: import curses [as 别名]
# 或者: from curses import KEY_IC [as 别名]
def get_keyboard_codes():
"""
Return mapping of keycode integer values paired by their curses key-name.
:rtype: dict
Returns dictionary of (code, name) pairs for curses keyboard constant
values and their mnemonic name. Such as key ``260``, with the value of
its identity, ``u'KEY_LEFT'``. These are derived from the attributes by
the same of the curses module, with the following exceptions:
* ``KEY_DELETE`` in place of ``KEY_DC``
* ``KEY_INSERT`` in place of ``KEY_IC``
* ``KEY_PGUP`` in place of ``KEY_PPAGE``
* ``KEY_PGDOWN`` in place of ``KEY_NPAGE``
* ``KEY_ESCAPE`` in place of ``KEY_EXIT``
* ``KEY_SUP`` in place of ``KEY_SR``
* ``KEY_SDOWN`` in place of ``KEY_SF``
This function is the inverse of :func:`get_curses_keycodes`. With the
given override "mixins" listed above, the keycode for the delete key will
map to our imaginary ``KEY_DELETE`` mnemonic, effectively erasing the
phrase ``KEY_DC`` from our code vocabulary for anyone that wishes to use
the return value to determine the key-name by keycode.
"""
keycodes = OrderedDict(get_curses_keycodes())
keycodes.update(CURSES_KEYCODE_OVERRIDE_MIXIN)
# invert dictionary (key, values) => (values, key), preferring the
# last-most inserted value ('KEY_DELETE' over 'KEY_DC').
return dict(zip(keycodes.values(), keycodes.keys()))
示例4: define_keys
# 需要导入模块: import curses [as 别名]
# 或者: from curses import KEY_IC [as 别名]
def define_keys(self):
self.keys = {'j': self.down,
'k': self.up,
'h': self.left,
'l': self.right,
'J': self.page_down,
'K': self.page_up,
'm': self.mark,
"'": self.goto_mark,
'L': self.page_right,
'H': self.page_left,
'q': self.quit,
'Q': self.quit,
'$': self.line_end,
'^': self.line_home,
'0': self.line_home,
'g': self.home,
'G': self.goto_row,
'|': self.goto_col,
'\n': self.show_cell,
'/': self.search,
'n': self.search_results,
'p': self.search_results_prev,
't': self.toggle_header,
'-': self.column_gap_down,
'+': self.column_gap_up,
'<': self.column_width_all_down,
'>': self.column_width_all_up,
',': self.column_width_down,
'.': self.column_width_up,
'a': self.sort_by_column_natural,
'A': self.sort_by_column_natural_reverse,
's': self.sort_by_column,
'S': self.sort_by_column_reverse,
'y': self.yank_cell,
'r': self.reload,
'c': self.toggle_column_width,
'C': self.set_current_column_width,
']': self.skip_to_row_change,
'[': self.skip_to_row_change_reverse,
'}': self.skip_to_col_change,
'{': self.skip_to_col_change_reverse,
'?': self.help,
curses.KEY_F1: self.help,
curses.KEY_UP: self.up,
curses.KEY_DOWN: self.down,
curses.KEY_LEFT: self.left,
curses.KEY_RIGHT: self.right,
curses.KEY_HOME: self.line_home,
curses.KEY_END: self.line_end,
curses.KEY_PPAGE: self.page_up,
curses.KEY_NPAGE: self.page_down,
curses.KEY_IC: self.mark,
curses.KEY_DC: self.goto_mark,
curses.KEY_ENTER: self.show_cell,
KEY_CTRL('a'): self.line_home,
KEY_CTRL('e'): self.line_end,
}