Logo Search packages:      
Sourcecode: scenic version File versions  Download package

def scenic::application::Application::_start_the_application (   self ) [private]
Should be called only once.
(once Twisted's reactor is running)

Definition at line 329 of file application.py.

                                    :
        """
        Should be called only once.
        (once Twisted's reactor is running)
        """
        reactor.addSystemEventTrigger("before", "shutdown", self.before_shutdown)
        try:
            import pypm
        except ImportError:
            try:
                from pygame import pypm # we can use the pygame.pypm, it is the same as python-portmidi's
            except ImportError:
                log.warning("MIDI support has not been found. You should install python-portmidi for MIDI support.")
                self._midi_is_supported = False
                pypm = None
        if self._midi_is_supported:
            log.info("MIDI support has been detected. Using PyPortMidi version %s" % (pypm.__version__))
        try:
            self.server.start_listening()
        except error.CannotListenError, e:
            def _cb(unused_result):
                reactor.stop()
            log.error("Cannot start SIC server. %s" % (e))
            deferred = dialogs.ErrorDialog.create(_("Is another Scenic running? Cannot bind to port %(port)d") % {"port": self.config.negotiation_port}, parent=self.gui.main_window)
            deferred.addCallback(_cb)
            return
        # Devices: JACKD (every 5 seconds)
        # send some TCP data if connected every 5 minutes
        self._keep_tcp_alive_task.start(5 * 60, now=False)
        # first, poll devices, next restore v4l2 settings, finally, update widgets and poll cameras again.
        # Devices: X11 and XV
        def _cb2(unused_result):
            self.gui.update_widgets_with_saved_config()
            d = self.poll_camera_devices() # we need to do it once more, to update the list of possible image size according to the selected video device
        #first_action = defer.DeferredList([
        def _cb1(unused_result):
            d = self._restore_v4l2_settings()
            d.addCallback(_cb2)
        deferred_list = defer.DeferredList([
            self.poll_x11_devices(), 
            self.poll_xvideo_extension(),
            self.poll_camera_devices(), 
            self.poll_jack_now(),
            self.poll_midi_devices(),
            self.poll_milhouse_maxchannels()
            ])
        deferred_list.addCallback(_cb1)


Generated by  Doxygen 1.6.0   Back to index