Exemplo n.º 1
0
Arquivo: page.py Projeto: gza/pdbg
 def on_prop_set(self, mgr, response, name, context_id):
     if isinstance(response, PropertySetResponse):
         callback = bind_params(self.on_prop_set_prop_get, context_id)
         mgr.send_property_get(name, context=context_id, observer=callback) 
     else:
         # TODO: do something ...
         pass
Exemplo n.º 2
0
Arquivo: page.py Projeto: gza/pdbg
    def on_cont_stack_get(self, mgr, response):
        # Called by conn_mgr after on_cont_status, with a stack_get response.
        # Updates the the source in the source view and the line number if 
        # the file on the top of the stack is in the source cache. Or, requests
        # the source file on the top of the stack.
        stack = response.get_stack_elements()
        top = stack[0]
        source_view = self._view['source_view']

        self._source_cache.unset_current_lines()

        # check if the sourceview is showing the file on the top of the stack.
        # If so, update the current line and return.
        if source_view.current_file_uri == top['filename']:
            source_view.current_source.current_line = top['lineno']
            source_view.refresh_current_line()
            source_view.scroll_to_current_line()
            mgr.send_context_names(observer=self.on_cont_context_names)
            return

        if self._source_cache.has_key(top['filename']):
            source = self._source_cache[top['filename']]
            source.current_line = top['lineno']
            self._view.update_source(source)
            mgr.send_context_names(observer=self.on_cont_context_names)
        else:
            file_uri = top['filename']
            callback = bind_params(self.on_cont_source, stack)
            mgr.send_source(file_uri, callback)
            mgr.send_context_names(observer=self.on_cont_context_names)
Exemplo n.º 3
0
Arquivo: page.py Projeto: gza/pdbg
 def _remove_line_breakpoint(self, line_num):
     source = self._view['source_view'].current_source
     if not source:
         return
     breaks_on_line = source.get_breakpoints_on_line(line_num)
     if len(breaks_on_line) == 0:
         return
     id = breaks_on_line[0]['id']
     callback = bind_params(self.on_breakpoint_remove, source, id)
     self._conn_mgr.send_breakpoint_remove(id, callback)
Exemplo n.º 4
0
Arquivo: page.py Projeto: gza/pdbg
 def _set_line_breakpoint(self, line_num):
     source = self._view['source_view'].current_source
     if not source:
         return
     breaks_on_line = source.get_breakpoints_on_line(line_num)
     if len(breaks_on_line) > 0:
         return
     callback = bind_params(self.on_breakpoint_set, source, line_num)
     self._conn_mgr.send_line_breakpoint_set(source.file_uri, 
         line_num + 1, callback)
Exemplo n.º 5
0
Arquivo: page.py Projeto: gza/pdbg
 def on_cont_context_names(self, mgr, response):
     # Called by conn_mgr after on_cont_source or on_cont_stack_get with a
     # context_names response. Sends requests for all contexts.
     notebook = self._view['property_notebook']
     names = response.get_names()
     for (name, id) in names:
         observer = bind_params(self.on_cont_context_get, id)
         mgr.send_context_get(context_id=id, observer=observer)
         notebook.setup_property_page(id, name)
     notebook.remove_invalid_pages(id for (name, id) in names)
Exemplo n.º 6
0
Arquivo: page.py Projeto: gza/pdbg
 def on_property_clicked(self, notebook, column_id, context_id, name, type, value):
     if not self._conn_mgr.can_interact:
         return
     if column_id == 'value':
         display_names = self._conn_mgr.get_type_display_names()
         prop_view = ChangePropertyView(type, display_names)
         dialog = prop_view['prop_dialog']
         response = dialog.run()
         dialog.hide()
         if response == gtk.RESPONSE_ACCEPT:
             callback = bind_params(self.on_prop_set, name, context_id)
             self._conn_mgr.send_property_set(name, type=dialog.get_type(), 
                 value=dialog.get_value(), context=context_id, 
                 observer=callback)
Exemplo n.º 7
0
Arquivo: page.py Projeto: gza/pdbg
 def on_get_uri_button_clicked(self, *args):
     # Called by gtk when the get URI button is clicked, AND when enter
     # is pressed in the current URI entry. (The latter is due to the
     # connecting of the entries activate signal to this method).
     if not self._conn_mgr.can_interact:
         return
     entered_uri = self._view['uri_entry'].get_text()
     if entered_uri == self._view['source_view'].current_file_uri:
         return
     if self._source_cache.has_key(entered_uri):
         source = self._source_cache[entered_uri]
         self._view.update_source(source)
     else:
         callback = bind_params(self.on_get_uri_source, entered_uri)
         self._conn_mgr.send_source(entered_uri, callback)
Exemplo n.º 8
0
Arquivo: page.py Projeto: 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)