generated from itdominator/Python-With-Gtk-Template
File open sets default path to current path if any
This commit is contained in:
parent
6752cf47df
commit
9d2c62ef20
|
@ -50,7 +50,8 @@ class KeyInputController:
|
||||||
if keyname == "t":
|
if keyname == "t":
|
||||||
self._create_view()
|
self._create_view()
|
||||||
if keyname == "o":
|
if keyname == "o":
|
||||||
event_system.emit("open_files")
|
page_num, container, source_view = self.get_active_view()
|
||||||
|
event_system.emit("open_files", (source_view,))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,12 @@ class OpenFileButton(Gtk.Button):
|
||||||
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
||||||
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
|
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
|
||||||
|
|
||||||
|
try:
|
||||||
|
folder = widget.get_current_file().get_parent()
|
||||||
|
chooser.set_current_folder( folder.get_uri() )
|
||||||
|
except Exception as e:
|
||||||
|
...
|
||||||
|
|
||||||
response = chooser.run()
|
response = chooser.run()
|
||||||
if response == Gtk.ResponseType.OK:
|
if response == Gtk.ResponseType.OK:
|
||||||
filename = chooser.get_filename()
|
filename = chooser.get_filename()
|
||||||
|
|
|
@ -57,7 +57,7 @@ class SaveFileDialog:
|
||||||
dlg.set_current_name("new.txt")
|
dlg.set_current_name("new.txt")
|
||||||
dlg.set_current_folder(os.path.expanduser('~'))
|
dlg.set_current_folder(os.path.expanduser('~'))
|
||||||
else:
|
else:
|
||||||
dlg.set_current_folder(current_file.get_parent().get_path())
|
dlg.set_current_folder(current_file.get_parent().get_uri())
|
||||||
dlg.set_current_name(current_filename)
|
dlg.set_current_name(current_filename)
|
||||||
|
|
||||||
response = dlg.run()
|
response = dlg.run()
|
||||||
|
|
Loading…
Reference in New Issue