Skip to content

Commit

Permalink
#2601 add pause keys: p and P to stop updating the screen
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@27020 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 22, 2020
1 parent 6721d3e commit 99a3088
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/xpra/client/top_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
RED = 3

EXIT_KEYS = (ord("q"), ord("Q"))
PAUSE_KEYS = (ord("p"), ord("P"))


def get_title():
title = "Xpra top %s" % __version__
Expand Down Expand Up @@ -290,6 +292,7 @@ def __init__(self, *args):
self.server_last_info = typedict()
self.server_last_info_time = 0
self.info_timer = 0
self.paused = False
self.stdscr = None

def client_type(self):
Expand Down Expand Up @@ -335,17 +338,20 @@ def err(self, e):

def update_screen(self):
self.log("update_screen()")
self.stdscr.erase()
try:
self.do_update_screen()
except Exception as e:
self.err(e)
finally:
self.stdscr.refresh()
if not self.paused:
self.stdscr.erase()
try:
self.do_update_screen()
except Exception as e:
self.err(e)
finally:
self.stdscr.refresh()
v = self.stdscr.getch()
if v in EXIT_KEYS:
self.log("exit on key '%s'" % v)
self.quit(0)
if v in PAUSE_KEYS:
self.paused = not self.paused

def do_update_screen(self):
self.log("do_update_screen()")
Expand Down

0 comments on commit 99a3088

Please sign in to comment.