Example #1
0
 def _setup_log(self):
     log_text_view = self.gld.get_widget("log")
     text_buffer = TextBuffer()
     iter = text_buffer.get_start_iter()
     log_file = self.database.log.values()[0]
     
     while log_file:
         text_buffer.insert(iter, log_file.pop())
     log_text_view.set_buffer(text_buffer)
Example #2
0
    def _set_pac_summary(self, pac):
        sum_txt = self.gld.get_widget("summary")
        file_tree = self.gld.get_widget("files")

        def list_tag(tag, widget, event, iter):
            if event.type == BUTTON_RELEASE:
                buff = widget.get_buffer()
                url = tag.get_data("url")
                if url:
                    webbrowser.open_new_tab(url)
        
        text_buffer = TextBuffer()
        tag_table = text_buffer.get_tag_table()
        heading_tag = TextTag("heading")
        heading_tag.set_property("weight", pango.WEIGHT_BOLD)
        heading_tag.set_property("foreground", "grey")

        link_tag = TextTag('link')
        link_tag.set_property("foreground", 'brown')
        link_tag.set_property('underline', pango.UNDERLINE_SINGLE)
        link_tag.set_data("url", pac.url)
        link_tag.connect("event", list_tag)
        
        center_tag = TextTag("center")
        #center_tag.set_property("indent", 800)
        center_tag.set_property("foreground", "blue")
        #center_tag.set_property("left-margin", 90)
        tag_table.add(heading_tag)
        tag_table.add(center_tag)
        tag_table.add(link_tag)
        
        iter = text_buffer.get_start_iter()
        
        if pac.installed:
            text_buffer.insert_with_tags_by_name(iter, "Description\n", 'heading')
            text_buffer.insert(iter, pac.description[0] + "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "Size\n", 'heading')
            text_buffer.insert(iter, pac.size + "\n")

            text_buffer.insert_with_tags_by_name(iter, "URL\n", 'heading')
            text_buffer.insert_with_tags_by_name(iter, pac.url, 'link')
            text_buffer.insert(iter, "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "Install Date\n", 'heading')
            text_buffer.insert(iter, pac.dates[0] + "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "Install Reason\n", 'heading')
            text_buffer.insert(iter, pac.explicitly[0] + "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "Required By\n", 'heading')
            text_buffer.insert(iter, pac.req_by + "\n")

            text_buffer.insert_with_tags_by_name(iter, "Depends On\n", 'heading')
            text_buffer.insert(iter, pac.dependencies + "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "Packager\n", 'heading')
            text_buffer.insert(iter, pac.description[1] + "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "Build Date\n", 'heading')
            text_buffer.insert(iter, pac.dates[1])

            sum_txt.set_buffer(text_buffer)
    
        else:            
            text_buffer.insert_with_tags_by_name(iter, "Description\n", "heading")
            text_buffer.insert(iter, pac.description[0] + "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "Size (compressed)\n", "heading")
            text_buffer.insert(iter, pac.size + "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "URL\n", 'heading')
            text_buffer.insert_with_tags_by_name(iter, pac.url, 'link')
            text_buffer.insert(iter, "\n")
            
            text_buffer.insert_with_tags_by_name(iter, "Depends On\n", "heading")
            text_buffer.insert(iter, pac.dependencies, )
            
            sum_txt.set_buffer(text_buffer)