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: page.py Progetto: gza/pdbg
 def on_check_init_steps(self):
     if len(self._init_steps_done) == _NUM_INIT_STEPS:
         # The page's initial state is prepared, make it show up.
         self._view['outer_box'].show_all()
         # Make this page be on top in the notebook.
         app_view = AppView.get_instance()
         app_view['notebook'].set_current_page(self._page_num)
         return False
     else:
         return True
Esempio n. 3
0
File: page.py Progetto: gza/pdbg
 def on_get_uri_source(self, mgr, response, entered_uri):
     # Called by conn_mgr with a source response containing source for a 
     # user requested file.
     if isinstance(response, SourceResponse):
         source = Source(entered_uri, response.source)
         self._source_cache[entered_uri] = source
         self._view.update_source(source)
     else:
         app_view = AppView.get_instance()
         app_view.show_warning('error_req_source', entered_uri, 
             response.error_msg)
Esempio n. 4
0
File: page.py Progetto: gza/pdbg
 def on_io_event(self, source, condition):
     # Called from the gobject main loop when an event occurs on the 
     # connection socket.
     if condition == gobject.IO_IN:
         try:
             self._conn_mgr.process_response()
         except ConnectionClosed, e:
             self._conn_mgr.close_connection()
             app_view = AppView.get_instance()
             app_view['notebook'].set_current_page(self._page_num)
             app_view.show_error('conn_closed')
             app_view['notebook'].remove_page(self._page_num)
Esempio n. 5
0
File: page.py Progetto: gza/pdbg
    def on_init_packet(self, mgr, init, remote_addr):
        # Called by conn_mgr when the initial XML packet is received from the
        # engine. Appends a new notebook page and requests the source for the
        # initial script.
        conn_info = init.get_engine_info()
        conn_info.update({ 'remote_ip': remote_addr[0], 
            'remote_port': remote_addr[1] })

        app_view = AppView.get_instance()
        self._page_num = self._view.append_page_on_init(conn_info, 
            app_view['notebook'])

        file_uri = init.file_uri
        src_callback = bind_params(self.on_init_source, file_uri)

        mgr.send_source(file_uri, observer=src_callback)
        mgr.send_typemap_get(observer=self.on_init_typemap_get)
        mgr.send_stdout(observer=self.on_init_stdout)
        mgr.send_stderr(observer=self.on_init_stderr)
        mgr.send_status(observer=self.on_init_status)

        config = Config.get_instance()
        gobject.timeout_add(config['init_check_timeout_ms'], 
            self.on_check_init_steps)
Esempio n. 6
0
File: page.py Progetto: gza/pdbg
 def refresh_page_number(self):
     notebook = AppView.get_instance()['notebook']
     self._page_num = notebook.page_num(self._view['outer_box'])
Esempio n. 7
0
File: page.py Progetto: gza/pdbg
 def on_tab_close_button_clicked(self, button):
     # Called by gtk when the close button on the pages tab is clicked.
     self._conn_mgr.close_connection()
     app_view = AppView.get_instance()
     app_view['notebook'].remove_page(self._page_num)
Esempio n. 8
0
 def _prop_dialog(self):
     app_view = AppView.get_instance()
     dialog = ChangePropertyDialog(app_view['window'], self._current_type, 
         self._display_names)
     dialog.set_default_size(300, -1)
     return dialog
Esempio n. 9
0
File: app.py Progetto: gza/pdbg
 def run(self):
     self._setup()
     AppView.get_instance()['window'].show_all()
     gtk.main()