WIP separating fs actions

This commit is contained in:
2022-12-06 23:36:10 -06:00
parent 6d4279c871
commit 9eeb24e19a
14 changed files with 389 additions and 311 deletions

View File

@@ -113,7 +113,7 @@ class Plugin(PluginBase):
self._archiver_dialogue.hide()
def archive_files(self, save_target, state):
paths = [shlex.quote(p) for p in state.selected_files]
paths = [shlex.quote(p) for p in state.uris]
sItr, eItr = self._arc_command_buffer.get_bounds()
pre_command = self._arc_command_buffer.get_text(sItr, eItr, False)

View File

@@ -123,8 +123,8 @@ class Plugin(PluginBase):
GLib.idle_add(self._process_changes, (state))
def _process_changes(self, state):
if len(state.selected_files) == 1:
uri = state.selected_files[0]
if len(state.uris) == 1:
uri = state.uris[0]
path = state.tab.get_current_directory()

View File

@@ -95,7 +95,7 @@ class Plugin(PluginBase):
def _process_changes(self, state):
self._fm_state = None
if len(state.selected_files) == 1:
if len(state.uris) == 1:
self._fm_state = state
self._set_ui_data()
response = self._thumbnailer_dialog.run()
@@ -115,7 +115,7 @@ class Plugin(PluginBase):
print(video_data["videos"]) if not keys in ("", None) and "videos" in keys else ...
def get_video_data(self):
uri = self._fm_state.selected_files[0]
uri = self._fm_state.uris[0]
path = self._fm_state.tab.get_current_directory()
parts = uri.split("/")
_title = parts[ len(parts) - 1 ]

View File

@@ -99,9 +99,9 @@ class Plugin(PluginBase):
def delete_files(self, widget = None, eve = None):
self._event_system.emit("get_current_state")
state = self._fm_state
uris = state.selected_files
uris = state.uris
response = None
state.message_dialog.format_secondary_text(f"Do you really want to delete the {len(uris)} file(s)?")
for uri in uris:
file = Gio.File.new_for_path(uri)
@@ -122,13 +122,13 @@ class Plugin(PluginBase):
def trash_files(self, widget = None, eve = None, verbocity = False):
self._event_system.emit("get_current_state")
state = self._fm_state
for uri in state.selected_files:
for uri in state.uris:
self.trashman.trash(uri, verbocity)
def restore_trash_files(self, widget = None, eve = None, verbocity = False):
self._event_system.emit("get_current_state")
state = self._fm_state
for uri in state.selected_files:
for uri in state.uris:
self.trashman.restore(filename=uri.split("/")[-1], verbose = verbocity)
def empty_trash(self, widget = None, eve = None, verbocity = False):

View File

@@ -98,8 +98,8 @@ class Plugin(PluginBase):
def _process_changes(self, state):
self._fm_state = None
if len(state.selected_files) == 1:
if state.selected_files[0].lower().endswith(state.tab.fvideos):
if len(state.uris) == 1:
if state.uris[0].lower().endswith(state.tab.fvideos):
self._fm_state = state
self._set_ui_data()
response = self._thumbnailer_dialog.run()
@@ -132,7 +132,7 @@ class Plugin(PluginBase):
def _set_ui_data(self):
uri = self._fm_state.selected_files[0]
uri = self._fm_state.uris[0]
path = self._fm_state.tab.get_current_directory()
parts = uri.split("/")