From b1ece511598fef48f743574e7b910fb3aaa0e096 Mon Sep 17 00:00:00 2001 From: Nokse22 <44558032+Nokse22@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:24:36 +0200 Subject: [PATCH] fixed bug, removed unused code --- ...io.github.nokse22.teleprompter.gschema.xml | 12 ----------- src/main.py | 21 +++++-------------- src/window.py | 10 --------- 3 files changed, 5 insertions(+), 38 deletions(-) diff --git a/data/io.github.nokse22.teleprompter.gschema.xml b/data/io.github.nokse22.teleprompter.gschema.xml index 9ac6ac3..4cd2bf8 100644 --- a/data/io.github.nokse22.teleprompter.gschema.xml +++ b/data/io.github.nokse22.teleprompter.gschema.xml @@ -14,24 +14,12 @@ The font color - - '#242424' - The background color - The background color - - 100 The speed The speed - - 5 - The slow speed - The slow speed - - '#ED333B' The slow speed diff --git a/src/main.py b/src/main.py index 9a4e466..3f1d709 100644 --- a/src/main.py +++ b/src/main.py @@ -76,8 +76,10 @@ def do_activate(self): self.win = self.props.active_window if not self.win: self.win = TeleprompterWindow(application=self) - self.create_action('play', self.win.play, ['space']) - self.create_action('fullscreen', self.win.toggle_fullscreen, ['F11']) + self.create_action( + 'play', self.win.play, ['space']) + self.create_action( + 'fullscreen', self.win.toggle_fullscreen, ['F11']) self.win.present() def on_about_action(self, *args): @@ -225,26 +227,13 @@ def on_font_changed(self, fontWidget): self.win.save_app_settings(self.win.settings) def on_speed_changed(self, speed_adj): - # print("speed changed") speed = speed_adj.get_value() self.win.settings.speed = speed - # if speed_adj.get_value() >= speed1 / 2: - # speed_adj.set_value(speed1 / 2) - # speed_adj.set_upper(sliderWidget.get_value() / 2) - # else: - # speed_adj.set_upper(sliderWidget.get_value() / 2) - self.win.save_app_settings(self.win.settings) - - def on_slow_speed_changed(self, sliderWidget): - # print("slow speed changed") - self.win.settings.slowSpeed = sliderWidget.get_value() - - self.win.save_app_settings(self.win.settings) + self.saved_settings.set_int("speed", speed * 10) def on_bold_highlight_set(self, switch, foo): self.win.settings.boldHighlight = not switch.get_state() - print(switch.get_state()) self.win.updateFont() self.win.apply_text_tags() diff --git a/src/window.py b/src/window.py index 1ac2986..cb359bb 100644 --- a/src/window.py +++ b/src/window.py @@ -29,9 +29,7 @@ def __init__(self): self.font = 'Cantarell 40' self.textColor = Gdk.RGBA() self.textColor.parse("#62A0EA") - self.backgroundColor = Gdk.RGBA() self.speed = 150 - self.slowSpeed = 50 self.highlightColor = Gdk.RGBA() self.highlightColor.parse("#ED333B") self.boldHighlight = True @@ -95,8 +93,6 @@ def toHexStr(self, color): def save_app_settings(self, settings): self.saved_settings.set_string( "text", self.toHexStr(settings.textColor)) - self.saved_settings.set_string( - "background", self.toHexStr(settings.backgroundColor)) self.saved_settings.set_string( "highlight", self.toHexStr(settings.highlightColor)) @@ -105,8 +101,6 @@ def save_app_settings(self, settings): self.saved_settings.set_int( "speed", settings.speed * 10) - self.saved_settings.set_int( - "slow-speed", settings.slowSpeed * 10) self.saved_settings.set_boolean( "bold-highlight", settings.boldHighlight) @@ -154,16 +148,12 @@ def load_app_settings(self): color1.parse(self.saved_settings.get_string("text")) settings.textColor = color1 - color2.parse(self.saved_settings.get_string("background")) - settings.backgroundColor = color2 - color3.parse(self.saved_settings.get_string("highlight")) settings.highlightColor = color3 settings.font = self.saved_settings.get_string("font") settings.speed = self.saved_settings.get_int("speed") / 10 - settings.slowSpeed = self.saved_settings.get_int("slow-speed") / 10 settings.boldHighlight = self.saved_settings.get_boolean( "bold-highlight")