gtk-stream 0.5__py3-none-any.whl → 0.6__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/application.py CHANGED
@@ -81,5 +81,5 @@ class GtkStreamApp(Gtk.Application):
81
81
  def setProp(self, id, name, value):
82
82
  def cb():
83
83
  w = self.namedWidgets[id]
84
- w.set_property(name, parse_property(get_prop_type(w.__class__, name), value))
84
+ w.set_property(name, parse_property(get_prop_type(w.__class__, name), value)(self))
85
85
  self.run_when_idle(cb)
@@ -14,3 +14,4 @@ from .classes.ScrolledWindow import ScrolledWindow
14
14
  from .classes.Paned import Paned
15
15
  from .classes.Frame import Frame, FrameLabel
16
16
  from .classes.Grid import Grid, Cell
17
+ from .classes.Stack import Stack
@@ -18,7 +18,7 @@ class Document:
18
18
  self.app.nameWidget(self.id, w)
19
19
  for (p,v) in self.props.items():
20
20
  # print(f"Setting property '{p}' to '{v}' in widget {self.__class__}", file=sys.stderr)
21
- w.set_property(p, v)
21
+ w.set_property(p, v(self.app))
22
22
  w.insert_child = lambda d: self.insert_child(w, d)
23
23
  def render(self):
24
24
  w = self.render_raw()
@@ -0,0 +1,11 @@
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())
@@ -7,7 +7,7 @@ class Switch(Document):
7
7
  __g_class__ = Gtk.Switch
8
8
  def __init__(self, app, id, managed = "false", **kwargs):
9
9
  super().__init__(app, id=id, **kwargs)
10
- self.managed = parse_property('gboolean', managed)
10
+ self.managed = parse_property('gboolean', managed)(app)
11
11
  def render_raw(self):
12
12
  ret = Gtk.Switch()
