gtk-stream 0.11.1__tar.gz → 0.11.3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/PKG-INFO +1 -1
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/_version.py +2 -2
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/application.py +1 -3
- gtk_stream-0.11.3/gtk_stream/command_line.py +87 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Picture.py +5 -6
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/parser.py +3 -5
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/properties.py +13 -1
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream.egg-info/PKG-INFO +1 -1
- gtk_stream-0.11.1/gtk_stream/command_line.py +0 -46
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/README.md +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk-stream +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/__init__.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/common.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/__init__.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Box.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Button.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Document.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Dropdown.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Entry.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/FlowBox.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Frame.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Grid.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Label.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Paned.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/ProgressBar.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Scale.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/ScrolledWindow.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Separator.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Stack.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Switch.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream/documents/classes/__init__.py +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream.egg-info/SOURCES.txt +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream.egg-info/dependency_links.txt +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream.egg-info/entry_points.txt +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream.egg-info/requires.txt +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/gtk_stream.egg-info/top_level.txt +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/pyproject.toml +0 -0
- {gtk_stream-0.11.1 → gtk_stream-0.11.3}/setup.cfg +0 -0
@@ -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
|
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# Gtk-Stream : A stream-based GUI protocol
|
2
|
+
# Copyright (C) 2024 Marc Coiffier
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
import argparse
|
18
|
+
|
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()
|
29
|
+
|
30
|
+
if args.help:
|
31
|
+
parser.print_help()
|
32
|
+
|
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)
|
38
|
+
|
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
|
66
|
+
|
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
|
+
|
@@ -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)
|
@@ -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,46 +0,0 @@
|
|
1
|
-
# Gtk-Stream : A stream-based GUI protocol
|
2
|
-
# Copyright (C) 2024 Marc Coiffier
|
3
|
-
#
|
4
|
-
# This program is free software: you can redistribute it and/or modify
|
5
|
-
# it under the terms of the GNU General Public License as published by
|
6
|
-
# the Free Software Foundation, either version 3 of the License, or
|
7
|
-
# (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU General Public License
|
15
|
-
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
16
|
-
|
17
|
-
import io
|
18
|
-
import xml.sax as sax
|
19
|
-
import sys
|
20
|
-
import os
|
21
|
-
|
22
|
-
from .parser import GtkStreamXMLHandler
|
23
|
-
from .common import Logger, LogLevel
|
24
|
-
from . import GLib
|
25
|
-
|
26
|
-
logLevel = LogLevel.__dict__.get(os.environ.get('GTK_STREAM_LOGLEVEL', 'WARN'), LogLevel.WARN)
|
27
|
-
|
28
|
-
logger = Logger(logLevel)
|
29
|
-
|
30
|
-
class GtkStreamErrorHandler(sax.handler.ErrorHandler):
|
31
|
-
def error(self, exc):
|
32
|
-
raise exc
|
33
|
-
def fatalError(self, exc):
|
34
|
-
raise exc
|
35
|
-
|
36
|
-
def main():
|
37
|
-
handler = GtkStreamXMLHandler(logger)
|
38
|
-
errHandler = GtkStreamErrorHandler()
|
39
|
-
parser = sax.make_parser()
|
40
|
-
parser.setContentHandler(handler)
|
41
|
-
parser.setErrorHandler(errHandler)
|
42
|
-
try:
|
43
|
-
parser.parse(io.FileIO(0, 'r', closefd=False))
|
44
|
-
except Exception as e:
|
45
|
-
logger.error("Done with exception : %s", e)
|
46
|
-
handler.quit_application()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|