gtk-stream 0.1__py3-none-any.whl → 0.2__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.
gtk_stream/common.py CHANGED
@@ -1,10 +1,11 @@
1
1
  import sys
2
2
 
3
- def printEvent(event, id):
3
+ def printEvent(event, id, retval = None):
4
4
  def ret(w):
5
5
  try:
6
6
  print(f"{id}:{event}", file=sys.stdout)
7
7
  sys.stdout.flush()
8
8
  except:
9
9
  print("Broken pipe, right ?", file=sys.stderr)
10
+ return retval
10
11
  return ret
@@ -1,9 +1,10 @@
1
1
  from .classes.Document import Document
2
2
 
3
3
  from .classes.Label import Label
4
- from .classes.Button import Button
4
+ from .classes.Button import Button, LinkButton
5
5
  from .classes.ProgressBar import ProgressBar
6
6
  from .classes.Dropdown import Dropdown, Item
7
+ from .classes.Switch import Switch
7
8
 
8
9
  from .classes.Box import Box
9
10
  from .classes.Paned import Paned
@@ -11,3 +11,13 @@ class Button(Document):
11
11
  return button
12
12
  def attach_child(self, w, d):
13
13
  w.set_child(d.render())
14
+
15
+ class LinkButton(Button):
16
+ def __init__(self, app, id, **kwargs):
17
+ super().__init__(app, id=id, **kwargs)
18
+ def render_raw(self):
19
+ button = Gtk.LinkButton()
20
+ button.connect('activate-link', printEvent('clicked', self.id, True))
21
+ return button
22
+ def attach_child(self, w, d):
23
+ w.set_child(d.render())
@@ -0,0 +1,20 @@
1
+ import sys
2
+
3
+ from ... import Gtk
4
+ from ...common import printEvent
5
+ from .. import Document
6
+ from ...properties import parse_property
7
+
8
+ class Switch(Document):
9
+ def __init__(self, app, id, managed = "false", **kwargs):
10
+ super().__init__(app, id=id, **kwargs)
11
+ self.managed = parse_property('managed', managed)
12
+ def render_raw(self):
13
+ 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)
20
+ return ret
gtk_stream/parser.py CHANGED
@@ -3,7 +3,7 @@ import signal
3
3
  import xml.sax as sax
4
4
 
5
5
  from . import GLib
6
- from .documents import Document, Label, Box, Button, ProgressBar, Dropdown, Item, Paned, Frame, Grid, Cell
6
+ from .documents import Document, Label, Box, Button, ProgressBar, Dropdown, Item, Paned, Frame, Grid, Cell, LinkButton, Switch
7
7
  from .application import GtkStreamApp
8
8
 
9
9
  class _Object:
@@ -19,7 +19,9 @@ WIDGET_DOCUMENTS = {
19
19
  'paned': Paned,
20
20
  'grid': Grid,
21
21
  'cell': Cell,
22
- 'frame': Frame
22
+ 'frame': Frame,
23
+ 'link': LinkButton,
24
+ 'switch': Switch
23
25
  }
24
26
 
25
27
  class GtkStreamXMLHandler(sax.ContentHandler):
gtk_stream/properties.py CHANGED
@@ -26,12 +26,15 @@ _PARSE_PROPERTY = {
26
26
  'show-text': _parse_boolean_property,
27
27
  'enable-search': _parse_boolean_property,
28
28
  'search-match-mode': _parse_searchMode_property,
29
+ 'visited': _parse_boolean_property,
29
30
  'hexpand': _parse_boolean_property,
30
31
  'hexpand-set': _parse_boolean_property,
31
32
  'vexpand': _parse_boolean_property,
32
33
  'vexpand-set': _parse_boolean_property,
33
34
  'xalign': _parse_float_property,
34
- 'yalign': _parse_float_property
35
+ 'yalign': _parse_float_property,
36
+ 'state': _parse_boolean_property,
37
+ 'managed': _parse_boolean_property
35
38
  }
36
39
 
37
40
  def parse_property(prop, val):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.1
3
+ Version: 0.2
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/
@@ -1,12 +1,12 @@
1
1
  gtk_stream/__init__.py,sha256=pDhUSN4AYNsP8_tilU1zmDCYdiv7ak4PE1TW0qFrDlg,99
