示例#1
0
文件: notes.py 项目: SNoiraud/gramps
    def build_gui(self):
        """
        Build the GUI interface.
        """
        top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        hbox = Gtk.Box()
        self.left = SimpleButton('go-previous', self.left_clicked)
        self.left.set_sensitive(False)
        hbox.pack_start(self.left, False, False, 0)
        self.right = SimpleButton('go-next', self.right_clicked)
        self.right.set_sensitive(False)
        hbox.pack_start(self.right, False, False, 0)
        self.page = Gtk.Label()
        hbox.pack_end(self.page, False, False, 10)

        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
                                  Gtk.PolicyType.AUTOMATIC)
        self.texteditor = StyledTextEditor()
        self.texteditor.set_editable(False)
        self.texteditor.set_wrap_mode(Gtk.WrapMode.WORD)
        scrolledwindow.add(self.texteditor)

        top.pack_start(hbox, False, False, 0)
        top.pack_start(scrolledwindow, True, True, 0)
        top.show_all()
        return top
示例#2
0
文件: notes.py 项目: vperic/gramps
    def build_gui(self):
        """
        Build the GUI interface.
        """
        top = Gtk.VBox(homogeneous=False)

        hbox = Gtk.HBox()
        self.left = SimpleButton(Gtk.STOCK_GO_BACK, self.left_clicked)
        self.left.set_sensitive(False)
        hbox.pack_start(self.left, False, False, 0)
        self.right = SimpleButton(Gtk.STOCK_GO_FORWARD, self.right_clicked)
        self.right.set_sensitive(False)
        hbox.pack_start(self.right, False, False, 0)
        self.page = Gtk.Label()
        hbox.pack_end(self.page, False, False, 10)

        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
                                  Gtk.PolicyType.AUTOMATIC)
        self.texteditor = StyledTextEditor()
        self.texteditor.set_editable(False)
        self.texteditor.set_wrap_mode(Gtk.WrapMode.WORD)
        scrolledwindow.add(self.texteditor)

        top.pack_start(hbox, False, False, 0)
        top.pack_start(scrolledwindow, True, True, 0)
        top.show_all()
        return top
示例#3
0
    def build_gui(self):
        """
        Build the GUI interface.
        """
        top = Gtk.VBox(homogeneous=False)
        
        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.texteditor = StyledTextEditor()
        self.texteditor.set_editable(False)
        self.texteditor.set_wrap_mode(Gtk.WrapMode.WORD)
        scrolledwindow.add(self.texteditor)

        self.set_text()
        
        top.pack_start(scrolledwindow, True, True, 0)
        top.show_all()
        return top
示例#4
0
    def build_gui(self):
        """
        Build the GUI interface.
        """
        top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        hbox = Gtk.Box()
        self.left = SimpleButton(Gtk.STOCK_GO_BACK, self.left_clicked)
        self.left.set_tooltip_text(_('Previous To Do note'))
        self.left.set_sensitive(False)
        hbox.pack_start(self.left, False, False, 0)
        self.right = SimpleButton(Gtk.STOCK_GO_FORWARD, self.right_clicked)
        self.right.set_tooltip_text(_('Next To Do note'))
        self.right.set_sensitive(False)
        hbox.pack_start(self.right, False, False, 0)
        self.edit = SimpleButton(Gtk.STOCK_EDIT, self.edit_clicked)
        self.edit.set_tooltip_text(_('Edit the selected To Do note'))
        self.edit.set_sensitive(False)
        hbox.pack_start(self.edit, False, False, 0)
        self.new = SimpleButton(Gtk.STOCK_NEW, self.new_clicked)
        self.new.set_tooltip_text(_('Add a new To Do note'))
        hbox.pack_start(self.new, False, False, 0)
        self.page = Gtk.Label()
        hbox.pack_end(self.page, False, False, 10)

        self.title = Gtk.Label()
        self.title.set_alignment(0, 0)
        self.title.set_line_wrap(True)

        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
                                  Gtk.PolicyType.AUTOMATIC)
        self.texteditor = StyledTextEditor()
        self.texteditor.set_editable(False)
        self.texteditor.set_wrap_mode(Gtk.WrapMode.WORD)
        scrolledwindow.add(self.texteditor)

        top.pack_start(hbox, False, False, 0)
        top.pack_start(self.title, False, False, 4)
        top.pack_start(scrolledwindow, True, True, 0)
        top.show_all()
        return top
