gtk-stream 0.11.1__py3-none-any.whl → 0.11.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gtk_stream/_version.py +2 -2
- gtk_stream/application.py +1 -3
- gtk_stream/command_line.py +66 -25
- gtk_stream/documents/classes/Picture.py +5 -6
- gtk_stream/parser.py +3 -5
- gtk_stream/properties.py +13 -1
- {gtk_stream-0.11.1.dist-info → gtk_stream-0.11.3.dist-info}/METADATA +1 -1
- {gtk_stream-0.11.1.dist-info → gtk_stream-0.11.3.dist-info}/RECORD +11 -11
- {gtk_stream-0.11.1.dist-info → gtk_stream-0.11.3.dist-info}/WHEEL +1 -1
- {gtk_stream-0.11.1.dist-info → gtk_stream-0.11.3.dist-info}/entry_points.txt +0 -0
- {gtk_stream-0.11.1.dist-info → gtk_stream-0.11.3.dist-info}/top_level.txt +0 -0
gtk_stream/_version.py
CHANGED
gtk_stream/application.py
CHANGED
@@ -48,11 +48,9 @@ def style_store():
|
|
48
48
|
return (lambda: " ".join(style),None, style.append)
|
49
49
|
|
50
50
|
class GtkStreamApp(Gtk.Application):
|
51
|
-
def __init__(self, logger,
|
51
|
+
def __init__(self, logger, **kwargs):
|
52
52
|
super().__init__(**kwargs)
|
53
53
|
self.logger = logger
|
54
|
-
if name != None:
|
55
|
-
GLib.set_application_name(name)
|
56
54
|
self.namedWidgets = { }
|
57
55
|
self.namedWindows = { }
|
58
56
|
|
gtk_stream/command_line.py
CHANGED
@@ -14,33 +14,74 @@
|
|
14
14
|
# You should have received a copy of the GNU General Public License
|
15
15
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
16
16
|
|
17
|
-
import
|
18
|
-
import xml.sax as sax
|
19
|
-
import sys
|
20
|
-
import os
|
17
|
+
import argparse
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
def main():
|
20
|
+
parser = argparse.ArgumentParser(
|
21
|
+
prog='gtk-stream',
|
22
|
+
description='A stream-based GUI tool',
|
23
|
+
add_help=False
|
24
|
+
)
|
25
|
+
parser.add_argument('--list-icons', action='store_true')
|
26
|
+
parser.add_argument('--hook')
|
27
|
+
parser.add_argument('-h', '--help', action='store_true')
|
28
|
+
args = parser.parse_args()
|
25
29
|
|
26
|
-
|
30
|
+
if args.help:
|
31
|
+
parser.print_help()
|
27
32
|
|
28
|
-
|
33
|
+
elif args.list_icons:
|
34
|
+
from . import Gtk, Gdk
|
35
|
+
theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default())
|
36
|
+
for name in theme.get_icon_names():
|
37
|
+
print(name)
|
29
38
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
39
|
+
elif args.hook:
|
40
|
+
match args.hook:
|
41
|
+
case "bash":
|
42
|
+
print('''
|
43
|
+
coproc GTK_STREAM { exec gtk-stream; }
|
44
|
+
trap 'kill -INT "$GTK_STREAM_PID"; wait' EXIT
|
45
|
+
exec {GTK_STREAM_EVENTS}<&"${GTK_STREAM[0]}"
|
46
|
+
exec {GTK_STREAM_MESSAGES}>&"${GTK_STREAM[1]}"
|
47
|
+
function GTK.send() {
|
48
|
+
if (($# > 0)); then
|
49
|
+
printf "$@" >&"$GTK_STREAM_MESSAGES"
|
50
|
+
else
|
51
|
+
cat >&"$GTK_STREAM_MESSAGES"
|
52
|
+
fi
|
53
|
+
}
|
54
|
+
function GTK.recv() {
|
55
|
+
read -u "$GTK_STREAM_EVENTS" "$@"
|
56
|
+
}
|
57
|
+
''')
|
58
|
+
else:
|
59
|
+
import io
|
60
|
+
import sys
|
61
|
+
import os
|
62
|
+
import xml.sax as sax
|
63
|
+
from .parser import GtkStreamXMLHandler
|
64
|
+
from .application import GtkStreamApp
|
65
|
+
from .common import Logger, LogLevel
|
35
66
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
67
|
+
class GtkStreamErrorHandler(sax.handler.ErrorHandler):
|
68
|
+
def error(self, exc):
|
69
|
+
raise exc
|
70
|
+
def fatalError(self, exc):
|
71
|
+
raise exc
|
72
|
+
|
73
|
+
logLevel = LogLevel.__dict__.get(os.environ.get('GTK_STREAM_LOGLEVEL', 'WARN'), LogLevel.WARN)
|
74
|
+
|
75
|
+
logger = Logger(logLevel)
|
76
|
+
|
77
|
+
app = GtkStreamApp(logger)
|
78
|
+
handler = GtkStreamXMLHandler(logger,app)
|
79
|
+
errHandler = GtkStreamErrorHandler()
|
80
|
+
parser = sax.make_parser()
|
81
|
+
parser.setContentHandler(handler)
|
82
|
+
parser.setErrorHandler(errHandler)
|
83
|
+
try:
|
84
|
+
parser.parse(io.FileIO(0, 'r', closefd=False))
|
85
|
+
except Exception as e:
|
86
|
+
logger.error("Done with exception : %s", e)
|
87
|
+
handler.quit_application()
|
@@ -20,16 +20,15 @@ from .. import Document
|
|
20
20
|
|
21
21
|
class Picture(Document):
|
22
22
|
__g_class__ = Gtk.Picture
|
23
|
-
def __init__(self, app,
|
23
|
+
def __init__(self, app, **kwargs):
|
24
24
|
super().__init__(app, **kwargs)
|
25
|
-
self.src = src
|
26
25
|
def render_raw(self):
|
27
|
-
return Gtk.Picture
|
26
|
+
return Gtk.Picture()
|
28
27
|
|
29
28
|
class Icon(Document):
|
30
29
|
__g_class__ = Gtk.Image
|
31
|
-
def __init__(self, app,
|
30
|
+
def __init__(self, app, **kwargs):
|
32
31
|
super().__init__(app, **kwargs)
|
33
|
-
self.src = src
|
34
32
|
def render_raw(self):
|
35
|
-
return Gtk.Image
|
33
|
+
return Gtk.Image()
|
34
|
+
|
gtk_stream/parser.py
CHANGED
@@ -23,8 +23,6 @@ import xml.sax as sax
|
|
23
23
|
from . import GLib
|
24
24
|
from . import documents as docs
|
25
25
|
|
26
|
-
from .application import GtkStreamApp
|
27
|
-
|
28
26
|
WIDGET_DOCUMENTS = {
|
29
27
|
'progress-bar' : docs.ProgressBar,
|
30
28
|
'label' : docs.Label,
|
@@ -53,8 +51,9 @@ WIDGET_DOCUMENTS = {
|
|
53
51
|
}
|
54
52
|
|
55
53
|
class GtkStreamXMLHandler(sax.ContentHandler):
|
56
|
-
def __init__(self, logger):
|
54
|
+
def __init__(self, logger, app):
|
57
55
|
self.logger = logger
|
56
|
+
self.app = app
|
58
57
|
self.transition_enter = self.transE_conn
|
59
58
|
self.transition_leave = self.transL_final
|
60
59
|
self.transition_chars = self.ignore_chars
|
@@ -95,7 +94,6 @@ class GtkStreamXMLHandler(sax.ContentHandler):
|
|
95
94
|
def transE_conn(self, name, attrs):
|
96
95
|
match name:
|
97
96
|
case 'application':
|
98
|
-
self.app = GtkStreamApp(self.logger, **attrs)
|
99
97
|
def on_activate(a):
|
100
98
|
a.hold()
|
101
99
|
self.app.connect('activate', on_activate)
|
@@ -114,7 +112,7 @@ class GtkStreamXMLHandler(sax.ContentHandler):
|
|
114
112
|
# touching the parser
|
115
113
|
self.messages = {
|
116
114
|
f.__tag_name__: self.startMessage(functools.partial(f,self.app), f.__store__)
|
117
|
-
for f in
|
115
|
+
for f in self.app.__class__.__dict__.values()
|
118
116
|
if hasattr(f, '__tag_name__')
|
119
117
|
}
|
120
118
|
self.logger.debug("Messages: %s", self.messages)
|
gtk_stream/properties.py
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
import sys
|
18
18
|
|
19
|
-
from . import Gtk
|
19
|
+
from . import Gtk, Gio
|
20
20
|
|
21
21
|
def _const(x):
|
22
22
|
return lambda _: x
|
@@ -53,6 +53,16 @@ def _parse_widget_property(val):
|
|
53
53
|
return lambda app: app.namedWidgets[val]
|
54
54
|
def _parse_window_property(val):
|
55
55
|
return lambda app: app.namedWindows[val]
|
56
|
+
def _parse_gfile_property(val):
|
57
|
+
return _const(Gio.File.new_for_path(val))
|
58
|
+
def _parse_align_property(val):
|
59
|
+
match val:
|
60
|
+
case "start":
|
61
|
+
return _const(Gtk.Align.START)
|
62
|
+
case "center":
|
63
|
+
return _const(Gtk.Align.CENTER)
|
64
|
+
case "end":
|
65
|
+
return _const(Gtk.Align.END)
|
56
66
|
|
57
67
|
_PARSE_TYPE_PROPERTY = {
|
58
68
|
'GStrv' : _parse_css_classes_property,
|
@@ -66,6 +76,8 @@ _PARSE_TYPE_PROPERTY = {
|
|
66
76
|
'GtkWindow' : _parse_window_property,
|
67
77
|
'GtkAdjustment' : _parse_adjustment_property,
|
68
78
|
'gchararray' : _const,
|
79
|
+
'GFile' : _parse_gfile_property,
|
80
|
+
'GtkAlign' : _parse_align_property,
|
69
81
|
}
|
70
82
|
|
71
83
|
def parse_property(prop_type, val):
|
@@ -1,10 +1,10 @@
|
|
1
1
|
gtk_stream/__init__.py,sha256=y6JLknVFexWrSo_Zl7-TXrPR6EQ5XVMeFO1bUzLN9Lg,98
|
2
|
-
gtk_stream/_version.py,sha256=
|
3
|
-
gtk_stream/application.py,sha256=
|
4
|
-
gtk_stream/command_line.py,sha256=
|
2
|
+
gtk_stream/_version.py,sha256=OkAeaAqw1G6xdcg59fk8Mamyqb2RLX_cARtBOHOICIM,413
|
3
|
+
gtk_stream/application.py,sha256=Au4MngStEIKQdGnl-H6eGWDt923onqRDjW1mPFB9M8I,4911
|
4
|
+
gtk_stream/command_line.py,sha256=aagZJ6kyQxbIcx818jU8XPHddC68q7qtkJRNpk5IvJk,2833
|
5
5
|
gtk_stream/common.py,sha256=xdscxYgBg_Ux6iyk26gB-AMSgoUIqlZUPgso5YS_gKE,2106
|
6
|
-
gtk_stream/parser.py,sha256=
|
7
|
-
gtk_stream/properties.py,sha256=
|
6
|
+
gtk_stream/parser.py,sha256=kyZtHxB4yz_gr0kc6akBMZfFouHZP6XnXF0BZzO_adA,6494
|
7
|
+
gtk_stream/properties.py,sha256=RjdRgKUSldIK4Nsij8leBANJicf6oP-Nr53tYI4uEE8,3551
|
8
8
|
gtk_stream/documents/__init__.py,sha256=T9mIonSi9DWrpXQzbjq0s0TPU0hB7HylfhMA20OfWIg,831
|
9
9
|
gtk_stream/documents/classes/Box.py,sha256=d01o2-JQ3-k0VjvvY8E7mly-u_f1v1NqYz1IDjHZLUo,1381
|
10
10
|
gtk_stream/documents/classes/Button.py,sha256=21bVI7DUWmiusboxdsimTgcqKtLqzQydhS9ifIt4R64,1512
|
@@ -16,7 +16,7 @@ gtk_stream/documents/classes/Frame.py,sha256=zAZvsT-YTZMijsgk7p0YVf6siAmFoCCSXou
|
|
16
16
|
gtk_stream/documents/classes/Grid.py,sha256=jDJ9U1GJZ45hi1VvPsCwFILN7CwEkgjqYqhTzMdtX9o,1249
|
17
17
|
gtk_stream/documents/classes/Label.py,sha256=bBNBTvGs6fM8uLf4EDb2Ro8FmCeS27cnU1Ao-44nRYs,1023
|
18
18
|
gtk_stream/documents/classes/Paned.py,sha256=q1goKJMWBg1d3hS0eanPBxzBqLB-Pz5hUnH9N-RXXh8,1392
|
19
|
-
gtk_stream/documents/classes/Picture.py,sha256=
|
19
|
+
gtk_stream/documents/classes/Picture.py,sha256=p84N1ntCHu47O84m48zC8uKFgso3-38yXpPlAjr4IKU,1153
|
20
20
|
gtk_stream/documents/classes/ProgressBar.py,sha256=NPJtP3qaKiZUEAYEHZk4FEoWSFn2KVorI2SVb8cDnW0,966
|
21
21
|
gtk_stream/documents/classes/Scale.py,sha256=6rW6sBCdpPaqgDEGUPZi5UR8CT3bPmaZQqXXhnl-oaw,1124
|
22
22
|
gtk_stream/documents/classes/ScrolledWindow.py,sha256=WaTPgz6GBC-hjH83SQT2OGUdCapHAgO3xEmSMJZ8q70,1041
|
@@ -24,8 +24,8 @@ gtk_stream/documents/classes/Separator.py,sha256=uw_EgAKs_6pNA8nrOLzruIlJfk4uaog
|
|
24
24
|
gtk_stream/documents/classes/Stack.py,sha256=YA6NDzZL2u4Ko8GXtx8Or-jEWGMCEw2cC1HNkAMRw-8,1030
|
25
25
|
gtk_stream/documents/classes/Switch.py,sha256=jQVuxqS9Pmpp1ymB_dbJPxasJNpm4e35ry0JYPHdAsk,1275
|
26
26
|
gtk_stream/documents/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
|
-
gtk_stream-0.11.
|
28
|
-
gtk_stream-0.11.
|
29
|
-
gtk_stream-0.11.
|
30
|
-
gtk_stream-0.11.
|
31
|
-
gtk_stream-0.11.
|
27
|
+
gtk_stream-0.11.3.dist-info/METADATA,sha256=KVLg05oiD8yi-hsNSWs9Zc_DNEZv6BOAwonyhImOYcs,807
|
28
|
+
gtk_stream-0.11.3.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
|
29
|
+
gtk_stream-0.11.3.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
|
30
|
+
gtk_stream-0.11.3.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
|
31
|
+
gtk_stream-0.11.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|