13
13
  ret.connect('state-set', printEvent('switch', self.id,
gtk_stream/parser.py CHANGED
@@ -28,7 +28,8 @@ WIDGET_DOCUMENTS = {
28
28
  'switch' : docs.Switch,
29
29
  'picture' : docs.Picture,
30
30
  'separator' : docs.Separator,
31
- 'scrolled-window' : docs.ScrolledWindow
31
+ 'scrolled-window' : docs.ScrolledWindow,
32
+ 'stack' : docs.Stack
32
33
  }
33
34
 
34
35
  class GtkStreamXMLHandler(sax.ContentHandler):
gtk_stream/properties.py CHANGED
@@ -2,24 +2,28 @@ import sys
2
2
 
3
3
  from . import Gtk
4
4
 
5
+ def _const(x):
6
+ return lambda _: x
5
7
  def _parse_orientation_property(val):
6
- return (Gtk.Orientation.HORIZONTAL) if val == "horizontal" else (Gtk.Orientation.VERTICAL)
8
+ return _const((Gtk.Orientation.HORIZONTAL) if val == "horizontal" else (Gtk.Orientation.VERTICAL))
7
9
  def _parse_boolean_property(val):
8
- return True if val == "true" else False
10
+ return _const(True if val == "true" else False)
9
11
  def _parse_float_property(val):
10
- return float(val)
12
+ return _const(float(val))
11
13
  def _parse_int_property(val):
12
- return int(val)
14
+ return _const(int(val))
13
15
  def _parse_searchMode_property(val):
14
16
  match val:
15
17
  case 'exact':
16
- return Gtk.StringFilterMatchMode.EXACT
18
+ return _const(Gtk.StringFilterMatchMode.EXACT)
17
19
  case 'substring':
18
- return Gtk.StringFilterMatchMode.SUBSTRING
20
+ return _const(Gtk.StringFilterMatchMode.SUBSTRING)
19
21
  case _:
20
- return Gtk.StringFilterMatchMode.PREFIX
22
+ return _const(Gtk.StringFilterMatchMode.PREFIX)
21
23
  def _parse_css_classes_property(val):
22
- return val.split()
24
+ return _const(val.split())
25
+ def _parse_widget_property(val):
26
+ return lambda app: app.namedWidgets[val]
23
27
 
24
28
  _PARSE_TYPE_PROPERTY = {
25
29
  'GStrv' : _parse_css_classes_property,
@@ -28,11 +32,13 @@ _PARSE_TYPE_PROPERTY = {
28
32
  'gfloat' : _parse_float_property,
29
33
  'gint' : _parse_int_property,
30
34
  'gboolean' : _parse_boolean_property,
31
- 'GtkStringFilterMatchMode' : _parse_searchMode_property
35
+ 'GtkStringFilterMatchMode' : _parse_searchMode_property,
36
+ 'GtkWidget' : _parse_widget_property,
37
+ 'gchararray' : _const,
32
38
  }
33
39
 
34
40
  def parse_property(prop_type, val):
35
41
  # print(f"Parsing property '{val}' of type '{prop_type}'", file=sys.stderr)
36
- return _PARSE_TYPE_PROPERTY.get(prop_type, lambda x: x)(val)
42
+ return _PARSE_TYPE_PROPERTY[prop_type](val)
37
43
  def get_prop_type(klass, prop):
38
44
  return klass.find_property(prop).value_type.name
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtk-stream
3
- Version: 0.5
3
+ Version: 0.6
4
4
  Summary: A simple stream-oriented GUI protocol
5
5
  Author-email: Marc Coiffier <marc.coiffier@univ-grenoble-alpes.fr>
6
- Project-URL: Homepage, https://coiffiem.gricad-pages.univ-grenoble-alpes.fr/gtk-stream/
6
+ Project-URL: Homepage, https://coiffier.net/projects/gtk-stream/
7
+ Project-URL: Source, https://coiffier.net/projects/gtk-stream/code/
7
8
  Classifier: Development Status :: 4 - Beta
8
9
  Classifier: Intended Audience :: Developers
9
10
  Classifier: Environment :: X11 Applications :: GTK
@@ -1,13 +1,13 @@
1
1
  gtk_stream/__init__.py,sha256=pDhUSN4AYNsP8_tilU1zmDCYdiv7ak4PE1TW0qFrDlg,99
2
- gtk_stream/application.py,sha256=e_Xvi9xG1kCD979CnZyAZlFj0F8cDUf_9_Tad2bmirs,3111
2
+ gtk_stream/application.py,sha256=I3uXFdJwUuEdqND8eGDEEuAFr6T-WIizv_8eCZsEnmU,3117
3
3
  gtk_stream/command_line.py,sha256=c2ghqIQB5hYxtCszss1z84yKoeRYvaMJJMi4aiTspWg,312
4
4
  gtk_stream/common.py,sha256=sEw15nVw9SVp8eLVOB5Zj1JITVhUhCF0i3PSwpd8lis,590
5
- gtk_stream/parser.py,sha256=W0I9P6imw5HQ11Yd6lJsEOtsZyfTlHPCoHLb2sRBT9I,7158
6
- gtk_stream/properties.py,sha256=jxd7f-9Xl2cfMQpXuVEc_0VrgjfWcRjES7EzfhjQ5Rw,1392
7
- gtk_stream/documents/__init__.py,sha256=fPfffVh90czgded8wxI-KFLyw0ZG0tfQ-v3_E5JawQE,639
5
+ gtk_stream/parser.py,sha256=BUuJbPr8CUtO6msfxIXzdRpJ-crN7M18zOMLBj93_zs,7194
6
+ gtk_stream/properties.py,sha256=YfWlSUQEaIE2Cz5zjnajK6JWncWvWv26PemGRJQXoFQ,1654
7
+ gtk_stream/documents/__init__.py,sha256=jqjJ4yY4fzpFbDfhe0pwR1ahg2jLaeLC-eyH6YTuLpQ,681
8
8
  gtk_stream/documents/classes/Box.py,sha256=-L0OSIcPCOYedJqD9zPpe183EJJkClboX1-3yGHmnL0,661
9
9
  gtk_stream/documents/classes/Button.py,sha256=HeIYBix4qLVZc_a6Fs_MofyqxHeXbuZzsk_FneGLGb4,809
10
- gtk_stream/documents/classes/Document.py,sha256=w3DXEmEvqRO8efJ5ovre_ToGylSVjN5C1vu81LiNl1U,1379
10
+ gtk_stream/documents/classes/Document.py,sha256=gqil7_Kzp-TmDdr6JD0nwZqwjfSkZUwK_92WeOPRfg0,1389
11
11
  gtk_stream/documents/classes/Dropdown.py,sha256=-H344e7PsfwlnHT7eYBC35rVFkwVPSRJL3szU6w2A8U,1706
12
12
  gtk_stream/documents/classes/Frame.py,sha256=xG8Wts9xBw0Kk7VKv_YHSq-zf2coeRRtQKQkdtJMXAc,502
13
13
  gtk_stream/documents/classes/Grid.py,sha256=HG7zW6i4h9MMVnmBwvDI8A1mspmRk35HOc0lwGYxPQc,529
@@ -17,10 +17,11 @@ gtk_stream/documents/classes/Picture.py,sha256=fNtM3TLkr2au92m8MCJmE3fYvyajFgw1V
17
17
  gtk_stream/documents/classes/ProgressBar.py,sha256=aegonsruP3jPGA6Wguk-MdIm5e3y-4Ug3q_cGglDcAA,246
18
18
  gtk_stream/documents/classes/ScrolledWindow.py,sha256=XX5tZDC5SlxAPMrzSscO3O3KzwZZDWKw02Q_bp0M6OE,321
19
19
  gtk_stream/documents/classes/Separator.py,sha256=LKjh0BX5DZ-1dn5KL4Yu6anGL9AevnIrq9a52F2fKr4,240
20
- gtk_stream/documents/classes/Switch.py,sha256=AQYK8MTwiB7vzJpv1JB8RTgWpW3bZ-EGY7_8MX-29TY,640
20
+ gtk_stream/documents/classes/Stack.py,sha256=d8Gj9CFHV2KfofO4cRJQf8v7XSLJ42EJUV9IjVy6Dpc,310
21
+ gtk_stream/documents/classes/Switch.py,sha256=KPqCQqzgpWCfiWTEwMXYbV4LzcjBLh5GnH0XTusPvqQ,645
21
22
  gtk_stream/documents/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- gtk_stream-0.5.dist-info/METADATA,sha256=3WjZCh3mqbZLJ6wAzpG2-ojfeb2i4RH-XMAseLv4_Wc,555
23
- gtk_stream-0.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
24
- gtk_stream-0.5.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
25
- gtk_stream-0.5.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
26
- gtk_stream-0.5.dist-info/RECORD,,
23
+ gtk_stream-0.6.dist-info/METADATA,sha256=WhVEXTmW0SHx16pN1pGfKUOJacSbjBwPdxOzBFUeaIs,600
24
+ gtk_stream-0.6.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
25
+ gtk_stream-0.6.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
26
+ gtk_stream-0.6.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
27
+ gtk_stream-0.6.dist-info/RECORD,,