From d4919054f99582ca52a227f72a57486ca2424669 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 31 May 2016 21:59:31 -0400 Subject: [PATCH] qt: move qt.base units into qt root package --- .gitignore | 8 ++------ build.py | 4 ++-- core/__init__.py | 2 ++ core_me/__init__.py | 3 --- core_pe/__init__.py | 2 -- core_se/__init__.py | 3 --- qt/{base => }/app.py | 14 +++++++------- qt/base/__init__.py | 0 qt/base/dg.qrc | 13 ------------- qt/{base => }/deletion_options.py | 0 qt/{base => }/details_dialog.py | 0 qt/{base => }/details_table.py | 0 qt/dg.qrc | 9 +++++++++ qt/{base => }/directories_dialog.py | 0 qt/{base => }/directories_model.py | 0 qt/{base => }/ignore_list_dialog.py | 0 qt/{base => }/ignore_list_table.py | 0 qt/me/details_dialog.py | 16 +++++++-------- qt/me/preferences_dialog.py | 2 +- qt/me/results_model.py | 5 ++--- qt/pe/details_dialog.py | 30 ++++++++++++++--------------- qt/pe/preferences_dialog.py | 2 +- qt/pe/results_model.py | 5 ++--- qt/{base => }/platform.py | 0 qt/{base => }/preferences.py | 0 qt/{base => }/preferences_dialog.py | 0 qt/{base => }/prioritize_dialog.py | 0 qt/{base => }/problem_dialog.py | 0 qt/{base => }/problem_table.py | 0 qt/{base => }/result_window.py | 6 +++--- qt/{base => }/results_model.py | 0 qt/run_template.py | 10 +++++----- qt/se/details_dialog.py | 16 +++++++-------- qt/se/preferences_dialog.py | 2 +- qt/se/results_model.py | 5 ++--- qt/{base => }/stats_label.py | 0 36 files changed, 67 insertions(+), 90 deletions(-) rename qt/{base => }/app.py (95%) delete mode 100644 qt/base/__init__.py delete mode 100644 qt/base/dg.qrc rename qt/{base => }/deletion_options.py (100%) rename qt/{base => }/details_dialog.py (100%) rename qt/{base => }/details_table.py (100%) create mode 100644 qt/dg.qrc rename qt/{base => }/directories_dialog.py (100%) rename qt/{base => }/directories_model.py (100%) rename qt/{base => }/ignore_list_dialog.py (100%) rename qt/{base => }/ignore_list_table.py (100%) rename qt/{base => }/platform.py (100%) rename qt/{base => }/preferences.py (100%) rename qt/{base => }/preferences_dialog.py (100%) rename qt/{base => }/prioritize_dialog.py (100%) rename qt/{base => }/problem_dialog.py (100%) rename qt/{base => }/problem_table.py (100%) rename qt/{base => }/result_window.py (98%) rename qt/{base => }/results_model.py (100%) rename qt/{base => }/stats_label.py (100%) diff --git a/.gitignore b/.gitignore index 831c9fe5..da5cda66 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,21 @@ .DS_Store -*.pyc +__pycache__ *.so *.mo *.pyd *.waf* .lock-waf* -.idea .tox build dist -install -installer_tmp-cache env /deps cocoa/autogen /run.py -/conf.json /cocoa/*/Info.plist /cocoa/*/build -/qt/base/*_rc.py +/qt/*_rc.py /help/*/conf.py /help/*/changelog.rst diff --git a/build.py b/build.py index faab84d4..6f74c349 100644 --- a/build.py +++ b/build.py @@ -171,8 +171,8 @@ def build_qt(dev): print("Building localizations") build_localizations('qt') print("Building Qt stuff") - print_and_do("pyrcc5 {0} > {1}".format(op.join('qt', 'base', 'dg.qrc'), op.join('qt', 'base', 'dg_rc.py'))) - fix_qt_resource_file(op.join('qt', 'base', 'dg_rc.py')) + print_and_do("pyrcc5 {0} > {1}".format(op.join('qt', 'dg.qrc'), op.join('qt', 'dg_rc.py'))) + fix_qt_resource_file(op.join('qt', 'dg_rc.py')) build_help() print("Creating the run.py file") shutil.copy(op.join('qt', 'run_template.py'), 'run.py') diff --git a/core/__init__.py b/core/__init__.py index 8b137891..8b0777bf 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -1 +1,3 @@ +__version__ = '3.9.1' +__appname__ = 'dupeGuru' diff --git a/core_me/__init__.py b/core_me/__init__.py index f48793de..e69de29b 100644 --- a/core_me/__init__.py +++ b/core_me/__init__.py @@ -1,3 +0,0 @@ -__version__ = '6.8.1' -__appname__ = 'dupeGuru Music Edition' - diff --git a/core_pe/__init__.py b/core_pe/__init__.py index 65652dfa..e69de29b 100644 --- a/core_pe/__init__.py +++ b/core_pe/__init__.py @@ -1,2 +0,0 @@ -__version__ = '2.10.1' -__appname__ = 'dupeGuru Picture Edition' diff --git a/core_se/__init__.py b/core_se/__init__.py index 8b0777bf..e69de29b 100644 --- a/core_se/__init__.py +++ b/core_se/__init__.py @@ -1,3 +0,0 @@ -__version__ = '3.9.1' -__appname__ = 'dupeGuru' - diff --git a/qt/base/app.py b/qt/app.py similarity index 95% rename from qt/base/app.py rename to qt/app.py index 514a622b..077c8034 100644 --- a/qt/base/app.py +++ b/qt/app.py @@ -28,13 +28,13 @@ from .directories_dialog import DirectoriesDialog from .problem_dialog import ProblemDialog from .ignore_list_dialog import IgnoreListDialog 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 .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 tr = trget('ui') diff --git a/qt/base/__init__.py b/qt/base/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/qt/base/dg.qrc b/qt/base/dg.qrc deleted file mode 100644 index f506b64a..00000000 --- a/qt/base/dg.qrc +++ /dev/null @@ -1,13 +0,0 @@ - - - ../../images/dgpe_logo_32.png - ../../images/dgpe_logo_128.png - ../../images/dgme_logo_32.png - ../../images/dgme_logo_128.png - ../../images/dgse_logo_32.png - ../../images/dgse_logo_128.png - ../../images/plus_8.png - ../../images/minus_8.png - ../../qtlib/images/search_clear_13.png - - \ No newline at end of file diff --git a/qt/base/deletion_options.py b/qt/deletion_options.py similarity index 100% rename from qt/base/deletion_options.py rename to qt/deletion_options.py diff --git a/qt/base/details_dialog.py b/qt/details_dialog.py similarity index 100% rename from qt/base/details_dialog.py rename to qt/details_dialog.py diff --git a/qt/base/details_table.py b/qt/details_table.py similarity index 100% rename from qt/base/details_table.py rename to qt/details_table.py diff --git a/qt/dg.qrc b/qt/dg.qrc new file mode 100644 index 00000000..545a9806 --- /dev/null +++ b/qt/dg.qrc @@ -0,0 +1,9 @@ + + + ../images/dgse_logo_32.png + ../images/dgse_logo_128.png + ../images/plus_8.png + ../images/minus_8.png + ../qtlib/images/search_clear_13.png + + diff --git a/qt/base/directories_dialog.py b/qt/directories_dialog.py similarity index 100% rename from qt/base/directories_dialog.py rename to qt/directories_dialog.py diff --git a/qt/base/directories_model.py b/qt/directories_model.py similarity index 100% rename from qt/base/directories_model.py rename to qt/directories_model.py diff --git a/qt/base/ignore_list_dialog.py b/qt/ignore_list_dialog.py similarity index 100% rename from qt/base/ignore_list_dialog.py rename to qt/ignore_list_dialog.py diff --git a/qt/base/ignore_list_table.py b/qt/ignore_list_table.py similarity index 100% rename from qt/base/ignore_list_table.py rename to qt/ignore_list_table.py diff --git a/qt/me/details_dialog.py b/qt/me/details_dialog.py index 9f1ca2bf..61ccca1e 100644 --- a/qt/me/details_dialog.py +++ b/qt/me/details_dialog.py @@ -1,17 +1,15 @@ -# Created By: Virgil Dupras -# Created On: 2009-04-27 -# Copyright 2015 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "GPLv3" License as described in the "LICENSE" file, -# which should be included with this package. The terms are also available at +# Copyright 2016 Hardcoded Software (http://www.hardcoded.net) +# +# This software is licensed under the "GPLv3" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html from PyQt5.QtCore import QSize from PyQt5.QtWidgets import QVBoxLayout, QAbstractItemView from hscommon.trans import trget -from ..base.details_dialog import DetailsDialog as DetailsDialogBase -from ..base.details_table import DetailsTable +from ..details_dialog import DetailsDialog as DetailsDialogBase +from ..details_table import DetailsTable tr = trget('ui') @@ -28,4 +26,4 @@ class DetailsDialog(DetailsDialogBase): self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) self.tableView.setShowGrid(False) self.verticalLayout.addWidget(self.tableView) - + diff --git a/qt/me/preferences_dialog.py b/qt/me/preferences_dialog.py index 3b5caf0e..9eaa1712 100644 --- a/qt/me/preferences_dialog.py +++ b/qt/me/preferences_dialog.py @@ -13,7 +13,7 @@ from hscommon.trans import trget from core.app import AppMode from core.scanner import ScanType -from ..base.preferences_dialog import PreferencesDialogBase +from ..preferences_dialog import PreferencesDialogBase tr = trget('ui') diff --git a/qt/me/results_model.py b/qt/me/results_model.py index 552e0afe..1fe58741 100644 --- a/qt/me/results_model.py +++ b/qt/me/results_model.py @@ -1,12 +1,11 @@ -# Created On: 2011-11-27 -# Copyright 2015 Hardcoded Software (http://www.hardcoded.net) +# Copyright 2016 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html from qtlib.column import Column -from ..base.results_model import ResultsModel as ResultsModelBase +from ..results_model import ResultsModel as ResultsModelBase class ResultsModel(ResultsModelBase): COLUMNS = [ diff --git a/qt/pe/details_dialog.py b/qt/pe/details_dialog.py index 8d032a60..7820e6ac 100644 --- a/qt/pe/details_dialog.py +++ b/qt/pe/details_dialog.py @@ -1,9 +1,7 @@ -# Created By: Virgil Dupras -# Created On: 2009-04-27 -# Copyright 2015 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "GPLv3" License as described in the "LICENSE" file, -# which should be included with this package. The terms are also available at +# Copyright 2016 Hardcoded Software (http://www.hardcoded.net) +# +# This software is licensed under the "GPLv3" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html from PyQt5.QtCore import Qt, QSize @@ -11,8 +9,8 @@ from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QVBoxLayout, QAbstractItemView, QHBoxLayout, QLabel, QSizePolicy from hscommon.trans import trget -from ..base.details_dialog import DetailsDialog as DetailsDialogBase -from ..base.details_table import DetailsTable +from ..details_dialog import DetailsDialog as DetailsDialogBase +from ..details_table import DetailsTable tr = trget('ui') @@ -21,7 +19,7 @@ class DetailsDialog(DetailsDialogBase): DetailsDialogBase.__init__(self, parent, app) self.selectedPixmap = None self.referencePixmap = None - + def _setupUi(self): self.setWindowTitle(tr("Details")) self.resize(502, 295) @@ -61,21 +59,21 @@ class DetailsDialog(DetailsDialogBase): self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) self.tableView.setShowGrid(False) self.verticalLayout.addWidget(self.tableView) - + def _update(self): if not self.app.model.selected_dupes: return dupe = self.app.model.selected_dupes[0] group = self.app.model.results.get_group_of_duplicate(dupe) ref = group.ref - + self.selectedPixmap = QPixmap(str(dupe.path)) if ref is dupe: self.referencePixmap = None else: self.referencePixmap = QPixmap(str(ref.path)) self._updateImages() - + def _updateImages(self): if self.selectedPixmap is not None: target_size = self.selectedImage.size() @@ -89,18 +87,18 @@ class DetailsDialog(DetailsDialogBase): self.referenceImage.setPixmap(scaledPixmap) else: self.referenceImage.setPixmap(QPixmap()) - + #--- Override def resizeEvent(self, event): self._updateImages() - + def show(self): DetailsDialogBase.show(self) self._update() - + # model --> view def refresh(self): DetailsDialogBase.refresh(self) if self.isVisible(): self._update() - + diff --git a/qt/pe/preferences_dialog.py b/qt/pe/preferences_dialog.py index 18ee9a80..047c4948 100644 --- a/qt/pe/preferences_dialog.py +++ b/qt/pe/preferences_dialog.py @@ -8,7 +8,7 @@ from hscommon.trans import trget from core.scanner import ScanType from core.app import AppMode -from ..base.preferences_dialog import PreferencesDialogBase +from ..preferences_dialog import PreferencesDialogBase tr = trget('ui') diff --git a/qt/pe/results_model.py b/qt/pe/results_model.py index c9f9d415..caec1a93 100644 --- a/qt/pe/results_model.py +++ b/qt/pe/results_model.py @@ -1,12 +1,11 @@ -# Created On: 2011-11-27 -# Copyright 2015 Hardcoded Software (http://www.hardcoded.net) +# Copyright 2016 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html from qtlib.column import Column -from ..base.results_model import ResultsModel as ResultsModelBase +from ..results_model import ResultsModel as ResultsModelBase class ResultsModel(ResultsModelBase): COLUMNS = [ diff --git a/qt/base/platform.py b/qt/platform.py similarity index 100% rename from qt/base/platform.py rename to qt/platform.py diff --git a/qt/base/preferences.py b/qt/preferences.py similarity index 100% rename from qt/base/preferences.py rename to qt/preferences.py diff --git a/qt/base/preferences_dialog.py b/qt/preferences_dialog.py similarity index 100% rename from qt/base/preferences_dialog.py rename to qt/preferences_dialog.py diff --git a/qt/base/prioritize_dialog.py b/qt/prioritize_dialog.py similarity index 100% rename from qt/base/prioritize_dialog.py rename to qt/prioritize_dialog.py diff --git a/qt/base/problem_dialog.py b/qt/problem_dialog.py similarity index 100% rename from qt/base/problem_dialog.py rename to qt/problem_dialog.py diff --git a/qt/base/problem_table.py b/qt/problem_table.py similarity index 100% rename from qt/base/problem_table.py rename to qt/problem_table.py diff --git a/qt/base/result_window.py b/qt/result_window.py similarity index 98% rename from qt/base/result_window.py rename to qt/result_window.py index b496ed42..529aee14 100644 --- a/qt/base/result_window.py +++ b/qt/result_window.py @@ -17,12 +17,12 @@ from qtlib.util import moveToScreenCenter, horizontalWrap, createActions from qtlib.search_edit import SearchEdit from core.app import AppMode -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 .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 tr = trget('ui') diff --git a/qt/base/results_model.py b/qt/results_model.py similarity index 100% rename from qt/base/results_model.py rename to qt/results_model.py diff --git a/qt/run_template.py b/qt/run_template.py index 7954d9c9..7e42a474 100644 --- a/qt/run_template.py +++ b/qt/run_template.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -# Copyright 2015 Hardcoded Software (http://www.hardcoded.net) +# Copyright 2016 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at @@ -16,9 +16,9 @@ from PyQt5.QtWidgets import QApplication from hscommon.trans import install_gettext_trans_under_qt from qtlib.error_report_dialog import install_excepthook from qtlib.util import setupQtLogging -from qt.base import dg_rc -from qt.base.platform import BASE_PATH -from core_se import __version__, __appname__ +from qt import dg_rc +from qt.platform import BASE_PATH +from core import __version__, __appname__ def main(): app = QApplication(sys.argv) @@ -32,7 +32,7 @@ def main(): install_gettext_trans_under_qt(locale_folder, lang) # Many strings are translated at import time, so this is why we only import after the translator # has been installed - from qt.base.app import DupeGuru + from qt.app import DupeGuru app.setWindowIcon(QIcon(QPixmap(":/{0}".format(DupeGuru.LOGO_NAME)))) dgapp = DupeGuru() install_excepthook('https://github.com/hsoft/dupeguru/issues') diff --git a/qt/se/details_dialog.py b/qt/se/details_dialog.py index 7810e795..d715a3a4 100644 --- a/qt/se/details_dialog.py +++ b/qt/se/details_dialog.py @@ -1,17 +1,15 @@ -# Created By: Virgil Dupras -# Created On: 2009-05-24 -# Copyright 2015 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "GPLv3" License as described in the "LICENSE" file, -# which should be included with this package. The terms are also available at +# Copyright 2016 Hardcoded Software (http://www.hardcoded.net) +# +# This software is licensed under the "GPLv3" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html from PyQt5.QtCore import QSize from PyQt5.QtWidgets import QVBoxLayout, QAbstractItemView from hscommon.trans import trget -from ..base.details_dialog import DetailsDialog as DetailsDialogBase -from ..base.details_table import DetailsTable +from ..details_dialog import DetailsDialog as DetailsDialogBase +from ..details_table import DetailsTable tr = trget('ui') @@ -28,4 +26,4 @@ class DetailsDialog(DetailsDialogBase): self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) self.tableView.setShowGrid(False) self.verticalLayout.addWidget(self.tableView) - + diff --git a/qt/se/preferences_dialog.py b/qt/se/preferences_dialog.py index 9daf276e..62db72d4 100644 --- a/qt/se/preferences_dialog.py +++ b/qt/se/preferences_dialog.py @@ -16,7 +16,7 @@ from hscommon.util import tryint from core.app import AppMode from core.scanner import ScanType -from ..base.preferences_dialog import PreferencesDialogBase +from ..preferences_dialog import PreferencesDialogBase tr = trget('ui') diff --git a/qt/se/results_model.py b/qt/se/results_model.py index 85f720d8..24c6f077 100644 --- a/qt/se/results_model.py +++ b/qt/se/results_model.py @@ -1,12 +1,11 @@ -# Created On: 2011-11-27 -# Copyright 2015 Hardcoded Software (http://www.hardcoded.net) +# Copyright 2016 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/gpl-3.0.html from qtlib.column import Column -from ..base.results_model import ResultsModel as ResultsModelBase +from ..results_model import ResultsModel as ResultsModelBase class ResultsModel(ResultsModelBase): COLUMNS = [ diff --git a/qt/base/stats_label.py b/qt/stats_label.py similarity index 100% rename from qt/base/stats_label.py rename to qt/stats_label.py