mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-11-22 15:46:39 +03:00
Adding toggle to hide transition options
This commit is contained in:
parent
13e17a118a
commit
72fa8421ef
120
waypaper/app.py
120
waypaper/app.py
@ -170,7 +170,54 @@ class App(Gtk.Window):
|
|||||||
self.grid.set_column_spacing(0)
|
self.grid.set_column_spacing(0)
|
||||||
self.scrolled_window.add(self.grid)
|
self.scrolled_window.add(self.grid)
|
||||||
|
|
||||||
# BOTTOM MENU
|
# SWWW TRANSITION MENU
|
||||||
|
|
||||||
|
# Transitions menu above the main menu for swww options
|
||||||
|
self.swww_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
|
||||||
|
|
||||||
|
# Create a transition type dropdown menu for swww
|
||||||
|
self.swww_label = Gtk.Label(label="Transition options: ")
|
||||||
|
self.swww_transitions_options = Gtk.ComboBoxText()
|
||||||
|
|
||||||
|
# Get angle for animation
|
||||||
|
self.swww_angle_entry = Gtk.Entry()
|
||||||
|
self.swww_angle_entry.set_width_chars(7)
|
||||||
|
self.swww_angle_entry.set_placeholder_text("angle")
|
||||||
|
self.swww_box.pack_start(self.swww_angle_entry, False, False, 0)
|
||||||
|
|
||||||
|
# Get steps for animation
|
||||||
|
self.swww_steps_entry = Gtk.Entry()
|
||||||
|
self.swww_steps_entry.set_width_chars(7)
|
||||||
|
self.swww_steps_entry.set_placeholder_text("steps")
|
||||||
|
self.swww_box.pack_start(self.swww_steps_entry, False, False, 0)
|
||||||
|
|
||||||
|
# Get duration for animation
|
||||||
|
self.swww_duration_entry = Gtk.Entry()
|
||||||
|
self.swww_duration_entry.set_width_chars(7)
|
||||||
|
self.swww_duration_entry.set_placeholder_text("duration")
|
||||||
|
self.swww_box.pack_start(self.swww_duration_entry, False, False, 0)
|
||||||
|
|
||||||
|
# Get fps for animation
|
||||||
|
self.swww_fps_entry = Gtk.Entry()
|
||||||
|
self.swww_fps_entry.set_width_chars(5)
|
||||||
|
self.swww_fps_entry.set_placeholder_text("fps")
|
||||||
|
self.swww_box.pack_start(self.swww_fps_entry, False, False, 0)
|
||||||
|
|
||||||
|
# Create a box to contain the bottom row of buttons with margin:
|
||||||
|
self.swww_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
|
||||||
|
self.swww_container.set_margin_bottom(0)
|
||||||
|
self.main_box.pack_start(self.swww_container, False, False, 0)
|
||||||
|
|
||||||
|
# Create alignment container for swww submenu:
|
||||||
|
self.swww_row_alignment = Gtk.Alignment(xalign=0.5, yalign=0.0, xscale=0.5, yscale=0.5)
|
||||||
|
self.swww_container.pack_start(self.swww_row_alignment, True, False, 0)
|
||||||
|
|
||||||
|
# Pack the new box at the end of the main box:
|
||||||
|
self.swww_options_box = Gtk.HBox(spacing=10)
|
||||||
|
self.swww_options_box.pack_start(self.swww_box, False, False, 0)
|
||||||
|
self.swww_row_alignment.add(self.swww_options_box)
|
||||||
|
|
||||||
|
# BACKEND MENU
|
||||||
|
|
||||||
# Create a backend dropdown menu:
|
# Create a backend dropdown menu:
|
||||||
self.backend_option_combo = Gtk.ComboBoxText()
|
self.backend_option_combo = Gtk.ComboBoxText()
|
||||||
@ -222,50 +269,6 @@ class App(Gtk.Window):
|
|||||||
self.bottom_loading_box.set_margin_bottom(0)
|
self.bottom_loading_box.set_margin_bottom(0)
|
||||||
self.main_box.pack_end(self.bottom_loading_box, False, False, 0)
|
self.main_box.pack_end(self.bottom_loading_box, False, False, 0)
|
||||||
|
|
||||||
# SWWW TRANSITION MENU
|
|
||||||
|
|
||||||
# Transitions menu above the main menu for swww options
|
|
||||||
self.swww_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
|
|
||||||
|
|
||||||
# Label for swww options
|
|
||||||
self.swww_label = Gtk.Label(label="Transition options: ")
|
|
||||||
|
|
||||||
# Create a transition type dropdown menu for swww
|
|
||||||
self.swww_transitions_options = Gtk.ComboBoxText()
|
|
||||||
|
|
||||||
# Get angle for animation
|
|
||||||
self.swww_angle_entry = Gtk.Entry()
|
|
||||||
self.swww_angle_entry.set_width_chars(7)
|
|
||||||
self.swww_angle_entry.set_placeholder_text("angle")
|
|
||||||
self.swww_box.pack_start(self.swww_angle_entry, False, False, 0)
|
|
||||||
|
|
||||||
# Get steps for animation
|
|
||||||
self.swww_steps_entry = Gtk.Entry()
|
|
||||||
self.swww_steps_entry.set_width_chars(7)
|
|
||||||
self.swww_steps_entry.set_placeholder_text("steps")
|
|
||||||
self.swww_box.pack_start(self.swww_steps_entry, False, False, 0)
|
|
||||||
|
|
||||||
# Get duration for animation
|
|
||||||
self.swww_duration_entry = Gtk.Entry()
|
|
||||||
self.swww_duration_entry.set_width_chars(7)
|
|
||||||
self.swww_duration_entry.set_placeholder_text("duration")
|
|
||||||
self.swww_box.pack_start(self.swww_duration_entry, False, False, 0)
|
|
||||||
|
|
||||||
# Get fps for animation
|
|
||||||
self.swww_fps_entry = Gtk.Entry()
|
|
||||||
self.swww_fps_entry.set_width_chars(5)
|
|
||||||
self.swww_fps_entry.set_placeholder_text("fps")
|
|
||||||
self.swww_box.pack_start(self.swww_fps_entry, False, False, 0)
|
|
||||||
|
|
||||||
# Create a box to contain the bottom row of buttons with margin:
|
|
||||||
self.swww_button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
|
|
||||||
self.swww_button_box.set_margin_bottom(0)
|
|
||||||
self.main_box.pack_start(self.swww_button_box, False, False, 0)
|
|
||||||
|
|
||||||
# Create alignment container for swww submenu:
|
|
||||||
self.swww_row_alignment = Gtk.Alignment(xalign=0.5, yalign=0.0, xscale=0.5, yscale=0.5)
|
|
||||||
self.swww_button_box.pack_start(self.swww_row_alignment, True, False, 0)
|
|
||||||
|
|
||||||
# Create alignment container for bottom menu:
|
# Create alignment container for bottom menu:
|
||||||
self.button_row_alignment = Gtk.Alignment(xalign=0.5, yalign=0.0, xscale=0.5, yscale=0.5)
|
self.button_row_alignment = Gtk.Alignment(xalign=0.5, yalign=0.0, xscale=0.5, yscale=0.5)
|
||||||
self.bottom_button_box.pack_start(self.button_row_alignment, True, False, 0)
|
self.bottom_button_box.pack_start(self.button_row_alignment, True, False, 0)
|
||||||
@ -279,11 +282,6 @@ class App(Gtk.Window):
|
|||||||
self.options_box.pack_start(self.backend_option_combo, False, False, 0)
|
self.options_box.pack_start(self.backend_option_combo, False, False, 0)
|
||||||
self.button_row_alignment.add(self.options_box)
|
self.button_row_alignment.add(self.options_box)
|
||||||
|
|
||||||
# Pack the new box at the end of the main box:
|
|
||||||
self.swww_options_box = Gtk.HBox(spacing=10)
|
|
||||||
self.swww_options_box.pack_start(self.swww_box, False, False, 0)
|
|
||||||
self.swww_row_alignment.add(self.swww_options_box)
|
|
||||||
|
|
||||||
self.swww_options_display()
|
self.swww_options_display()
|
||||||
self.monitor_option_display()
|
self.monitor_option_display()
|
||||||
self.fill_option_display()
|
self.fill_option_display()
|
||||||
@ -302,20 +300,27 @@ class App(Gtk.Window):
|
|||||||
self.filter_gifs_checkbox = Gtk.CheckMenuItem(label=self.txt.msg_gifs)
|
self.filter_gifs_checkbox = Gtk.CheckMenuItem(label=self.txt.msg_gifs)
|
||||||
self.filter_gifs_checkbox.set_active(self.cf.show_gifs_only)
|
self.filter_gifs_checkbox.set_active(self.cf.show_gifs_only)
|
||||||
self.filter_gifs_checkbox.connect("toggled", self.on_filter_gifs_toggled)
|
self.filter_gifs_checkbox.connect("toggled", self.on_filter_gifs_toggled)
|
||||||
|
self.menu.append(self.filter_gifs_checkbox)
|
||||||
|
|
||||||
# Create subfolder toggle:
|
# Create subfolder toggle:
|
||||||
self.include_subfolders_checkbox = Gtk.CheckMenuItem(label=self.txt.msg_subfolders)
|
self.include_subfolders_checkbox = Gtk.CheckMenuItem(label=self.txt.msg_subfolders)
|
||||||
self.include_subfolders_checkbox.set_active(self.cf.include_subfolders)
|
self.include_subfolders_checkbox.set_active(self.cf.include_subfolders)
|
||||||
self.include_subfolders_checkbox.connect("toggled", self.on_include_subfolders_toggled)
|
self.include_subfolders_checkbox.connect("toggled", self.on_include_subfolders_toggled)
|
||||||
|
self.menu.append(self.include_subfolders_checkbox)
|
||||||
|
|
||||||
# Create hidden toggle:
|
# Create hidden toggle:
|
||||||
self.include_hidden_checkbox = Gtk.CheckMenuItem(label=self.txt.msg_hidden)
|
self.include_hidden_checkbox = Gtk.CheckMenuItem(label=self.txt.msg_hidden)
|
||||||
self.include_hidden_checkbox.set_active(self.cf.show_hidden)
|
self.include_hidden_checkbox.set_active(self.cf.show_hidden)
|
||||||
self.include_hidden_checkbox.connect("toggled", self.on_hidden_files_toggled)
|
self.include_hidden_checkbox.connect("toggled", self.on_hidden_files_toggled)
|
||||||
|
|
||||||
self.menu.append(self.filter_gifs_checkbox)
|
|
||||||
self.menu.append(self.include_subfolders_checkbox)
|
|
||||||
self.menu.append(self.include_hidden_checkbox)
|
self.menu.append(self.include_hidden_checkbox)
|
||||||
|
|
||||||
|
# Create show transition options toggle:
|
||||||
|
if self.cf.backend == "swww":
|
||||||
|
self.show_transition_options_checkbox = Gtk.CheckMenuItem(label=self.txt.msg_transitions)
|
||||||
|
self.show_transition_options_checkbox.set_active(self.cf.show_transition_options)
|
||||||
|
self.show_transition_options_checkbox.connect("toggled", self.on_show_transition_options_toggled)
|
||||||
|
self.menu.append(self.show_transition_options_checkbox)
|
||||||
|
|
||||||
self.menu.show_all()
|
self.menu.show_all()
|
||||||
|
|
||||||
def on_options_button_clicked(self, widget) -> None:
|
def on_options_button_clicked(self, widget) -> None:
|
||||||
@ -352,7 +357,7 @@ class App(Gtk.Window):
|
|||||||
self.swww_box.remove(self.swww_fps_entry)
|
self.swww_box.remove(self.swww_fps_entry)
|
||||||
self.swww_box.remove(self.swww_duration_entry)
|
self.swww_box.remove(self.swww_duration_entry)
|
||||||
|
|
||||||
if self.cf.backend != "swww":
|
if self.cf.backend != "swww" or not self.cf.show_transition_options:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.swww_transitions_options = Gtk.ComboBoxText()
|
self.swww_transitions_options = Gtk.ComboBoxText()
|
||||||
@ -580,6 +585,13 @@ class App(Gtk.Window):
|
|||||||
threading.Thread(target=self.process_images).start()
|
threading.Thread(target=self.process_images).start()
|
||||||
|
|
||||||
|
|
||||||
|
def on_show_transition_options_toggled(self, toggle) -> None:
|
||||||
|
"""Toggle visibility of transition menu"""
|
||||||
|
self.cf.show_transition_options = toggle.get_active()
|
||||||
|
threading.Thread(target=self.process_images).start()
|
||||||
|
self.swww_options_display()
|
||||||
|
|
||||||
|
|
||||||
def toggle_hidden_files(self) -> None:
|
def toggle_hidden_files(self) -> None:
|
||||||
"""Toggle visibility of hidden files via keys"""
|
"""Toggle visibility of hidden files via keys"""
|
||||||
self.cf.show_hidden = not self.cf.show_hidden
|
self.cf.show_hidden = not self.cf.show_hidden
|
||||||
|
@ -37,6 +37,7 @@ class Config:
|
|||||||
self.include_subfolders = False
|
self.include_subfolders = False
|
||||||
self.show_hidden = False
|
self.show_hidden = False
|
||||||
self.show_gifs_only = False
|
self.show_gifs_only = False
|
||||||
|
self.show_transition_options = True
|
||||||
self.about = AboutData()
|
self.about = AboutData()
|
||||||
self.cache_dir = user_cache_path(self.about.applicationName())
|
self.cache_dir = user_cache_path(self.about.applicationName())
|
||||||
self.config_dir = user_config_path(self.about.applicationName())
|
self.config_dir = user_config_path(self.about.applicationName())
|
||||||
@ -85,6 +86,7 @@ class Config:
|
|||||||
self.swww_transition_fps = config.get("Settings", "swww_transition_fps", fallback=self.swww_transition_fps)
|
self.swww_transition_fps = config.get("Settings", "swww_transition_fps", fallback=self.swww_transition_fps)
|
||||||
self.lang = config.get("Settings", "language", fallback=self.lang)
|
self.lang = config.get("Settings", "language", fallback=self.lang)
|
||||||
self.include_subfolders = config.getboolean("Settings", "subfolders", fallback=self.include_subfolders)
|
self.include_subfolders = config.getboolean("Settings", "subfolders", fallback=self.include_subfolders)
|
||||||
|
self.show_transition_options = config.getboolean("Settings", "show_transition_options", fallback=self.show_transition_options)
|
||||||
self.show_hidden = config.getboolean("Settings", "show_hidden", fallback=self.show_hidden)
|
self.show_hidden = config.getboolean("Settings", "show_hidden", fallback=self.show_hidden)
|
||||||
self.show_gifs_only = config.getboolean("Settings", "show_gifs_only", fallback=self.show_gifs_only)
|
self.show_gifs_only = config.getboolean("Settings", "show_gifs_only", fallback=self.show_gifs_only)
|
||||||
self.use_xdg_state = config.getboolean("Settings", "use_xdg_state", fallback=self.use_xdg_state)
|
self.use_xdg_state = config.getboolean("Settings", "use_xdg_state", fallback=self.use_xdg_state)
|
||||||
@ -198,6 +200,7 @@ class Config:
|
|||||||
config.set("Settings", "subfolders", str(self.include_subfolders))
|
config.set("Settings", "subfolders", str(self.include_subfolders))
|
||||||
config.set("Settings", "show_hidden", str(self.show_hidden))
|
config.set("Settings", "show_hidden", str(self.show_hidden))
|
||||||
config.set("Settings", "show_gifs_only", str(self.show_gifs_only))
|
config.set("Settings", "show_gifs_only", str(self.show_gifs_only))
|
||||||
|
config.set("Settings", "show_transition_options", str(self.show_transition_options))
|
||||||
config.set("Settings", "post_command", self.post_command)
|
config.set("Settings", "post_command", self.post_command)
|
||||||
config.set("Settings", "number_of_columns", str(self.number_of_columns))
|
config.set("Settings", "number_of_columns", str(self.number_of_columns))
|
||||||
config.set("Settings", "swww_transition_type", str(self.swww_transition_type))
|
config.set("Settings", "swww_transition_type", str(self.swww_transition_type))
|
||||||
|
@ -26,6 +26,7 @@ class English:
|
|||||||
self.msg_subfolders = "Show subfolders"
|
self.msg_subfolders = "Show subfolders"
|
||||||
self.msg_hidden = "Show hidden"
|
self.msg_hidden = "Show hidden"
|
||||||
self.msg_gifs = "Show gifs only"
|
self.msg_gifs = "Show gifs only"
|
||||||
|
self.msg_transitions = "Show transition options"
|
||||||
self.msg_changefolder = "Change wallpaper folder"
|
self.msg_changefolder = "Change wallpaper folder"
|
||||||
self.msg_choosefolder = "Please choose a folder"
|
self.msg_choosefolder = "Please choose a folder"
|
||||||
self.msg_caching = "Caching wallpapers..."
|
self.msg_caching = "Caching wallpapers..."
|
||||||
@ -82,6 +83,7 @@ class German:
|
|||||||
self.msg_subfolders = "Unterordner"
|
self.msg_subfolders = "Unterordner"
|
||||||
self.msg_hidden = "Hidden"
|
self.msg_hidden = "Hidden"
|
||||||
self.msg_gifs = "Show only gifs"
|
self.msg_gifs = "Show only gifs"
|
||||||
|
self.msg_transitions = "Show transition options"
|
||||||
self.msg_changefolder = "Hintergrundbild-Ordner ändern"
|
self.msg_changefolder = "Hintergrundbild-Ordner ändern"
|
||||||
self.msg_choosefolder = "Bitte wählen Sie einen Ordner aus"
|
self.msg_choosefolder = "Bitte wählen Sie einen Ordner aus"
|
||||||
self.msg_caching = "Hintergrundbilder werden zwischengespeichert..."
|
self.msg_caching = "Hintergrundbilder werden zwischengespeichert..."
|
||||||
@ -136,8 +138,9 @@ class French:
|
|||||||
self.msg_search = "Chercher"
|
self.msg_search = "Chercher"
|
||||||
self.msg_exit = "Quitter"
|
self.msg_exit = "Quitter"
|
||||||
self.msg_subfolders = "Sous-dossiers"
|
self.msg_subfolders = "Sous-dossiers"
|
||||||
self.msg_hidden = "Hidden"
|
self.msg_hidden = "Afficher caché"
|
||||||
self.msg_gifs = "Show only gifs"
|
self.msg_gifs = "Afficher uniquement les gifs"
|
||||||
|
self.msg_transitions = "Afficher les options de transition"
|
||||||
self.msg_changefolder = "Changer de dossier de papier peint"
|
self.msg_changefolder = "Changer de dossier de papier peint"
|
||||||
self.msg_choosefolder = "Veuillez choisir un dossier"
|
self.msg_choosefolder = "Veuillez choisir un dossier"
|
||||||
self.msg_caching = "Mise en cache des papiers peints..."
|
self.msg_caching = "Mise en cache des papiers peints..."
|
||||||
@ -194,6 +197,7 @@ class Polish:
|
|||||||
self.msg_subfolders = "Podkatalogi"
|
self.msg_subfolders = "Podkatalogi"
|
||||||
self.msg_hidden = "Hidden"
|
self.msg_hidden = "Hidden"
|
||||||
self.msg_gifs = "Show only gifs"
|
self.msg_gifs = "Show only gifs"
|
||||||
|
self.msg_transitions = "Show transition options"
|
||||||
self.msg_changefolder = "Zmień folder z tapetami"
|
self.msg_changefolder = "Zmień folder z tapetami"
|
||||||
self.msg_choosefolder = "Proszę wybrać folder"
|
self.msg_choosefolder = "Proszę wybrać folder"
|
||||||
self.msg_caching = "Kasowanie tapet..."
|
self.msg_caching = "Kasowanie tapet..."
|
||||||
@ -250,6 +254,7 @@ class Russian:
|
|||||||
self.msg_subfolders = "Показать подпапки"
|
self.msg_subfolders = "Показать подпапки"
|
||||||
self.msg_hidden = "Показать скрытые"
|
self.msg_hidden = "Показать скрытые"
|
||||||
self.msg_gifs = "Показать только gif"
|
self.msg_gifs = "Показать только gif"
|
||||||
|
self.msg_transitions = "Показать опции перехода"
|
||||||
self.msg_changefolder = "Изменить папку с обоями"
|
self.msg_changefolder = "Изменить папку с обоями"
|
||||||
self.msg_choosefolder = "Пожалуйста, выберите папку"
|
self.msg_choosefolder = "Пожалуйста, выберите папку"
|
||||||
self.msg_caching = "Кэширование обоев..."
|
self.msg_caching = "Кэширование обоев..."
|
||||||
@ -306,6 +311,7 @@ class Belarusian:
|
|||||||
self.msg_subfolders = "Паказаць падтэчкі"
|
self.msg_subfolders = "Паказаць падтэчкі"
|
||||||
self.msg_hidden = "Паказаць схаваныя"
|
self.msg_hidden = "Паказаць схаваныя"
|
||||||
self.msg_gifs = "Паказаць толькі gif"
|
self.msg_gifs = "Паказаць толькі gif"
|
||||||
|
self.msg_transitions = "Show transition options"
|
||||||
self.msg_changefolder = "Змяніць тэчку са шпалерамі"
|
self.msg_changefolder = "Змяніць тэчку са шпалерамі"
|
||||||
self.msg_choosefolder = "Калі ласка, абярыце тэчку"
|
self.msg_choosefolder = "Калі ласка, абярыце тэчку"
|
||||||
self.msg_caching = "Кэшаванне шпалер..."
|
self.msg_caching = "Кэшаванне шпалер..."
|
||||||
@ -362,6 +368,7 @@ class Chinese:
|
|||||||
self.msg_subfolders = "子文件夹"
|
self.msg_subfolders = "子文件夹"
|
||||||
self.msg_hidden = "Show hidden"
|
self.msg_hidden = "Show hidden"
|
||||||
self.msg_gifs = "Show only gifs"
|
self.msg_gifs = "Show only gifs"
|
||||||
|
self.msg_transitions = "Show transition options"
|
||||||
self.msg_changefolder = "更改壁纸文件夹"
|
self.msg_changefolder = "更改壁纸文件夹"
|
||||||
self.msg_choosefolder = "请选择一个文件夹"
|
self.msg_choosefolder = "请选择一个文件夹"
|
||||||
self.msg_caching = "缓存壁纸..."
|
self.msg_caching = "缓存壁纸..."
|
||||||
@ -417,6 +424,7 @@ class Spanish:
|
|||||||
self.msg_subfolders = "Ver subcarpetas"
|
self.msg_subfolders = "Ver subcarpetas"
|
||||||
self.msg_hidden = "Ver archivos ocultos"
|
self.msg_hidden = "Ver archivos ocultos"
|
||||||
self.msg_gifs = 'Ver solamente imágenes de tipo "GIF"'
|
self.msg_gifs = 'Ver solamente imágenes de tipo "GIF"'
|
||||||
|
self.msg_transitions = "Show transition options"
|
||||||
self.msg_changefolder = "Cambiar carpeta de imágenes"
|
self.msg_changefolder = "Cambiar carpeta de imágenes"
|
||||||
self.msg_choosefolder = "Por favor, selecciona una carpeta"
|
self.msg_choosefolder = "Por favor, selecciona una carpeta"
|
||||||
self.msg_caching = "Almacenando en el caché..."
|
self.msg_caching = "Almacenando en el caché..."
|
||||||
|
Loading…
Reference in New Issue
Block a user