2013-07-28 19:09:17 +00:00
|
|
|
Developer Guide
|
|
|
|
===============
|
|
|
|
|
|
|
|
When looking at a non-trivial codebase for the first time, it's very difficult to understand
|
|
|
|
anything of it until you get the "Big Picture". This page is meant to, hopefully, make you get
|
|
|
|
dupeGuru's big picture.
|
|
|
|
|
|
|
|
Model/View/Controller... nope!
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
dupeGuru's codebase has quite a few design flaws. The Model, View and Controller roles are filled by
|
|
|
|
different classes, scattered around. If you're aware of that, it might help you to understand what
|
|
|
|
the heck is going on.
|
|
|
|
|
2014-10-06 00:12:38 +00:00
|
|
|
The central piece of dupeGuru is :class:`core.app.DupeGuru`. It's the only
|
2013-07-28 19:09:17 +00:00
|
|
|
interface to the python's code for the GUI code. A duplicate scan is started with
|
2014-10-06 00:12:38 +00:00
|
|
|
:meth:`core.app.DupeGuru.start_scanning()`, directories are added through
|
|
|
|
:meth:`core.app.DupeGuru.add_directory()`, etc..
|
2013-07-28 19:09:17 +00:00
|
|
|
|
|
|
|
A lot of functionalities of the App are implemented in the platform-specific subclasses of
|
2014-10-06 00:12:38 +00:00
|
|
|
:class:`core.app.DupeGuru`, like ``DupeGuru`` in ``cocoa/inter/app.py``, or the ``DupeGuru`` class
|
|
|
|
in ``qt/base/app.py``. For example, when performing "Remove Selected From Results",
|
|
|
|
``RemoveSelected()`` on the cocoa side, and ``remove_duplicates()`` on the PyQt side, are
|
|
|
|
respectively called to perform the thing.
|
2013-07-28 19:09:17 +00:00
|
|
|
|
2013-08-21 02:52:43 +00:00
|
|
|
.. _jobs:
|
|
|
|
|
2013-07-28 19:09:17 +00:00
|
|
|
Jobs
|
|
|
|
----
|
|
|
|
|
|
|
|
A lot of operations in dupeGuru take a significant amount of time. This is why there's a generalized
|
2014-10-06 00:12:38 +00:00
|
|
|
threaded job mechanism built-in :class:`~core.app.DupeGuru`. First, :class:`~core.app.DupeGuru` has
|
|
|
|
a ``progress`` member which is an instance of
|
|
|
|
:class:`~hscommon.jobprogress.performer.ThreadedJobPerformer`. It lets the GUI code know of the progress
|
|
|
|
of the current threaded job. When :class:`~core.app.DupeGuru` needs to start a job, it calls
|
2013-07-28 19:09:17 +00:00
|
|
|
``_start_job()`` and the platform specific subclass deals with the details of starting the job.
|
|
|
|
|
|
|
|
Core principles
|
|
|
|
---------------
|
|
|
|
|
2014-10-06 00:12:38 +00:00
|
|
|
The core of the duplicate matching takes place (for SE and ME, not PE) in :mod:`core.engine`.
|
|
|
|
There's :func:`core.engine.getmatches` which take a list of :class:`core.fs.File` instances and
|
|
|
|
return a list of ``(firstfile, secondfile, match_percentage)`` matches. Then, there's
|
|
|
|
:func:`core.engine.get_groups` which takes a list of matches and returns a list of
|
|
|
|
:class:`.Group` instances (a :class:`.Group` is basically a list of :class:`.File` matching
|
|
|
|
together).
|
|
|
|
|
|
|
|
When a scan is over, the final result (the list of groups from :func:`.get_groups`) is placed into
|
|
|
|
:attr:`core.app.DupeGuru.results`, which is a :class:`core.results.Results` instance. The
|
|
|
|
:class:`~.Results` instance is where all the dupe marking, sorting, removing, power marking, etc.
|
|
|
|
takes place.
|
2013-08-18 22:36:09 +00:00
|
|
|
|
|
|
|
API
|
|
|
|
---
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 2
|
|
|
|
|
2013-11-16 19:46:34 +00:00
|
|
|
core/index
|
|
|
|
hscommon/index
|