示例#5
0
    def write_media(self, media_list, event):
        for media_ref in media_list:

            mobj = self.dbstate.db.get_media_from_handle(media_ref.ref)
            button = self.get_thumbnail(media_ref, size=SIZE_LARGE)
            if button:

                self.vbox2.add(button)

                vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

                if event:
                    etype = str(event.get_type())
                    label = Gtk.Label(etype)
                    vbox.pack_start(label, False, False, 0)
                    who = get_participant_from_event(self.dbstate.db, event.handle)
                    label = Gtk.Label(who)
                    vbox.pack_start(label, False, False, 0)
                    date_place = self.format_event(event)
                    label = Gtk.Label(date_place)
                    vbox.pack_start(label, False, False, 0)

                notes = mobj.get_note_list()
                if len(notes) > 0:
                    note = self.dbstate.db.get_note_from_handle(notes[0])
                    texteditor = StyledTextEditor()
                    texteditor.set_editable(False)
                    texteditor.set_wrap_mode(Gtk.WrapMode.WORD)
                    texteditor.set_text(note.get_styledtext())
                    texteditor.set_hexpand(True)
                    texteditor.show()
                    vbox.pack_start(texteditor, True, True, 0)
                    vbox.show_all()

                self.vbox2.attach_next_to(vbox, button,
                                          Gtk.PositionType.RIGHT, 1, 1)
示例#6
0
    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate

        tool.Tool.__init__(self, dbstate, options_class, name)

        self.window_name = _('Note Cleanup Tool')
        ManagedWindow.__init__(self, uistate, [], self.__class__)

        self.dbstate = dbstate
        self.trans = None
        self.moved_files = []
        self.titles = [_('Cleaned Notes'), _('Links Only'),
                       _('Issues')]
        self.models = []
        self.views = []
        self.changelist = []
        self.changelistidx = 0

        window = MyWindow(self.dbstate, self.uistate, [])
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        hbox.set_homogeneous(True)
        rvbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2,
                        width_request=400)
        vbox.pack_start(hbox, True, True, 5)
        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        self.notebook.connect('switch-page', self.pagesw)
        for title in self.titles:
            self.create_tab(title)
        hbox.pack_start(self.notebook, True, True, 3)
        hbox.pack_start(rvbox, True, True, 3)

        bbox = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL)
        vbox.pack_start(bbox, False, False, 5)
        close = Gtk.Button(label=_('Close'))
        close.set_tooltip_text(_('Close the Note Cleanup Tool'))
        close.connect('clicked', self.close)
        save = Gtk.Button(label=_('Save All'))
        save.set_tooltip_text(_('Save All Changes'))
        save.connect('clicked', self.saveit)
        search = Gtk.Button(label=_('Search'))
        search.set_tooltip_text(_('Search for Untidy Notes'))
        search.connect('clicked', self.cleanup)
        testnote = Gtk.Button(label=_('Generate Test Notes'))
        testnote.set_tooltip_text(_(
            'Generate Test notes in range N99996-N99999.\n'
            'These are added to your database, so you may want to work with'
            ' a test database or delete them later.'))
        testnote.connect('clicked', self.gentest)
        export = Gtk.Button(label=_('Export'))
        export.set_tooltip_text(_('Export the results to a text file'))
        export.connect('clicked', self.export_results)
        bbox.add(search)
        bbox.add(testnote)
        bbox.add(export)
        bbox.add(save)
        bbox.add(close)
        self.tb = StyledTextEditor()
        self.tb.set_editable(False)
        self.tb.set_wrap_mode(Gtk.WrapMode.WORD)
        tbw = Gtk.ScrolledWindow()
        tbw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        tbw.add(self.tb)
        rvbox.pack_start(tbw, True, True, 0)
        self.ta = StyledTextEditor()
        self.ta.set_transient_parent(window)
        self.ta.set_editable(True)
        self.ta.set_wrap_mode(Gtk.WrapMode.WORD)
        taw = Gtk.ScrolledWindow()
        taw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        taw.add(self.ta)
        # tat=self.ta.get_toolbar()
        tat, self.action_group = self.ta.create_toolbar(
            uistate.uimanager, window)
        tat.set_icon_size(Gtk.IconSize.SMALL_TOOLBAR)
        tatb = tat.get_nth_item(5)
        tat.remove(tatb)
        tatb = tat.get_nth_item(5)
        tat.remove(tatb)
        rvbox.pack_start(tat, False, False, 0)
        rvbox.pack_start(taw, True, True, 0)
        self.clear_models()
        vbox.show_all()
        window.add(vbox)
        window.set_size_request(800, 400)
        self.set_window(window, None, self.window_name)
        self.show()

        self.show_tabs()
        WarningDialog(
            self.window_name,
            _("Please back up your database before running this tool.\n\n"
              "Start the tool by pressing the 'Search' button, then review"
              " the results.\n"
              "When satisifed press the 'Save All' button to save your work.\n"
              "You may export a summary list of the notes that"
              " were found using the 'Export' button."),
            self.window)