1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import os
- import time
- import urllib.request
- import threading
- import json
- from subprocess import *
- from gi.repository import Gtk
- from gi.repository import Gdk
- from gi.repository import GLib
- from gi.repository import Pango
- from gi.repository import GdkPixbuf
- from PIL import Image, ImageSequence
- from flbry import ui
- from flbry import fetch
- def button(win, name):
-
- vbox = Gtk.VBox()
- hbox = Gtk.HBox()
- vbox.pack_start(hbox, False, False, 0)
- hbox.pack_start(ui.icon(win, "emblem-favorite"), False, False, 0)
- hbox.pack_start(Gtk.Label(" Follow: "), False, False, 0)
-
- switch = Gtk.Switch()
- hbox.pack_start(switch, False, False, 0)
- if name in win.subs:
- switch.set_active(True)
- def on_follow(w, e):
- if switch.get_active():
- if name not in win.subs:
- win.subs.append(name)
- else:
- if name in win.subs:
- win.subs.remove(name)
- save(win)
- switch.connect("notify::active", on_follow)
-
- return vbox
- def save(win):
-
- out = fetch.lbrynet("preference_get")
- out["shared"]["value"]["subscriptions"] = win.subs
- fetch.lbrynet("preference_set", {"key":"shared", "value":out["shared"]})
-
|