mirror of
https://github.com/arsenetar/dupeguru.git
synced 2024-12-21 10:59:03 +00:00
Replace all relative imports
This commit is contained in:
parent
f7ed1c801c
commit
e382683f66
28
core/app.py
28
core/app.py
@ -23,20 +23,20 @@ from hscommon.util import delete_if_empty, first, escape, nonone, allsame
|
||||
from hscommon.trans import tr
|
||||
from hscommon import desktop
|
||||
|
||||
from . import se, me, pe
|
||||
from .pe.photo import get_delta_dimensions
|
||||
from .util import cmp_value, fix_surrogate_encoding
|
||||
from . import directories, results, export, fs, prioritize
|
||||
from .ignore import IgnoreList
|
||||
from .exclude import ExcludeDict as ExcludeList
|
||||
from .scanner import ScanType
|
||||
from .gui.deletion_options import DeletionOptions
|
||||
from .gui.details_panel import DetailsPanel
|
||||
from .gui.directory_tree import DirectoryTree
|
||||
from .gui.ignore_list_dialog import IgnoreListDialog
|
||||
from .gui.exclude_list_dialog import ExcludeListDialogCore
|
||||
from .gui.problem_dialog import ProblemDialog
|
||||
from .gui.stats_label import StatsLabel
|
||||
from core import se, me, pe
|
||||
from core.pe.photo import get_delta_dimensions
|
||||
from core.util import cmp_value, fix_surrogate_encoding
|
||||
from core import directories, results, export, fs, prioritize
|
||||
from core.ignore import IgnoreList
|
||||
from core.exclude import ExcludeDict as ExcludeList
|
||||
from core.scanner import ScanType
|
||||
from core.gui.deletion_options import DeletionOptions
|
||||
from core.gui.details_panel import DetailsPanel
|
||||
from core.gui.directory_tree import DirectoryTree
|
||||
from core.gui.ignore_list_dialog import IgnoreListDialog
|
||||
from core.gui.exclude_list_dialog import ExcludeListDialogCore
|
||||
from core.gui.problem_dialog import ProblemDialog
|
||||
from core.gui.stats_label import StatsLabel
|
||||
|
||||
HAD_FIRST_LAUNCH_PREFERENCE = "HadFirstLaunch"
|
||||
DEBUG_MODE_PREFERENCE = "DebugMode"
|
||||
|
@ -13,7 +13,7 @@ from hscommon.jobprogress import job
|
||||
from hscommon.util import FileOrPath
|
||||
from hscommon.trans import tr
|
||||
|
||||
from . import fs
|
||||
from core import fs
|
||||
|
||||
__all__ = [
|
||||
"Directories",
|
||||
|
@ -2,7 +2,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from .markable import Markable
|
||||
from core.markable import Markable
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
# TODO: perhaps use regex module for better Unicode support? https://pypi.org/project/regex/
|
||||
|
@ -7,7 +7,7 @@
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from hscommon.gui.base import GUIObject
|
||||
from .base import DupeGuruGUIObject
|
||||
from core.gui.base import DupeGuruGUIObject
|
||||
|
||||
|
||||
class DetailsPanel(GUIObject, DupeGuruGUIObject):
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
from hscommon.gui.tree import Tree, Node
|
||||
|
||||
from ..directories import DirectoryState
|
||||
from .base import DupeGuruGUIObject
|
||||
from core.directories import DirectoryState
|
||||
from core.gui.base import DupeGuruGUIObject
|
||||
|
||||
STATE_ORDER = [DirectoryState.NORMAL, DirectoryState.REFERENCE, DirectoryState.EXCLUDED]
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from .exclude_list_table import ExcludeListTable
|
||||
from core.gui.exclude_list_table import ExcludeListTable
|
||||
from core.exclude import has_sep
|
||||
from os import sep
|
||||
import logging
|
||||
|
@ -2,7 +2,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from .base import DupeGuruGUIObject
|
||||
from core.gui.base import DupeGuruGUIObject
|
||||
from hscommon.gui.table import GUITable, Row
|
||||
from hscommon.gui.column import Column, Columns
|
||||
from hscommon.trans import trget
|
||||
|
@ -6,7 +6,7 @@
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from hscommon.trans import tr
|
||||
from .ignore_list_table import IgnoreListTable
|
||||
from core.gui.ignore_list_table import IgnoreListTable
|
||||
|
||||
|
||||
class IgnoreListDialog:
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
from hscommon import desktop
|
||||
|
||||
from .problem_table import ProblemTable
|
||||
from core.gui.problem_table import ProblemTable
|
||||
|
||||
|
||||
class ProblemDialog:
|
||||
|
@ -11,7 +11,7 @@ from operator import attrgetter
|
||||
from hscommon.gui.table import GUITable, Row
|
||||
from hscommon.gui.column import Columns
|
||||
|
||||
from .base import DupeGuruGUIObject
|
||||
from core.gui.base import DupeGuruGUIObject
|
||||
|
||||
|
||||
class DupeRow(Row):
|
||||
|
@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from .base import DupeGuruGUIObject
|
||||
from core.gui.base import DupeGuruGUIObject
|
||||
|
||||
|
||||
class StatsLabel(DupeGuruGUIObject):
|
||||
|
@ -1 +1 @@
|
||||
from . import fs, prioritize, result_table, scanner # noqa
|
||||
from core.me import fs, prioritize, result_table, scanner # noqa
|
||||
|
@ -1,8 +1,7 @@
|
||||
from . import ( # noqa
|
||||
from core.pe import ( # noqa
|
||||
block,
|
||||
cache,
|
||||
exif,
|
||||
iphoto_plist,
|
||||
matchblock,
|
||||
matchexif,
|
||||
photo,
|
||||
|
@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ._block import NoBlocksError, DifferentBlockCountError, avgdiff, getblocks2 # NOQA
|
||||
from core.pe._block import NoBlocksError, DifferentBlockCountError, avgdiff, getblocks2 # NOQA
|
||||
|
||||
# Converted to C
|
||||
# def getblock(image):
|
||||
|
@ -4,7 +4,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ._cache import string_to_colors # noqa
|
||||
from core.pe._cache import string_to_colors # noqa
|
||||
|
||||
|
||||
def colors_to_string(colors):
|
||||
|
@ -10,7 +10,7 @@ import shelve
|
||||
import tempfile
|
||||
from collections import namedtuple
|
||||
|
||||
from .cache import string_to_colors, colors_to_string
|
||||
from core.pe.cache import string_to_colors, colors_to_string
|
||||
|
||||
|
||||
def wrap_path(path):
|
||||
|
@ -9,7 +9,7 @@ import os.path as op
|
||||
import logging
|
||||
import sqlite3 as sqlite
|
||||
|
||||
from .cache import string_to_colors, colors_to_string
|
||||
from core.pe.cache import string_to_colors, colors_to_string
|
||||
|
||||
|
||||
class SqliteCache:
|
||||
|
@ -15,7 +15,7 @@ from hscommon.trans import tr
|
||||
from hscommon.jobprogress import job
|
||||
|
||||
from core.engine import Match
|
||||
from .block import avgdiff, DifferentBlockCountError, NoBlocksError
|
||||
from core.pe.block import avgdiff, DifferentBlockCountError, NoBlocksError
|
||||
|
||||
# OPTIMIZATION NOTES:
|
||||
# The bottleneck of the matching phase is CPU, which is why we use multiprocessing. However, another
|
||||
@ -51,11 +51,11 @@ except Exception:
|
||||
|
||||
def get_cache(cache_path, readonly=False):
|
||||
if cache_path.endswith("shelve"):
|
||||
from .cache_shelve import ShelveCache
|
||||
from core.pe.cache_shelve import ShelveCache
|
||||
|
||||
return ShelveCache(cache_path, readonly=readonly)
|
||||
else:
|
||||
from .cache_sqlite import SqliteCache
|
||||
from core.pe.cache_sqlite import SqliteCache
|
||||
|
||||
return SqliteCache(cache_path, readonly=readonly)
|
||||
|
||||
|
@ -9,7 +9,7 @@ from hscommon.util import get_file_ext, format_size
|
||||
|
||||
from core.util import format_timestamp, format_perc, format_dupe_count
|
||||
from core import fs
|
||||
from . import exif
|
||||
from core.pe import exif
|
||||
|
||||
# This global value is set by the platform-specific subclasser of the Photo base class
|
||||
PLAT_SPECIFIC_PHOTO_CLASS = None
|
||||
|
@ -8,7 +8,7 @@ from hscommon.trans import tr
|
||||
|
||||
from core.scanner import Scanner, ScanType, ScanOption
|
||||
|
||||
from . import matchblock, matchexif
|
||||
from core.pe import matchblock, matchexif
|
||||
|
||||
|
||||
class ScannerPE(Scanner):
|
||||
|
@ -17,8 +17,8 @@ from hscommon.conflict import get_conflicted_name
|
||||
from hscommon.util import flatten, nonone, FileOrPath, format_size
|
||||
from hscommon.trans import tr
|
||||
|
||||
from . import engine
|
||||
from .markable import Markable
|
||||
from core import engine
|
||||
from core.markable import Markable
|
||||
|
||||
|
||||
class Results(Markable):
|
||||
|
@ -13,7 +13,7 @@ from hscommon.jobprogress import job
|
||||
from hscommon.util import dedupe, rem_file_ext, get_file_ext
|
||||
from hscommon.trans import tr
|
||||
|
||||
from . import engine
|
||||
from core import engine
|
||||
|
||||
# It's quite ugly to have scan types from all editions all put in the same class, but because there's
|
||||
# there will be some nasty bugs popping up (ScanType is used in core when in should exclusively be
|
||||
|
@ -1 +1 @@
|
||||
from . import fs, result_table, scanner # noqa
|
||||
from core.se import fs, result_table, scanner # noqa
|
||||
|
@ -15,10 +15,10 @@ import hscommon.util
|
||||
from hscommon.testutil import eq_, log_calls
|
||||
from hscommon.jobprogress.job import Job
|
||||
|
||||
from .base import TestApp
|
||||
from .results_test import GetTestGroups
|
||||
from .. import app, fs, engine
|
||||
from ..scanner import ScanType
|
||||
from core.tests.base import TestApp
|
||||
from core.tests.results_test import GetTestGroups
|
||||
from core import app, fs, engine
|
||||
from core.scanner import ScanType
|
||||
|
||||
|
||||
def add_fake_files_to_directories(directories, files):
|
||||
|
@ -10,12 +10,11 @@ from hscommon.util import get_file_ext, format_size
|
||||
from hscommon.gui.column import Column
|
||||
from hscommon.jobprogress.job import nulljob, JobCancelled
|
||||
|
||||
from .. import engine
|
||||
from .. import prioritize
|
||||
from ..engine import getwords
|
||||
from ..app import DupeGuru as DupeGuruBase
|
||||
from ..gui.result_table import ResultTable as ResultTableBase
|
||||
from ..gui.prioritize_dialog import PrioritizeDialog
|
||||
from core import engine, prioritize
|
||||
from core.engine import getwords
|
||||
from core.app import DupeGuru as DupeGuruBase
|
||||
from core.gui.result_table import ResultTable as ResultTableBase
|
||||
from core.gui.prioritize_dialog import PrioritizeDialog
|
||||
|
||||
|
||||
class DupeGuruView:
|
||||
|
@ -9,7 +9,7 @@ from pytest import raises, skip
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
try:
|
||||
from ..pe.block import avgdiff, getblocks2, NoBlocksError, DifferentBlockCountError
|
||||
from core.pe.block import avgdiff, getblocks2, NoBlocksError, DifferentBlockCountError
|
||||
except ImportError:
|
||||
skip("Can't import the block module, probably hasn't been compiled.")
|
||||
|
||||
|
@ -10,9 +10,9 @@ from pytest import raises, skip
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
try:
|
||||
from ..pe.cache import colors_to_string, string_to_colors
|
||||
from ..pe.cache_sqlite import SqliteCache
|
||||
from ..pe.cache_shelve import ShelveCache
|
||||
from core.pe.cache import colors_to_string, string_to_colors
|
||||
from core.pe.cache_sqlite import SqliteCache
|
||||
from core.pe.cache_shelve import ShelveCache
|
||||
except ImportError:
|
||||
skip("Can't import the cache module, probably hasn't been compiled.")
|
||||
|
||||
|
@ -14,14 +14,14 @@ from pathlib import Path
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.plat import ISWINDOWS
|
||||
|
||||
from ..fs import File
|
||||
from ..directories import (
|
||||
from core.fs import File
|
||||
from core.directories import (
|
||||
Directories,
|
||||
DirectoryState,
|
||||
AlreadyThereError,
|
||||
InvalidPathError,
|
||||
)
|
||||
from ..exclude import ExcludeList, ExcludeDict
|
||||
from core.exclude import ExcludeList, ExcludeDict
|
||||
|
||||
|
||||
def create_fake_fs(rootpath):
|
||||
|
@ -10,9 +10,9 @@ from hscommon.jobprogress import job
|
||||
from hscommon.util import first
|
||||
from hscommon.testutil import eq_, log_calls
|
||||
|
||||
from .base import NamedObject
|
||||
from .. import engine
|
||||
from ..engine import (
|
||||
from core.tests.base import NamedObject
|
||||
from core import engine
|
||||
from core.engine import (
|
||||
get_match,
|
||||
getwords,
|
||||
Group,
|
||||
|
@ -10,8 +10,8 @@ from xml.etree import ElementTree as ET
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.plat import ISWINDOWS
|
||||
|
||||
from .base import DupeGuru
|
||||
from ..exclude import ExcludeList, ExcludeDict, default_regexes, AlreadyThereException
|
||||
from core.tests.base import DupeGuru
|
||||
from core.exclude import ExcludeList, ExcludeDict, default_regexes, AlreadyThereException
|
||||
|
||||
from re import error
|
||||
|
||||
|
@ -13,7 +13,7 @@ from pathlib import Path
|
||||
from hscommon.testutil import eq_
|
||||
from core.tests.directories_test import create_fake_fs
|
||||
|
||||
from .. import fs
|
||||
from core import fs
|
||||
|
||||
hasher: typing.Callable
|
||||
try:
|
||||
|
@ -10,7 +10,7 @@ from xml.etree import ElementTree as ET
|
||||
from pytest import raises
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
from ..ignore import IgnoreList
|
||||
from core.ignore import IgnoreList
|
||||
|
||||
|
||||
def test_empty():
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
from ..markable import MarkableList, Markable
|
||||
from core.markable import MarkableList, Markable
|
||||
|
||||
|
||||
def gen():
|
||||
|
@ -9,8 +9,8 @@
|
||||
import os.path as op
|
||||
from itertools import combinations
|
||||
|
||||
from .base import TestApp, NamedObject, with_app, eq_
|
||||
from ..engine import Group, Match
|
||||
from core.tests.base import TestApp, NamedObject, with_app, eq_
|
||||
from core.engine import Group, Match
|
||||
|
||||
no = NamedObject
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from .base import TestApp, GetTestGroups
|
||||
from core.tests.base import TestApp, GetTestGroups
|
||||
|
||||
|
||||
def app_with_results():
|
||||
|
@ -12,10 +12,9 @@ from xml.etree import ElementTree as ET
|
||||
from pytest import raises
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.util import first
|
||||
|
||||
from .. import engine
|
||||
from .base import NamedObject, GetTestGroups, DupeGuru
|
||||
from ..results import Results
|
||||
from core import engine
|
||||
from core.tests.base import NamedObject, GetTestGroups, DupeGuru
|
||||
from core.results import Results
|
||||
|
||||
|
||||
class TestCaseResultsEmpty:
|
||||
|
@ -10,11 +10,11 @@ from hscommon.jobprogress import job
|
||||
from pathlib import Path
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
from .. import fs
|
||||
from ..engine import getwords, Match
|
||||
from ..ignore import IgnoreList
|
||||
from ..scanner import Scanner, ScanType
|
||||
from ..me.scanner import ScannerME
|
||||
from core import fs
|
||||
from core.engine import getwords, Match
|
||||
from core.ignore import IgnoreList
|
||||
from core.scanner import Scanner, ScanType
|
||||
from core.me.scanner import ScannerME
|
||||
|
||||
|
||||
class NamedObject:
|
||||
|
@ -21,7 +21,7 @@ import importlib
|
||||
from datetime import datetime
|
||||
import glob
|
||||
|
||||
from .plat import ISWINDOWS
|
||||
from hscommon.plat import ISWINDOWS
|
||||
|
||||
|
||||
def print_and_do(cmd):
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import copy
|
||||
|
||||
from .base import GUIObject
|
||||
from hscommon.gui.base import GUIObject
|
||||
|
||||
|
||||
class Column:
|
||||
|
@ -4,9 +4,9 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..jobprogress.performer import ThreadedJobPerformer
|
||||
from .base import GUIObject
|
||||
from .text_field import TextField
|
||||
from hscommon.jobprogress.performer import ThreadedJobPerformer
|
||||
from hscommon.gui.base import GUIObject
|
||||
from hscommon.gui.text_field import TextField
|
||||
|
||||
|
||||
class ProgressWindowView:
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
from collections.abc import Sequence, MutableSequence
|
||||
|
||||
from .base import GUIObject
|
||||
from hscommon.gui.base import GUIObject
|
||||
|
||||
|
||||
class Selectable(Sequence):
|
||||
|
@ -9,8 +9,8 @@
|
||||
from collections.abc import MutableSequence
|
||||
from collections import namedtuple
|
||||
|
||||
from .base import GUIObject
|
||||
from .selectable_list import Selectable
|
||||
from hscommon.gui.base import GUIObject
|
||||
from hscommon.gui.selectable_list import Selectable
|
||||
|
||||
|
||||
# We used to directly subclass list, but it caused problems at some point with deepcopy
|
||||
|
@ -5,8 +5,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from .base import GUIObject
|
||||
from ..util import nonone
|
||||
from hscommon.gui.base import GUIObject
|
||||
from hscommon.util import nonone
|
||||
|
||||
|
||||
class TextFieldView:
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
from collections.abc import MutableSequence
|
||||
|
||||
from .base import GUIObject
|
||||
from hscommon.gui.base import GUIObject
|
||||
|
||||
|
||||
class Node(MutableSequence):
|
||||
|
@ -9,7 +9,7 @@
|
||||
from threading import Thread
|
||||
import sys
|
||||
|
||||
from .job import Job, JobInProgressError, JobCancelled
|
||||
from hscommon.jobprogress.job import Job, JobInProgressError, JobCancelled
|
||||
|
||||
|
||||
class ThreadedJobPerformer:
|
||||
|
@ -5,21 +5,10 @@ import tempfile
|
||||
|
||||
import polib
|
||||
|
||||
from . import pygettext
|
||||
from hscommon import pygettext
|
||||
|
||||
LC_MESSAGES = "LC_MESSAGES"
|
||||
|
||||
# There isn't a 1-on-1 exact fit between .po language codes and cocoa ones
|
||||
PO2COCOA = {
|
||||
"pl_PL": "pl",
|
||||
"pt_BR": "pt-BR",
|
||||
"zh_CN": "zh-Hans",
|
||||
}
|
||||
|
||||
COCOA2PO = {v: k for k, v in PO2COCOA.items()}
|
||||
|
||||
STRING_EXT = ".strings"
|
||||
|
||||
|
||||
def get_langs(folder):
|
||||
return [name for name in os.listdir(folder) if op.isdir(op.join(folder, name))]
|
||||
|
@ -7,7 +7,7 @@
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
from .build import read_changelog_file, filereplace
|
||||
from hscommon.build import read_changelog_file, filereplace
|
||||
from sphinx.cmd.build import build_main as sphinx_build
|
||||
|
||||
CHANGELOG_FORMAT = """
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from ..conflict import (
|
||||
from hscommon.conflict import (
|
||||
get_conflicted_name,
|
||||
get_unconflicted_name,
|
||||
is_conflicted,
|
||||
@ -16,7 +16,7 @@ from ..conflict import (
|
||||
smart_move,
|
||||
)
|
||||
from pathlib import Path
|
||||
from ..testutil import eq_
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
|
||||
class TestCaseGetConflictedName:
|
||||
|
@ -4,8 +4,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..testutil import eq_
|
||||
from ..notify import Broadcaster, Listener, Repeater
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.notify import Broadcaster, Listener, Repeater
|
||||
|
||||
|
||||
class HelloListener(Listener):
|
||||
|
@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..path import pathify
|
||||
from hscommon.path import pathify
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..testutil import eq_, callcounter, CallLogger
|
||||
from ..gui.selectable_list import SelectableList, GUISelectableList
|
||||
from hscommon.testutil import eq_, callcounter, CallLogger
|
||||
from hscommon.gui.selectable_list import SelectableList, GUISelectableList
|
||||
|
||||
|
||||
def test_in():
|
||||
|
@ -13,8 +13,8 @@ import sqlite3 as sqlite
|
||||
|
||||
from pytest import raises
|
||||
|
||||
from ..testutil import eq_
|
||||
from ..sqlite import ThreadedConn
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.sqlite import ThreadedConn
|
||||
|
||||
# Threading is hard to test. In a lot of those tests, a failure means that the test run will
|
||||
# hang forever. Well... I don't know a better alternative.
|
||||
|
@ -6,8 +6,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..testutil import CallLogger, eq_
|
||||
from ..gui.table import Table, GUITable, Row
|
||||
from hscommon.testutil import CallLogger, eq_
|
||||
from hscommon.gui.table import Table, GUITable, Row
|
||||
|
||||
|
||||
class TestRow(Row):
|
||||
|
@ -6,8 +6,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..testutil import eq_
|
||||
from ..gui.tree import Tree, Node
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.gui.tree import Tree, Node
|
||||
|
||||
|
||||
def tree_with_some_nodes():
|
||||
|
@ -10,9 +10,9 @@ from io import StringIO
|
||||
|
||||
from pytest import raises
|
||||
|
||||
from ..testutil import eq_
|
||||
from hscommon.testutil import eq_
|
||||
from pathlib import Path
|
||||
from ..util import (
|
||||
from hscommon.util import (
|
||||
nonone,
|
||||
tryint,
|
||||
first,
|
||||
|
@ -8,28 +8,12 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import threading
|
||||
import py.path
|
||||
|
||||
|
||||
def eq_(a, b, msg=None):
|
||||
__tracebackhide__ = True
|
||||
assert a == b, msg or "{!r} != {!r}".format(a, b)
|
||||
|
||||
|
||||
def eq_sorted(a, b, msg=None):
|
||||
"""If both a and b are iterable sort them and compare using eq_, otherwise just pass them through to eq_ anyway."""
|
||||
try:
|
||||
eq_(sorted(a), sorted(b), msg)
|
||||
except TypeError:
|
||||
eq_(a, b, msg)
|
||||
|
||||
|
||||
def assert_almost_equal(a, b, places=7):
|
||||
__tracebackhide__ = True
|
||||
assert round(a, ndigits=places) == round(b, ndigits=places)
|
||||
|
||||
|
||||
def callcounter():
|
||||
def f(*args, **kwargs):
|
||||
f.callcount += 1
|
||||
@ -38,23 +22,6 @@ def callcounter():
|
||||
return f
|
||||
|
||||
|
||||
class TestData:
|
||||
def __init__(self, datadirpath):
|
||||
self.datadirpath = py.path.local(datadirpath)
|
||||
|
||||
def filepath(self, relative_path, *args):
|
||||
"""Returns the path of a file in testdata.
|
||||
|
||||
'relative_path' can be anything that can be added to a Path
|
||||
if args is not empty, it will be joined to relative_path
|
||||
"""
|
||||
resultpath = self.datadirpath.join(relative_path)
|
||||
if args:
|
||||
resultpath = resultpath.join(*args)
|
||||
assert resultpath.check()
|
||||
return str(resultpath)
|
||||
|
||||
|
||||
class CallLogger:
|
||||
"""This is a dummy object that logs all calls made to it.
|
||||
|
||||
@ -168,20 +135,6 @@ def app(request):
|
||||
return app
|
||||
|
||||
|
||||
def jointhreads():
|
||||
"""Join all threads to the main thread"""
|
||||
for thread in threading.enumerate():
|
||||
if hasattr(thread, "BUGGY"):
|
||||
continue
|
||||
if thread.getName() != "MainThread" and thread.isAlive():
|
||||
if hasattr(thread, "close"):
|
||||
thread.close()
|
||||
thread.join(1)
|
||||
if thread.isAlive():
|
||||
print("Thread problem. Some thread doesn't want to stop.")
|
||||
thread.BUGGY = True
|
||||
|
||||
|
||||
def _unify_args(func, args, kwargs, args_to_ignore=None):
|
||||
"""Unify args and kwargs in the same dictionary.
|
||||
|
||||
|
@ -13,7 +13,7 @@ import locale
|
||||
import logging
|
||||
import os.path as op
|
||||
|
||||
from .plat import ISLINUX
|
||||
from hscommon.plat import ISLINUX
|
||||
|
||||
_trfunc = None
|
||||
_trget = None
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
from math import ceil
|
||||
from pathlib import Path
|
||||
from .path import pathify, log_io_error
|
||||
from hscommon.path import pathify, log_io_error
|
||||
|
||||
from typing import IO, Any, Callable, Generator, Iterable, List, Tuple, Union
|
||||
|
||||
|
32
qt/app.py
32
qt/app.py
@ -21,22 +21,22 @@ from qt.progress_window import ProgressWindow
|
||||
|
||||
from core.app import AppMode, DupeGuru as DupeGuruModel
|
||||
import core.pe.photo
|
||||
from . import platform
|
||||
from .preferences import Preferences
|
||||
from .result_window import ResultWindow
|
||||
from .directories_dialog import DirectoriesDialog
|
||||
from .problem_dialog import ProblemDialog
|
||||
from .ignore_list_dialog import IgnoreListDialog
|
||||
from .exclude_list_dialog import ExcludeListDialog
|
||||
from .deletion_options import DeletionOptions
|
||||
from .se.details_dialog import DetailsDialog as DetailsDialogStandard
|
||||
from .me.details_dialog import DetailsDialog as DetailsDialogMusic
|
||||
from .pe.details_dialog import DetailsDialog as DetailsDialogPicture
|
||||
from .se.preferences_dialog import PreferencesDialog as PreferencesDialogStandard
|
||||
from .me.preferences_dialog import PreferencesDialog as PreferencesDialogMusic
|
||||
from .pe.preferences_dialog import PreferencesDialog as PreferencesDialogPicture
|
||||
from .pe.photo import File as PlatSpecificPhoto
|
||||
from .tabbed_window import TabBarWindow, TabWindow
|
||||
from qt import platform
|
||||
from qt.preferences import Preferences
|
||||
from qt.result_window import ResultWindow
|
||||
from qt.directories_dialog import DirectoriesDialog
|
||||
from qt.problem_dialog import ProblemDialog
|
||||
from qt.ignore_list_dialog import IgnoreListDialog
|
||||
from qt.exclude_list_dialog import ExcludeListDialog
|
||||
from qt.deletion_options import DeletionOptions
|
||||
from qt.se.details_dialog import DetailsDialog as DetailsDialogStandard
|
||||
from qt.me.details_dialog import DetailsDialog as DetailsDialogMusic
|
||||
from qt.pe.details_dialog import DetailsDialog as DetailsDialogPicture
|
||||
from qt.se.preferences_dialog import PreferencesDialog as PreferencesDialogStandard
|
||||
from qt.me.preferences_dialog import PreferencesDialog as PreferencesDialogMusic
|
||||
from qt.pe.preferences_dialog import PreferencesDialog as PreferencesDialogPicture
|
||||
from qt.pe.photo import File as PlatSpecificPhoto
|
||||
from qt.tabbed_window import TabBarWindow, TabWindow
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -10,7 +10,7 @@ from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QDockWidget, QWidget
|
||||
|
||||
from qt.util import move_to_screen_center
|
||||
from .details_table import DetailsModel
|
||||
from qt.details_table import DetailsModel
|
||||
from hscommon.plat import ISLINUX
|
||||
|
||||
|
||||
|
@ -31,8 +31,8 @@ from qt.radio_box import RadioBox
|
||||
from qt.recent import Recent
|
||||
from qt.util import move_to_screen_center, create_actions
|
||||
|
||||
from . import platform
|
||||
from .directories_model import DirectoriesModel, DirectoriesDelegate
|
||||
from qt import platform
|
||||
from qt.directories_model import DirectoriesModel, DirectoriesDelegate
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -16,7 +16,7 @@ from PyQt5.QtWidgets import (
|
||||
QSizePolicy,
|
||||
QHeaderView,
|
||||
)
|
||||
from .exclude_list_table import ExcludeListTable
|
||||
from qt.exclude_list_table import ExcludeListTable
|
||||
|
||||
from core.exclude import AlreadyThereException
|
||||
from hscommon.trans import trget
|
||||
|
@ -17,7 +17,7 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from hscommon.trans import trget
|
||||
from qt.util import horizontal_wrap
|
||||
from .ignore_list_table import IgnoreListTable
|
||||
from qt.ignore_list_table import IgnoreListTable
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -8,8 +8,8 @@ from PyQt5.QtCore import QSize
|
||||
from PyQt5.QtWidgets import QAbstractItemView
|
||||
|
||||
from hscommon.trans import trget
|
||||
from ..details_dialog import DetailsDialog as DetailsDialogBase
|
||||
from ..details_table import DetailsTable
|
||||
from qt.details_dialog import DetailsDialog as DetailsDialogBase
|
||||
from qt.details_table import DetailsTable
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -18,7 +18,7 @@ from hscommon.trans import trget
|
||||
from core.app import AppMode
|
||||
from core.scanner import ScanType
|
||||
|
||||
from ..preferences_dialog import PreferencesDialogBase
|
||||
from qt.preferences_dialog import PreferencesDialogBase
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from qt.column import Column
|
||||
from ..results_model import ResultsModel as ResultsModelBase
|
||||
from qt.results_model import ResultsModel as ResultsModelBase
|
||||
|
||||
|
||||
class ResultsModel(ResultsModelBase):
|
||||
|
@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ._block_qt import getblocks # NOQA
|
||||
from qt.pe._block_qt import getblocks # NOQA
|
||||
|
||||
# Converted to C
|
||||
# def getblock(image):
|
||||
|
@ -8,9 +8,9 @@ from PyQt5.QtCore import Qt, QSize, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtWidgets import QAbstractItemView, QSizePolicy, QGridLayout, QSplitter, QFrame
|
||||
from PyQt5.QtGui import QResizeEvent
|
||||
from hscommon.trans import trget
|
||||
from ..details_dialog import DetailsDialog as DetailsDialogBase
|
||||
from ..details_table import DetailsTable
|
||||
from .image_viewer import ViewerToolBar, ScrollAreaImageViewer, ScrollAreaController
|
||||
from qt.details_dialog import DetailsDialog as DetailsDialogBase
|
||||
from qt.details_table import DetailsTable
|
||||
from qt.pe.image_viewer import ViewerToolBar, ScrollAreaImageViewer, ScrollAreaController
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -10,7 +10,7 @@ from PyQt5.QtGui import QImage, QImageReader, QTransform
|
||||
|
||||
from core.pe.photo import Photo as PhotoBase
|
||||
|
||||
from .block import getblocks
|
||||
from qt.pe.block import getblocks
|
||||
|
||||
|
||||
class File(PhotoBase):
|
||||
|
@ -12,7 +12,7 @@ from qt.radio_box import RadioBox
|
||||
from core.scanner import ScanType
|
||||
from core.app import AppMode
|
||||
|
||||
from ..preferences_dialog import PreferencesDialogBase
|
||||
from qt.preferences_dialog import PreferencesDialogBase
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from qt.column import Column
|
||||
from ..results_model import ResultsModel as ResultsModelBase
|
||||
from qt.results_model import ResultsModel as ResultsModelBase
|
||||
|
||||
|
||||
class ResultsModel(ResultsModelBase):
|
||||
|
@ -37,7 +37,7 @@ from qt.util import horizontal_wrap, move_to_screen_center
|
||||
from qt.preferences import get_langnames
|
||||
from enum import Flag, auto
|
||||
|
||||
from .preferences import Preferences
|
||||
from qt.preferences import Preferences
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -21,7 +21,7 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from qt.util import move_to_screen_center
|
||||
from hscommon.trans import trget
|
||||
from .problem_table import ProblemTable
|
||||
from qt.problem_table import ProblemTable
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -28,12 +28,12 @@ from qt.util import move_to_screen_center, horizontal_wrap, create_actions
|
||||
from qt.search_edit import SearchEdit
|
||||
|
||||
from core.app import AppMode
|
||||
from .results_model import ResultsView
|
||||
from .stats_label import StatsLabel
|
||||
from .prioritize_dialog import PrioritizeDialog
|
||||
from .se.results_model import ResultsModel as ResultsModelStandard
|
||||
from .me.results_model import ResultsModel as ResultsModelMusic
|
||||
from .pe.results_model import ResultsModel as ResultsModelPicture
|
||||
from qt.results_model import ResultsView
|
||||
from qt.stats_label import StatsLabel
|
||||
from qt.prioritize_dialog import PrioritizeDialog
|
||||
from qt.se.results_model import ResultsModel as ResultsModelStandard
|
||||
from qt.me.results_model import ResultsModel as ResultsModelMusic
|
||||
from qt.pe.results_model import ResultsModel as ResultsModelPicture
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -8,8 +8,8 @@ from PyQt5.QtCore import QSize
|
||||
from PyQt5.QtWidgets import QAbstractItemView
|
||||
|
||||
from hscommon.trans import trget
|
||||
from ..details_dialog import DetailsDialog as DetailsDialogBase
|
||||
from ..details_table import DetailsTable
|
||||
from qt.details_dialog import DetailsDialog as DetailsDialogBase
|
||||
from qt.details_table import DetailsTable
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -20,7 +20,7 @@ from hscommon.trans import trget
|
||||
from core.app import AppMode
|
||||
from core.scanner import ScanType
|
||||
|
||||
from ..preferences_dialog import PreferencesDialogBase
|
||||
from qt.preferences_dialog import PreferencesDialogBase
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from qt.column import Column
|
||||
from ..results_model import ResultsModel as ResultsModelBase
|
||||
from qt.results_model import ResultsModel as ResultsModelBase
|
||||
|
||||
|
||||
class ResultsModel(ResultsModelBase):
|
||||
|
@ -15,10 +15,10 @@ from PyQt5.QtWidgets import (
|
||||
)
|
||||
from hscommon.trans import trget
|
||||
from qt.util import move_to_screen_center, create_actions
|
||||
from .directories_dialog import DirectoriesDialog
|
||||
from .result_window import ResultWindow
|
||||
from .ignore_list_dialog import IgnoreListDialog
|
||||
from .exclude_list_dialog import ExcludeListDialog
|
||||
from qt.directories_dialog import DirectoriesDialog
|
||||
from qt.result_window import ResultWindow
|
||||
from qt.ignore_list_dialog import IgnoreListDialog
|
||||
from qt.exclude_list_dialog import ExcludeListDialog
|
||||
|
||||
tr = trget("ui")
|
||||
|
||||
|
@ -15,7 +15,7 @@ from PyQt5.QtCore import (
|
||||
QItemSelection,
|
||||
)
|
||||
|
||||
from .column import Columns, Column
|
||||
from qt.column import Columns, Column
|
||||
|
||||
|
||||
class Table(QAbstractTableModel):
|
||||
|
Loading…
Reference in New Issue
Block a user