def __init__(self, app=None, scene_id="default", spinviewer_fps=30): global log self.app = app self.user_id = self.app.config.user_id self.scene_id = scene_id self.has_ever_started_viewer = False self.spinviewer_fps = spinviewer_fps unique_master_id = "spinic" log_dir = master.DEFAULT_LOG_DIR log_level = 'warning' if self.app.config.verbose: log_level = 'info' if self.app.config.debug: log_level = 'debug' master.start_logging(log_level=log_level) log = logger.start(name="launching") pid_file = master.write_master_pid_file(identifier=unique_master_id, directory=log_dir) # might raise a RuntimeError: self.lunch_master = master.Master(log_dir=log_dir, pid_file=pid_file, verbose=True) self.lunch_gui = gui.start_gui(self.lunch_master) self._start()
gtk2reactor.install() # has to be done before importing reactor from twisted.internet import reactor from twisted.internet import task from lunch import commands from lunch import master from lunch import gui has_them = False counter = 0 if __name__ == "__main__": unique_master_id = "example" log_dir = master.DEFAULT_LOG_DIR master.start_logging() pid_file = master.write_master_pid_file(identifier=unique_master_id, directory=log_dir) m = master.Master(log_dir=log_dir, pid_file=pid_file, verbose=True) m.add_command(commands.Command("xeyes", identifier="xeyes")) m.add_command(commands.Command("xlogo", identifier="xlogo")) m.add_command(commands.Command("xcalc", identifier="xcalc")) m.add_command( commands.Command("xterm -hold -e /bin/bash -c \"echo %d\"" % (counter), identifier="xterm")) counter += 1 has_them = True def _test(): global has_them
from twisted.internet import gtk2reactor gtk2reactor.install() # has to be done before importing reactor from twisted.internet import reactor from twisted.internet import task from lunch import commands from lunch import master from lunch import gui has_them = False counter = 0 if __name__ == "__main__": unique_master_id = "example" log_dir = master.DEFAULT_LOG_DIR master.start_logging() pid_file = master.write_master_pid_file(identifier=unique_master_id, directory=log_dir) m = master.Master(log_dir=log_dir, pid_file=pid_file, verbose=True) m.add_command(commands.Command("xeyes", identifier="xeyes")) m.add_command(commands.Command("xlogo", identifier="xlogo")) m.add_command(commands.Command("xcalc", identifier="xcalc")) m.add_command(commands.Command("xterm -hold -e /bin/bash -c \"echo %d\"" % (counter), identifier="xterm")) counter += 1 has_them = True def _test(): global has_them global counter if not has_them: print("Adding them again!")