diff --git a/qt/base/app.py b/qt/base/app.py index 5bc86c6c..189a62a9 100644 --- a/qt/base/app.py +++ b/qt/base/app.py @@ -28,6 +28,7 @@ from . import platform from .main_window import MainWindow from .directories_dialog import DirectoriesDialog +from .problem_dialog import ProblemDialog JOBID2TITLE = { JOB_SCAN: "Scanning for duplicates", @@ -71,6 +72,7 @@ class DupeGuru(DupeGuruBase, QObject): self._progress = Progress(self.main_window) self.directories_dialog = DirectoriesDialog(self.main_window, self) self.details_dialog = self._create_details_dialog(self.main_window) + self.problemDialog = ProblemDialog(parent=self.main_window, app=self) self.preferences_dialog = self._create_preferences_dialog(self.main_window) self.about_box = AboutBox(self.main_window, self) @@ -206,9 +208,12 @@ class DupeGuru(DupeGuruBase, QObject): def job_finished(self, jobid): self._job_completed(jobid) - if jobid in (JOB_MOVE, JOB_COPY, JOB_DELETE) and self.last_op_error_count > 0: - msg = "{0} files could not be processed.".format(self.results.mark_count) - QMessageBox.warning(self.main_window, 'Warning', msg) + if jobid in (JOB_MOVE, JOB_COPY, JOB_DELETE): + if self.results.problems: + self.problemDialog.show() + else: + msg = "All files were processed successfully." + QMessageBox.information(self.main_window, 'Operation Complete', msg) elif jobid == JOB_SCAN: if not self.results.groups: title = "Scanning complete" diff --git a/qt/base/problem_dialog.py b/qt/base/problem_dialog.py new file mode 100644 index 00000000..bb2ce294 --- /dev/null +++ b/qt/base/problem_dialog.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Created By: Virgil Dupras +# Created On: 2010-04-12 +# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) +# +# This software is licensed under the "HS" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at +# http://www.hardcoded.net/licenses/hs_license + +from PyQt4.QtCore import Qt +from PyQt4.QtGui import QDialog + +from core.gui.problem_dialog import ProblemDialog as ProblemDialogModel +from .problem_table import ProblemTable +from .problem_dialog_ui import Ui_ProblemDialog + +class ProblemDialog(QDialog, Ui_ProblemDialog): + def __init__(self, parent, app): + flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint + QDialog.__init__(self, parent, flags) + self.app = app + self._setupUi() + self.model = ProblemDialogModel(view=self, app=app) + self.table = ProblemTable(problem_dialog=self, view=self.tableView) + self.model.connect() + self.table.model.connect() + + self.revealButton.clicked.connect(self.model.reveal_selected_dupe) + + def _setupUi(self): + self.setupUi(self) + diff --git a/qt/base/problem_dialog.ui b/qt/base/problem_dialog.ui new file mode 100644 index 00000000..65cc24bf --- /dev/null +++ b/qt/base/problem_dialog.ui @@ -0,0 +1,116 @@ + + + ProblemDialog + + + + 0 + 0 + 413 + 323 + + + + Problems! + + + + + + There were problems processing some (or all) of the files. The cause of these problems are described in the table below. Those files were not removed from your results. + + + true + + + + + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 18 + + + false + + + 18 + + + true + + + false + + + + + + + + + Reveal Selected + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + true + + + + + + + + + + + closeButton + clicked() + ProblemDialog + accept() + + + 367 + 301 + + + 272 + 299 + + + + + diff --git a/qt/base/problem_table.py b/qt/base/problem_table.py new file mode 100644 index 00000000..8f35cf08 --- /dev/null +++ b/qt/base/problem_table.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Created By: Virgil Dupras +# Created On: 2010-04-12 +# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) +# +# This software is licensed under the "HS" License as described in the "LICENSE" file, +# which should be included with this package. The terms are also available at +# http://www.hardcoded.net/licenses/hs_license + +from qtlib.column import Column +from qtlib.table import Table +from core.gui.problem_table import ProblemTable as ProblemTableModel + +class ProblemTable(Table): + COLUMNS = [ + Column('path', 'File Path', 150), + Column('msg', 'Error Message', 150), + ] + + def __init__(self, problem_dialog, view): + model = ProblemTableModel(view=self, problem_dialog=problem_dialog.model) + Table.__init__(self, model, view) + # we have to prevent Return from initiating editing. + # self.view.editSelected = lambda: None + \ No newline at end of file