Skip to content

Commit

Permalink
fixed bug, removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nokse22 committed Sep 27, 2024
1 parent 0c4b749 commit b1ece51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 38 deletions.
12 changes: 0 additions & 12 deletions data/io.github.nokse22.teleprompter.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,12 @@
<description>The font color</description>
</key>

<key name="background" type="s">
<default>'#242424'</default>
<summary>The background color</summary>
<description>The background color</description>
</key>

<key name="speed" type="i">
<default>100</default>
<summary>The speed</summary>
<description>The speed</description>
</key>

<key name="slow-speed" type="i">
<default>5</default>
<summary>The slow speed</summary>
<description>The slow speed</description>
</key>

<key name="highlight" type="s">
<default>'#ED333B'</default>
<summary>The slow speed</summary>
Expand Down
21 changes: 5 additions & 16 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ['<primary>space'])
self.create_action('fullscreen', self.win.toggle_fullscreen, ['F11'])
self.create_action(
'play', self.win.play, ['<primary>space'])
self.create_action(
'fullscreen', self.win.toggle_fullscreen, ['F11'])
self.win.present()

def on_about_action(self, *args):
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 0 additions & 10 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit b1ece51

Please sign in to comment.