mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-07-23 15:20:48 -04:00
Better terminal palette handling. Fixes #8.
This commit is contained in:
parent
4a935cb500
commit
4da00e57f3
2 changed files with 12 additions and 1 deletions
|
@ -47,6 +47,14 @@ class NomadNetworkApp:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Could not restore flow control sequences. The contained exception was: "+str(e), RNS.LOG_WARNING)
|
RNS.log("Could not restore flow control sequences. The contained exception was: "+str(e), RNS.LOG_WARNING)
|
||||||
|
|
||||||
|
if hasattr(self.ui, "restore_palette"):
|
||||||
|
if self.ui.restore_palette:
|
||||||
|
try:
|
||||||
|
self.ui.screen.write("\x1b]104\x07")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
RNS.log("Could not restore terminal color palette. The contained exception was: "+str(e), RNS.LOG_WARNING)
|
||||||
|
|
||||||
RNS.log("Nomad Network Client exiting now", RNS.LOG_VERBOSE)
|
RNS.log("Nomad Network Client exiting now", RNS.LOG_VERBOSE)
|
||||||
|
|
||||||
def exception_handler(self, e_type, e_value, e_traceback):
|
def exception_handler(self, e_type, e_value, e_traceback):
|
||||||
|
|
|
@ -207,7 +207,10 @@ class TextUI:
|
||||||
def set_colormode(self, colormode):
|
def set_colormode(self, colormode):
|
||||||
self.colormode = colormode
|
self.colormode = colormode
|
||||||
self.screen.set_terminal_properties(colormode)
|
self.screen.set_terminal_properties(colormode)
|
||||||
|
|
||||||
|
if self.colormode < 256:
|
||||||
self.screen.reset_default_terminal_palette()
|
self.screen.reset_default_terminal_palette()
|
||||||
|
self.restore_palette = True
|
||||||
|
|
||||||
def unhandled_input(self, key):
|
def unhandled_input(self, key):
|
||||||
if key == "ctrl q":
|
if key == "ctrl q":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue