core.gui.deletion_options¶
- class core.gui.deletion_options.DeletionOptions¶
Present the user with deletion options before proceeding.
When the user activates “Send to trash”, we present him with a couple of options that changes the behavior of that deletion operation.
- show(mark_count)¶
Prompt the user with a modal dialog offering our deletion options.
Parameters: mark_count (int) – Number of dupes marked for deletion. Return type: bool Returns: Whether the user accepted the dialog (we cancel deletion if false).
- supports_links()¶
Returns whether our platform supports symlinks.
- direct = None¶
Delete dupes directly and don’t send to trash. bool. get/set
- link_deleted¶
Replace deleted dupes with symlinks (or hardlinks) to the dupe group reference.
bool. get/set
Whether the link is a symlink or hardlink is decided by use_hardlinks.
- use_hardlinks = None¶
Whether symlinks or hardlinks are used when doing link_deleted. bool. get/set
- class core.gui.deletion_options.DeletionOptionsView¶
Expected interface for DeletionOptions‘s view.
Not actually used in the code. For documentation purposes only.
Our view presents the user with an appropriate way (probably a mix of checkboxes and radio buttons) to set the different flags in DeletionOptions. Note that DeletionOptions.use_hardlinks is only relevant if DeletionOptions.link_deleted is true. This is why we toggle the “enabled” state of that flag.
We expect the view to set DeletionOptions.link_deleted immediately as the user changes its value because it will toggle set_hardlink_option_enabled()
Other than the flags, there’s also a prompt message which has a dynamic content, defined by update_msg().
- set_hardlink_option_enabled(is_enabled: bool)¶
Enable or disable the widget controlling DeletionOptions.use_hardlinks.
- show()¶
Show the dialog in a modal fashion.
Returns whether the dialog was “accepted” (the user pressed OK).
- update_msg(msg: str)¶
Update the dialog’s prompt with str.