gtk-stream 0.2.2__tar.gz → 0.4__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.
- {gtk_stream-0.2.2 → gtk_stream-0.4}/PKG-INFO +2 -1
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/application.py +4 -4
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/__init__.py +6 -4
- gtk_stream-0.4/gtk_stream/documents/classes/Box.py +22 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/classes/Button.py +4 -2
- gtk_stream-0.4/gtk_stream/documents/classes/Document.py +40 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/classes/Dropdown.py +2 -1
- gtk_stream-0.4/gtk_stream/documents/classes/Frame.py +18 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/classes/Grid.py +4 -8
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/classes/Label.py +1 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/classes/Paned.py +1 -0
- gtk_stream-0.4/gtk_stream/documents/classes/Picture.py +11 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/classes/ProgressBar.py +1 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/classes/Switch.py +2 -1
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/parser.py +25 -19
- gtk_stream-0.4/gtk_stream/properties.py +38 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream.egg-info/PKG-INFO +2 -1
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream.egg-info/SOURCES.txt +1 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/pyproject.toml +2 -1
- gtk_stream-0.2.2/gtk_stream/documents/classes/Box.py +0 -10
- gtk_stream-0.2.2/gtk_stream/documents/classes/Document.py +0 -30
- gtk_stream-0.2.2/gtk_stream/documents/classes/Frame.py +0 -14
- gtk_stream-0.2.2/gtk_stream/properties.py +0 -41
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/__init__.py +0 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/command_line.py +0 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/common.py +0 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream/documents/classes/__init__.py +0 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream.egg-info/dependency_links.txt +0 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream.egg-info/entry_points.txt +0 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream.egg-info/requires.txt +0 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/gtk_stream.egg-info/top_level.txt +0 -0
- {gtk_stream-0.2.2 → gtk_stream-0.4}/setup.cfg +0 -0
@@ -1,11 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: gtk-stream
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4
|
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/
|
7
7
|
Classifier: Development Status :: 4 - Beta
|
8
8
|
Classifier: Intended Audience :: Developers
|
9
|
+
Classifier: Environment :: X11 Applications :: GTK
|
9
10
|
Classifier: Topic :: Software Development :: User Interfaces
|
10
11
|
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
11
12
|
Requires-Dist: pygobject
|
@@ -2,7 +2,7 @@ import sys
|
|
2
2
|
|
3
3
|
from . import Gtk, GLib, Gdk
|
4
4
|
from .common import printEvent
|
5
|
-
from .properties import parse_property
|
5
|
+
from .properties import parse_property, get_prop_type
|
6
6
|
|
7
7
|
class GtkStreamApp(Gtk.Application):
|
8
8
|
def __init__(self, name = None, **kwargs):
|
@@ -70,16 +70,16 @@ class GtkStreamApp(Gtk.Application):
|
|
70
70
|
w = self.namedWidgets[id]
|
71
71
|
w.get_parent().remove(w)
|
72
72
|
self.run_when_idle(cb)
|
73
|
-
def
|
73
|
+
def insertWidget(self, to, document):
|
74
74
|
def cb():
|
75
75
|
if to in self.namedWidgets:
|
76
76
|
w = self.namedWidgets[to]
|
77
|
-
w.
|
77
|
+
w.insert_child(document)
|
78
78
|
else:
|
79
79
|
raise Exception(f"Error: unknown widget id '{to}'")
|
80
80
|
self.run_when_idle(cb)
|
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(name, value))
|
84
|
+
w.set_property(name, parse_property(get_prop_type(w.__class__, name), value))
|
85
85
|
self.run_when_idle(cb)
|
@@ -1,12 +1,14 @@
|
|
1
|
-
from .classes.Document import Document
|
1
|
+
from .classes.Document import Document, PseudoDocument
|
2
2
|
|
3
3
|
from .classes.Label import Label
|
4
|
-
from .classes.
|
4
|
+
from .classes.Picture import Picture
|
5
5
|
from .classes.ProgressBar import ProgressBar
|
6
|
+
|
7
|
+
from .classes.Button import Button, LinkButton
|
6
8
|
from .classes.Dropdown import Dropdown, Item
|
7
9
|
from .classes.Switch import Switch
|
8
10
|
|
9
|
-
from .classes.Box import Box
|
11
|
+
from .classes.Box import Box, BoxPrepend
|
10
12
|
from .classes.Paned import Paned
|
11
|
-
from .classes.Frame import Frame
|
13
|
+
from .classes.Frame import Frame, FrameLabel
|
12
14
|
from .classes.Grid import Grid, Cell
|
@@ -0,0 +1,22 @@
|
|
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())
|
@@ -3,21 +3,23 @@ from ...common import printEvent
|
|
3
3
|
from .. import Document
|
4
4
|
|
5
5
|
class Button(Document):
|
6
|
+
__g_class__ = Gtk.Button
|
6
7
|
def __init__(self, app, id, **kwargs):
|
7
8
|
super().__init__(app, id = id, **kwargs)
|
8
9
|
def render_raw(self):
|
9
10
|
button = Gtk.Button()
|
10
11
|
button.connect('clicked', printEvent('clicked', self.id))
|
11
12
|
return button
|
12
|
-
def
|
13
|
+
def insert_child(self, w, d):
|
13
14
|
w.set_child(d.render())
|
14
15
|
|
15
16
|
class LinkButton(Button):
|
17
|
+
__g_class__ = Gtk.LinkButton
|
16
18
|
def __init__(self, app, id, **kwargs):
|
17
19
|
super().__init__(app, id=id, **kwargs)
|
18
20
|
def render_raw(self):
|
19
21
|
button = Gtk.LinkButton()
|
20
22
|
button.connect('activate-link', printEvent('clicked', self.id, True))
|
21
23
|
return button
|
22
|
-
def
|
24
|
+
def insert_child(self, w, d):
|
23
25
|
w.set_child(d.render())
|
@@ -0,0 +1,40 @@
|
|
1
|
+
from ...properties import parse_property, get_prop_type
|
2
|
+
|
3
|
+
class Document:
|
4
|
+
__g_class__ = None
|
5
|
+
def __init__(self, app, id = None, **attrs):
|
6
|
+
self.id = id
|
7
|
+
self.app = app
|
8
|
+
self.props = { attr: parse_property(get_prop_type(self.__g_class__, attr), val) for (attr, val) in attrs.items() }
|
9
|
+
self.children = []
|
10
|
+
|
11
|
+
def add_child(self, child):
|
12
|
+
self.children.append(child)
|
13
|
+
|
14
|
+
def render_raw(self):
|
15
|
+
"""Method to render the document to a widet"""
|
16
|
+
raise Exception("Method 'render' not implemented")
|
17
|
+
def set_properties(self, w):
|
18
|
+
self.app.nameWidget(self.id, w)
|
19
|
+
for (p,v) in self.props.items():
|
20
|
+
# print(f"Setting property '{p}' to '{v}' in widget {self.__class__}", file=sys.stderr)
|
21
|
+
w.set_property(p, v)
|
22
|
+
w.insert_child = lambda d: self.insert_child(w, d)
|
23
|
+
def render(self):
|
24
|
+
w = self.render_raw()
|
25
|
+
self.set_properties(w)
|
26
|
+
for child in self.children:
|
27
|
+
self.insert_child(w, child)
|
28
|
+
return w
|
29
|
+
|
30
|
+
def insert_child(self, w, child):
|
31
|
+
raise Exception("Unimplemented method 'insert_child'")
|
32
|
+
|
33
|
+
class PseudoDocument(Document):
|
34
|
+
def __init__(self, app):
|
35
|
+
super().__init__(app)
|
36
|
+
self.child = None
|
37
|
+
def add_child(self, child):
|
38
|
+
self.child = child
|
39
|
+
def render(self):
|
40
|
+
return self.child.render()
|
@@ -22,6 +22,7 @@ class _ItemObject(GObject.Object):
|
|
22
22
|
return self.value
|
23
23
|
|
24
24
|
class Dropdown(Document):
|
25
|
+
__g_class__ = Gtk.DropDown
|
25
26
|
def __init__(self, app, id, **kwargs):
|
26
27
|
super().__init__(app, id=id, **kwargs)
|
27
28
|
def render_raw(self):
|
@@ -44,5 +45,5 @@ class Dropdown(Document):
|
|
44
45
|
|
45
46
|
ret.connect('notify::selected-item', printEvent('selected', self.id, get_data = lambda w,_: w.get_selected_item().value))
|
46
47
|
return ret
|
47
|
-
def
|
48
|
+
def insert_child(self, w, d):
|
48
49
|
pass
|
@@ -0,0 +1,18 @@
|
|
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,24 +1,20 @@
|
|
1
1
|
from ... import Gtk
|
2
|
-
from .. import Document
|
2
|
+
from .. import Document, PseudoDocument
|
3
3
|
|
4
|
-
class Cell(
|
4
|
+
class Cell(PseudoDocument):
|
5
5
|
def __init__(self, app, x, y, w="1", h="1"):
|
6
6
|
super().__init__(app)
|
7
|
-
self.child = None
|
8
7
|
self.x = int(x)
|
9
8
|
self.y = int(y)
|
10
9
|
self.w = int(w)
|
11
10
|
self.h = int(h)
|
12
|
-
def render(self):
|
13
|
-
return self.child.render()
|
14
|
-
def add_child(self, child):
|
15
|
-
self.child = child
|
16
11
|
|
17
12
|
class Grid(Document):
|
13
|
+
__g_class__ = Gtk.Grid
|
18
14
|
def __init__(self, app, **kwargs):
|
19
15
|
super().__init__(app, **kwargs)
|
20
16
|
|
21
17
|
def render_raw(self):
|
22
18
|
return Gtk.Grid()
|
23
|
-
def
|
19
|
+
def insert_child(self, w, d):
|
24
20
|
w.attach(d.render(), d.x, d.y, d.w, d.h)
|
@@ -0,0 +1,11 @@
|
|
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)
|
@@ -4,9 +4,10 @@ from .. import Document
|
|
4
4
|
from ...properties import parse_property
|
5
5
|
|
6
6
|
class Switch(Document):
|
7
|
+
__g_class__ = Gtk.Switch
|
7
8
|
def __init__(self, app, id, managed = "false", **kwargs):
|
8
9
|
super().__init__(app, id=id, **kwargs)
|
9
|
-
self.managed = parse_property('
|
10
|
+
self.managed = parse_property('gboolean', managed)
|
10
11
|
def render_raw(self):
|
11
12
|
ret = Gtk.Switch()
|
12
13
|
ret.connect('state-set', printEvent('switch', self.id,
|
@@ -1,27 +1,32 @@
|
|
1
1
|
import threading
|
2
2
|
import signal
|
3
|
+
import sys
|
3
4
|
import xml.sax as sax
|
4
5
|
|
5
6
|
from . import GLib
|
6
|
-
from .
|
7
|
+
from . import documents as docs
|
8
|
+
|
7
9
|
from .application import GtkStreamApp
|
8
10
|
|
9
11
|
class _Object:
|
10
12
|
pass
|
11
13
|
|
12
14
|
WIDGET_DOCUMENTS = {
|
13
|
-
'progress-bar': ProgressBar,
|
14
|
-
'label': Label,
|
15
|
-
'box': Box,
|
16
|
-
'
|
17
|
-
'
|
18
|
-
'
|
19
|
-
'
|
20
|
-
'
|
21
|
-
'
|
22
|
-
'
|
23
|
-
'
|
24
|
-
'
|
15
|
+
'progress-bar' : docs.ProgressBar,
|
16
|
+
'label' : docs.Label,
|
17
|
+
'box' : docs.Box,
|
18
|
+
'box-prepend' : docs.BoxPrepend,
|
19
|
+
'button' : docs.Button,
|
20
|
+
'dropdown' : docs.Dropdown,
|
21
|
+
'item' : docs.Item,
|
22
|
+
'paned' : docs.Paned,
|
23
|
+
'grid' : docs.Grid,
|
24
|
+
'cell' : docs.Cell,
|
25
|
+
'frame' : docs.Frame,
|
26
|
+
'frame-label' : docs.FrameLabel,
|
27
|
+
'link' : docs.LinkButton,
|
28
|
+
'switch' : docs.Switch,
|
29
|
+
'picture' : docs.Picture
|
25
30
|
}
|
26
31
|
|
27
32
|
class GtkStreamXMLHandler(sax.ContentHandler):
|
@@ -78,11 +83,12 @@ class GtkStreamXMLHandler(sax.ContentHandler):
|
|
78
83
|
match name:
|
79
84
|
case 'style':
|
80
85
|
style = _Object()
|
86
|
+
style.chars = []
|
81
87
|
def onchars(s):
|
82
|
-
style.chars
|
88
|
+
style.chars.append(s)
|
83
89
|
def leave():
|
84
90
|
self.transition_chars = self.ignore_chars
|
85
|
-
self.app.addStyle(style.chars)
|
91
|
+
self.app.addStyle(" ".join(style.chars))
|
86
92
|
self.transition_chars = onchars
|
87
93
|
self.transition_enter = self.transE_final
|
88
94
|
self.transition_leave = self.transL_tag('style', self.transE_message, leave_parent, leave)
|
@@ -123,14 +129,14 @@ class GtkStreamXMLHandler(sax.ContentHandler):
|
|
123
129
|
self.transition_enter = self.transE_final
|
124
130
|
self.transition_leave = self.transL_tag('set-prop', self.transE_message, leave_parent)
|
125
131
|
|
126
|
-
case '
|
127
|
-
if '
|
132
|
+
case 'insert':
|
133
|
+
if 'into' in attrs:
|
128
134
|
children = []
|
129
135
|
def leave():
|
130
136
|
for child in children:
|
131
|
-
self.app.
|
137
|
+
self.app.insertWidget(attrs['into'], child)
|
132
138
|
self.transition_enter = self.transE_addChild(lambda child: children.append(child))
|
133
|
-
self.transition_leave = self.transL_tag('
|
139
|
+
self.transition_leave = self.transL_tag('insert', self.transE_message, leave_parent, leave)
|
134
140
|
else:
|
135
141
|
raise Exception("Expected 'to' attribute of 'append' message")
|
136
142
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import sys
|
2
|
+
|
3
|
+
from . import Gtk
|
4
|
+
|
5
|
+
def _parse_orientation_property(val):
|
6
|
+
return (Gtk.Orientation.HORIZONTAL) if val == "horizontal" else (Gtk.Orientation.VERTICAL)
|
7
|
+
def _parse_boolean_property(val):
|
8
|
+
return True if val == "true" else False
|
9
|
+
def _parse_float_property(val):
|
10
|
+
return float(val)
|
11
|
+
def _parse_int_property(val):
|
12
|
+
return int(val)
|
13
|
+
def _parse_searchMode_property(val):
|
14
|
+
match val:
|
15
|
+
case 'exact':
|
16
|
+
return Gtk.StringFilterMatchMode.EXACT
|
17
|
+
case 'substring':
|
18
|
+
return Gtk.StringFilterMatchMode.SUBSTRING
|
19
|
+
case _:
|
20
|
+
return Gtk.StringFilterMatchMode.PREFIX
|
21
|
+
def _parse_css_classes_property(val):
|
22
|
+
return val.split()
|
23
|
+
|
24
|
+
_PARSE_TYPE_PROPERTY = {
|
25
|
+
'GStrv' : _parse_css_classes_property,
|
26
|
+
'GtkOrientation' : _parse_orientation_property,
|
27
|
+
'gdouble' : _parse_float_property,
|
28
|
+
'gfloat' : _parse_float_property,
|
29
|
+
'gint' : _parse_int_property,
|
30
|
+
'gboolean' : _parse_boolean_property,
|
31
|
+
'GtkStringFilterMatchMode' : _parse_searchMode_property
|
32
|
+
}
|
33
|
+
|
34
|
+
def parse_property(prop_type, val):
|
35
|
+
# print(f"Parsing property '{val}' of type '{prop_type}'", file=sys.stderr)
|
36
|
+
return _PARSE_TYPE_PROPERTY.get(prop_type, lambda x: x)(val)
|
37
|
+
def get_prop_type(klass, prop):
|
38
|
+
return klass.find_property(prop).value_type.name
|
@@ -1,11 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: gtk-stream
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4
|
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/
|
7
7
|
Classifier: Development Status :: 4 - Beta
|
8
8
|
Classifier: Intended Audience :: Developers
|
9
|
+
Classifier: Environment :: X11 Applications :: GTK
|
9
10
|
Classifier: Topic :: Software Development :: User Interfaces
|
10
11
|
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
11
12
|
Requires-Dist: pygobject
|
@@ -20,6 +20,7 @@ gtk_stream/documents/classes/Frame.py
|
|
20
20
|
gtk_stream/documents/classes/Grid.py
|
21
21
|
gtk_stream/documents/classes/Label.py
|
22
22
|
gtk_stream/documents/classes/Paned.py
|
23
|
+
gtk_stream/documents/classes/Picture.py
|
23
24
|
gtk_stream/documents/classes/ProgressBar.py
|
24
25
|
gtk_stream/documents/classes/Switch.py
|
25
26
|
gtk_stream/documents/classes/__init__.py
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "gtk-stream"
|
7
|
-
version = "0.
|
7
|
+
version = "0.4"
|
8
8
|
description = "A simple stream-oriented GUI protocol"
|
9
9
|
authors = [
|
10
10
|
{ name = "Marc Coiffier", email = "marc.coiffier@univ-grenoble-alpes.fr" }
|
@@ -14,6 +14,7 @@ dependencies = [ "pygobject" ]
|
|
14
14
|
classifiers = [
|
15
15
|
"Development Status :: 4 - Beta",
|
16
16
|
"Intended Audience :: Developers",
|
17
|
+
"Environment :: X11 Applications :: GTK",
|
17
18
|
"Topic :: Software Development :: User Interfaces",
|
18
19
|
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
19
20
|
]
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import sys
|
2
|
-
from ...properties import parse_property
|
3
|
-
|
4
|
-
class Document:
|
5
|
-
def __init__(self, app, id = None, **attrs):
|
6
|
-
self.id = id
|
7
|
-
self.app = app
|
8
|
-
self.props = { attr: parse_property(attr, val) for (attr, val) in attrs.items() }
|
9
|
-
self.children = []
|
10
|
-
|
11
|
-
def add_child(self, child):
|
12
|
-
self.children.append(child)
|
13
|
-
|
14
|
-
def render_raw(self):
|
15
|
-
"""Method to render the document to a widet"""
|
16
|
-
raise Exception("Method 'render' not implemented")
|
17
|
-
def set_properties(self, w):
|
18
|
-
self.app.nameWidget(self.id, w)
|
19
|
-
for (p,v) in self.props.items():
|
20
|
-
w.set_property(p, v)
|
21
|
-
w.attach_child = lambda d: self.attach_child(w, d)
|
22
|
-
def render(self):
|
23
|
-
w = self.render_raw()
|
24
|
-
self.set_properties(w)
|
25
|
-
for child in self.children:
|
26
|
-
self.attach_child(w, child)
|
27
|
-
return w
|
28
|
-
|
29
|
-
def attach_child(self, w, child):
|
30
|
-
raise Exception("Unimplemented method 'attach_child'")
|
@@ -1,14 +0,0 @@
|
|
1
|
-
from ... import Gtk
|
2
|
-
from .. import Document
|
3
|
-
|
4
|
-
class Frame(Document):
|
5
|
-
def __init__(self, app, label=None, **kwargs):
|
6
|
-
super().__init__(app,**kwargs)
|
7
|
-
self.label = label
|
8
|
-
def render_raw(self):
|
9
|
-
ret = Gtk.Frame()
|
10
|
-
if self.label != None:
|
11
|
-
ret.set_label(self.label)
|
12
|
-
return ret
|
13
|
-
def attach_child(self, w, d):
|
14
|
-
w.set_child(d.render())
|
@@ -1,41 +0,0 @@
|
|
1
|
-
from . import Gtk
|
2
|
-
|
3
|
-
def _parse_orientation_property(val):
|
4
|
-
return (Gtk.Orientation.HORIZONTAL) if val == "horizontal" else (Gtk.Orientation.VERTICAL)
|
5
|
-
def _parse_boolean_property(val):
|
6
|
-
return True if val == "true" else False
|
7
|
-
def _parse_float_property(val):
|
8
|
-
return float(val)
|
9
|
-
def _parse_int_property(val):
|
10
|
-
return int(val)
|
11
|
-
def _parse_searchMode_property(val):
|
12
|
-
match val:
|
13
|
-
case 'exact':
|
14
|
-
return Gtk.StringFilterMatchMode.EXACT
|
15
|
-
case 'substring':
|
16
|
-
return Gtk.StringFilterMatchMode.SUBSTRING
|
17
|
-
case _:
|
18
|
-
return Gtk.StringFilterMatchMode.PREFIX
|
19
|
-
def _parse_css_classes_property(val):
|
20
|
-
return val.split()
|
21
|
-
|
22
|
-
_PARSE_PROPERTY = {
|
23
|
-
'css-classes': _parse_css_classes_property,
|
24
|
-
'orientation': _parse_orientation_property,
|
25
|
-
'fraction': _parse_float_property,
|
26
|
-
'show-text': _parse_boolean_property,
|
27
|
-
'enable-search': _parse_boolean_property,
|
28
|
-
'search-match-mode': _parse_searchMode_property,
|
29
|
-
'visited': _parse_boolean_property,
|
30
|
-
'hexpand': _parse_boolean_property,
|
31
|
-
'hexpand-set': _parse_boolean_property,
|
32
|
-
'vexpand': _parse_boolean_property,
|
33
|
-
'vexpand-set': _parse_boolean_property,
|
34
|
-
'xalign': _parse_float_property,
|
35
|
-
'yalign': _parse_float_property,
|
36
|
-
'state': _parse_boolean_property,
|
37
|
-
'managed': _parse_boolean_property
|
38
|
-
}
|
39
|
-
|
40
|
-
def parse_property(prop, val):
|
41
|
-
return _PARSE_PROPERTY.get(prop, lambda x: x)(val)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|