What can I do to help fix unpadded Text gramplets?

The Gramps dashboard (with the example.gramps tree) looks like:

Look at the left edge of the “Welcome to Gramps!” Gramplet. The underlined of the hotlinked lines runs right into the left edge of the window. The text is only slightly better with a single pixel of kerning space. There are no vertical gutters. The right edge has a bit worse example with the “it’s” running offscreen.

Having the content text butting right against the edge gives an amateurish false impression.

What Python lines need to be hacked in to add a few gutter pixels between the left & right borders & the text?

2 Likes

The dashboard Gramplets use the GrampletPane class, which in turn uses the grampletpane.glade file (in gramps.gui.glade subdir).

In that file there is a section that defines the “Textview”:

                <child>
                  <object class="GtkTextView" id="gvtextview">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="editable">False</property>
                    <property name="wrap_mode">word</property>
                  </object>
                </child>

You would want to add some margins to that view, below the other properties:

                    <property name="left_margin">6</property>
                    <property name="right_margin">6</property>
3 Likes

Since it is likely that the Textview pane for all gramplets won’t want to have side margins, is it better to insert margin definitions in each individual gramplet instead of wholesale in the grampletpane.glade file? Or, is it more reasonable to expect margins and override them when not needed?

(The Dashboard and the split bars seem to have different Glade definitions, right? To avoid a exception, the default margins for text panes in both will probably need to be harmonized.)

Using the Welcomegramplet.py as an example,

    def build_gui(self):
        """
        Build the GUI interface.
        """
        top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        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.display_text()

        top.pack_start(scrolledwindow, True, True, 0)
        top.show_all()
        return top

I just insert margin definitions after the line: self.texteditor.set_wrap_mode(Gtk.WrapMode.WORD)

        self.texteditor.set_left_margin(6)
        self.texteditor.set_right_margin(6)

Nevermind. After changing both the Glade file and the welcomegramplet.py file, it looks like there’s no conflict.

@prculley could you review the newly filed bug with the revised glade file ? And possibly submit a corresponding pull request?

I added a Top margin

              `<property name="top_margin">6</property>`

Cannot see a need to add a bottom margin.

EDIT: which doesn’t do anything :smiling_face_with_tear: