Esempio n. 1
0
File: app.py Progetto: gza/pdbg
    def _setup(self):
        config = Config.get_instance()

        logging.basicConfig(
            level=config['logging_level'], 
            format='%(asctime)s %(levelname)s %(message)s')

        # Override some of the theme styles.
        gtk.rc_parse_string(_gtk_styles)

        # Connect application signal handlers.
        app_view = AppView.get_instance()
        app_view['window'].connect('destroy', self.on_quit_app)
        app_view['quit_item'].connect('activate', self.on_quit_app)
        app_view['about_item'].connect('activate', self.on_activate_about)

        # Setup singleton managers.
        ListenerManager.get_instance().setup()
        PagesManager.get_instance().setup()
        ToolbarManager.get_instance().setup()

        # Interpolate the ip address/port into the placeholder label.
        app_view = AppView.get_instance()
        info_lbl = app_view['info_page_label']
        listener = ListenerManager.get_instance().listener
        info_lbl.set_text(info_lbl.get_text() % (listener.ip_address, \
            listener.port))

        # Register a function to poll for incoming connections.
        gobject.timeout_add(config['listener_timeout_ms'], self.on_timeout)
Esempio n. 2
0
File: app.py Progetto: gza/pdbg
 def on_timeout(self):
     ListenerManager.get_instance().accept_connection()
     return True