From e2ab77fca7fd50079908d0f1bdf3d6300ac93194 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 26 Jun 2014 12:38:59 +1000 Subject: [PATCH] Make the Fake Galil display window support the 8 controllers --- .../TEST_SICS/fakeGalil/SIM_GALIL.py | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/site_ansto/instrument/TEST_SICS/fakeGalil/SIM_GALIL.py b/site_ansto/instrument/TEST_SICS/fakeGalil/SIM_GALIL.py index a5615c70..fc52aff1 100755 --- a/site_ansto/instrument/TEST_SICS/fakeGalil/SIM_GALIL.py +++ b/site_ansto/instrument/TEST_SICS/fakeGalil/SIM_GALIL.py @@ -26,25 +26,32 @@ def display_iterator(): try: rows, cols = screen.stdscr.getmaxyx() col = 0 + column_width = 78 / len(devices.keys()) for idx in sorted(devices.keys()): line = 0; col += 1 - screen.stdscr.addstr(line, 13 * (col - 1) + 2, "%8s=%d" % (idx, factories[idx].numProtocols)) + header = "%s=%d" % (idx, factories[idx].numProtocols) + screen.stdscr.addstr(line, column_width * (col - 1) + 2, header.rjust(column_width-1)) line = 1 for mtr in sorted(devices[idx].motors.keys()): screen.stdscr.addstr(line, 0, "%1s:" % mtr) try: name = devices[idx].motors[mtr].name - if len(name) > 12: - name = name[:12] - screen.stdscr.addstr(line, 13 * (col - 1) + 2, "%12s" % name.rjust(12), curses.A_DIM) + if len(name) > column_width-1: + name = name[:column_width-1] + if (devices[idx].motors[mtr].motorState == "OFF"): + screen.stdscr.addstr(line, column_width * (col - 1) + 2, "%s" % name.rjust(column_width-1), curses.A_DIM) + else: + screen.stdscr.addstr(line, column_width * (col - 1) + 2, "%s" % name.rjust(column_width-1), curses.A_STANDOUT) except: - screen.stdscr.addstr(line, 13 * (col - 1) + 2, "%12s" % "") - value = "%12.3f" % devices[idx].motors[mtr].getPosition() + screen.stdscr.addstr(line, column_width * (col - 1) + 2, "%s" % "".rjust(column_width-1)) + value = "%.3f" % devices[idx].motors[mtr].getPosition() + if len(value) > column_width-1: + value = value[:column_width-1] if (devices[idx].motors[mtr].motorState == "OFF"): - screen.stdscr.addstr(line + 1, 13 * (col - 1) + 2, "%s " % value, curses.A_BOLD) + screen.stdscr.addstr(line + 1, column_width * (col - 1) + 2, "%s" % value.rjust(column_width-1), curses.A_BOLD) else: - screen.stdscr.addstr(line + 1, 13 * (col - 1) + 2, "%s*" % value, curses.A_STANDOUT) + screen.stdscr.addstr(line + 1, column_width * (col - 1) + 2, "%s" % value.rjust(column_width-1), curses.A_STANDOUT) line += 2 except: raise