예제 #1
0
파일: launcher.py 프로젝트: s2t2/SNAP
    def __init__(self, opts):
        ShowBase.__init__(self)

        self._module = None  # the currently loaded module
        self._instance = None  # instance of the module's Main class
        self._executing = False  # whether we are executing the module
        self._remote_commands = Queue.Queue(
        )  # a message queue filled by the TCP server
        self._opts = opts  # the configuration options
        self._console = None  # graphical console, if any

        # send an initial start marker
        send_marker(999)

        # preload some data and init some settings
        self.set_defaults()

        # register the main loop
        self._main_task = self.taskMgr.add(self._main_loop_tick,
                                           "main_loop_tick")

        # register global keys if desired
        if opts.developer:
            self.accept("escape", exit)
            self.accept("f1", self._remote_commands.put, ['start'])
            self.accept("f2", self._remote_commands.put, ['cancel'])
            self.accept("f5", self._remote_commands.put, ['prune'])
            self.accept("f12", self._init_console)

        # load the initial module or config if desired
        if opts.module is not None:
            if opts.module.endswith(".cfg"):
                self.load_config(opts.module)
            else:
                self.load_module(opts.module)

        # start the module if desired
        if (opts.autolaunch == True) or (opts.autolaunch == '1'):
            self.start_module()

        # start the TCP server for remote control
        self._init_server(opts.serverport)
예제 #2
0
파일: launcher.py 프로젝트: sccn/SNAP
    def __init__(self,opts):
        ShowBase.__init__(self)

        self._module = None              # the currently loaded module
        self._instance = None            # instance of the module's Main class
        self._executing = False          # whether we are executing the module
        self._remote_commands = Queue.Queue() # a message queue filled by the TCP server
        self._opts = opts                # the configuration options
        self._console = None             # graphical console, if any
        
        # send an initial start marker
        send_marker(999)

        # preload some data and init some settings
        self.set_defaults()

        # register the main loop
        self._main_task = self.taskMgr.add(self._main_loop_tick,"main_loop_tick")
        
        # register global keys if desired
        if opts.developer:
            self.accept("escape",exit)
            self.accept("f1",self._remote_commands.put,['start'])
            self.accept("f2",self._remote_commands.put,['cancel'])
            self.accept("f5",self._remote_commands.put,['prune'])
            self.accept("f12",self._init_console)
                
        # load the initial module or config if desired
        if opts.module is not None:
            if opts.module.endswith(".cfg"):
                self.load_config(opts.module)
            else:
                self.load_module(opts.module)
                
        # start the module if desired
        if (opts.autolaunch == True) or (opts.autolaunch=='1'):
            self.start_module()

        # start the TCP server for remote control
        self._init_server(opts.serverport)
예제 #3
0
 def marker(self, markercode):
     """Send a marker."""
     send_marker(markercode)
예제 #4
0
 def marker(self,markercode):
     """Send a marker."""
     send_marker(markercode)