def __init__(self): gtksourceview.View.__init__(self) self._current_line = None self._current_source = None buffer = gtksourceview.Buffer() php_lang = _get_language_for_mime_type('application/x-php') if php_lang: buffer.set_language(php_lang) buffer.set_highlight_syntax(True) buffer.set_highlight_matching_brackets(False) config = Config.get_instance() mgr = gtksourceview.style_scheme_manager_get_default() style_scheme = mgr.get_scheme(config['style_scheme']) if style_scheme: buffer.set_style_scheme(style_scheme) self.set_show_line_numbers(True) self.set_show_line_marks(True) self.set_editable(False) self.set_cursor_visible(False) self.set_buffer(buffer) self._set_font() self._add_tags() self._add_marks()
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)
def _setup(self): config = Config.get_instance() logging.basicConfig( level=config['logging_level'], format='%(asctime)s %(levelname)s %(message)s') readline.parse_and_bind('tab: complete')
def _add_tags(self): config = Config.get_instance() tag = gtk.TextTag('current_line') tag.set_property('foreground', config['current_line_foreground']) tag.set_property('foreground-set', True) tag.set_property('paragraph-background', \ config['current_line_background']) tag.set_property('paragraph-background-set', True) self.get_buffer().get_tag_table().add(tag)
def _about_dialog(self): config = Config.get_instance() dialog = gtk.AboutDialog() dialog.set_name('pDBG') dialog.set_version('0.01') dialog.set_website('http://pdbg.googlecode.com') dialog.set_authors(['Christopher Utz <*****@*****.**>']) dialog.set_copyright(u'\u00A92008 Christopher Utz') dialog.set_comments('A frontend for DBGp protocol based debugging engines') dialog.set_license(_license_text) dialog.set_wrap_license(True) return dialog
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)
def _add_marks(self): config = Config.get_instance() img = gtk.gdk.pixbuf_new_from_file(config.get_image_path('breakpoint')) self.set_mark_category_pixbuf('breakpoint', img)