gtk-stream 0.14.2__py3-none-any.whl → 0.15.1__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-0.14.2.dist-info → gtk_stream-0.15.1.dist-info}/METADATA +1 -1
- {gtk_stream-0.14.2.dist-info → gtk_stream-0.15.1.dist-info}/RECORD +7 -7
- {gtk_stream-0.14.2.dist-info → gtk_stream-0.15.1.dist-info}/WHEEL +0 -0
- {gtk_stream-0.14.2.dist-info → gtk_stream-0.15.1.dist-info}/entry_points.txt +0 -0
- {gtk_stream-0.14.2.dist-info → gtk_stream-0.15.1.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.new("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):
|
@@ -1,6 +1,6 @@
|
|
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=po5_rvCFTU8xU9IC56wyK0-zfBgz_U4xX6CO2mv9Mzs,413
|
3
|
+
gtk_stream/application.py,sha256=Tf5kbpHmsZ_rnFFklLtCGBul7HoHiXe0398wExP3q_M,6944
|
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
|
@@ -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.1.dist-info/METADATA,sha256=KFQPdW6O5As9qAmoagWL8NkZHzE03a9zStuS1_e7Hps,807
|
28
|
+
gtk_stream-0.15.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
29
|
+
gtk_stream-0.15.1.dist-info/entry_points.txt,sha256=PmhKTb4MMQM6dN2HJcoDSMI8L0lZIFIlFn-BgdfPDpo,60
|
30
|
+
gtk_stream-0.15.1.dist-info/top_level.txt,sha256=vE9zfHGe9Ke7FSe0wBK2WYJI-BpcQNu6xDC3Cu5O8rQ,11
|
31
|
+
gtk_stream-0.15.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|