Skip to content

Commit

Permalink
added release notes and fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Nokse22 committed Sep 27, 2024
1 parent 07bf577 commit 0c4b749
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 46 deletions.
15 changes: 11 additions & 4 deletions data/io.github.nokse22.teleprompter.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,18 @@
<color type="primary" scheme_preference="dark">#393939</color>
</branding>

<custom>
<value key="GnomeSoftware::key-colors">[(99, 181, 231), (39, 99, 135)]</value>
</custom>

<releases>
<release version="1.0.0" date="2024-09-27">
<description translate="no">
<p>Updated runtime to GNOME 47</p>
<p>Added light theme support</p>
<p>Improved design</p>
<p>Fixed bug opening files</p>
<p>Added Hebrew translation (Yosef Or Boczko)</p>
<p>Added Hindi translation (Scrambled777)</p>
<p>Added Bulgarian translation (Scrambled777)</p>
</description>
</release>
<release version="0.1.8" date="2024-03-26">
<description translate="no">
<p>Updated runtime</p>
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project('teleprompter',
version: '1.0.0',
meson_version: '>= 0.62.0',
meson_version: '>= 0.63.0',
default_options: [ 'warning_level=2', 'werror=false', ],
)

Expand Down
26 changes: 13 additions & 13 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,52 +96,52 @@ def on_about_action(self, *args):
about.set_translator_credits(_("translator-credits"))
about.present(self.props.active_window)

def on_preferences_action(self, widget, _):
def on_preferences_action(self, *args):
"""Callback for the app.preferences action."""

pref = Adw.PreferencesDialog()

settingsPage = Adw.PreferencesPage(title="Generals")
settingsPage = Adw.PreferencesPage(
title=_("Generals"))
settingsPage.set_icon_name("applications-system-symbolic")
pref.add(settingsPage)

# stylePage = Adw.PreferencesPage(title="Style")
# stylePage.set_icon_name("applications-graphics-symbolic")
# pref.add(stylePage)

scrollSettingsGroup = Adw.PreferencesGroup(title=gettext.gettext("Scroll Settings"))
scrollSettingsGroup = Adw.PreferencesGroup(
title=_("Scroll Settings"))
settingsPage.add(scrollSettingsGroup)

scrollSpeedRow = Adw.SpinRow(title=gettext.gettext("Scroll Speed"), subtitle=gettext.gettext("In words per minute (approximately)"))
scrollSpeedRow = Adw.SpinRow(
title=_("Scroll Speed"),
subtitle=_("In words per minute (approximately)"))
scrollSettingsGroup.add(scrollSpeedRow)

speed_adj = Gtk.Adjustment(upper=200, step_increment=1, lower=10)
speed_adj.set_value(self.win.settings.speed)
scrollSpeedRow.set_adjustment(speed_adj)

textGroup = Adw.PreferencesGroup(title=gettext.gettext("Text"))
textGroup = Adw.PreferencesGroup(title=_("Text"))
settingsPage.add(textGroup)

highlightColorPickerRow = Adw.ActionRow(
title=gettext.gettext("Highlight color"))
title=_("Highlight color"))
textGroup.add(highlightColorPickerRow)

highlightColorPicker = Gtk.ColorButton(valign=Gtk.Align.CENTER)
highlightColorPicker.set_rgba(self.win.settings.highlightColor)
highlightColorPickerRow.add_suffix(highlightColorPicker)

boldHighlight = Adw.ActionRow(title=gettext.gettext("Bold Highlight"))
boldHighlight = Adw.ActionRow(title=_("Bold Highlight"))
textGroup.add(boldHighlight)

boldHighlightSwitch = Gtk.Switch(valign=Gtk.Align.CENTER)
boldHighlightSwitch.set_active(self.win.settings.boldHighlight)

boldHighlight.add_suffix(boldHighlightSwitch)

fontColorPickerRow = Adw.ActionRow(title=gettext.gettext("Font color"))
fontColorPickerRow = Adw.ActionRow(title=_("Font color"))
textGroup.add(fontColorPickerRow)

fontPickerRow = Adw.ActionRow(title=gettext.gettext("Font"))
fontPickerRow = Adw.ActionRow(title=_("Font"))
textGroup.add(fontPickerRow)

fontPicker = Gtk.FontButton(valign=Gtk.Align.CENTER)
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python = import('python')
conf = configuration_data()
conf.set('PYTHON', python.find_installation('python3').full_path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('localedir', get_option('prefix') / get_option('localedir'))
conf.set('pkgdatadir', pkgdatadir)

configure_file(
Expand Down
39 changes: 12 additions & 27 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,18 @@ def save_app_settings(self, settings):
self.saved_settings.set_boolean(
"bold-highlight", settings.boldHighlight)

def on_file_selected(self, dialog, response):
if response == -3:
selected_file = dialog.get_file()
if selected_file:
file_path = selected_file.get_path()
def show_file_chooser_dialog(self):
dialog = Gtk.FileDialog(
title=_("Open File"),
)

dialog.open(self, None, self.on_open_file_response)

def on_open_file_response(self, dialog, response):
try:
file = dialog.open_finish(response)
if file:
file_path = file.get_path()
try:
with open(file_path, 'r') as file:
file_contents = file.read()
Expand All @@ -130,32 +137,10 @@ def on_file_selected(self, dialog, response):
toast.set_timeout(1)
self.overlay.add_toast(toast)
except Exception:
dialog.destroy()
toast = Adw.Toast()
toast.set_title("Error reading file")
toast.set_timeout(1)
self.overlay.add_toast(toast)

else:
dialog.destroy()

def show_file_chooser_dialog(self):
dialog = Gtk.FileDialog(
title=_("Open File"),
)

dialog.open(self, None, self.on_open_file_response)

def on_open_file_response(self, dialog, response):
try:
file = dialog.open_finish(response)

if file:
filepath = file.get_path()
self.loading_file = True
self.window_settings.set_setting("load-type", None, False)
self.logger.info("open file response")
self.load_file(filepath=filepath)
except Exception:
return

Expand Down

0 comments on commit 0c4b749

Please sign in to comment.