1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 22:51:39 +00:00

Pushed job_finished logic down from GUI layers to the core.

This commit is contained in:
Virgil Dupras
2012-03-09 13:47:28 -05:00
parent 5fb7742cf4
commit ef0a66f794
6 changed files with 50 additions and 60 deletions

View File

@@ -218,6 +218,11 @@ http://www.hardcoded.net/licenses/bsd_license
return [Dialogs askYesNo:prompt] == NSAlertFirstButtonReturn;
}
- (void)showProblemDialog
{
[[self resultWindow] showProblemDialog];
}
- (void)setupAsRegistered
{
// Nothing to do.

View File

@@ -42,6 +42,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)fillColumnsMenu;
- (void)sendMarkedToTrash:(BOOL)hardlinkDeleted;
- (void)updateOptionSegments;
- (void)showProblemDialog;
/* Actions */
- (IBAction)clearIgnoreList:(id)sender;
@@ -74,7 +75,4 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)toggleDetailsPanel:(id)sender;
- (IBAction)togglePowerMarker:(id)sender;
- (IBAction)toggleQuicklookPanel:(id)sender;
/* Notifications */
- (void)jobCompleted:(NSNotification *)aNotification;
@end

View File

@@ -32,7 +32,6 @@ http://www.hardcoded.net/licenses/bsd_license
[matches setTarget:self];
[matches setDoubleAction:@selector(openClicked:)];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobCompleted:) name:JobCompletedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobStarted:) name:JobStarted object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobInProgress:) name:JobInProgress object:nil];
return self;
@@ -104,6 +103,11 @@ http://www.hardcoded.net/licenses/bsd_license
[optionsSwitch setSelected:[table deltaValuesMode] forSegment:2];
}
- (void)showProblemDialog
{
[problemDialog showWindow:self];
}
/* Actions */
- (IBAction)clearIgnoreList:(id)sender
{
@@ -377,42 +381,6 @@ http://www.hardcoded.net/licenses/bsd_license
previewPanel = nil;
}
/* Notifications */
- (void)jobCompleted:(NSNotification *)aNotification
{
id lastAction = [[ProgressController mainProgressController] jobId];
if ([lastAction isEqualTo:jobCopy]) {
if ([model scanWasProblematic]) {
[problemDialog showWindow:self];
}
else {
[Dialogs showMessage:TR(@"All marked files were copied sucessfully.")];
}
}
else if ([lastAction isEqualTo:jobMove]) {
if ([model scanWasProblematic]) {
[problemDialog showWindow:self];
}
else {
[Dialogs showMessage:TR(@"All marked files were moved sucessfully.")];
}
}
else if ([lastAction isEqualTo:jobDelete]) {
if ([model scanWasProblematic]) {
[problemDialog showWindow:self];
}
else {
[Dialogs showMessage:TR(@"All marked files were sucessfully sent to Trash.")];
}
}
else if ([lastAction isEqualTo:jobScan]) {
NSInteger rowCount = [[table model] numberOfRows];
if (rowCount == 0) {
[Dialogs showMessage:TR(@"No duplicates found.")];
}
}
}
- (void)jobInProgress:(NSNotification *)aNotification
{
[Dialogs showMessage:TR(@"A previous action is still hanging in there. You can't start a new one yet. Wait a few seconds, then try again.")];

View File

@@ -21,6 +21,7 @@ JOBID2TITLE = {
class DupeGuruView(FairwareView):
def askYesNoWithPrompt_(self, prompt: str) -> bool: pass
def showProblemDialog(self): pass
class PyDupeGuruBase(PyFairware):
FOLLOW_PROTOCOLS = ['Worker']
@@ -128,9 +129,6 @@ class PyDupeGuruBase(PyFairware):
def getMarkCount(self) -> int:
return self.model.results.mark_count
def scanWasProblematic(self) -> bool:
return bool(self.model.results.problems)
def resultsAreModified(self) -> bool:
return self.model.results.is_modified
@@ -197,3 +195,14 @@ class PyDupeGuruBase(PyFairware):
def ask_yes_no(self, prompt):
return self.callback.askYesNoWithPrompt_(prompt)
@dontwrap
def show_results_window(self):
# Not needed yet because our progress dialog is shown as a sheet of the results window,
# which causes it to be already visible when the scan/load ends.
# XXX Make progress sheet be a child of the folder selection window.
pass
@dontwrap
def show_problem_dialog(self):
self.callback.showProblemDialog()