Make display window optional for SIM_GALIL.py

This commit is contained in:
Ferdi Franceschini
2013-11-28 09:48:10 +11:00
committed by Ferdi Franceschini
parent d2ac198251
commit fc02a71882

View File

@@ -77,8 +77,9 @@ class MyScreen(Screen):
def main(**kwargs): def main(**kwargs):
global screen, devices, factories global screen, devices, factories
parser = argparse.ArgumentParser( description="Generates fake Galil controllers for testing SICS" ) parser = argparse.ArgumentParser( description='Generates fake Galil controllers for testing SICS' )
parser.add_argument("instrument", help="The instrument name") parser.add_argument('instrument', help='The instrument name')
parser.add_argument('-w', '--window', help='Create a display window', action='store_true', default=False)
args = parser.parse_args() args = parser.parse_args()
basePort = { basePort = {
@@ -97,9 +98,10 @@ def main(**kwargs):
factories[controllerName] = factory factories[controllerName] = factory
reactor.listenTCP(port, factory) reactor.listenTCP(port, factory)
stdscr = curses.initscr() if (args.window):
screen = MyScreen(stdscr) stdscr = curses.initscr()
reactor.addReader(screen) screen = MyScreen(stdscr)
reactor.addReader(screen)
#lc = LoopingCall(device_iterator) #lc = LoopingCall(device_iterator)
#lc.start(0.5) #lc.start(0.5)