# dupeGuru 4.3.1 documentation

## core.app

class core.app.DupeGuru(view, portable=False)

  Holds everything together.

  Instantiated once per running application, it holds a reference to every high-level object whose reference needs to be held: `Results`, `Directories`, `core.gui` instances, etc..

  It also hosts high level methods and acts as a coordinator for all those elements. This is why some of its methods seem a bit shallow, like for example `mark_all()` and `remove_duplicates()`. These methos are just proxies for a method in `results`, but they are also followed by a notification call which is very important if we want GUI elements to be correctly notified of a change in the data they’re presenting.

  directories

    Instance of `Directories`. It holds the current folder selection.

  results

    Instance of `core.results.Results`. Holds the results of the latest scan.

  selected_dupes

    List of currently selected dupes from our `results`. Whenever the user changes its selection at the UI level, `result_table` takes care of updating this attribute, so you can trust that it’s always up-to-date.

  result_table

    Instance of `meta-gui` table listing the results from `results`

  add_directory(d)

    Adds folder `d` to `directories`.

    Shows an error message dialog if something bad happens.

    Parameters

      d (str) – path of folder to add

  add_selected_to_ignore_list()

    Adds `selected_dupes` to `ignore_list`.

  apply_filter(result_filter)

    Apply a filter `filter` to the results so that it shows only dupe groups that match it.

    Parameters

      filter (str) – filter to apply

  copy_or_move_marked(copy)

    Start an async move (or copy) job on marked duplicates.

    Parameters

      copy (bool) – If True, duplicates will be copied instead of moved

  delete_marked()

    Start an async job to send marked duplicates to the trash.

  export_to_csv()

    Export current results to CSV.

    The columns and their order in the resulting CSV file is determined in the same way as in `export_to_xhtml()`.

  export_to_xhtml()

    Export current results to XHTML.

    The configuration of the `result_table` (columns order and visibility) is used to determine how the data is presented in the export. In other words, the exported table in the resulting XHTML will look just like the results table.

  invoke_custom_command()

    Calls command in `CustomCommand` pref with `%d` and `%r` placeholders replaced.

    Using the current selection, `%d` is replaced with the currently selected dupe and `%r` is replaced with that dupe’s ref file. If there’s no selection, the command is not invoked. If the dupe is a ref, `%d` and `%r` will be the same.

  load()

    Load directory selection and ignore list from files in appdata.

    This method is called during startup so that directory selection and ignore list, which is persistent data, is the same as when the last session was closed (when `save()` was called).

  load_from(filename)

    Start an async job to load results from `filename`.

    Parameters

      filename (str) – path of the XML file (created with `save_as()`) to load

  make_selected_reference()

    Promote `selected_dupes` to reference position within their respective groups.

    Each selected dupe will become the `ref` of its group. If there’s more than one dupe selected for the same group, only the first (in the order currently shown in `result_table`) dupe will be promoted.

  mark_all()

    Set all dupes in the results as marked.

  mark_dupe(dupe, marked)

    Change marked status of `dupe`.

    Parameters

      - dupe (`File`) – dupe to mark/unmark

      - marked (bool) – True = mark, False = unmark

  mark_invert()

    Invert the marked state of all dupes in the results.

  mark_none()

    Set all dupes in the results as unmarked.

  open_selected()

    Open `selected_dupes` with their associated application.

  purge_ignore_list()

    Remove files that don’t exist from `ignore_list`.

  remove_directories(indexes)

    Remove root directories at `indexes` from `directories`.

    Parameters

      indexes (list of int) – Indexes of the directories to remove.

  remove_duplicates(duplicates)

    Remove `duplicates` from `results`.

    Calls `remove_duplicates()` and send appropriate notifications.

    Parameters

      duplicates (list of `File`) – duplicates to remove.

  remove_marked()

    Removed marked duplicates from the results (without touching the files themselves).

  remove_selected()

    Removed `selected_dupes` from the results (without touching the files themselves).

  rename_selected(newname)

    Renames the selected dupes’s file to `newname`.

    If there’s more than one selected dupes, the first one is used.

    Parameters

      newname (str) – The filename to rename the dupe’s file to.

  reprioritize_groups(sort_key)

    Sort dupes in each group (in `results`) according to `sort_key`.

    Called by the re-prioritize dialog. Calls `prioritize()` and, once the sorting is done, show a message that confirms the action.

    Parameters

      sort_key (f(dupe)) – The key being sent to `prioritize()`

  save_as(filename)

    Save results in `filename`.

    Parameters

      filename (str) – path of the file to save results (as XML) to.

  save_directories_as(filename)

    Save directories in `filename`.

    Parameters

      filename (str) – path of the file to save directories (as XML) to.

  start_scanning(profile_scan=False)

    Starts an async job to scan for duplicates.

    Scans folders selected in `directories` and put the results in `results`

  without_ref(dupes)

    Returns `dupes` with all reference elements removed.