本文整理汇总了Python中curses.doupdate方法的典型用法代码示例。如果您正苦于以下问题:Python curses.doupdate方法的具体用法?Python curses.doupdate怎么用?Python curses.doupdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.doupdate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_and_draw_screen
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def setup_and_draw_screen(self):
self.max_y, self.max_x = self.stdscr.getmaxyx()
self.head_win = curses.newwin(1, self.max_x, 0, 0)
self.body_win = curses.newwin(self.max_y - 2, self.max_x, 1, 0)
self.footer_win = curses.newwin(1, self.max_x, self.max_y - 1, 0)
self.login_win = curses.newwin(self.max_y - 2, self.max_x, 1, 0)
self.init_head()
self.init_body()
self.init_footer()
self.footer.set_screen(self.footer_win)
self.body_win.keypad(1)
curses.doupdate()
示例2: __del__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def __del__(self):
del self.panel
del self.win
curses.panel.update_panels()
curses.doupdate()
示例3: done_paint
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def done_paint(self):
"""update the sreen after paint operations, this will invoke all
necessary stuff to refresh all (possibly overlapping) windows in
the right order and then push it to the screen"""
curses.panel.update_panels()
curses.doupdate()
示例4: suspend
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def suspend():
"""
Suspend curses in order to open another subprocess in the terminal.
"""
try:
curses.endwin()
yield
finally:
curses.doupdate()
示例5: display
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def display(self, msg=None):
"""
Redraw the screen, possibly showing a message on the bottom row.
"""
self.screen.clear()
width0 = 6*(self.maxx - 10)//10
width1 = 4*(self.maxx - 10)//10
showobjs = self.flat[self.top:self.top+self.maxy-1]
for i, (obj, depth) in enumerate(showobjs):
text = obj.render()
style = curses.A_BOLD if i == self.cursor else curses.A_NORMAL
self.screen.addstr(i, depth*2, text[0][:width0-depth*2], style)
self.screen.addstr(i, width0+2, text[1][:width1-4])
self.screen.addstr(i, width0+width1, text[2][:4])
self.screen.addstr(i, width0+width1+5, text[3][:5])
if msg is not None:
self.screen.addstr(self.maxy-1, 0,
msg[:self.maxx-1], curses.A_BOLD)
else:
self.screen.addstr(self.maxy-1, 0,
self.status[:self.maxx-1], curses.A_BOLD)
self.screen.refresh()
curses.doupdate()
示例6: refresh_chat
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def refresh_chat(self):
"""
Refresh only the chat box.
"""
self.chat_container.noutrefresh()
self.chat_win.noutrefresh()
curses.doupdate()
示例7: refresh_prompt
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def refresh_prompt(self):
"""
Refresh only the input prompt.
"""
self.prompt_win.noutrefresh()
curses.doupdate()
示例8: refresh_all
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def refresh_all(self):
"""
Refresh everything in the interface.
"""
self.stdscr.noutrefresh()
self.chat_container.noutrefresh()
self.chat_win.noutrefresh()
self.prompt_win.noutrefresh()
curses.doupdate()
示例9: resize
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def resize(self, uis):
curses.endwin()
curses.doupdate()
global mainwin
mainwin.refresh()
maxy, maxx = mainwin.getmaxyx()
for ui in uis:
ui.resize(maxy, maxx)
示例10: main
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def main():
"""Test most of the GUI (except lockout processing)
Initialize and set up screen
Create windows
Generate dummy spectrum data
Update windows with dummy values
Process keyboard strokes
"""
# Use the curses.wrapper() to crash cleanly
# Note the screen object is passed from the wrapper()
# http://stackoverflow.com/questions/9854511/ppos_ython-curses-dilemma
# The issue is the debuuger won't work with the wrapper()
# So enable the next 2 lines and don't pass screen to main()
screen = curses.initscr()
curses.start_color()
# Setup the screen
setup_screen(screen)
# Create windows
specwin = SpectrumWindow(screen)
chanwin = ChannelWindow(screen)
lockoutwin = LockoutWindow(screen)
rxwin = RxWindow(screen)
while 1:
# Generate some random spectrum data from -dyanmic_range to 0 dB
# then offset_db
length = 128
dynamic_range_db = 100
offset_db = 50
data = np.power(10, (-dynamic_range_db*np.random.rand(length)/10)\
+ offset_db/10)
#data = 1E-5*np.ones(length)
specwin.draw_spectrum(data)
# Put some dummy values in the channel, lockout, and receiver windows
chanwin.draw_channels(['144.100', '142.40', '145.00', '144.10',\
'142.40', '145.00', '144.10', '142.40', '145.00', '144.10', '142.40',\
'145.00', '142.40', '145.00', '144.10', '142.400', '145.00', '145.00'])
lockoutwin.draw_channels(['144.100', '142.40', '145.00'])
rxwin.draw_rx()
# Update physical screen
curses.doupdate()
# Check for keystrokes and process
keyb = screen.getch()
specwin.proc_keyb(keyb)
rxwin.proc_keyb_hard(keyb)
rxwin.proc_keyb_soft(keyb)
# Sleep to get about a 10 Hz refresh
time.sleep(0.1)
示例11: _get_input
# 需要导入模块: import curses [as 别名]
# 或者: from curses import doupdate [as 别名]
def _get_input(self, wait_tenths):
# this works around a strange curses bug with window resizing
# not being reported correctly with repeated calls to this
# function without a doupdate call in between
curses.doupdate()
key = self._getch(wait_tenths)
resize = False
raw = []
keys = []
while key >= 0:
raw.append(key)
if key==KEY_RESIZE:
resize = True
elif key==KEY_MOUSE:
keys += self._encode_mouse_event()
else:
keys.append(key)
key = self._getch_nodelay()
processed = []
try:
while keys:
run, keys = escape.process_keyqueue(keys, True)
processed += run
except escape.MoreInputRequired:
key = self._getch(self.complete_tenths)
while key >= 0:
raw.append(key)
if key==KEY_RESIZE:
resize = True
elif key==KEY_MOUSE:
keys += self._encode_mouse_event()
else:
keys.append(key)
key = self._getch_nodelay()
while keys:
run, keys = escape.process_keyqueue(keys, False)
processed += run
if resize:
processed.append('window resize')
return processed, raw