File open sets default path to current path if any

This commit is contained in:
itdominator 2023-11-12 16:50:53 -06:00
parent 6752cf47df
commit 9d2c62ef20
3 changed files with 11 additions and 4 deletions

View File

@ -50,7 +50,8 @@ class KeyInputController:
if keyname == "t":
self._create_view()
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

View File

@ -47,6 +47,12 @@ class OpenFileButton(Gtk.Button):
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
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()
if response == Gtk.ResponseType.OK:
filename = chooser.get_filename()

View File

@ -57,7 +57,7 @@ class SaveFileDialog:
dlg.set_current_name("new.txt")
dlg.set_current_folder(os.path.expanduser('~'))
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)
response = dlg.run()