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
@ -65,4 +66,4 @@ class KeyInputController:
if keyname == "Right":
self.keyboard_move_tab_right(page_num)
return True
return True

View File

@ -46,6 +46,12 @@ class OpenFileButton(Gtk.Button):
Gtk.FileChooserAction.OPEN,
(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:
@ -55,4 +61,4 @@ class OpenFileButton(Gtk.Button):
_gfile = Gio.File.new_for_path(path)
event_system.emit("keyboard_open_file", (_gfile,))
chooser.destroy()
chooser.destroy()

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()