mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 13:44:37 +00:00
Added the problem dialog to the Qt side.
This commit is contained in:
parent
454ce604ad
commit
699023992c
@ -28,6 +28,7 @@ from . import platform
|
|||||||
|
|
||||||
from .main_window import MainWindow
|
from .main_window import MainWindow
|
||||||
from .directories_dialog import DirectoriesDialog
|
from .directories_dialog import DirectoriesDialog
|
||||||
|
from .problem_dialog import ProblemDialog
|
||||||
|
|
||||||
JOBID2TITLE = {
|
JOBID2TITLE = {
|
||||||
JOB_SCAN: "Scanning for duplicates",
|
JOB_SCAN: "Scanning for duplicates",
|
||||||
@ -71,6 +72,7 @@ class DupeGuru(DupeGuruBase, QObject):
|
|||||||
self._progress = Progress(self.main_window)
|
self._progress = Progress(self.main_window)
|
||||||
self.directories_dialog = DirectoriesDialog(self.main_window, self)
|
self.directories_dialog = DirectoriesDialog(self.main_window, self)
|
||||||
self.details_dialog = self._create_details_dialog(self.main_window)
|
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.preferences_dialog = self._create_preferences_dialog(self.main_window)
|
||||||
self.about_box = AboutBox(self.main_window, self)
|
self.about_box = AboutBox(self.main_window, self)
|
||||||
|
|
||||||
@ -206,9 +208,12 @@ class DupeGuru(DupeGuruBase, QObject):
|
|||||||
|
|
||||||
def job_finished(self, jobid):
|
def job_finished(self, jobid):
|
||||||
self._job_completed(jobid)
|
self._job_completed(jobid)
|
||||||
if jobid in (JOB_MOVE, JOB_COPY, JOB_DELETE) and self.last_op_error_count > 0:
|
if jobid in (JOB_MOVE, JOB_COPY, JOB_DELETE):
|
||||||
msg = "{0} files could not be processed.".format(self.results.mark_count)
|
if self.results.problems:
|
||||||
QMessageBox.warning(self.main_window, 'Warning', msg)
|
self.problemDialog.show()
|
||||||
|
else:
|
||||||
|
msg = "All files were processed successfully."
|
||||||
|
QMessageBox.information(self.main_window, 'Operation Complete', msg)
|
||||||
elif jobid == JOB_SCAN:
|
elif jobid == JOB_SCAN:
|
||||||
if not self.results.groups:
|
if not self.results.groups:
|
||||||
title = "Scanning complete"
|
title = "Scanning complete"
|
||||||
|
32
qt/base/problem_dialog.py
Normal file
32
qt/base/problem_dialog.py
Normal file
@ -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)
|
||||||
|
|
116
qt/base/problem_dialog.ui
Normal file
116
qt/base/problem_dialog.ui
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ProblemDialog</class>
|
||||||
|
<widget class="QDialog" name="ProblemDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>413</width>
|
||||||
|
<height>323</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Problems!</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>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.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tableView">
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderDefaultSectionSize">
|
||||||
|
<number>18</number>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderHighlightSections">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderDefaultSectionSize">
|
||||||
|
<number>18</number>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderHighlightSections">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="revealButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reveal Selected</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="closeButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Close</string>
|
||||||
|
</property>
|
||||||
|
<property name="default">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>closeButton</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>ProblemDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>367</x>
|
||||||
|
<y>301</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>272</x>
|
||||||
|
<y>299</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
25
qt/base/problem_table.py
Normal file
25
qt/base/problem_table.py
Normal file
@ -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
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user