astroDimitrios / rose

:rose: Rose is a toolkit for writing, editing and running application configurations.
https://metomi.github.io/rose/
GNU General Public License v3.0
0 stars 1 forks source link

Description text for vars appears next to not below variable names #13

Closed astroDimitrios closed 2 months ago

astroDimitrios commented 2 months ago

Descriptions should be below variable names.

image image

J-J-Abram commented 2 months ago

From Gtk tutorial, layout positioning underneath rather than next to is from these commands:

        grid.attach_next_to(button3, button1, Gtk.PositionType.BOTTOM, 1, 2)
        grid.attach_next_to(button4, button3, Gtk.PositionType.RIGHT, 2, 1)

Multiple files contain:

container.attach
table.attach

This might be me going down a rabbit hole but...

Issue may be related to this variable: META_PROP_DESCRIPTION or this one: SHOW_MODE_CUSTOM_DESCRIPTION and this one: should_show_mode

In keywidget.py line 271

def _get_metadata_formatting(self, mode):
        """Apply the correct formatting for a metadata property."""
        mode_format = "{" + mode + "}"
        if (mode == metomi.rose.META_PROP_DESCRIPTION and
                self.show_modes[
                    metomi.rose.config_editor.SHOW_MODE_CUSTOM_DESCRIPTION]):
            mode_format = metomi.rose.config_editor.CUSTOM_FORMAT_DESCRIPTION

Line 290:

    def _set_show_custom_meta_text(self, mode, should_show_mode):
        """Set the display of a custom format for a metadata property."""
        if mode == metomi.rose.config_editor.SHOW_MODE_CUSTOM_TITLE:
            return self._set_show_title(
                not self.show_modes[metomi.rose.config_editor.SHOW_MODE_NO_TITLE])
        if mode == metomi.rose.config_editor.SHOW_MODE_CUSTOM_DESCRIPTION:
            is_shown = not self.show_modes[
                metomi.rose.config_editor.SHOW_MODE_NO_DESCRIPTION]
            if is_shown:
                self._set_show_meta_text_mode(metomi.rose.META_PROP_DESCRIPTION,
                                              False)
                self._set_show_meta_text_mode(metomi.rose.META_PROP_DESCRIPTION,
                                              True)
        if mode == metomi.rose.config_editor.SHOW_MODE_CUSTOM_HELP:
            is_shown = not self.show_modes[
                metomi.rose.config_editor.SHOW_MODE_NO_HELP]
            if is_shown:
                self._set_show_meta_text_mode(metomi.rose.META_PROP_HELP, False)
                self._set_show_meta_text_mode(metomi.rose.META_PROP_HELP, True)

Line 430 (The best line):

# This is not very nice.

J-J-Abram commented 2 months ago

In metomi/rose/config_editor/keywidget.py line 310

printing out 'mode_text' shows that this variable contains the variable descriptions seen in the metadata

Line 71 If you print out self.my_variable.name that is the variable title

if self.my_variable.name != '':
            self.entry = Gtk.Label()
            self.entry.set_alignment(
                self.LABEL_X_OFFSET,
                self.entry.get_alignment()[1])
            self.entry.set_text(self.my_variable.name)
        else:
            self.entry = Gtk.Entry()
            self.entry.modify_text(Gtk.StateType.NORMAL,
                                   self.MODIFIED_COLOUR)
            self.entry.connect("focus-out-event",
                               lambda w, e: self._setter(w, variable))
astroDimitrios commented 2 months ago

When we removed Vbox from the class definitions we should have added the orientation parameter to the super() call in the class's __init__ function:

super(KeyWidget, self).__init__(homogeneous=False, spacing=0, orientation=Gtk.Orientation.VERTICAL)

Someone will need to go back and check which widgets were built on VBox and add this back in.