gtk-stream 0.6__tar.gz → 0.7__tar.gz

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.
Files changed (46) hide show
  1. {gtk_stream-0.6 → gtk_stream-0.7}/PKG-INFO +9 -2
  2. gtk_stream-0.7/README.md +5 -0
  3. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/application.py +16 -1
  4. gtk_stream-0.7/gtk_stream/command_line.py +45 -0
  5. gtk_stream-0.7/gtk_stream/common.py +35 -0
  6. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/documents/__init__.py +1 -0
  7. gtk_stream-0.7/gtk_stream/documents/classes/Box.py +38 -0
  8. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/documents/classes/Button.py +16 -0
  9. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/documents/classes/Document.py +16 -0
  10. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/documents/classes/Dropdown.py +16 -0
  11. gtk_stream-0.7/gtk_stream/documents/classes/FlowBox.py +34 -0
  12. gtk_stream-0.7/gtk_stream/documents/classes/Frame.py +34 -0
  13. gtk_stream-0.7/gtk_stream/documents/classes/Grid.py +36 -0
  14. gtk_stream-0.7/gtk_stream/documents/classes/Label.py +28 -0
  15. gtk_stream-0.7/gtk_stream/documents/classes/Paned.py +37 -0
  16. gtk_stream-0.7/gtk_stream/documents/classes/Picture.py +27 -0
  17. gtk_stream-0.7/gtk_stream/documents/classes/ProgressBar.py +25 -0
  18. gtk_stream-0.7/gtk_stream/documents/classes/ScrolledWindow.py +27 -0
  19. gtk_stream-0.7/gtk_stream/documents/classes/Separator.py +25 -0
  20. gtk_stream-0.7/gtk_stream/documents/classes/Stack.py +27 -0
  21. gtk_stream-0.7/gtk_stream/documents/classes/Switch.py +32 -0
  22. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/parser.py +20 -1
  23. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/properties.py +16 -0
  24. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream.egg-info/PKG-INFO +9 -2
  25. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream.egg-info/SOURCES.txt +2 -0
  26. {gtk_stream-0.6 → gtk_stream-0.7}/pyproject.toml +3 -2
  27. gtk_stream-0.6/gtk_stream/command_line.py +0 -14
  28. gtk_stream-0.6/gtk_stream/common.py +0 -19
  29. gtk_stream-0.6/gtk_stream/documents/classes/Box.py +0 -22
  30. gtk_stream-0.6/gtk_stream/documents/classes/Frame.py +0 -18
  31. gtk_stream-0.6/gtk_stream/documents/classes/Grid.py +0 -20
  32. gtk_stream-0.6/gtk_stream/documents/classes/Label.py +0 -12
  33. gtk_stream-0.6/gtk_stream/documents/classes/Paned.py +0 -21
  34. gtk_stream-0.6/gtk_stream/documents/classes/Picture.py +0 -11
  35. gtk_stream-0.6/gtk_stream/documents/classes/ProgressBar.py +0 -9
  36. gtk_stream-0.6/gtk_stream/documents/classes/ScrolledWindow.py +0 -11
  37. gtk_stream-0.6/gtk_stream/documents/classes/Separator.py +0 -9
  38. gtk_stream-0.6/gtk_stream/documents/classes/Stack.py +0 -11
  39. gtk_stream-0.6/gtk_stream/documents/classes/Switch.py +0 -16
  40. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/__init__.py +0 -0
  41. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream/documents/classes/__init__.py +0 -0
  42. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream.egg-info/dependency_links.txt +0 -0
  43. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream.egg-info/entry_points.txt +0 -0
  44. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream.egg-info/requires.txt +0 -0
  45. {gtk_stream-0.6 → gtk_stream-0.7}/gtk_stream.egg-info/top_level.txt +0 -0
  46. {gtk_stream-0.6 → gtk_stream-0.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.6
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/
@@ -9,5 +9,12 @@ Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: Environment :: X11 Applications :: GTK
11
11
  Classifier: Topic :: Software Development :: User Interfaces
12
- Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
12
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
13
+ Description-Content-Type: text/markdown
13
14
  Requires-Dist: pygobject
15
+
16
+ GTK-Stream
17
+ ==========
18
+
19
+ - Pretty documentation : [link](https://coiffier.net/projects/gtk-stream/)
20
+ - Same documentation, but less pretty : [link](doc/index.md)
@@ -0,0 +1,5 @@
1
+ GTK-Stream
2
+ ==========
3
+
4
+ - Pretty documentation : [link](https://coiffier.net/projects/gtk-stream/)
5
+ - Same documentation, but less pretty : [link](doc/index.md)
@@ -1,5 +1,20 @@
1
- import sys
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/>.
2
16
 
17
+ import sys
3
18
  from . import Gtk, GLib, Gdk
4
19
  from .common import printEvent
5
20
  from .properties import parse_property, get_prop_type
@@ -0,0 +1,45 @@
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 signal
20
+ import sys
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
32
+
33
+ def main():
34
+ handler = GtkStreamXMLHandler()
35
+ errHandler = GtkStreamErrorHandler()
36
+ parser = sax.make_parser()
37
+ parser.setContentHandler(handler)
38
+ parser.setErrorHandler(errHandler)
39
+ try:
40
+ parser.parse(io.FileIO(0, 'r', closefd=False))
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)
@@ -0,0 +1,35 @@
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 sys
18
+
19
+ def _data_str_default(*args):
20
+ return ''
21
+ def _data_str_by(get_data):
22
+ def ret(*args):
23
+ return ":"+get_data(*args)
24
+ return ret
25
+
26
+ def printEvent(event, id, retval = None, get_data = None):
27
+ data_str = _data_str_default if get_data == None else _data_str_by(get_data)
28
+ def ret(*args):
29
+ try:
30
+ print("{}:{}{}".format(id,event,data_str(*args)), file=sys.stdout)
31
+ sys.stdout.flush()
32
+ except Exception as e:
33
+ print("Exception when writing an event: {}".format(e), file=sys.stderr)
34
+ return retval
35
+ return ret
@@ -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,38 @@
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 BoxPrepend(PseudoDocument):
21
+ def __init__(self, app, after = None):
22
+ super().__init__(app)
23
+ self.after = after
24
+
25
+ class Box(Document):
26
+ __g_class__ = Gtk.Box
27
+ def __init__(self, app, **kwargs):
28
+ super().__init__(app, **kwargs)
29
+ def render_raw(self):
30
+ return Gtk.Box()
31
+ def insert_child(self, w, d):
32
+ if isinstance(d, BoxPrepend):
33
+ if d.after != None:
34
+ w.insert_child_after(d.render(), self.app.namedWidgets[d.after])
35
+ else:
36
+ w.prepend(d.render())
37
+ else:
38
+ w.append(d.render())
@@ -1,3 +1,19 @@
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
+
1
17
  from ... import Gtk
2
18
  from ...common import printEvent
3
19
  from .. import Document
@@ -1,3 +1,19 @@
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
+
1
17
  from ...properties import parse_property, get_prop_type
2
18
 
3
19
  class Document:
@@ -1,3 +1,19 @@
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
+
1
17
  from ... import Gtk, Gio, GObject
2
18
  from .. import Document
3
19
  from ...common import printEvent
@@ -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())
@@ -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 FrameLabel(PseudoDocument):
21
+ def __init__(self, app):
22
+ super().__init__(app)
23
+
24
+ class Frame(Document):
25
+ __g_class__ = Gtk.Frame
26
+ def __init__(self, app, **kwargs):
27
+ super().__init__(app,**kwargs)
28
+ def render_raw(self):
29
+ return Gtk.Frame()
30
+ def insert_child(self, w, d):
31
+ if isinstance(d, FrameLabel):
32
+ w.set_label_widget(d.render())
33
+ else:
34
+ w.set_child(d.render())
@@ -0,0 +1,36 @@
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 Cell(PseudoDocument):
21
+ def __init__(self, app, x, y, w="1", h="1"):
22
+ super().__init__(app)
23
+ self.x = int(x)
24
+ self.y = int(y)
25
+ self.w = int(w)
26
+ self.h = int(h)
27
+
28
+ class Grid(Document):
29
+ __g_class__ = Gtk.Grid
30
+ def __init__(self, app, **kwargs):
31
+ super().__init__(app, **kwargs)
32
+
33
+ def render_raw(self):
34
+ return Gtk.Grid()
35
+ def insert_child(self, w, d):
36
+ w.attach(d.render(), d.x, d.y, d.w, d.h)
@@ -0,0 +1,28 @@
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
19
+
20
+ class Label(Document):
21
+ __g_class__ = Gtk.Label
22
+ def __init__(self, app, text, **kwargs):
23
+ super().__init__(app, **kwargs)
24
+ self.text = text
25
+ def render_raw(self):
26
+ l = Gtk.Label()
27
+ l.set_text(self.text)
28
+ return l
@@ -0,0 +1,37 @@
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
19
+
20
+ class Paned(Document):
21
+ __g_class__ = Gtk.Paned
22
+ def __init__(self, app, **kwargs):
23
+ super().__init__(app, **kwargs)
24
+ def render(self):
25
+ if len(self.children) == 1:
26
+ return self.children[0].render()
27
+
28
+ l = self.children[0].render()
29
+ for (r,rem_size) in zip(self.children[1:], range(len(self.children),1,-1)):
30
+ j = Gtk.Paned()
31
+ j.set_shrink_start_child(False)
32
+ j.set_shrink_end_child(False)
33
+ j.props.start_child = l
34
+ j.props.end_child = r.render()
35
+ self.set_properties(j)
36
+ l = j
37
+ return l
@@ -0,0 +1,27 @@
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 sys
18
+ from ... import Gtk
19
+ from .. import Document
20
+
21
+ class Picture(Document):
22
+ __g_class__ = Gtk.Picture
23
+ def __init__(self, app, src, **kwargs):
24
+ super().__init__(app, **kwargs)
25
+ self.src = src
26
+ def render_raw(self):
27
+ return Gtk.Picture.new_for_filename(self.src)
@@ -0,0 +1,25 @@
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
19
+
20
+ class ProgressBar(Document):
21
+ __g_class__ = Gtk.ProgressBar
22
+ def __init__(self, app, **kwargs):
23
+ super().__init__(app, **kwargs)
24
+ def render_raw(self):
25
+ return Gtk.ProgressBar()
@@ -0,0 +1,27 @@
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
19
+
20
+ class ScrolledWindow(Document):
21
+ __g_class__ = Gtk.ScrolledWindow
22
+ def __init__(self, app, **kwargs):
23
+ super().__init__(app, **kwargs)
24
+ def render_raw(self):
25
+ return Gtk.ScrolledWindow()
26
+ def insert_child(self, w, d):
27
+ w.set_child(d.render())
@@ -0,0 +1,25 @@
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
19
+
20
+ class Separator(Document):
21
+ __g_class__ = Gtk.Separator
22
+ def __init__(self, app, **kwargs):
23
+ super().__init__(app, **kwargs)
24
+ def render_raw(self):
25
+ return Gtk.Separator()
@@ -0,0 +1,27 @@
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 Stack(Document):
21
+ __g_class__ = Gtk.Stack
22
+ def __init__(self, app, **kwargs):
23
+ super().__init__(app, **kwargs)
24
+ def render_raw(self):
25
+ return Gtk.Stack()
26
+ def insert_child(self, w, d):
27
+ w.add_child(d.render())
@@ -0,0 +1,32 @@
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 ...common import printEvent
19
+ from .. import Document
20
+ from ...properties import parse_property
21
+
22
+ class Switch(Document):
23
+ __g_class__ = Gtk.Switch
24
+ def __init__(self, app, id, managed = "false", **kwargs):
25
+ super().__init__(app, id=id, **kwargs)
26
+ self.managed = parse_property('gboolean', managed)(app)
27
+ def render_raw(self):
28
+ ret = Gtk.Switch()
29
+ ret.connect('state-set', printEvent('switch', self.id,
30
+ retval = self.managed,
31
+ get_data = lambda _,state: "on" if state else "off"))
32
+ return ret
@@ -1,3 +1,19 @@
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
+
1
17
  import threading
2
18
  import signal
3
19
  import sys
@@ -29,7 +45,9 @@ WIDGET_DOCUMENTS = {
29
45
  'picture' : docs.Picture,
30
46
  'separator' : docs.Separator,
31
47
  'scrolled-window' : docs.ScrolledWindow,
32
- 'stack' : docs.Stack
48
+ 'stack' : docs.Stack,
49
+ 'flow-box' : docs.FlowBox,
50
+ 'flow-box-prepend': docs.FlowBoxPrepend
33
51
  }
34
52
 
35
53
  class GtkStreamXMLHandler(sax.ContentHandler):
@@ -73,6 +91,7 @@ class GtkStreamXMLHandler(sax.ContentHandler):
73
91
  threading.Thread(target = appMain).start()
74
92
  def on_sigint(a,b):
75
93
  def cb():
94
+ print("SIGINT received", file=sys.stderr)
76
95
  self.app.quit()
77
96
  sys.exit(0)
78
97
  GLib.idle_add(cb)
@@ -1,3 +1,19 @@
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
+
1
17
  import sys
2
18
 
3
19
  from . import Gtk
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.6
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/
@@ -9,5 +9,12 @@ Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: Environment :: X11 Applications :: GTK
11
11
  Classifier: Topic :: Software Development :: User Interfaces
12
- Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
12
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
13
+ Description-Content-Type: text/markdown
13
14
  Requires-Dist: pygobject
15
+
16
+ GTK-Stream
17
+ ==========
18
+
19
+ - Pretty documentation : [link](https://coiffier.net/projects/gtk-stream/)
20
+ - Same documentation, but less pretty : [link](doc/index.md)
@@ -1,3 +1,4 @@
1
+ README.md
1
2
  pyproject.toml
2
3
  gtk_stream/__init__.py
3
4
  gtk_stream/application.py
@@ -16,6 +17,7 @@ gtk_stream/documents/classes/Box.py
16
17
  gtk_stream/documents/classes/Button.py
17
18
  gtk_stream/documents/classes/Document.py
18
19
  gtk_stream/documents/classes/Dropdown.py
20
+ gtk_stream/documents/classes/FlowBox.py
19
21
  gtk_stream/documents/classes/Frame.py
20
22
  gtk_stream/documents/classes/Grid.py
21
23
  gtk_stream/documents/classes/Label.py
@@ -4,11 +4,12 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gtk-stream"
7
- version = "0.6"
7
+ version = "0.7"
8
8
  description = "A simple stream-oriented GUI protocol"
9
9
  authors = [
10
10
  { name = "Marc Coiffier", email = "marc.coiffier@univ-grenoble-alpes.fr" }
11
11
  ]
12
+ readme = "README.md"
12
13
 
13
14
  dependencies = [ "pygobject" ]
14
15
  classifiers = [
@@ -16,7 +17,7 @@ classifiers = [
16
17
  "Intended Audience :: Developers",
17
18
  "Environment :: X11 Applications :: GTK",
18
19
  "Topic :: Software Development :: User Interfaces",
19
- "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
20
+ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
20
21
  ]
21
22
 
22
23
  [project.urls]
@@ -1,14 +0,0 @@
1
- import io
2
- import xml.sax as sax
3
- import signal
4
-
5
- from .parser import GtkStreamXMLHandler
6
-
7
- def main():
8
- handler = GtkStreamXMLHandler()
9
- parser = sax.make_parser()
10
- parser.setContentHandler(handler)
11
- try:
12
- parser.parse(io.FileIO(0, 'r', closefd=False))
13
- finally:
14
- handler.app.release()
@@ -1,19 +0,0 @@
1
- import sys
2
-
3
- def _data_str_default(*args):
4
- return ''
5
- def _data_str_by(get_data):
6
- def ret(*args):
7
- return ":"+get_data(*args)
8
- return ret
9
-
10
- def printEvent(event, id, retval = None, get_data = None):
11
- data_str = _data_str_default if get_data == None else _data_str_by(get_data)
12
- def ret(*args):
13
- try:
14
- print("{}:{}{}".format(id,event,data_str(*args)), file=sys.stdout)
15
- sys.stdout.flush()
16
- except Exception as e:
17
- print("Exception when writing an event: {}".format(e), file=sys.stderr)
18
- return retval
19
- return ret
@@ -1,22 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document, PseudoDocument
3
-
4
- class BoxPrepend(PseudoDocument):
5
- def __init__(self, app, after = None):
6
- super().__init__(app)
7
- self.after = after
8
-
9
- class Box(Document):
10
- __g_class__ = Gtk.Box
11
- def __init__(self, app, **kwargs):
12
- super().__init__(app, **kwargs)
13
- def render_raw(self):
14
- return Gtk.Box()
15
- def insert_child(self, w, d):
16
- if isinstance(d, BoxPrepend):
17
- if d.after != None:
18
- w.insert_child_after(d.render(), self.app.namedWidgets[d.after])
19
- else:
20
- w.prepend(d.render())
21
- else:
22
- w.append(d.render())
@@ -1,18 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document, PseudoDocument
3
-
4
- class FrameLabel(PseudoDocument):
5
- def __init__(self, app):
6
- super().__init__(app)
7
-
8
- class Frame(Document):
9
- __g_class__ = Gtk.Frame
10
- def __init__(self, app, **kwargs):
11
- super().__init__(app,**kwargs)
12
- def render_raw(self):
13
- return Gtk.Frame()
14
- def insert_child(self, w, d):
15
- if isinstance(d, FrameLabel):
16
- w.set_label_widget(d.render())
17
- else:
18
- w.set_child(d.render())
@@ -1,20 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document, PseudoDocument
3
-
4
- class Cell(PseudoDocument):
5
- def __init__(self, app, x, y, w="1", h="1"):
6
- super().__init__(app)
7
- self.x = int(x)
8
- self.y = int(y)
9
- self.w = int(w)
10
- self.h = int(h)
11
-
12
- class Grid(Document):
13
- __g_class__ = Gtk.Grid
14
- def __init__(self, app, **kwargs):
15
- super().__init__(app, **kwargs)
16
-
17
- def render_raw(self):
18
- return Gtk.Grid()
19
- def insert_child(self, w, d):
20
- w.attach(d.render(), d.x, d.y, d.w, d.h)
@@ -1,12 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document
3
-
4
- class Label(Document):
5
- __g_class__ = Gtk.Label
6
- def __init__(self, app, text, **kwargs):
7
- super().__init__(app, **kwargs)
8
- self.text = text
9
- def render_raw(self):
10
- l = Gtk.Label()
11
- l.set_text(self.text)
12
- return l
@@ -1,21 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document
3
-
4
- class Paned(Document):
5
- __g_class__ = Gtk.Paned
6
- def __init__(self, app, **kwargs):
7
- super().__init__(app, **kwargs)
8
- def render(self):
9
- if len(self.children) == 1:
10
- return self.children[0].render()
11
-
12
- l = self.children[0].render()
13
- for (r,rem_size) in zip(self.children[1:], range(len(self.children),1,-1)):
14
- j = Gtk.Paned()
15
- j.set_shrink_start_child(False)
16
- j.set_shrink_end_child(False)
17
- j.props.start_child = l
18
- j.props.end_child = r.render()
19
- self.set_properties(j)
20
- l = j
21
- return l
@@ -1,11 +0,0 @@
1
- import sys
2
- from ... import Gtk
3
- from .. import Document
4
-
5
- class Picture(Document):
6
- __g_class__ = Gtk.Picture
7
- def __init__(self, app, src, **kwargs):
8
- super().__init__(app, **kwargs)
9
- self.src = src
10
- def render_raw(self):
11
- return Gtk.Picture.new_for_filename(self.src)
@@ -1,9 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document
3
-
4
- class ProgressBar(Document):
5
- __g_class__ = Gtk.ProgressBar
6
- def __init__(self, app, **kwargs):
7
- super().__init__(app, **kwargs)
8
- def render_raw(self):
9
- return Gtk.ProgressBar()
@@ -1,11 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document
3
-
4
- class ScrolledWindow(Document):
5
- __g_class__ = Gtk.ScrolledWindow
6
- def __init__(self, app, **kwargs):
7
- super().__init__(app, **kwargs)
8
- def render_raw(self):
9
- return Gtk.ScrolledWindow()
10
- def insert_child(self, w, d):
11
- w.set_child(d.render())
@@ -1,9 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document
3
-
4
- class Separator(Document):
5
- __g_class__ = Gtk.Separator
6
- def __init__(self, app, **kwargs):
7
- super().__init__(app, **kwargs)
8
- def render_raw(self):
9
- return Gtk.Separator()
@@ -1,11 +0,0 @@
1
- from ... import Gtk
2
- from .. import Document, PseudoDocument
3
-
4
- class Stack(Document):
5
- __g_class__ = Gtk.Stack
6
- def __init__(self, app, **kwargs):
7
- super().__init__(app, **kwargs)
8
- def render_raw(self):
9
- return Gtk.Stack()
10
- def insert_child(self, w, d):
11
- w.add_child(d.render())
@@ -1,16 +0,0 @@
1
- from ... import Gtk
2
- from ...common import printEvent
3
- from .. import Document
4
- from ...properties import parse_property
5
-
6
- class Switch(Document):
7
- __g_class__ = Gtk.Switch
8
- def __init__(self, app, id, managed = "false", **kwargs):
9
- super().__init__(app, id=id, **kwargs)
10
- self.managed = parse_property('gboolean', managed)(app)
11
- def render_raw(self):
12
- ret = Gtk.Switch()
13
- ret.connect('state-set', printEvent('switch', self.id,
14
- retval = self.managed,
15
- get_data = lambda _,state: "on" if state else "off"))
16
- return ret
File without changes