gtk-stream 0.6.1__py3-none-any.whl → 0.7__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.
@@ -17,14 +17,29 @@
17
17
  import io
18
18
  import xml.sax as sax
19
19
  import signal
20
+ import sys
20
21
 
21
22
  from .parser import GtkStreamXMLHandler
23
+ from . import GLib
24
+
25
+ class GtkStreamErrorHandler(sax.handler.ErrorHandler):
26
+ def error(self, exc):
27
+ print("Error", file=sys.stderr)
28
+ raise exc
29
+ def fatalError(self, exc):
30
+ print("Fatal error", file=sys.stderr)
31
+ raise exc
22
32
 
23
33
  def main():
24
34
  handler = GtkStreamXMLHandler()
35
+ errHandler = GtkStreamErrorHandler()
25
36
  parser = sax.make_parser()
26
37
  parser.setContentHandler(handler)
38
+ parser.setErrorHandler(errHandler)
27
39
  try:
28
40
  parser.parse(io.FileIO(0, 'r', closefd=False))
29
- finally:
30
- handler.app.release()
41
+ except Exception as e:
42
+ def quit():
43
+ handler.app.quit()
44
+ GLib.idle_add(quit)
45
+ print(f"Done with exception : {e}\n", file=sys.stderr)
@@ -10,6 +10,7 @@ from .classes.Dropdown import Dropdown, Item
10
10
  from .classes.Switch import Switch
11
11
 
12
12
  from .classes.Box import Box, BoxPrepend
13
+ from .classes.FlowBox import FlowBox, FlowBoxPrepend
13
14
  from .classes.ScrolledWindow import ScrolledWindow
14
15
  from .classes.Paned import Paned
15
16
  from .classes.Frame import Frame, FrameLabel
@@ -0,0 +1,34 @@
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
+ from ... import Gtk
18
+ from .. import Document, PseudoDocument
19
+
20
+ class FlowBoxPrepend(PseudoDocument):
21
+ def __init__(self, app):
22
+ super().__init__(app)
23
+
24
+ class FlowBox(Document):
25
+ __g_class__ = Gtk.FlowBox
26
+ def __init__(self, app, **kwargs):
27
+ super().__init__(app, **kwargs)
28
+ def render_raw(self):
29
+ return Gtk.FlowBox()
30
+ def insert_child(self, w, d):
31
+ if isinstance(d, FlowBoxPrepend):
32
+ w.prepend(d.render())
33
+ else:
34
+ w.append(d.render())
gtk_stream/parser.py CHANGED
@@ -45,7 +45,9 @@ WIDGET_DOCUMENTS = {
45
45
  'picture' : docs.Picture,
46
46
  'separator' : docs.Separator,
47
47
  'scrolled-window' : docs.ScrolledWindow,
48
- 'stack' : docs.Stack
48
+ 'stack' : docs.Stack,
49
+ 'flow-box' : docs.FlowBox,
50
+ 'flow-box-prepend': docs.FlowBoxPrepend
49
51
  }
50
52
 
51
53
  class GtkStreamXMLHandler(sax.ContentHandler):
@@ -89,6 +91,7 @@ class GtkStreamXMLHandler(sax.ContentHandler):
89
91
  threading.Thread(target = appMain).start()
90
92
  def on_sigint(a,b):
91
93
  def cb():
94
+ print("SIGINT received", file=sys.stderr)
92
95
  self.app.quit()
93
96
  sys.exit(0)
94
97
  GLib.idle_add(cb)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.6.1
3
+ Version: 0.7
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/
@@ -1,14 +1,15 @@
1
1
  gtk_stream/__init__.py,sha256=pDhUSN4AYNsP8_tilU1zmDCYdiv7ak4PE1TW0qFrDlg,99
2
2
  gtk_stream/application.py,sha256=g95IbeV2fjKf55bRqBCl9EpdiA-sR9XHmp6BMGZBAbo,3836
