gtk-stream 0.14.1__py3-none-any.whl → 0.15__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/_version.py +2 -2
- gtk_stream/application.py +46 -13
- gtk_stream/properties.py +11 -0
- {gtk_stream-0.14.1.dist-info → gtk_stream-0.15.dist-info}/METADATA +1 -1
- {gtk_stream-0.14.1.dist-info → gtk_stream-0.15.dist-info}/RECORD +8 -8
- {gtk_stream-0.14.1.dist-info → gtk_stream-0.15.dist-info}/WHEEL +0 -0
- {gtk_stream-0.14.1.dist-info → gtk_stream-0.15.dist-info}/entry_points.txt +0 -0
- {gtk_stream-0.14.1.dist-info → gtk_stream-0.15.dist-info}/top_level.txt +0 -0
gtk_stream/_version.py
CHANGED
gtk_stream/application.py
CHANGED
@@ -98,19 +98,52 @@ class GtkStreamApp(Gtk.Application):
|
|
98
98
|
self.attrs_set.release()
|
99
99
|
|
100
100
|
@app_message('file-dialog')
|
101
|
-
def open_file_dialog(self, id, parent):
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
101
|
+
def open_file_dialog(self, id, parent, action = "open"):
|
102
|
+
parent_window = self.named_windows[parent]
|
103
|
+
if Gtk.MINOR_VERSION >= 10:
|
104
|
+
# From version 4.10, use FileDialog
|
105
|
+
dialog = Gtk.FileDialog()
|
106
|
+
dialog.props.modal = True
|
107
|
+
match action:
|
108
|
+
case 'open':
|
109
|
+
open_func = dialog.open
|
110
|
+
finish_func = dialog.open_finish
|
111
|
+
case 'save':
|
112
|
+
open_func = dialog.save
|
113
|
+
finish_func = dialog.save_finish
|
114
|
+
|
115
|
+
def on_choose(_, b):
|
116
|
+
try:
|
117
|
+
file = finish_func(b)
|
118
|
+
print(f"{id}:selected:{file.get_path()}")
|
119
|
+
sys.stdout.flush()
|
120
|
+
except GLib.GError as e:
|
121
|
+
print(f"{id}:none-selected")
|
122
|
+
sys.stdout.flush()
|
123
|
+
|
124
|
+
open_func(parent = parent_window, callback = on_choose)
|
125
|
+
|
126
|
+
else:
|
127
|
+
# Before version 4.10, use FileChooserDialog
|
128
|
+
match action:
|
129
|
+
case 'open':
|
130
|
+
fc_action = Gtk.FileChooserAction.OPEN
|
131
|
+
fc_label = "Open"
|
132
|
+
case 'save':
|
133
|
+
fc_action = Gtk.FileChooserAction.SAVE
|
134
|
+
fc_label = "Save"
|
135
|
+
dialog = Gtk.FileChooserDialog("Choose a file", parent_window, fc_action, fc_label, Gtk.ResponseType.ACCEPT)
|
136
|
+
dialog.props.modal = True
|
137
|
+
def on_choose(_, b):
|
138
|
+
try:
|
139
|
+
file = dialog.get_file()
|
140
|
+
print(f"{id}:selected:{file.get_path()}")
|
141
|
+
sys.stdout.flush()
|
142
|
+
except GLib.GError as e:
|
143
|
+
print(f"{id}:none-selected")
|
144
|
+
sys.stdout.flush()
|
145
|
+
dialog.connect("response", on_choose)
|
146
|
+
dialog.present()
|
114
147
|
|
115
148
|
@app_message('window', single_store)
|
116
149
|
def new_window(self, document, id, **attrs):
|
gtk_stream/properties.py
CHANGED
@@ -73,6 +73,16 @@ def _parse_selection_mode_property(val):
|
|
73
73
|
return _const(Gtk.SelectionMode.BROWSE)
|
74
74
|
case "multiple":
|
75
75
|
return _const(Gtk.SelectionMode.MULTIPLE)
|
76
|
+
def _parse_justification_property(val):
|
77
|
+
match val:
|
78
|
+
case "left":
|
79
|
+
return _const(Gtk.Justification.LEFT)
|
80
|
+
case "center":
|
81
|
+
return _const(Gtk.Justification.CENTER)
|
82
|
+
case "right":
|
83
|
+
return _const(Gtk.Justification.RIGHT)
|
84
|
+
case "fill":
|
85
|
+
return _const(Gtk.Justification.FILL)
|
76
86
|
|
77
87
|
_PARSE_TYPE_PROPERTY = {
|
78
88
|
'GStrv' : _parse_css_classes_property,
|
@@ -90,6 +100,7 @@ _PARSE_TYPE_PROPERTY = {
|
|
90
100
|
'GFile' : _parse_gfile_property,
|
91
101
|
'GtkAlign' : _parse_align_property,
|
92
102
|
'GtkSelectionMode' : _parse_selection_mode_property,
|
103
|
+
'GtkJustification' : _parse_justification_property,
|
93
104
|
}
|
94
105
|
|
95
106
|
def parse_property(prop_type, val):
|
@@ -1,10 +1,10 @@
|
|
1
1
|
gtk_stream/__init__.py,sha256=y6JLknVFexWrSo_Zl7-TXrPR6EQ5XVMeFO1bUzLN9Lg,98
|
2
|
-
gtk_stream/_version.py,sha256=
|
3
|
-
gtk_stream/application.py,sha256=
|
2
|
+
gtk_stream/_version.py,sha256=poZz4oZoUd1b8WrBvqHJC0SHzGSqhHsFiUSMJDd_Hcw,408
|
3
|
+
gtk_stream/application.py,sha256=2VWewLGIh9h8Gv7kHos53tOVqPL08KB1atxiJgvudto,6940
|
4
4
|
gtk_stream/command_line.py,sha256=57slfbV-EUWVI8bsA50IzmCLqNjN9aZpz8J8Gtituro,3105
|
5
5
|
gtk_stream/common.py,sha256=2USRh42DmmxtPO1y8gpeU0hMuHfhcqJBPuxtvd46YHg,2112
|
6
6
|
gtk_stream/parser.py,sha256=lt1cHYwhrd0SwSQfbxtbK6NdwbnFmgeBDIeNY0eepwc,5709
|
7
|
-
gtk_stream/properties.py,sha256=
|
7
|
+
gtk_stream/properties.py,sha256=F0AdqgtlgmhDwjuNvA7-hnCSl_8ZCcyl2Q_JfxWeGRk,4448
|
8
8
|
gtk_stream/documents/__init__.py,sha256=cMWSmjD2_5oJ2EoSk3Jy9-LPeAGKDIidYNRJvqUzdU8,856
|
9
9
|
gtk_stream/documents/classes/Box.py,sha256=3GUaeG4kZks0NPUJT4JmwVCAJJ3aXtNvtG3b1xv2-iE,1411
|
10
10
|
gtk_stream/documents/classes/Button.py,sha256=UbFi3FeJzpfBCAArtlnmmkcB24kpEyCmpCORnGuKJsc,1520
|
@@ -24,8 +24,8 @@ gtk_stream/documents/classes/Separator.py,sha256=uw_EgAKs_6pNA8nrOLzruIlJfk4uaog
|
|
24
24
|
gtk_stream/documents/classes/Stack.py,sha256=diZyuBLwuCjn_WE3wx5MBgHN_ty6WXSsyIFRVAbe8yI,1572
|
25
25
|
gtk_stream/documents/classes/Switch.py,sha256=jQVuxqS9Pmpp1ymB_dbJPxasJNpm4e35ry0JYPHdAsk,1275
|
26
26
|
gtk_stream/documents/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
|
-
gtk_stream-0.
|
28
|
-
gtk_stream-0.
|
29
|
-
gtk_stream-0.
|
30
|
-
gtk_stream-0.
|
31
|
-
gtk_stream-0.
|
27
|
+
gtk_stream-0.15.dist-info/METADATA,sha256=P_fnnVTZ70JrRyWErM_4hCqIO34aNmSavevsRawaSI0,805
|
28
|
+
gtk_stream-0.15.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
29
|
+
gtk_stream-0.15.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
|
30
|
+
gtk_stream-0.15.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
|
31
|
+
gtk_stream-0.15.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|