Ejemplo n.º 1
0
 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()
Ejemplo n.º 2
0
"""
This example demonstrate how to use lunch master as a library.
"""
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

if __name__ == "__main__":
    unique_master_id = "example"
    log_dir = master.DEFAULT_LOG_DIR
    pid_file = master.write_master_pid_file(identifier=unique_master_id,
                                            directory=log_dir)
    # XXX add_command here
    m = master.Master(log_dir=log_dir, pid_file=pid_file)
    m.add_command(commands.Command("xeyes", identifier="xeyes"))
    m.add_command(commands.Command("xlogo", identifier="xlogo"))
    m.add_command(commands.Command("xcalc", identifier="xcalc"))

    def _test():
        print("Adding one more!")
        m.add_command(commands.Command("xeyes"))

    looping_call = task.LoopingCall(_test)
    looping_call.start(1.0, False)
    gui.start_gui(m)
    reactor.run()
Ejemplo n.º 3
0
#!/usr/bin/env python
"""
This example demonstrate how to use lunch master as a library.
"""
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

if __name__ == "__main__":
    unique_master_id = "example"
    log_dir = master.DEFAULT_LOG_DIR
    pid_file = master.write_master_pid_file(identifier=unique_master_id, directory=log_dir)
    # XXX add_command here
    m = master.Master(log_dir=log_dir, pid_file=pid_file)
    m.add_command(commands.Command("xeyes", identifier="xeyes"))
    m.add_command(commands.Command("xlogo", identifier="xlogo"))
    m.add_command(commands.Command("xcalc", identifier="xcalc"))
    def _test():
        print("Adding one more!")
        m.add_command(commands.Command("xeyes"))
    looping_call = task.LoopingCall(_test)
    looping_call.start(1.0, False) 
    gui.start_gui(m)
    reactor.run()