3
- gtk_stream/command_line.py,sha256=tnMvtDsQrTc8zr3zTvwAEWuuhNMgxAaF9qDjAyiW9yM,1032
3
+ gtk_stream/command_line.py,sha256=6Yj6NV12cqlnSE5ZHTjNqxE6ZtosuWAiJm66awpJ2H8,1503
4
4
  gtk_stream/common.py,sha256=wjByU_xhzgCKJFSkEr0gNsi2dqv38kA9_2DodRRrBw4,1310
5
- gtk_stream/parser.py,sha256=75tSJtvQrwQd34K8P18OAQUEjkmmPt8z7sVBOf47VAU,7914
5
+ gtk_stream/parser.py,sha256=9AfSOb-T7O98A-XIH16eBBC6eA0jsFmEVi3F19kAiGY,8063
6
6
  gtk_stream/properties.py,sha256=r_zxYIBe5g8SGueuhtf5CIAWesmm2tXv6llh6657a74,2374
7
- gtk_stream/documents/__init__.py,sha256=jqjJ4yY4fzpFbDfhe0pwR1ahg2jLaeLC-eyH6YTuLpQ,681
7
+ gtk_stream/documents/__init__.py,sha256=_y2h6kINZGuYibRgfgVwtmZGmSdIBHZP0TUB182Ado8,741
8
8
  gtk_stream/documents/classes/Box.py,sha256=d01o2-JQ3-k0VjvvY8E7mly-u_f1v1NqYz1IDjHZLUo,1381
9
9
  gtk_stream/documents/classes/Button.py,sha256=NoDuAwd2XqXY8ZvyOg9xeKIru71JBi4ZFS3Oe6P478Q,1529
10
10
  gtk_stream/documents/classes/Document.py,sha256=m_N7UCxHmdlQ34OvP91EvUEdl40CzuRngeJRj9w3dPU,2109
11
11
  gtk_stream/documents/classes/Dropdown.py,sha256=NUUQ24yrJomlwcXWgm73kEsAsy4Eej6udg77HFBgiZs,2426
12
+ gtk_stream/documents/classes/FlowBox.py,sha256=UoVYS2j_osOV-IgbVoaqluTBCiaXus5dq2e9qhAu2Xo,1225
12
13
  gtk_stream/documents/classes/Frame.py,sha256=zAZvsT-YTZMijsgk7p0YVf6siAmFoCCSXouZo9XDpsA,1222
13
14
  gtk_stream/documents/classes/Grid.py,sha256=jDJ9U1GJZ45hi1VvPsCwFILN7CwEkgjqYqhTzMdtX9o,1249
14
15
  gtk_stream/documents/classes/Label.py,sha256=bBNBTvGs6fM8uLf4EDb2Ro8FmCeS27cnU1Ao-44nRYs,1023
@@ -20,8 +21,8 @@ gtk_stream/documents/classes/Separator.py,sha256=uw_EgAKs_6pNA8nrOLzruIlJfk4uaog
20
21
  gtk_stream/documents/classes/Stack.py,sha256=YA6NDzZL2u4Ko8GXtx8Or-jEWGMCEw2cC1HNkAMRw-8,1030
21
22
  gtk_stream/documents/classes/Switch.py,sha256=bLOkyAy_v2T_Gli9c6TAhnUJcqhbnxbD9oswPdTAsGo,1365
22
23
  gtk_stream/documents/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- gtk_stream-0.6.1.dist-info/METADATA,sha256=2x5RAxnuDZ-AMqBf__ETYAetTKUTJaIfzFGI3R1Ojm0,806
24
- gtk_stream-0.6.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
25
- gtk_stream-0.6.1.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
26
- gtk_stream-0.6.1.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
27
- gtk_stream-0.6.1.dist-info/RECORD,,
24
+ gtk_stream-0.7.dist-info/METADATA,sha256=ReGnW0Nugu54Bbmm4GMDzE0vxxoZBk1Mfy8BQQPzv4c,804
25
+ gtk_stream-0.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
26
+ gtk_stream-0.7.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
27
+ gtk_stream-0.7.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
28
+ gtk_stream-0.7.dist-info/RECORD,,