mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Added extra Fairware reminder. We'll see if that boosts dupeGuru contributions.
This commit is contained in:
@@ -150,6 +150,9 @@ class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
def _set_default(self, key_name, value):
|
||||
raise NotImplementedError()
|
||||
|
||||
def _show_extra_fairware_reminder(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
#--- Public
|
||||
def add_directory(self, d):
|
||||
try:
|
||||
@@ -178,6 +181,10 @@ class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
self.results.apply_filter(filter)
|
||||
self._results_changed()
|
||||
|
||||
def show_extra_fairware_reminder_if_needed(self):
|
||||
if self.results.mark_count > 100 and self.should_show_fairware_reminder:
|
||||
self._show_extra_fairware_reminder()
|
||||
|
||||
def clean_empty_dirs(self, path):
|
||||
if self.options['clean_empty_dirs']:
|
||||
while delete_if_empty(path, ['.DS_Store']):
|
||||
@@ -216,10 +223,12 @@ class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
j.start_job(self.results.mark_count)
|
||||
self.results.perform_on_marked(op, not copy)
|
||||
|
||||
self.show_extra_fairware_reminder_if_needed()
|
||||
jobid = JOB_COPY if copy else JOB_MOVE
|
||||
self._start_job(jobid, do)
|
||||
|
||||
def delete_marked(self, replace_with_hardlinks=False):
|
||||
self.show_extra_fairware_reminder_if_needed()
|
||||
self._start_job(JOB_DELETE, self._do_delete, replace_with_hardlinks)
|
||||
|
||||
def export_to_xhtml(self, column_ids):
|
||||
|
||||
@@ -64,6 +64,9 @@ class DupeGuru(app.DupeGuru):
|
||||
def _set_default(self, key_name, value):
|
||||
NSUserDefaults.standardUserDefaults().setObject_forKey_(value, key_name)
|
||||
|
||||
def _show_extra_fairware_reminder(self):
|
||||
NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_('ShowExtraFairwareReminder', self, None)
|
||||
|
||||
#--- Public
|
||||
def start_scanning(self):
|
||||
self._select_dupes([])
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2010-02-02
|
||||
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
|
||||
@@ -17,6 +16,7 @@ from .gui.problem_dialog import ProblemDialog
|
||||
from .gui.problem_table import ProblemTable
|
||||
from .gui.result_table import ResultTable
|
||||
from .gui.stats_label import StatsLabel
|
||||
from .gui.extra_fairware_reminder import ExtraFairwareReminder
|
||||
|
||||
class PyDupeGuruBase(PyFairware):
|
||||
#---Directories
|
||||
@@ -236,3 +236,26 @@ class PyProblemDialog(PyGUIObject):
|
||||
|
||||
class PyProblemTable(PyTable):
|
||||
py_class = ProblemTable
|
||||
|
||||
class PyExtraFairwareReminder(PyGUIObject):
|
||||
py_class = ExtraFairwareReminder
|
||||
|
||||
def start(self):
|
||||
self.py.start()
|
||||
|
||||
def updateButton(self):
|
||||
self.py.update_button()
|
||||
|
||||
# model --> view
|
||||
def start_timer(self):
|
||||
self.cocoa.startTimer()
|
||||
|
||||
def stop_timer(self):
|
||||
self.cocoa.stopTimer()
|
||||
|
||||
def enable_button(self):
|
||||
self.cocoa.enableButton()
|
||||
|
||||
def set_button_text(self, text):
|
||||
self.cocoa.setButtonText_(text)
|
||||
|
||||
|
||||
30
core/gui/extra_fairware_reminder.py
Normal file
30
core/gui/extra_fairware_reminder.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2011-03-04
|
||||
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
|
||||
#
|
||||
# This software is licensed under the "BSD" 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/bsd_license
|
||||
|
||||
import time
|
||||
|
||||
from hscommon.trans import tr
|
||||
from .base import GUIObject
|
||||
|
||||
class ExtraFairwareReminder(GUIObject):
|
||||
def start(self):
|
||||
self.start_time = time.time()
|
||||
self.view.start_timer()
|
||||
|
||||
def update_button(self):
|
||||
elapsed = time.time() - self.start_time
|
||||
remaining = 60 - round(elapsed)
|
||||
if remaining > 0:
|
||||
text = tr("Continue ({})").format(remaining)
|
||||
else:
|
||||
text = tr("Continue")
|
||||
self.view.enable_button()
|
||||
self.view.stop_timer()
|
||||
self.view.set_button_text(text)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user