2
2
  gtk_stream/application.py,sha256=FZe4gQm5U0NGKKpi_Pp7VqxMtlbdbNJOYhcradzeSH4,3068
3
3
  gtk_stream/command_line.py,sha256=c2ghqIQB5hYxtCszss1z84yKoeRYvaMJJMi4aiTspWg,312
4
- gtk_stream/common.py,sha256=6v6vIFzi1mZvATUzSIb9hPKLcdCexjfBJJm2vafD8Ps,241
5
- gtk_stream/parser.py,sha256=GHq08hKSEVBphtnGm4G_evfE2PeB0QLzp5PDM6fR890,6731
6
- gtk_stream/properties.py,sha256=e6A2tjNjTVIGbNNQE8rOQUwB1uP9AZvIJl3MzdhbPIg,1392
7
- gtk_stream/documents/__init__.py,sha256=JArZ2Ry5u4Y9hyzdoBG_W47PgqZ-Og1UdWDdUVjhlW0,331
4
+ gtk_stream/common.py,sha256=rua0TZFq4xhSQgb7PKfF3px0kS-XgKRUOMprm3H-Xqc,278
5
+ gtk_stream/parser.py,sha256=ZyCm1WKgKH6syqyUCY7ZyTW642LMpzQ_dDSNsvcNsLY,6797
6
+ gtk_stream/properties.py,sha256=9bYzvqmUq8EidtBDZdKupLgYM9ucIGyxmahcIp9TxT8,1542
7
+ gtk_stream/documents/__init__.py,sha256=vTgKiiafqqkSOIUwOIzO40VsSdCpHFnGOGRm8rRv9mY,378
8
8
  gtk_stream/documents/classes/Box.py,sha256=6l9Z3GpC0Yv34jcGNTwlNLM5DpYyQ1iDihJsu1nxcy8,259
9
- gtk_stream/documents/classes/Button.py,sha256=CYTKNl0OR-xPB9VWvyXtnAtZWuQQ9CxrtxoqjxiwgMM,404
9
+ gtk_stream/documents/classes/Button.py,sha256=_NjoOrgdSVK4RQbh0V-QiZ_hfHasaMc9LQ2bf2egbe4,747
10
10
  gtk_stream/documents/classes/Document.py,sha256=scoJrdHen_1WRuqn3aN6FJUesHXPZZyKwmPuPDjjbzI,985
11
11
  gtk_stream/documents/classes/Dropdown.py,sha256=uDH1yfYoEGugen6O62EMf7Dh9WfqFjUj_fgxFZ395VY,1718
12
12
  gtk_stream/documents/classes/Frame.py,sha256=p8OcgYBki1NWe2tveZfRwb0aQzRAeHQa9wHmpjgRJoc,391
@@ -14,9 +14,10 @@ gtk_stream/documents/classes/Grid.py,sha256=SRDbMhPZHV372KN7Qr9vvamH2xwr39eojeWm
14
14
  gtk_stream/documents/classes/Label.py,sha256=BeL3zlf9YPuBGYS_YtHI0Q-MoVVLPao7kPIzPlwpyHY,275
15
15
  gtk_stream/documents/classes/Paned.py,sha256=4jZGEebhv9pNzTyYbQ8lyx_nsKd9Nmr10703V5n_kNw,644
16
16
  gtk_stream/documents/classes/ProgressBar.py,sha256=2_KCboyweGsqpBck61TvVGZYIsN8QVzAyqwwTDh-pDU,212
17
+ gtk_stream/documents/classes/Switch.py,sha256=yvWbooJyrInwTBDMVFmSQVNL3LsB3_r2DHve7qpcqWY,640
17
18
  gtk_stream/documents/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- gtk_stream-0.1.dist-info/METADATA,sha256=Hq2t55xlbQkAi4hXM9-0sykB31YXCN16TQq1aztu4tI,504
19
- gtk_stream-0.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
- gtk_stream-0.1.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
21
- gtk_stream-0.1.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
22
- gtk_stream-0.1.dist-info/RECORD,,
19
+ gtk_stream-0.2.dist-info/METADATA,sha256=xs2s_iAV1JrcSCw82wFDaU3IGaVnC9OW_gF9r3LPZhc,504
20
+ gtk_stream-0.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
21
+ gtk_stream-0.2.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
22
+ gtk_stream-0.2.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
23
+ gtk_stream-0.2.dist-info/RECORD,,