Skip to content

Commit c713113

Browse files
committed
1. Updating the file to follow black formatting standards
2. Updated the Confirm Title, Subtitle, Cancel Title, Subtitle 3. Updated the paths_to_display to utilize `os.path.basename` vs `path.split()`
1 parent 60acaea commit c713113

1 file changed

Lines changed: 14 additions & 23 deletions

File tree

commands/delete.py

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ def delete(self, index):
1414
try:
1515
send2trash(path)
1616
except OSError as e:
17-
sublime.error_message(
18-
"Unable to send to trash: {}".format(e))
19-
raise OSError(
20-
"Unable to send {0!r} to trash: {1}".format(path, e))
17+
sublime.error_message("Unable to send to trash: {}".format(e))
18+
raise OSError("Unable to send {0!r} to trash: {1}".format(path, e))
2119
if index > 1:
2220
view = self.window.find_open_file(self.paths[index - 2])
2321
if view is not None:
@@ -39,30 +37,23 @@ def run(self, paths=None, *args, **kwargs):
3937

4038
self.paths = paths or [self.view.file_name()]
4139
if get_settings().get("ask_for_confirmation_on_delete") is not False:
42-
confirm_text = "Send {0}item{1} to trash".format(
43-
("{0} ".format(
44-
len(self.paths)) if len(self.paths) > 1 else ""),
45-
("s" if len(
46-
self.paths) > 1 else "")
47-
)
48-
cancel_text = "Cancel deletion of {0}file{1}".format(
49-
("{0} ".format(
50-
len(self.paths)) if len(self.paths) > 1 else ""),
51-
("s" if len(
52-
self.paths) > 1 else "")
53-
)
40+
nitems = "{0} ".format(len(self.paths)) if len(self.paths) > 1 else ""
41+
extras = "s" if len(self.paths) > 1 else ""
42+
43+
confirm_title = "Confirm"
44+
confirm_subtitle = "Send {}item{} to trash".format(nitems, extras)
45+
cancel_title = "Cancel All (Select an individual file to remove it from the deletion list)"
46+
cancel_subtitle = "Cancel deletion of {0}item{1}".format(nitems, extras)
47+
5448
paths_to_display = [
55-
["Confirm", confirm_text],
56-
["Cancel", cancel_text]
49+
[confirm_title, confirm_subtitle],
50+
[cancel_title, cancel_subtitle],
5751
]
58-
5952
for path in paths:
60-
paths_to_display.append(
61-
[path.split(os.path.sep)[-1], path])
53+
paths_to_display.append([os.path.basename(path), path])
6254

6355
self.window.show_quick_panel(
64-
paths_to_display,
65-
self.delete,
56+
paths_to_display, self.delete,
6657
)
6758
else:
6859
# index 0 is like clicking on the first option of the panel

0 commit comments

Comments
 (0)