gtk-stream 0.11.2__tar.gz → 0.11.3__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/PKG-INFO +1 -1
  2. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/_version.py +2 -2
  3. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/application.py +1 -3
  4. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/command_line.py +43 -19
  5. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/parser.py +3 -5
  6. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/properties.py +9 -0
  7. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream.egg-info/PKG-INFO +1 -1
  8. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/README.md +0 -0
  9. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk-stream +0 -0
  10. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/__init__.py +0 -0
  11. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/common.py +0 -0
  12. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/__init__.py +0 -0
  13. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Box.py +0 -0
  14. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Button.py +0 -0
  15. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Document.py +0 -0
  16. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Dropdown.py +0 -0
  17. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Entry.py +0 -0
  18. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/FlowBox.py +0 -0
  19. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Frame.py +0 -0
  20. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Grid.py +0 -0
  21. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Label.py +0 -0
  22. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Paned.py +0 -0
  23. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Picture.py +0 -0
  24. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/ProgressBar.py +0 -0
  25. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Scale.py +0 -0
  26. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/ScrolledWindow.py +0 -0
  27. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Separator.py +0 -0
  28. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Stack.py +0 -0
  29. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/Switch.py +0 -0
  30. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream/documents/classes/__init__.py +0 -0
  31. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream.egg-info/SOURCES.txt +0 -0
  32. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream.egg-info/dependency_links.txt +0 -0
  33. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream.egg-info/entry_points.txt +0 -0
  34. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream.egg-info/requires.txt +0 -0
  35. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/gtk_stream.egg-info/top_level.txt +0 -0
  36. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/pyproject.toml +0 -0
  37. {gtk_stream-0.11.2 → gtk_stream-0.11.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.11.2
3
+ Version: 0.11.3
4
4
  Summary: A simple stream-oriented GUI protocol
5
5
  Author-email: Marc Coiffier <marc.coiffier@univ-grenoble-alpes.fr>
6
6
  Project-URL: Homepage, https://coiffier.net/projects/gtk-stream/
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.11.2'
16
- __version_tuple__ = version_tuple = (0, 11, 2)
15
+ __version__ = version = '0.11.3'
16
+ __version_tuple__ = version_tuple = (0, 11, 3)
@@ -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, name = None, **kwargs):
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
 
@@ -14,26 +14,8 @@
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 io
18
- import xml.sax as sax
19
- import sys
20
- import os
21
17
  import argparse
22
18
 
23
- from .parser import GtkStreamXMLHandler
24
- from .common import Logger, LogLevel
25
- from . import GLib, Gtk, Gdk
26
-
27
- logLevel = LogLevel.__dict__.get(os.environ.get('GTK_STREAM_LOGLEVEL', 'WARN'), LogLevel.WARN)
28
-
29
- logger = Logger(logLevel)
30
-
31
- class GtkStreamErrorHandler(sax.handler.ErrorHandler):
32
- def error(self, exc):
33
- raise exc
34
- def fatalError(self, exc):
35
- raise exc
36
-
37
19
  def main():
38
20
  parser = argparse.ArgumentParser(
39
21
  prog='gtk-stream',
@@ -41,17 +23,59 @@ def main():
41
23
  add_help=False
42
24
  )
43
25
  parser.add_argument('--list-icons', action='store_true')
26
+ parser.add_argument('--hook')
44
27
  parser.add_argument('-h', '--help', action='store_true')
45
28
  args = parser.parse_args()
46
29
 
47
30
  if args.help:
48
31
  parser.print_help()
32
+
49
33
  elif args.list_icons:
34
+ from . import Gtk, Gdk
50
35
  theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default())
51
36
  for name in theme.get_icon_names():
52
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
+ ''')
53
58
  else:
54
- handler = GtkStreamXMLHandler(logger)
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)
55
79
  errHandler = GtkStreamErrorHandler()
56
80
  parser = sax.make_parser()
57
81
  parser.setContentHandler(handler)
@@ -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 GtkStreamApp.__dict__.values()
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)
@@ -55,6 +55,14 @@ def _parse_window_property(val):
55
55
  return lambda app: app.namedWindows[val]
56
56
  def _parse_gfile_property(val):
57
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)
58
66
 
59
67
  _PARSE_TYPE_PROPERTY = {
60
68
  'GStrv' : _parse_css_classes_property,
@@ -69,6 +77,7 @@ _PARSE_TYPE_PROPERTY = {
69
77
  'GtkAdjustment' : _parse_adjustment_property,
70
78
  'gchararray' : _const,
71
79
  'GFile' : _parse_gfile_property,
80
+ 'GtkAlign' : _parse_align_property,
72
81
  }
73
82
 
74
83
  def parse_property(prop_type, val):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.11.2
3
+ Version: 0.11.3
4
4
  Summary: A simple stream-oriented GUI protocol
5
5
  Author-email: Marc Coiffier <marc.coiffier@univ-grenoble-alpes.fr>
6
6
  Project-URL: Homepage, https://coiffier.net/projects/gtk-stream/
File without changes
File without changes
File without changes
File without changes