forked from Mirrors/apostrophe
remove unneeded preferences
parent
cab5306efa
commit
bcd08397f1
|
@ -32,14 +32,6 @@
|
||||||
Enable or disable spellchecking.
|
Enable or disable spellchecking.
|
||||||
</description>
|
</description>
|
||||||
</key>
|
</key>
|
||||||
<key name='gradient-overlay' type='b'>
|
|
||||||
<default>false</default>
|
|
||||||
<summary>Draw scroll gradient</summary>
|
|
||||||
<description>
|
|
||||||
Show a gradient overlay over the text at the top anf bottom of the window.
|
|
||||||
It can cause performance problems to some users.
|
|
||||||
</description>
|
|
||||||
</key>
|
|
||||||
<key name='sync-scroll' type='b'>
|
<key name='sync-scroll' type='b'>
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
<summary>Synchronize editor/preview scrolling</summary>
|
<summary>Synchronize editor/preview scrolling</summary>
|
||||||
|
|
|
@ -41,54 +41,6 @@
|
||||||
<property name="margin_bottom">16</property>
|
<property name="margin_bottom">16</property>
|
||||||
<property name="row_spacing">8</property>
|
<property name="row_spacing">8</property>
|
||||||
<property name="column_spacing">8</property>
|
<property name="column_spacing">8</property>
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="dark_mode_auto_label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="halign">start</property>
|
|
||||||
<property name="label" translatable="yes">Set dark mode automatically</property>
|
|
||||||
<property name="justify">right</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSwitch" id="dark_mode_auto_switch">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">2</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="dark_mode_label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="halign">start</property>
|
|
||||||
<property name="label" translatable="yes">Force dark mode</property>
|
|
||||||
<property name="justify">right</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSwitch" id="dark_mode_switch">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">2</property>
|
|
||||||
<property name="top_attach">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="spellcheck_label">
|
<object class="GtkLabel" id="spellcheck_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -99,7 +51,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">3</property>
|
<property name="top_attach">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -110,31 +62,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">2</property>
|
<property name="left_attach">2</property>
|
||||||
<property name="top_attach">3</property>
|
<property name="top_attach">1</property>
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="gradient_overlay_label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="halign">start</property>
|
|
||||||
<property name="label" translatable="yes">Draw scroll gradient</property>
|
|
||||||
<property name="justify">right</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">4</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSwitch" id="gradient_overlay_switch">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">2</property>
|
|
||||||
<property name="top_attach">4</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -147,7 +75,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">5</property>
|
<property name="top_attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -160,7 +88,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">2</property>
|
<property name="left_attach">2</property>
|
||||||
<property name="top_attach">5</property>
|
<property name="top_attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -172,7 +100,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">5</property>
|
<property name="top_attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -186,7 +114,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -197,7 +125,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">2</property>
|
<property name="left_attach">2</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -206,15 +134,6 @@
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="tab_fill">False</property>
|
<property name="tab_fill">False</property>
|
||||||
|
|
|
@ -196,12 +196,10 @@ class Application(Gtk.Application):
|
||||||
settings.props.gtk_theme_name = "HighContrast"
|
settings.props.gtk_theme_name = "HighContrast"
|
||||||
|
|
||||||
def on_settings_changed(self, settings, key):
|
def on_settings_changed(self, settings, key):
|
||||||
if key == "dark-mode-auto" or key == "dark-mode":
|
if key == "dark-mode":
|
||||||
self._set_dark_mode ()
|
self._set_dark_mode ()
|
||||||
elif key == "spellcheck":
|
elif key == "spellcheck":
|
||||||
self.window.toggle_spellcheck(settings.get_value(key))
|
self.window.toggle_spellcheck(settings.get_value(key))
|
||||||
elif key == "gradient-overlay":
|
|
||||||
self.window.toggle_gradient_overlay(settings.get_value(key))
|
|
||||||
elif key == "input-format":
|
elif key == "input-format":
|
||||||
self.window.reload_preview()
|
self.window.reload_preview()
|
||||||
elif key == "sync-scroll":
|
elif key == "sync-scroll":
|
||||||
|
|
|
@ -142,11 +142,6 @@ class MainWindow(StyledWindow):
|
||||||
self.previewbars_visible = True
|
self.previewbars_visible = True
|
||||||
self.buffer_modified_for_status_bar = False
|
self.buffer_modified_for_status_bar = False
|
||||||
|
|
||||||
# some people seems to have performance problems with the overlay.
|
|
||||||
# Let them disable it
|
|
||||||
self.overlay_id = None
|
|
||||||
self.toggle_gradient_overlay(self.settings.get_value("gradient-overlay"))
|
|
||||||
|
|
||||||
# Init file name with None
|
# Init file name with None
|
||||||
self.set_filename()
|
self.set_filename()
|
||||||
|
|
||||||
|
@ -487,18 +482,6 @@ class MainWindow(StyledWindow):
|
||||||
|
|
||||||
self.text_view.set_spellcheck(state.get_boolean())
|
self.text_view.set_spellcheck(state.get_boolean())
|
||||||
|
|
||||||
def toggle_gradient_overlay(self, state):
|
|
||||||
"""Toggle the gradient overlay
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
state {gtk bool} -- Desired state of the gradient overlay (enabled/disabled)
|
|
||||||
"""
|
|
||||||
|
|
||||||
if state.get_boolean():
|
|
||||||
self.overlay_id = self.scrolled_window.connect_after("draw", self.draw_gradient)
|
|
||||||
elif self.overlay_id:
|
|
||||||
self.scrolled_window.disconnect(self.overlay_id)
|
|
||||||
|
|
||||||
def reload_preview(self, reshow=False):
|
def reload_preview(self, reshow=False):
|
||||||
self.preview_handler.reload(reshow=reshow)
|
self.preview_handler.reload(reshow=reshow)
|
||||||
|
|
||||||
|
@ -649,35 +632,6 @@ class MainWindow(StyledWindow):
|
||||||
|
|
||||||
self.buffer_modified_for_status_bar = False
|
self.buffer_modified_for_status_bar = False
|
||||||
|
|
||||||
def draw_gradient(self, _widget, cr):
|
|
||||||
"""draw fading gradient over the top and the bottom of the
|
|
||||||
TextWindow
|
|
||||||
"""
|
|
||||||
bg_color = self.get_style_context().get_background_color(Gtk.StateFlags.ACTIVE)
|
|
||||||
|
|
||||||
lg_top = cairo.LinearGradient(0, 0, 0, 32) # pylint: disable=no-member
|
|
||||||
lg_top.add_color_stop_rgba(
|
|
||||||
0, bg_color.red, bg_color.green, bg_color.blue, 1)
|
|
||||||
lg_top.add_color_stop_rgba(
|
|
||||||
1, bg_color.red, bg_color.green, bg_color.blue, 0)
|
|
||||||
|
|
||||||
width = self.scrolled_window.get_allocation().width
|
|
||||||
height = self.scrolled_window.get_allocation().height
|
|
||||||
|
|
||||||
cr.rectangle(0, 0, width, 32)
|
|
||||||
cr.set_source(lg_top)
|
|
||||||
cr.fill()
|
|
||||||
cr.rectangle(0, height - 32, width, height)
|
|
||||||
|
|
||||||
lg_btm = cairo.LinearGradient(0, height - 32, 0, height) # pylint: disable=no-member
|
|
||||||
lg_btm.add_color_stop_rgba(
|
|
||||||
1, bg_color.red, bg_color.green, bg_color.blue, 1)
|
|
||||||
lg_btm.add_color_stop_rgba(
|
|
||||||
0, bg_color.red, bg_color.green, bg_color.blue, 0)
|
|
||||||
|
|
||||||
cr.set_source(lg_btm)
|
|
||||||
cr.fill()
|
|
||||||
|
|
||||||
def on_delete_called(self, _widget, _data=None):
|
def on_delete_called(self, _widget, _data=None):
|
||||||
"""Called when the TexteditorWindow is closed.
|
"""Called when the TexteditorWindow is closed.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -67,14 +67,6 @@ class PreferencesDialog:
|
||||||
self.builder.add_from_resource(
|
self.builder.add_from_resource(
|
||||||
"/de/wolfvollprecht/UberWriter/ui/Preferences.ui")
|
"/de/wolfvollprecht/UberWriter/ui/Preferences.ui")
|
||||||
|
|
||||||
self.dark_mode_auto_switch = self.builder.get_object("dark_mode_auto_switch")
|
|
||||||
self.dark_mode_auto_switch.set_active(self.settings.get_value("dark-mode-auto"))
|
|
||||||
self.dark_mode_auto_switch.connect("state-set", self.on_dark_mode_auto)
|
|
||||||
|
|
||||||
self.dark_mode_switch = self.builder.get_object("dark_mode_switch")
|
|
||||||
self.dark_mode_switch.set_active(self.settings.get_value("dark-mode"))
|
|
||||||
self.dark_mode_switch.connect("state-set", self.on_dark_mode)
|
|
||||||
|
|
||||||
self.autohide_headerbar_switch = self.builder.get_object("autohide_headerbar_switch")
|
self.autohide_headerbar_switch = self.builder.get_object("autohide_headerbar_switch")
|
||||||
self.autohide_headerbar_switch.set_active(self.settings.get_value("autohide-headerbar"))
|
self.autohide_headerbar_switch.set_active(self.settings.get_value("autohide-headerbar"))
|
||||||
self.autohide_headerbar_switch.connect("state-set", self.on_autohide_headerbar)
|
self.autohide_headerbar_switch.connect("state-set", self.on_autohide_headerbar)
|
||||||
|
@ -83,10 +75,6 @@ class PreferencesDialog:
|
||||||
self.spellcheck_switch.set_active(self.settings.get_value("spellcheck"))
|
self.spellcheck_switch.set_active(self.settings.get_value("spellcheck"))
|
||||||
self.spellcheck_switch.connect("state-set", self.on_spellcheck)
|
self.spellcheck_switch.connect("state-set", self.on_spellcheck)
|
||||||
|
|
||||||
self.gradient_overlay_switch = self.builder.get_object("gradient_overlay_switch")
|
|
||||||
self.gradient_overlay_switch.set_active(self.settings.get_value("gradient-overlay"))
|
|
||||||
self.gradient_overlay_switch.connect("state-set", self.on_gradient_overlay)
|
|
||||||
|
|
||||||
input_format_store = Gtk.ListStore(int, str)
|
input_format_store = Gtk.ListStore(int, str)
|
||||||
input_format = self.settings.get_string("input-format")
|
input_format = self.settings.get_string("input-format")
|
||||||
input_format_active = 0
|
input_format_active = 0
|
||||||
|
@ -111,18 +99,6 @@ class PreferencesDialog:
|
||||||
preferences_window.set_transient_for(window)
|
preferences_window.set_transient_for(window)
|
||||||
preferences_window.show()
|
preferences_window.show()
|
||||||
|
|
||||||
def on_dark_mode_auto(self, _, state):
|
|
||||||
self.settings.set_boolean("dark-mode-auto", state)
|
|
||||||
if state and self.dark_mode_switch.get_active():
|
|
||||||
self.dark_mode_switch.set_active(GLib.Variant.new_boolean(False))
|
|
||||||
return False
|
|
||||||
|
|
||||||
def on_dark_mode(self, _, state):
|
|
||||||
self.settings.set_boolean("dark-mode", state)
|
|
||||||
if state and self.dark_mode_auto_switch.get_active():
|
|
||||||
self.dark_mode_auto_switch.set_active(GLib.Variant.new_boolean(False))
|
|
||||||
return False
|
|
||||||
|
|
||||||
def on_autohide_headerbar(self, _, state):
|
def on_autohide_headerbar(self, _, state):
|
||||||
self.settings.set_boolean("autohide-headerbar", state)
|
self.settings.set_boolean("autohide-headerbar", state)
|
||||||
return False
|
return False
|
||||||
|
@ -131,10 +107,6 @@ class PreferencesDialog:
|
||||||
self.settings.set_boolean("spellcheck", state)
|
self.settings.set_boolean("spellcheck", state)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_gradient_overlay(self, _, state):
|
|
||||||
self.settings.set_boolean("gradient-overlay", state)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def on_input_format(self, combobox):
|
def on_input_format(self, combobox):
|
||||||
fmt = self.formats[combobox.get_active()]
|
fmt = self.formats[combobox.get_active()]
|
||||||
self.settings.set_string("input-format", fmt["format"])
|
self.settings.set_string("input-format", fmt["format"])
|
||||||
|
|
|
@ -31,10 +31,9 @@ class Theme:
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_current_changed(cls):
|
def get_current_changed(cls):
|
||||||
theme_name = Gtk.Settings.get_default().get_property('gtk-theme-name')
|
theme_name = Gtk.Settings.get_default().get_property('gtk-theme-name')
|
||||||
dark_mode_auto = cls.settings.get_boolean('dark-mode-auto')
|
|
||||||
dark_mode = cls.settings.get_boolean('dark-mode')
|
dark_mode = cls.settings.get_boolean('dark-mode')
|
||||||
current_theme = cls.get_for_name(theme_name)
|
current_theme = cls.get_for_name(theme_name)
|
||||||
if not dark_mode_auto and dark_mode != current_theme.is_dark and current_theme.inverse_name:
|
if dark_mode != current_theme.is_dark and current_theme.inverse_name:
|
||||||
current_theme = cls.get_for_name(current_theme.inverse_name, current_theme.name)
|
current_theme = cls.get_for_name(current_theme.inverse_name, current_theme.name)
|
||||||
changed = current_theme != cls.previous
|
changed = current_theme != cls.previous
|
||||||
cls.previous = current_theme
|
cls.previous = current_theme
|
||||||
|
|
Loading…
Reference in New Issue