17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
-
+
-
|
# With the methodes .app_state() and .app_restore() named gtk widgets
# can be queried for attributes. The methods return a saveable dict,
# which contain current layout options for a few Widget types. Saving
# and restoring must be handled elsewhere.
# debug
from config import __print__, dbg, plugin_meta
from config import *
# system
import os.path
import copy
import sys
import re
import base64
import zlib
import inspect
from compat2and3 import unicode, xrange, PY3
import pkgutil
# gtk version (2=gtk2, 3=gtk3, 7=tk;)
ver = 2
# if running on Python3 or with commandline flag
if PY3 or "--gtk3" in sys.argv:
ver = 3
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
-
+
|
import gtk
import gobject
GdkPixbuf = gtk.gdk
empty_pixbuf = GdkPixbuf.Pixbuf(gtk.gdk.COLORSPACE_RGB,True,8,16,16)
empty_pixbuf.fill(0xFFFFFFFF)
# prepare gtkbuilder data
ui_xml = pkgutil.get_data("config", "gtk3.xml").decode("utf-8")
ui_xml = get_data("gtk3.xml", decode=True)
if ver == 2:
ui_xml = ui_xml.replace('version="3.0"', 'version="2.16"')
# simplified gtk constructors ---------------------------------------------
class uikit:
|
611
612
613
614
615
616
617
618
619
620
621
622
|
610
611
612
613
614
615
616
617
618
619
620
621
|
-
+
|
#
class AboutStreamtuner2(AuxiliaryWindow):
def __init__(self, parent):
a = gtk.AboutDialog()
a.set_name(parent.meta["id"])
a.set_version(parent.meta["version"])
a.set_license(parent.meta["license"])
a.set_authors((pkgutil.get_data("config", "CREDITS") or parent.meta["author"]).split("\n"))
a.set_authors((get_data("CREDITS") or parent.meta["author"]).split("\n"))
a.set_website(parent.meta["url"])
a.connect("response", lambda a, ok: ( a.hide(), a.destroy() ) )
a.show_all()
|