Browse Source

try.. except wrapper for ncurses.set_curs

283
ThomasV 12 years ago
parent
commit
5251f278e8
  1. 12
      gui/gui_text.py

12
gui/gui_text.py

@ -21,7 +21,7 @@ class ElectrumGui:
self.stdscr.keypad(1) self.stdscr.keypad(1)
self.stdscr.border(0) self.stdscr.border(0)
self.maxy, self.maxx = self.stdscr.getmaxyx() self.maxy, self.maxx = self.stdscr.getmaxyx()
curses.curs_set(0) self.set_cursor(0)
self.w = curses.newwin(10, 50, 5, 5) self.w = curses.newwin(10, 50, 5, 5)
self.wallet = wallet self.wallet = wallet
@ -44,6 +44,12 @@ class ElectrumGui:
self.num_tabs = len(self.tab_names) self.num_tabs = len(self.tab_names)
def set_cursor(self, x):
try:
curses.curs_set(x)
except:
pass
def restore_or_create(self): def restore_or_create(self):
pass pass
@ -51,12 +57,12 @@ class ElectrumGui:
pass pass
def get_string(self, y, x): def get_string(self, y, x):
curses.curs_set(1) self.set_cursor(1)
curses.echo() curses.echo()
self.stdscr.addstr( y, x, " "*20, curses.A_REVERSE) self.stdscr.addstr( y, x, " "*20, curses.A_REVERSE)
s = self.stdscr.getstr(y,x) s = self.stdscr.getstr(y,x)
curses.noecho() curses.noecho()
curses.curs_set(0) self.set_cursor(0)
return s return s

Loading…
Cancel
Save