mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-11-22 07:22:19 +03:00
added new swww transition menu feature.
This commit is contained in:
parent
2c816f3b07
commit
3464e7671d
@ -11,7 +11,7 @@ from waypaper.aboutdata import AboutData
|
||||
from waypaper.changer import change_wallpaper
|
||||
from waypaper.config import Config
|
||||
from waypaper.common import get_image_paths, get_random_file, get_monitor_names
|
||||
from waypaper.options import FILL_OPTIONS, SORT_OPTIONS, SORT_DISPLAYS, VIDEO_EXTENSIONS
|
||||
from waypaper.options import FILL_OPTIONS, SORT_OPTIONS, SORT_DISPLAYS, VIDEO_EXTENSIONS , SWWW_TRANSITION_TYPES
|
||||
from waypaper.translations import Chinese, English, French, German, Polish, Russian, Belarusian, Spanish
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
@ -182,6 +182,9 @@ class App(Gtk.Window):
|
||||
# Create a monitor option dropdown menu:
|
||||
self.monitor_option_combo = Gtk.ComboBoxText()
|
||||
|
||||
# Create a transition dropdown menu for swww
|
||||
self.swww_transitions_options = Gtk.ComboBoxText()
|
||||
|
||||
# Create the options menu button:
|
||||
self.options_button = Gtk.Button(label="Options")
|
||||
self.options_button.connect("clicked", self.on_options_button_clicked)
|
||||
@ -196,6 +199,7 @@ class App(Gtk.Window):
|
||||
self.options_box.pack_start(self.backend_option_combo, False, False, 0)
|
||||
self.button_row_alignment.add(self.options_box)
|
||||
|
||||
self.swww_transitions_options_display()
|
||||
self.monitor_option_display()
|
||||
self.fill_option_display()
|
||||
self.color_picker_display()
|
||||
@ -256,6 +260,23 @@ class App(Gtk.Window):
|
||||
# Add it to the row of buttons:
|
||||
self.options_box.pack_start(self.monitor_option_combo, False, False, 0)
|
||||
|
||||
def swww_transitions_options_display(self) -> None:
|
||||
""" Show swww transition option if backend is swww """
|
||||
self.options_box.remove(self.swww_transitions_options)
|
||||
if self.cf.backend not in ["swww"]:
|
||||
return
|
||||
|
||||
self.swww_transitions_options = Gtk.ComboBoxText()
|
||||
for transitions in SWWW_TRANSITION_TYPES:
|
||||
self.swww_transitions_options.append_text(transitions)
|
||||
active_transition = 0
|
||||
if self.cf.swww_transition_type in SWWW_TRANSITION_TYPES:
|
||||
active_transition = SWWW_TRANSITION_TYPES.index(self.cf.swww_transition_type)
|
||||
self.swww_transitions_options.set_active(active_transition)
|
||||
self.swww_transitions_options.connect("changed", self.on_transition_option_changed)
|
||||
self.swww_transitions_options.set_tooltip_text(self.txt.tip_transition)
|
||||
|
||||
self.options_box.pack_start(self.swww_transitions_options, False, False, 0)
|
||||
|
||||
def fill_option_display(self):
|
||||
"""Display fill option if backend is not hyprpaper"""
|
||||
@ -458,10 +479,20 @@ class App(Gtk.Window):
|
||||
self.cf.backend = self.backend_option_combo.get_active_text()
|
||||
self.cf.selected_monitor = "All"
|
||||
self.monitor_option_display()
|
||||
self.swww_transitions_options_display()
|
||||
self.fill_option_display()
|
||||
self.color_picker_display()
|
||||
self.show_all()
|
||||
|
||||
def on_transition_option_changed(self, combo) -> None:
|
||||
# Get the active index
|
||||
active_index = combo.get_active()
|
||||
|
||||
# Update the active transition type based on the selected option
|
||||
if active_index >= 0:
|
||||
self.cf.swww_transition_type = SWWW_TRANSITION_TYPES[active_index]
|
||||
print(f"transition type changed to: {self.cf.swww_transition_type}")
|
||||
|
||||
|
||||
def on_color_set(self, color_button):
|
||||
"""Convert selected color to web format"""
|
||||
@ -601,3 +632,4 @@ class App(Gtk.Window):
|
||||
self.connect("destroy", self.on_exit_clicked)
|
||||
self.show_all()
|
||||
Gtk.main()
|
||||
|
@ -238,4 +238,3 @@ class Config:
|
||||
if args.state_file:
|
||||
self.use_xdg_state = True # Use of a custom state file implies state is in a separate file, requires use_xdg_state
|
||||
self.state_file = pathlib.Path(args.state_file).expanduser()
|
||||
|
||||
|
@ -52,6 +52,7 @@ class English:
|
||||
self.tip_color = "Choose background color"
|
||||
self.tip_random = "Set random wallpaper"
|
||||
self.tip_exit = "Exit the application"
|
||||
self.tip_transition = "Choose transition type"
|
||||
|
||||
|
||||
class German:
|
||||
@ -105,6 +106,7 @@ class German:
|
||||
self.tip_color = "Hintergrundfarbe auswählen"
|
||||
self.tip_random = "Ein zufälliges Hintergrundbild auswählen"
|
||||
self.tip_exit = "Das Programm beenden"
|
||||
self.tip_transition = "Übergangstyp auswählen"
|
||||
|
||||
|
||||
class French:
|
||||
@ -158,6 +160,7 @@ class French:
|
||||
self.tip_color = "Choisir la couleur de fond"
|
||||
self.tip_random = "Définir un papier peint aléatoire"
|
||||
self.tip_exit = "Quitter l'application"
|
||||
self.tip_transition = "Choisissez le type de transition"
|
||||
|
||||
|
||||
class Polish:
|
||||
@ -211,6 +214,7 @@ class Polish:
|
||||
self.tip_color = "Wybierz kolor tła"
|
||||
self.tip_random = "Ustaw losową tapetę"
|
||||
self.tip_exit = "Wyjdź z aplikacji"
|
||||
self.tip_transition = "Wybierz typ przejścia"
|
||||
|
||||
|
||||
class Russian:
|
||||
@ -264,6 +268,7 @@ class Russian:
|
||||
self.tip_color = "Выбрать цвет фона"
|
||||
self.tip_random = "Установить случайные обои"
|
||||
self.tip_exit = "Выйти из приложения"
|
||||
self.tip_transition = "Выберите тип перехода"
|
||||
|
||||
|
||||
class Belarusian:
|
||||
@ -317,6 +322,7 @@ class Belarusian:
|
||||
self.tip_color = "Выбраць колер фону"
|
||||
self.tip_random = "Усталяваць выпадковыя шпалеры"
|
||||
self.tip_exit = "Выйсці з прыкладання"
|
||||
self.tip_transition = "Выберыце тып пераходу"
|
||||
|
||||
|
||||
class Chinese:
|
||||
@ -370,6 +376,7 @@ class Chinese:
|
||||
self.tip_color = "选择背景颜色"
|
||||
self.tip_random = "设置随机壁纸"
|
||||
self.tip_exit = "退出应用程序"
|
||||
self.tip_transition = "选择过渡类型"
|
||||
|
||||
class Spanish:
|
||||
def __init__(self):
|
||||
@ -422,3 +429,4 @@ class Spanish:
|
||||
self.tip_color = "Escoja un color de fondo"
|
||||
self.tip_random = "Actualizar la imagen de fondo a una imagen aleatoria"
|
||||
self.tip_exit = "Cerrar la aplicación"
|
||||
self.tip_transition = "Elige el tipo de transición"
|
Loading…
Reference in New Issue
Block a user