本文整理匯總了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