Skip to content

Commit

Permalink
Merge pull request #579 from Sjoerd1993/improve-style-editor
Browse files Browse the repository at this point in the history
improve style editor
  • Loading branch information
cmkohnen authored Nov 15, 2023
2 parents 7962cb9 + 78d7fa0 commit 8de0122
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
51 changes: 27 additions & 24 deletions data/ui/style_editor.blp
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ template $GraphsStyleEditor : Adw.NavigationPage {

Adw.PreferencesGroup {
title: _("Lines");
description: _("Change properties of the line and markers");

Adw.ComboRow linestyle {
title: _("Linestyle");
model: StringList {
strings [_("None"), _("Solid"), _("Dotted"), _("Dashed"), _("Dashdot")]
};
notify::selected => $on_linestyle();
}

Adw.ActionRow {
title: _("Linewidth");
visible: bind linewidth.sensitive;

Scale linewidth {
draw-value: true;
Expand All @@ -84,6 +85,7 @@ template $GraphsStyleEditor : Adw.NavigationPage {
lower: 0;
upper: 10;
};
sensitive: false;
}
}

Expand All @@ -100,10 +102,12 @@ template $GraphsStyleEditor : Adw.NavigationPage {
_("Filled plus"), _("Filled x"),
]
};
notify::selected => $on_markers();
}

Adw.ActionRow {
title: _("Marker Size");
visible: bind markersize.sensitive;

Scale markersize {
draw-value: true;
Expand All @@ -112,13 +116,34 @@ template $GraphsStyleEditor : Adw.NavigationPage {
lower: 0;
upper: 10;
};
sensitive: false;
}
}
}

Adw.PreferencesGroup {
title: _("Axes");

Adw.ActionRow {
title: _("Axis Width");

Scale axis_width {
draw-value: true;
width-request: 200;
adjustment: Adjustment {
lower: 0;
upper: 4;
};
}
}

Adw.SwitchRow draw_frame {
title: _("Draw Frame");
}
}

Adw.PreferencesGroup {
title: _("Ticks");
description: _("Settings for the ticks that are used on axes");

Adw.ComboRow tick_direction {
title: _("Tick Directions");
Expand Down Expand Up @@ -204,7 +229,6 @@ template $GraphsStyleEditor : Adw.NavigationPage {

Adw.PreferencesGroup {
title: _("Grid");
description: _("Settings for the grid");

Adw.SwitchRow show_grid {
title: _("Show Grid");
Expand Down Expand Up @@ -451,27 +475,6 @@ template $GraphsStyleEditor : Adw.NavigationPage {
}
}
}

Adw.PreferencesGroup {
title: _("Other");

Adw.ActionRow {
title: _("Axis Width");

Scale axis_width {
draw-value: true;
width-request: 200;
adjustment: Adjustment {
lower: 0;
upper: 4;
};
}
}

Adw.SwitchRow draw_frame {
title: _("Draw Frame");
}
}
}
}
};
Expand Down
8 changes: 8 additions & 0 deletions src/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,14 @@ def on_accept(dialog, result):
dialog.set_with_alpha(False)
dialog.choose_rgba(self.parent, color, None, on_accept)

@Gtk.Template.Callback()
def on_linestyle(self, comborow, _b):
self.linewidth.set_sensitive(comborow.get_selected() != 0)

@Gtk.Template.Callback()
def on_markers(self, comborow, _b):
self.markersize.set_sensitive(comborow.get_selected() != 0)

@Gtk.Template.Callback()
def add_color(self, _button):
self.line_colors.append("000000")
Expand Down

0 comments on commit 8de0122

Please sign in to comment.