From 20303aacfbc3484f62b53ddc74aac02af54f8386 Mon Sep 17 00:00:00 2001 From: trigg Date: Tue, 19 Jul 2022 23:13:12 +0100 Subject: [PATCH] - Raise error if widgets are unnamed - Rename alignment based on settings - Horizontal is a basic option --- discover_overlay/glade/settings.glade | 466 +++++++++++------- discover_overlay/glade/settings.glade~ | 226 +++++---- discover_overlay/locales/base.pot | 38 +- .../locales/cy/LC_MESSAGES/default.po | 40 +- .../locales/en/LC_MESSAGES/default.po | 38 +- discover_overlay/settings_window.py | 35 +- 6 files changed, 506 insertions(+), 337 deletions(-) diff --git a/discover_overlay/glade/settings.glade b/discover_overlay/glade/settings.glade index b4bb77d..741633e 100644 --- a/discover_overlay/glade/settings.glade +++ b/discover_overlay/glade/settings.glade @@ -155,6 +155,7 @@ 8 + window False Discover Overlay Configuration discover-overlay @@ -166,10 +167,12 @@ + overview_grid True False + overview_image True False 10 @@ -243,6 +246,7 @@ + voice_grid True False baseline @@ -255,8 +259,9 @@ 1 True - + + voice_location_grid True False center @@ -277,6 +282,22 @@ 2 + + + Floating + voice_floating + True + True + False + True + True + + + + 1 + 1 + + Anchor To Edge @@ -295,48 +316,15 @@ - - Floating - voice_floating + + voice_monitor True - True - False - True - True - - - - 1 - 1 - - - - - Place Window - voice_place_window_button - True - True - True - + False + 0 - 5 - 2 - - - - - Show Advanced Options - voice_show_advanced_options_button - True - True - True - - - - 0 - 6 + 2 2 @@ -378,18 +366,98 @@ - - voice_monitor + + Place Window + voice_place_window_button True - False - + True + True + 0 - 2 + 5 2 + + + Show Advanced Options + voice_show_advanced_options_button + True + True + True + + + + 0 + 6 + 2 + + + + + voice_display_horizontally_label + True + False + Display Horizontally + 0 + + + 2 + 4 + + + + + voice_display_horizontally + True + True + False + True + + + + 3 + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 @@ -399,6 +467,7 @@ + voice_colour_grid True False center @@ -1139,33 +1208,6 @@ 4 - - - voice_display_horizontally_label - True - False - Display Horizontally - 0 - - - 4 - 5 - - - - - voice_display_horizontally - True - True - False - True - - - - 5 - 5 - - voice_highlight_self_label @@ -1193,33 +1235,6 @@ 6 - - - voice_display_speakers_only_label - True - False - Display Speakers Only - 0 - - - 4 - 6 - - - - - voice_display_speakers_only - True - True - False - True - - - - 5 - 6 - - voice_show_test_content_label @@ -1273,6 +1288,33 @@ 7 + + + voice_display_speakers_only_label + True + False + Display Speakers Only + 0 + + + 4 + 5 + + + + + voice_display_speakers_only + True + True + False + True + + + + 5 + 5 + + voice_nick_length_label @@ -1283,7 +1325,7 @@ 4 - 7 + 6 @@ -1296,9 +1338,15 @@ 5 - 7 + 6 + + + + + + 0 @@ -1324,8 +1372,9 @@ - + + text_grid True False 5 @@ -1402,6 +1451,31 @@ 2 + + + text_server + True + False + + + 1 + 2 + + + + + Refresh List + text_refresh_server_button + True + True + True + + + + 2 + 2 + + text_channel_label @@ -1412,7 +1486,7 @@ 0 - 4 + 3 @@ -1425,73 +1499,18 @@ 0 - 5 + 4 - - text_colour_label + + text_channel True False - Text Colour - 0 - 0 - 6 - - - - - text_background_colour_label - True - False - Background Colour - 0 - - - 0 - 7 - - - - - text_overlay_location_label - True - False - Overlay Location - 0 - - - 0 - 8 - 2 - - - - - text_show_attachments_label - True - False - Show Attachments - 0 - - - 0 - 10 - - - - - text_line_limit_label - True - False - Line Limit - 0 - - - 0 - 11 + 1 + 3 @@ -1507,7 +1526,7 @@ 1 - 5 + 4 @@ -1521,7 +1540,7 @@ 1 - 6 + 5 @@ -1533,6 +1552,18 @@ True + + 1 + 6 + + + + + text_monitor + True + False + + 1 7 @@ -1549,7 +1580,7 @@ 1 - 9 + 8 @@ -1563,7 +1594,7 @@ 1 - 10 + 9 @@ -1576,57 +1607,111 @@ 1 - 11 + 10 - - text_server + + text_colour_label True False + Text Colour + 0 - 1 - 2 + 0 + 5 - - text_channel + + text_background_colour_label True False + Background Colour + 0 - 1 - 4 + 0 + 6 - - text_monitor + + text_overlay_location_label True False - + Overlay Location + 0 - 1 - 8 + 0 + 7 + 2 - - Refresh List - text_refresh_server_button + + text_show_attachments_label True - True - True - + False + Show Attachments + 0 - 1 - 3 + 0 + 9 + + + text_line_limit_label + True + False + Line Limit + 0 + + + 0 + 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1650,6 +1735,7 @@ + notification_grid True False 5 @@ -2120,6 +2206,7 @@ + core_grid True False 5 @@ -2157,6 +2244,7 @@ + core_run_conf_on_startup_label True False Run Configuration on Startup @@ -2237,6 +2325,7 @@ + core_settings_min_label True False Start Settings Minimized @@ -2276,6 +2365,7 @@ + core_hide_overlay_label True False Hide Overlays diff --git a/discover_overlay/glade/settings.glade~ b/discover_overlay/glade/settings.glade~ index ff43045..5f778b2 100644 --- a/discover_overlay/glade/settings.glade~ +++ b/discover_overlay/glade/settings.glade~ @@ -155,6 +155,7 @@ 8 + window False Discover Overlay Configuration discover-overlay @@ -166,10 +167,12 @@ + overview_grid True False + overview_image True False 10 @@ -243,6 +246,7 @@ + voice_grid True False baseline @@ -257,6 +261,7 @@ + voice_location_grid True False center @@ -399,6 +404,7 @@ + voice_colour_grid True False center @@ -1292,7 +1298,7 @@ True True voice_nick_lenght_adj - + 5 @@ -1324,8 +1330,9 @@ - + + text_grid True False 5 @@ -1402,6 +1409,31 @@ 2 + + + text_server + True + False + + + 1 + 2 + + + + + Refresh List + text_refresh_server_button + True + True + True + + + + 2 + 2 + + text_channel_label @@ -1412,7 +1444,7 @@ 0 - 4 + 3 @@ -1425,73 +1457,18 @@ 0 - 5 + 4 - - text_colour_label + + text_channel True False - Text Colour - 0 - 0 - 6 - - - - - text_background_colour_label - True - False - Background Colour - 0 - - - 0 - 7 - - - - - text_overlay_location_label - True - False - Overlay Location - 0 - - - 0 - 8 - 2 - - - - - text_show_attachments_label - True - False - Show Attachments - 0 - - - 0 - 10 - - - - - text_line_limit_label - True - False - Line Limit - 0 - - - 0 - 11 + 1 + 3 @@ -1507,7 +1484,7 @@ 1 - 5 + 4 @@ -1521,7 +1498,7 @@ 1 - 6 + 5 @@ -1533,6 +1510,18 @@ True + + 1 + 6 + + + + + text_monitor + True + False + + 1 7 @@ -1549,7 +1538,7 @@ 1 - 9 + 8 @@ -1563,7 +1552,7 @@ 1 - 10 + 9 @@ -1576,57 +1565,111 @@ 1 - 11 + 10 - - text_server + + text_colour_label True False + Text Colour + 0 - 1 - 2 + 0 + 5 - - text_channel + + text_background_colour_label True False + Background Colour + 0 - 1 - 4 + 0 + 6 - - text_monitor + + text_overlay_location_label True False - + Overlay Location + 0 - 1 - 8 + 0 + 7 + 2 - - Refresh List - text_refresh_server_button + + text_show_attachments_label True - True - True - + False + Show Attachments + 0 - 1 - 3 + 0 + 9 + + + text_line_limit_label + True + False + Line Limit + 0 + + + 0 + 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1650,6 +1693,7 @@ + notification_grid True False 5 @@ -2120,6 +2164,7 @@ + core_grid True False 5 @@ -2157,6 +2202,7 @@ + core_run_conf_on_startup_label True False Run Configuration on Startup @@ -2237,6 +2283,7 @@ + core_settings_min_label True False Start Settings Minimized @@ -2276,6 +2323,7 @@ + core_hide_overlay_label True False Hide Overlays diff --git a/discover_overlay/locales/base.pot b/discover_overlay/locales/base.pot index adcb06f..0436574 100644 --- a/discover_overlay/locales/base.pot +++ b/discover_overlay/locales/base.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-19 22:29+0100\n" +"POT-Creation-Date: 2022-07-19 23:04+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -88,6 +88,21 @@ msgstr "" msgid " for support. Or open an issue on our GitHub " msgstr "" +msgid "Top" +msgstr "" + +msgid "Bottom" +msgstr "" + +msgid "Left" +msgstr "" + +msgid "Middle" +msgstr "" + +msgid "Right" +msgstr "" + msgid "Settings" msgstr "" @@ -157,12 +172,6 @@ msgstr "" msgid "None" msgstr "" -msgid "Left" -msgstr "" - -msgid "Right" -msgstr "" - msgid "Discover Overlay Configuration" msgstr "" @@ -187,15 +196,6 @@ msgstr "" msgid "Show Advanced Options" msgstr "" -msgid "Top" -msgstr "" - -msgid "Middle" -msgstr "" - -msgid "Bottom" -msgstr "" - msgid "Foreground" msgstr "" @@ -301,6 +301,9 @@ msgstr "" msgid "Server" msgstr "" +msgid "Refresh List" +msgstr "" + msgid "Channel" msgstr "" @@ -316,9 +319,6 @@ msgstr "" msgid "Line Limit" msgstr "" -msgid "Refresh List" -msgstr "" - msgid "Text" msgstr "" diff --git a/discover_overlay/locales/cy/LC_MESSAGES/default.po b/discover_overlay/locales/cy/LC_MESSAGES/default.po index bf92872..7c57543 100644 --- a/discover_overlay/locales/cy/LC_MESSAGES/default.po +++ b/discover_overlay/locales/cy/LC_MESSAGES/default.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-19 22:29+0100\n" +"POT-Creation-Date: 2022-07-19 23:04+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -95,6 +95,21 @@ msgstr "Ewch i'n Discord" msgid " for support. Or open an issue on our GitHub " msgstr " am gymorth" +msgid "Top" +msgstr "Brig" + +msgid "Bottom" +msgstr "Gwaelod" + +msgid "Left" +msgstr "Chwith" + +msgid "Middle" +msgstr "Canol" + +msgid "Right" +msgstr "Dde" + msgid "Settings" msgstr "Gosodiadau" @@ -164,12 +179,6 @@ msgstr "Lapio" msgid "None" msgstr "Dim" -msgid "Left" -msgstr "Chwith" - -msgid "Right" -msgstr "Dde" - msgid "Discover Overlay Configuration" msgstr "Discover Overlay Cyfluniad" @@ -194,15 +203,6 @@ msgstr "Symudol" msgid "Show Advanced Options" msgstr "Dangos Mwy o Opsiynau" -msgid "Top" -msgstr "Brig" - -msgid "Middle" -msgstr "Canol" - -msgid "Bottom" -msgstr "Gwaelod" - msgid "Foreground" msgstr "Blaendir" @@ -308,6 +308,9 @@ msgstr "Arddull naid" msgid "Server" msgstr "Gweinydd" +msgid "Refresh List" +msgstr "Adnewyddu'r rhestr" + msgid "Channel" msgstr "Sianel" @@ -323,9 +326,6 @@ msgstr "Dangos atodiadau" msgid "Line Limit" msgstr "Terfyn Llinell" -msgid "Refresh List" -msgstr "Adnewyddu'r rhestr" - msgid "Text" msgstr "Testun" @@ -381,4 +381,4 @@ msgid "Hide Overlays" msgstr "Cuddio troslun" msgid "Core" -msgstr "Craidd" \ No newline at end of file +msgstr "Craidd" diff --git a/discover_overlay/locales/en/LC_MESSAGES/default.po b/discover_overlay/locales/en/LC_MESSAGES/default.po index adcb06f..0436574 100644 --- a/discover_overlay/locales/en/LC_MESSAGES/default.po +++ b/discover_overlay/locales/en/LC_MESSAGES/default.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-19 22:29+0100\n" +"POT-Creation-Date: 2022-07-19 23:04+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -88,6 +88,21 @@ msgstr "" msgid " for support. Or open an issue on our GitHub " msgstr "" +msgid "Top" +msgstr "" + +msgid "Bottom" +msgstr "" + +msgid "Left" +msgstr "" + +msgid "Middle" +msgstr "" + +msgid "Right" +msgstr "" + msgid "Settings" msgstr "" @@ -157,12 +172,6 @@ msgstr "" msgid "None" msgstr "" -msgid "Left" -msgstr "" - -msgid "Right" -msgstr "" - msgid "Discover Overlay Configuration" msgstr "" @@ -187,15 +196,6 @@ msgstr "" msgid "Show Advanced Options" msgstr "" -msgid "Top" -msgstr "" - -msgid "Middle" -msgstr "" - -msgid "Bottom" -msgstr "" - msgid "Foreground" msgstr "" @@ -301,6 +301,9 @@ msgstr "" msgid "Server" msgstr "" +msgid "Refresh List" +msgstr "" + msgid "Channel" msgstr "" @@ -316,9 +319,6 @@ msgstr "" msgid "Line Limit" msgstr "" -msgid "Refresh List" -msgstr "" - msgid "Text" msgstr "" diff --git a/discover_overlay/settings_window.py b/discover_overlay/settings_window.py index d853792..9d57948 100644 --- a/discover_overlay/settings_window.py +++ b/discover_overlay/settings_window.py @@ -73,6 +73,9 @@ class MainSettingsWindow(): for widget in builder.get_objects(): if widget.find_property("name"): name = widget.get_property("name") + if name == "": + log.error("Unnamed widget. All widgets must be named") + log.info(widget) self.widget[name] = widget # Translate labels and buttons @@ -221,6 +224,32 @@ class MainSettingsWindow(): self.widget['notebook'].set_current_page(0) self.window.show() + def set_alignment_labels(self, horz): + m1 = self.widget['voice_align_1'].get_model() + m2 = self.widget['voice_align_2'].get_model() + i = m1.get_iter_first() + i2 = m2.get_iter_first() + if horz: + m1.set_value(i, 0, _("Top")) + i = m1.iter_next(i) + m1.set_value(i, 0, _("Bottom")) + + m2.set_value(i2, 0, _("Left")) + i2 = m2.iter_next(i2) + m2.set_value(i2, 0, _("Middle")) + i2 = m2.iter_next(i2) + m2.set_value(i2, 0, _("Right")) + else: + m1.set_value(i, 0, _("Left")) + i = m1.iter_next(i) + m1.set_value(i, 0, _("Right")) + + m2.set_value(i2, 0, _("Top")) + i2 = m2.iter_next(i2) + m2.set_value(i2, 0, _("Middle")) + i2 = m2.iter_next(i2) + m2.set_value(i2, 0, _("Bottom")) + def read_config(self): self.widget['voice_advanced_grid'].hide() @@ -271,8 +300,9 @@ class MainSettingsWindow(): self.widget['voice_horizontal_padding'].set_value( config.getint("main", "horz_edge_padding", fallback=0)) - self.widget['voice_display_horizontally'].set_active( - config.getboolean("main", "horizontal", fallback=False)) + horz = config.getboolean("main", "horizontal", fallback=False) + self.set_alignment_labels(horz) + self.widget['voice_display_horizontally'].set_active(horz) self.widget['voice_highlight_self'].set_active( config.getboolean("main", "highlight_self", fallback=False)) @@ -763,6 +793,7 @@ class MainSettingsWindow(): def voice_display_horizontally_changed(self, button): self.config_set("main", "horizontal", "%s" % (button.get_active())) + self.set_alignment_labels(button.get_active()) def voice_highlight_self_changed(self, button): self.config_set("main", "highlight_self", "%s" % (button.get_active()))