本文整理汇总了Python中curses.beep方法的典型用法代码示例。如果您正苦于以下问题:Python curses.beep方法的具体用法?Python curses.beep怎么用?Python curses.beep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.beep方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: h_set_filtered_to_selected
# 需要导入模块: import curses [as 别名]
# 或者: from curses import beep [as 别名]
def h_set_filtered_to_selected(self, ch):
# This is broken on multiline
if len(self._filtered_values_cache) < 2:
self.value = self._filtered_values_cache
else:
# There is an error - trying to select too many things.
curses.beep()
示例2: auto_complete
# 需要导入模块: import curses [as 别名]
# 或者: from curses import beep [as 别名]
def auto_complete(self, input):
curses.beep()
示例3: use_mouse_event
# 需要导入模块: import curses [as 别名]
# 或者: from curses import beep [as 别名]
def use_mouse_event(self, mouse_event):
wg = self.find_mouse_handler(mouse_event)
if wg:
self.set_editing(wg)
if hasattr(wg, 'handle_mouse_event'):
wg.handle_mouse_event(mouse_event)
else:
curses.beep()
示例4: show_brief_message
# 需要导入模块: import curses [as 别名]
# 或者: from curses import beep [as 别名]
def show_brief_message(self, message):
curses.beep()
keep_for_a_moment = self.value
self.value = message
self.editing=False
self.display()
curses.napms(1200)
self.editing=True
self.value = keep_for_a_moment
示例5: h_set_filtered_to_selected
# 需要导入模块: import curses [as 别名]
# 或者: from curses import beep [as 别名]
def h_set_filtered_to_selected(self, ch):
if len(self._filtered_values_cache) < 2:
self.value = self.get_filtered_values()
else:
# There is an error - trying to select too many things.
curses.beep()
#####################################################################################
# The Following are maintained here for compatibility only.
# All new Applications should use classes above this comment.
#####################################################################################
示例6: auto_complete
# 需要导入模块: import curses [as 别名]
# 或者: from curses import beep [as 别名]
def auto_complete(self, input):
self.value = os.path.expanduser(self.value)
directory, fname = os.path.split(self.value)
# Let's have absolute paths.
directory = os.path.abspath(directory)
if self.value == '':
self.value=directory
try:
flist = os.listdir(directory)
except:
self.show_brief_message("Can't read directory!")
return False
flist = [os.path.join(directory, x) for x in flist]
possibilities = list(filter(
(lambda x: os.path.split(x)[1].startswith(fname)), flist
))
if len(possibilities) == 0:
# can't complete
curses.beep()
self.cursor_position = len(self.value)
elif len(possibilities) == 1:
if self.value != possibilities[0]:
self.value = possibilities[0]
if os.path.isdir(self.value) \
and not self.value.endswith(os.sep):
self.value = self.value + os.sep
self.cursor_position = len(self.value)
elif len(possibilities) > 1:
self.value = os.path.commonprefix(possibilities)
self.cursor_position = len(self.value)
curses.beep()
if os.path.isdir(self.value) and len(possibilities) < 2:
self.parent.wMain.change_dir(self.value)
if os.path.isdir(self.value) \
and not self.value.endswith(os.sep):
self.value = self.value + os.sep
self.cursor_position = len(self.value)
#self.h_exit_up(None)
else:
self.parent.value = directory
self.parent.update_grid()
示例7: do_command
# 需要导入模块: import curses [as 别名]
# 或者: from curses import beep [as 别名]
def do_command(self, ch):
if curses.ascii.isprint(ch) or ch == curses.ascii.LF:
text_window_height, text_window_width = self.text_window.getmaxyx()
y, x = size_as_drawn((self.get_content() + chr(ch)).split('\n'), text_window_width)
if y < text_window_height - 1 and x < text_window_width:
self.content.insert(self.cursor_pos, chr(ch))
self.cursor_pos += 1
else:
curses.beep()
elif ch == curses.KEY_BACKSPACE:
if self.cursor_pos > 0:
del self.content[self.cursor_pos - 1]
self.cursor_pos -= 1
else:
curses.beep()
elif ch == curses.KEY_DC:
if self.cursor_pos >= 0 and self.cursor_pos < len(self.content):
del self.content[self.cursor_pos]
else:
curses.beep()
elif ch == curses.KEY_LEFT:
if self.cursor_pos > 0:
self.cursor_pos -= 1
else:
curses.beep()
elif ch == curses.KEY_RIGHT:
if self.cursor_pos + 1 <= len(self.content):
self.cursor_pos += 1
else:
curses.beep()
elif ch in (curses.ascii.EOT, curses.ascii.RS): # ^D or (for some terminals) Ctrl+Enter
return False, False
elif ch == curses.ascii.ESC:
self.clear()
return False, True
elif ch == curses.KEY_RESIZE:
self.on_resize()
return True, False
self.refresh_text()
return True, False