EHS-Studio commited on
Commit
57d2903
·
verified ·
1 Parent(s): 1300da8

Add a Live wallpaper switch to the Wallpaper page

Browse files
assets/studio-animations.webp CHANGED
assets/studio-colors.webp CHANGED
assets/studio-live.webp CHANGED
assets/studio-presets.webp CHANGED
assets/studio-ripple.webp CHANGED
assets/studio-size.webp CHANGED
assets/studio-wallpaper.webp CHANGED
studio.py CHANGED
@@ -397,6 +397,7 @@ class Studio(Gtk.Window):
397
  super().__init__(title="TechGlass Studio")
398
  self.cfg = tgcore.load_config()
399
  self.refreshers = []
 
400
  self._wall_timer = None
401
  self._wall_gen = 0
402
  self.busy = False
@@ -527,7 +528,15 @@ class Studio(Gtk.Window):
527
 
528
  def switch(self, grid, label, path):
529
  sw = Gtk.Switch(active=self.get(path), halign=Gtk.Align.START)
530
- sw.connect("notify::active", lambda s, _p: self.set(path, s.get_active()))
 
 
 
 
 
 
 
 
531
  self.refreshers.append(lambda: sw.set_active(self.get(path)))
532
  self.row(grid, label, sw)
533
  return sw
@@ -648,6 +657,7 @@ class Studio(Gtk.Window):
648
  def build_wallpaper(self):
649
  g = self.page("wallpaper", "Wallpaper")
650
  self.section(g, "Source")
 
651
  self.combo(g, "Wallpaper", ("wallpaper", "mode"),
652
  (("generated", "Generate TechGlass art"), ("image", "Use my own image")))
653
  chooser = Gtk.FileChooserButton(title="Choose a wallpaper", action=Gtk.FileChooserAction.OPEN)
 
397
  super().__init__(title="TechGlass Studio")
398
  self.cfg = tgcore.load_config()
399
  self.refreshers = []
400
+ self._switches = {}
401
  self._wall_timer = None
402
  self._wall_gen = 0
403
  self.busy = False
 
528
 
529
  def switch(self, grid, label, path):
530
  sw = Gtk.Switch(active=self.get(path), halign=Gtk.Align.START)
531
+ twins = self._switches.setdefault(path, []) # the same setting can appear on two pages
532
+ twins.append(sw)
533
+
534
+ def toggled(s, _p):
535
+ self.set(path, s.get_active())
536
+ for other in twins:
537
+ if other is not s and other.get_active() != s.get_active():
538
+ other.set_active(s.get_active())
539
+ sw.connect("notify::active", toggled)
540
  self.refreshers.append(lambda: sw.set_active(self.get(path)))
541
  self.row(grid, label, sw)
542
  return sw
 
657
  def build_wallpaper(self):
658
  g = self.page("wallpaper", "Wallpaper")
659
  self.section(g, "Source")
660
+ self.switch(g, "Live wallpaper", ("live", "enabled"))
661
  self.combo(g, "Wallpaper", ("wallpaper", "mode"),
662
  (("generated", "Generate TechGlass art"), ("image", "Use my own image")))
663
  chooser = Gtk.FileChooserButton(title="Choose a wallpaper", action=Gtk.FileChooserAction.OPEN)
techglass-mint.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9011cea61e9987689e59e865b14d3a073f2132b1e725e90a2daed367957687ec
3
- size 163141
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cbffd5af73beed252c33e870e334bd443f4596b958d7e7e07b9a2a5ed5253ea1
3
+ size 163549