def rename_tab(self, tab, new_full_name, name_list=None): logging.info("encoding finished " + new_full_name) self.set_full_tab_name(tab, new_full_name) new_label_text = crop_string(new_full_name, FC().len_of_tab) self.get_tab_label(tab).activate() tab.get_child().label.set_text(new_label_text + ' ') if name_list: n = self.page_num(tab) name_list[n] = new_label_text
def _append_tab(self, full_name=_("Empty tab"), beans=None, rows=None, optimization=False): logging.info("append new tab") self.last_notebook_page = full_name try: logging.info("encoding of tab name is " + full_name) full_name = unicode(full_name) #convert from any encoding in ascii logging.info("encoding finished " + full_name) except: logging.warn( "problem of encoding definition for tab name is occured") visible_name = crop_string(full_name, FC().len_of_tab) tab_content = self.create_notebook_content(beans, rows, optimization) tab_content.label.set_angle(self.default_angle) tab = self.create_notebook_tab(tab_content) if self.navig: tab_content.label.set_angle(90) tab_content.full_name = full_name """label""" if visible_name.endswith(" "): tab_content.label.set_text(visible_name) else: tab_content.label.set_text(visible_name + " ") tab_content.label.show() if FC().tab_position == "left" or self.navig: """container Vertical Tab""" box = Gtk.VBox(False, 0) box.show() if FC().tab_close_element: box.pack_start(self.button(tab), False, False, 0) box.pack_end(tab_content.label, False, False, 0) else: """container Horizontal Tab""" box = Gtk.HBox(False, 0) box.show() if FC().tab_close_element: box.pack_end(self.button(tab), False, False, 0) box.pack_start(tab_content.label, False, False, 0) eventbox = self.to_eventbox(box, tab) """append tab""" self.prepend_page(tab, eventbox) self.set_tab_reorderable(tab, True) self.show_all() self.set_current_page(0) #only after show_all() if not self.navig: if self.get_n_pages() > FC().count_of_tabs: self.remove_page(self.get_n_pages() - 1)
def _append_tab(self, full_name=_("Empty tab"), beans=None, rows=None, optimization=False): logging.info("append new tab") self.last_notebook_page = full_name try: logging.info("encoding of tab name is " + full_name) full_name = unicode(full_name) #convert from any encoding in ascii logging.info("encoding finished " + full_name) except: logging.warn("problem of encoding definition for tab name is occured") visible_name = crop_string(full_name, FC().len_of_tab) tab_content = self.create_notebook_content(beans, rows, optimization) tab_content.label.set_angle(self.default_angle) tab = self.create_notebook_tab(tab_content) if self.navig: tab_content.label.set_angle(90) tab_content.full_name = full_name """label""" if visible_name.endswith(" "): tab_content.label.set_text(visible_name) else: tab_content.label.set_text(visible_name + " ") tab_content.label.show() if FC().tab_position == "left" or self.navig: """container Vertical Tab""" box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) box.show() if FC().tab_close_element: box.pack_start(self.button(tab), False, False, 0) box.pack_end(tab_content.label, False, False, 0) else: """container Horizontal Tab""" box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) box.show() if FC().tab_close_element: box.pack_end(self.button(tab), False, False, 0) box.pack_start(tab_content.label, False, False, 0) eventbox = self.to_eventbox(box, tab) """append tab""" self.prepend_page(tab, eventbox) self.set_tab_reorderable(tab, True) self.show_all() self.set_current_page(0) #only after show_all() if not self.navig: if self.get_n_pages() > FC().count_of_tabs: self.remove_page(self.get_n_pages() - 1)
def rename_tab(self, tab, new_full_name, name_list=None): try: logging.info("encoding of tab name is " + new_full_name) new_full_name = unicode(new_full_name) #convert from any encoding in ascii logging.info("encoding finished " + new_full_name) except: logging.warn("problem of encoding definition for tab name is occured") self.set_full_tab_name(tab, new_full_name) new_label_text = crop_string(new_full_name, FC().len_of_tab) self.get_tab_label(tab).activate() tab.get_child().label.set_text(new_label_text + ' ') if name_list: n = self.page_num(tab) name_list[n] = new_label_text
def rename_tab(self, tab, new_full_name, name_list=None): try: logging.info("encoding of tab name is " + new_full_name) new_full_name = unicode( new_full_name) #convert from any encoding in ascii logging.info("encoding finished " + new_full_name) except: logging.warn( "problem of encoding definition for tab name is occured") self.set_full_tab_name(tab, new_full_name) new_label_text = crop_string(new_full_name, FC().len_of_tab) self.get_tab_label(tab).activate() tab.get_child().label.set_text(new_label_text + ' ') if name_list: n = self.page_num(tab) name_list[n] = new_label_text