def instance(self): book.wiki = book.WikiBook() if not book.custom: book.custom = book.CustomBook() self.edit_page = 1 self.edit = edit.View() self.library = library.View(self) toolbar_box = ToolbarBox() activity_button = ActivityToolbarButton(self) toolbar_box.toolbar.insert(activity_button, 0) self.set_toolbar_box(toolbar_box) self._toolbar = toolbar_box.toolbar tool_group = None search_button = RadioToolButton() search_button.props.group = tool_group tool_group = search_button search_button.props.icon_name = 'white-search' search_button.set_tooltip(_('Library')) search_button.mode = 'search' search_button.connect('clicked', self.__mode_button_clicked) self._toolbar.insert(search_button, -1) edit_button = RadioToolButton() edit_button.props.group = tool_group edit_button.props.icon_name = 'toolbar-edit' edit_button.set_tooltip(_('Edit')) edit_button.mode = 'edit' edit_button.connect('clicked', self.__mode_button_clicked) self._toolbar.insert(edit_button, -1) self._toolbar.insert(Gtk.SeparatorToolItem(), -1) self.edit_bar = edit.ToolbarBuilder(self.edit, self._toolbar) self.library_bar = library.ToolbarBuilder(self.library, activity_button) self.library_bar.publish.show() edit_fake = Gtk.EventBox() self.notebook.append_page(self.library, None) self.notebook.append_page(self.edit, None) self.notebook.append_page(edit_fake, None) self.show_all() self.__mode_button_clicked(search_button) separator = Gtk.SeparatorToolItem() separator.props.draw = False separator.set_expand(True) separator.show() self._toolbar.insert(separator, -1) stop_button = StopButton(self) stop_button.show() self._toolbar.insert(stop_button, -1)
def resume_instance(self, filepath): book.custom = book.CustomBook(filepath) self.instance()