diff options
author | nicolargo <nicolargo@nicolargo-fujitsu.(none)> | 2011-12-04 22:00:23 +0100 |
---|---|---|
committer | nicolargo <nicolargo@nicolargo-fujitsu.(none)> | 2011-12-04 22:00:23 +0100 |
commit | ac6fe891b1655d212124a29d6ad969c52ce7a64a (patch) | |
tree | 62db23fd94bc23cebac1bef13064c61655af6908 | |
parent | 91efbc6ace6701404c7a55130b20f6ed42a669b2 (diff) |
Catch CTRL-C before init screen
-rwxr-xr-x | src/glances.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/glances.py b/src/glances.py index f593e3e7..a11ecf80 100755 --- a/src/glances.py +++ b/src/glances.py @@ -213,7 +213,6 @@ class glancesScreen(): # If current > 70% of max then color = self.if70pc_color / A_BOLD # If current > 90% of max then color = self.if90pc_color / A_REVERSE # By default: color = self.default_color / 0 - max = 0 try: (current * 100) / max except ZeroDivisionError: @@ -271,8 +270,11 @@ class glancesScreen(): def update(self): # Refresh the screen self.term_window.refresh() + # Sleep - curses.napms(self.__refresh_time*1000) + #curses.napms(self.__refresh_time*1000) + time.sleep(self.__refresh_time) + # Getkey self.__catchKey() @@ -432,14 +434,15 @@ def init(): printSyntax() sys.exit(0) + # Catch CTRL-C + signal.signal(signal.SIGINT, signal_handler) + # Init stats stats = glancesStats() # Init screen screen = glancesScreen(refresh_time) - # Catch CTRL-C - signal.signal(signal.SIGINT, signal_handler) def main(): # Init stuff |