gtk-stream 0.2__tar.gz → 0.2.1__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 (28) hide show
  1. {gtk_stream-0.2 → gtk_stream-0.2.1}/PKG-INFO +1 -1
  2. gtk_stream-0.2.1/gtk_stream/common.py +19 -0
  3. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Dropdown.py +2 -4
  4. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Switch.py +3 -8
  5. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream.egg-info/PKG-INFO +1 -1
  6. {gtk_stream-0.2 → gtk_stream-0.2.1}/pyproject.toml +1 -1
  7. gtk_stream-0.2/gtk_stream/common.py +0 -11
  8. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/__init__.py +0 -0
  9. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/application.py +0 -0
  10. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/command_line.py +0 -0
  11. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/__init__.py +0 -0
  12. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Box.py +0 -0
  13. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Button.py +0 -0
  14. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Document.py +0 -0
  15. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Frame.py +0 -0
  16. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Grid.py +0 -0
  17. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Label.py +0 -0
  18. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/Paned.py +0 -0
  19. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/ProgressBar.py +0 -0
  20. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/documents/classes/__init__.py +0 -0
  21. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/parser.py +0 -0
  22. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream/properties.py +0 -0
  23. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream.egg-info/SOURCES.txt +0 -0
  24. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream.egg-info/dependency_links.txt +0 -0
  25. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream.egg-info/entry_points.txt +0 -0
  26. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream.egg-info/requires.txt +0 -0
  27. {gtk_stream-0.2 → gtk_stream-0.2.1}/gtk_stream.egg-info/top_level.txt +0 -0
  28. {gtk_stream-0.2 → gtk_stream-0.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.2
3
+ Version: 0.2.1
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://coiffiem.gricad-pages.univ-grenoble-alpes.fr/gtk-stream/
@@ -0,0 +1,19 @@
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))
18
+ return retval
19
+ return ret
@@ -1,5 +1,6 @@
1
1
  from ... import Gtk, Gio, GObject
2
2
  from .. import Document
3
+ from ...common import printEvent
3
4
 
4
5
  class Item(Document):
5
6
  def __init__(self, app, value, **kwargs):
@@ -41,10 +42,7 @@ class Dropdown(Document):
41
42
 
42
43
  ret = Gtk.DropDown(model=model, expression=Gtk.PropertyExpression.new(_ItemObject, None, 'item_value'), factory=factory)
43
44
 
44
- def on_selection_change(w,d):
45
- print(f"{self.id}:selected:{w.get_selected_item().value}")
46
- sys.stdout.flush()
47
- ret.connect('notify::selected-item', on_selection_change)
45
+ ret.connect('notify::selected-item', printEvent('selected', self.id, get_data = lambda w,_: w.get_selected_item().value))
48
46
  return ret
49
47
  def attach_child(self, w, d):
50
48
  pass
@@ -1,5 +1,3 @@
1
- import sys
2
-
3
1
  from ... import Gtk
4
2
  from ...common import printEvent
5
3
  from .. import Document
@@ -11,10 +9,7 @@ class Switch(Document):
11
9
  self.managed = parse_property('managed', managed)
12
10
  def render_raw(self):
13
11
  ret = Gtk.Switch()
14
- def on_state_set(_x,new_state):
15
- state = "on" if new_state else "off"
16
- print(f"{self.id}:switch:{state}")
17
- sys.stdout.flush()
18
- return self.managed
19
- ret.connect('state-set', on_state_set)
12
+ ret.connect('state-set', printEvent('switch', self.id,
13
+ retval = self.managed,
14
+ get_data = lambda _,state: "on" if state else "off"))
20
15
  return ret
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.2
3
+ Version: 0.2.1
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://coiffiem.gricad-pages.univ-grenoble-alpes.fr/gtk-stream/
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gtk-stream"
7
- version = "0.2"
7
+ version = "0.2.1"
8
8
  description = "A simple stream-oriented GUI protocol"
9
9
  authors = [
10
10
  { name = "Marc Coiffier", email = "marc.coiffier@univ-grenoble-alpes.fr" }
@@ -1,11 +0,0 @@
1
- import sys
2
-
3
- def printEvent(event, id, retval = None):
4
- def ret(w):
5
- try:
6
- print(f"{id}:{event}", file=sys.stdout)
7
- sys.stdout.flush()
8
- except:
9
- print("Broken pipe, right ?", file=sys.stderr)
10
- return retval
11
- return ret
File without changes