Пример #1
0
 def __init__(self, name='TextTemplate'):
     TextBuffer.__init__(self)
     #self.set_name(name)
     self.__tagtable__ = self.get_tag_table()
     template_tag = _TemplateTag('template', foreground='magenta', scale=.85)
     self.__tagtable__.add(template_tag)
     self.__template__ = Template()
Пример #2
0
 def __init__(self, name='TextTemplate'):
     TextBuffer.__init__(self)
     #self.set_name(name)
     self.__tagtable__ = self.get_tag_table()
     template_tag = _TemplateTag('template')
     self.__tagtable__.add(template_tag)
     self.__template__ = Template()
Пример #3
0
 def __init__(self, name="TextTemplate"):
     TextBuffer.__init__(self)
     # self.set_name(name)
     self.__tagtable__ = self.get_tag_table()
     template_tag = _TemplateTag("template")
     self.__tagtable__.add(template_tag)
     self.__template__ = Template()
Пример #4
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)
Пример #5
0
	def finish(self, widget=None):
		self.results = ""
		for i in xrange(self.num_songs):
			current_hbox = self.quiz_vbox.get_children()[i]
			a = current_hbox.get_children()[0].get_active_text()
			t = current_hbox.get_children()[1].get_active_text()
			y = current_hbox.get_children()[2].get_active_text()
			g = current_hbox.get_children()[3].get_active_text()
			this_response = {'artist':a, 'title':t, 'genre':g, 'year':y}
			self.results += "Correct answer:\n"
			self.results += str(self.answers[i]) + "\n"
			self.results += "Your answer:\n"
			self.results += str(this_response) + "\n"
		log.info("results:\n" + self.results)

		result_buf = TextBuffer()
		result_buf.set_text(self.results)
		self.results_textview.set_buffer(result_buf)

		self.notebook.next_page()
Пример #6
0
 def set_text(self, text):
     TextBuffer.set_text(self, text)
     self.reset_template()
Пример #7
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)