mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +00:00 
			
		
		
		
	Fixed broken dgme-cocoa and replaced JOB_* consts with JobType const class.
This commit is contained in:
		
							parent
							
								
									3b4ea50119
								
							
						
					
					
						commit
						0da1947902
					
				| @ -72,12 +72,6 @@ | ||||
| 		CEB5E07813225C89009F521D /* ExtraFairwareReminder.m in Sources */ = {isa = PBXBuildFile; fileRef = CEB5E07613225C89009F521D /* ExtraFairwareReminder.m */; }; | ||||
| 		CEB5E07D13225CA2009F521D /* ExtraFairwareReminder.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEB5E07B13225CA2009F521D /* ExtraFairwareReminder.xib */; }; | ||||
| 		CEC481F21423FBC600034F91 /* columns.strings in Resources */ = {isa = PBXBuildFile; fileRef = CEC481ED1423FBC600034F91 /* columns.strings */; }; | ||||
| 		CEC481F31423FBC600034F91 /* help in Resources */ = {isa = PBXBuildFile; fileRef = CE073F5409CAE1A3005C1D2F /* help */; }; | ||||
| 		CEC481F41423FBC600034F91 /* dg_cocoa.plugin in Resources */ = {isa = PBXBuildFile; fileRef = CE381CF509915304003581CE /* dg_cocoa.plugin */; }; | ||||
| 		CEC481F51423FBC600034F91 /* folder32.png in Resources */ = {isa = PBXBuildFile; fileRef = CEFC294509C89E3D00D9F998 /* folder32.png */; }; | ||||
| 		CECE37A61423EA980005187F /* DetailsPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE05330D12E5D3ED0029EF25 /* DetailsPanel.xib */; }; | ||||
| 		CECE37A71423EA980005187F /* DirectoryPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE05330F12E5D3ED0029EF25 /* DirectoryPanel.xib */; }; | ||||
| 		CECE37A81423EA980005187F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE05331112E5D3ED0029EF25 /* MainMenu.xib */; }; | ||||
| 		CEDF07A3112493B200EE5BC0 /* StatsLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = CEDF07A2112493B200EE5BC0 /* StatsLabel.m */; }; | ||||
| 		CEEB135209C837A2004D2330 /* dupeguru.icns in Resources */ = {isa = PBXBuildFile; fileRef = CEEB135109C837A2004D2330 /* dupeguru.icns */; }; | ||||
| 		CEF3185913D8660000B8CDCA /* about.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEF3185513D8660000B8CDCA /* about.xib */; }; | ||||
| @ -582,13 +576,7 @@ | ||||
| 				CEF3185913D8660000B8CDCA /* about.xib in Resources */, | ||||
| 				CEF3185A13D8660000B8CDCA /* ErrorReportWindow.xib in Resources */, | ||||
| 				CE84C9BD1423AF200050A6AD /* PrioritizeDialog.xib in Resources */, | ||||
| 				CECE37A61423EA980005187F /* DetailsPanel.xib in Resources */, | ||||
| 				CECE37A71423EA980005187F /* DirectoryPanel.xib in Resources */, | ||||
| 				CECE37A81423EA980005187F /* MainMenu.xib in Resources */, | ||||
| 				CEC481F21423FBC600034F91 /* columns.strings in Resources */, | ||||
| 				CEC481F31423FBC600034F91 /* help in Resources */, | ||||
| 				CEC481F41423FBC600034F91 /* dg_cocoa.plugin in Resources */, | ||||
| 				CEC481F51423FBC600034F91 /* folder32.png in Resources */, | ||||
| 			); | ||||
| 			runOnlyForDeploymentPostprocessing = 0; | ||||
| 		}; | ||||
|  | ||||
							
								
								
									
										26
									
								
								core/app.py
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								core/app.py
									
									
									
									
									
								
							| @ -25,12 +25,6 @@ from hscommon.trans import tr | ||||
| 
 | ||||
| from . import directories, results, scanner, export, fs | ||||
| 
 | ||||
| JOB_SCAN = 'job_scan' | ||||
| JOB_LOAD = 'job_load' | ||||
| JOB_MOVE = 'job_move' | ||||
| JOB_COPY = 'job_copy' | ||||
| JOB_DELETE = 'job_delete' | ||||
| 
 | ||||
| HAD_FIRST_LAUNCH_PREFERENCE = 'HadFirstLaunch' | ||||
| DEBUG_MODE_PREFERENCE = 'DebugMode' | ||||
| 
 | ||||
| @ -42,6 +36,12 @@ class DestType: | ||||
|     Relative = 1 | ||||
|     Absolute = 2 | ||||
| 
 | ||||
| class JobType: | ||||
|     Scan = 'job_scan' | ||||
|     Load = 'job_load' | ||||
|     Move = 'job_move' | ||||
|     Copy = 'job_copy' | ||||
|     Delete = 'job_delete' | ||||
| 
 | ||||
| Column = namedtuple('Column', 'attr display') | ||||
| 
 | ||||
| @ -158,12 +158,12 @@ class DupeGuru(RegistrableApplication, Broadcaster): | ||||
|      | ||||
|     def _job_completed(self, jobid): | ||||
|         # Must be called by subclasses when they detect that an async job is completed. | ||||
|         if jobid == JOB_SCAN: | ||||
|         if jobid == JobType.Scan: | ||||
|             self._results_changed() | ||||
|         elif jobid in {JOB_LOAD, JOB_MOVE, JOB_DELETE}: | ||||
|         elif jobid in {JobType.Load, JobType.Move, JobType.Delete}: | ||||
|             self._results_changed() | ||||
|          | ||||
|         if jobid in {JOB_COPY, JOB_MOVE, JOB_DELETE}: | ||||
|         if jobid in {JobType.Copy, JobType.Move, JobType.Delete}: | ||||
|             self.notify('problems_changed') | ||||
|      | ||||
|     @staticmethod | ||||
| @ -256,12 +256,12 @@ class DupeGuru(RegistrableApplication, Broadcaster): | ||||
|             self.results.perform_on_marked(op, not copy) | ||||
|          | ||||
|         self.show_extra_fairware_reminder_if_needed() | ||||
|         jobid = JOB_COPY if copy else JOB_MOVE | ||||
|         jobid = JobType.Copy if copy else JobType.Move | ||||
|         self.view.start_job(jobid, do) | ||||
|      | ||||
|     def delete_marked(self, replace_with_hardlinks=False): | ||||
|         self.show_extra_fairware_reminder_if_needed() | ||||
|         self.view.start_job(JOB_DELETE, self._do_delete, args=[replace_with_hardlinks]) | ||||
|         self.view.start_job(JobType.Delete, self._do_delete, args=[replace_with_hardlinks]) | ||||
|      | ||||
|     def export_to_xhtml(self, column_ids): | ||||
|         column_ids = [colid for colid in column_ids if colid.isdigit()] | ||||
| @ -320,7 +320,7 @@ class DupeGuru(RegistrableApplication, Broadcaster): | ||||
|     def load_from(self, filename): | ||||
|         def do(j): | ||||
|             self.results.load_from_xml(filename, self._get_file, j) | ||||
|         self.view.start_job(JOB_LOAD, do) | ||||
|         self.view.start_job(JobType.Load, do) | ||||
|      | ||||
|     def make_selected_reference(self): | ||||
|         dupes = self.without_ref(self.selected_dupes) | ||||
| @ -420,7 +420,7 @@ class DupeGuru(RegistrableApplication, Broadcaster): | ||||
|             raise NoScannableFileError() | ||||
|         self.results.groups = [] | ||||
|         self._results_changed() | ||||
|         self.view.start_job(JOB_SCAN, do) | ||||
|         self.view.start_job(JobType.Scan, do) | ||||
|      | ||||
|     def toggle_selected_mark_state(self): | ||||
|         for dupe in self.selected_dupes: | ||||
|  | ||||
| @ -26,14 +26,14 @@ from .gui.result_table import ResultTable | ||||
| from .gui.stats_label import StatsLabel | ||||
| from .gui.extra_fairware_reminder import ExtraFairwareReminder | ||||
| from .gui.prioritize_dialog import PrioritizeDialog | ||||
| from . import app | ||||
| from .app import JobType | ||||
| 
 | ||||
| JOBID2TITLE = { | ||||
|     app.JOB_SCAN: tr("Scanning for duplicates"), | ||||
|     app.JOB_LOAD: tr("Loading"), | ||||
|     app.JOB_MOVE: tr("Moving"), | ||||
|     app.JOB_COPY: tr("Copying"), | ||||
|     app.JOB_DELETE: tr("Sending to Trash"), | ||||
|     JobType.Scan: tr("Scanning for duplicates"), | ||||
|     JobType.Load: tr("Loading"), | ||||
|     JobType.Move: tr("Moving"), | ||||
|     JobType.Copy: tr("Copying"), | ||||
|     JobType.Delete: tr("Sending to Trash"), | ||||
| } | ||||
| 
 | ||||
| class PyDupeGuruBase(PyFairware): | ||||
|  | ||||
| @ -6,9 +6,9 @@ | ||||
| # http://www.hardcoded.net/licenses/bsd_license | ||||
| 
 | ||||
| from hscommon.trans import tr as trbase | ||||
| from hscommon.util import format_size | ||||
| from hscommon.util import format_size, format_time | ||||
| 
 | ||||
| from core.app import (DupeGuru as DupeGuruBase, Column, format_time, format_timestamp, | ||||
| from core.app import (DupeGuru as DupeGuruBase, Column, format_timestamp, | ||||
|     format_perc, format_words, format_dupe_count, cmp_value) | ||||
| from . import prioritize | ||||
| from . import __appname__ | ||||
|  | ||||
| @ -14,17 +14,18 @@ import os.path as op | ||||
| from hscommon.cocoa import as_fetch | ||||
| from hscommon.trans import tr | ||||
| 
 | ||||
| from core.app import JobType | ||||
| from core.app_cocoa import JOBID2TITLE | ||||
| 
 | ||||
| from . import scanner, fs | ||||
| from .app import DupeGuru as DupeGuruBase | ||||
| 
 | ||||
| JOB_REMOVE_DEAD_TRACKS = 'jobRemoveDeadTracks' | ||||
| JOB_SCAN_DEAD_TRACKS = 'jobScanDeadTracks' | ||||
| JobType.RemoveDeadTracks = 'jobRemoveDeadTracks' | ||||
| JobType.ScanDeadTracks = 'jobScanDeadTracks' | ||||
| 
 | ||||
| JOBID2TITLE.update({ | ||||
|     JOB_REMOVE_DEAD_TRACKS: tr("Removing dead tracks from your iTunes Library"), | ||||
|     JOB_SCAN_DEAD_TRACKS: tr("Scanning the iTunes Library"), | ||||
|     JobType.RemoveDeadTracks: tr("Removing dead tracks from your iTunes Library"), | ||||
|     JobType.ScanDeadTracks: tr("Scanning the iTunes Library"), | ||||
| }) | ||||
| 
 | ||||
| class DupeGuruME(DupeGuruBase): | ||||
| @ -47,7 +48,7 @@ class DupeGuruME(DupeGuruBase): | ||||
|                 except CommandError as e: | ||||
|                     logging.warning('Error while trying to remove a track from iTunes: %s' % str(e)) | ||||
|          | ||||
|         self._start_job(JOB_REMOVE_DEAD_TRACKS, do) | ||||
|         self.view.start_job(JobType.RemoveDeadTracks, do) | ||||
|      | ||||
|     def scan_dead_tracks(self): | ||||
|         def do(j): | ||||
| @ -68,5 +69,5 @@ class DupeGuruME(DupeGuruBase): | ||||
|                     self.dead_tracks.append(track) | ||||
|             logging.info('Found %d dead tracks' % len(self.dead_tracks)) | ||||
|          | ||||
|         self._start_job(JOB_SCAN_DEAD_TRACKS, do) | ||||
|         self.view.start_job(JobType.ScanDeadTracks, do) | ||||
|      | ||||
|  | ||||
| @ -19,7 +19,7 @@ from jobprogress import job | ||||
| from jobprogress.qt import Progress | ||||
| from hscommon.trans import tr, trmsg | ||||
| 
 | ||||
| from core.app import JOB_SCAN, JOB_LOAD, JOB_MOVE, JOB_COPY, JOB_DELETE | ||||
| from core.app import JobType | ||||
| 
 | ||||
| from qtlib.about_box import AboutBox | ||||
| from qtlib.recent import Recent | ||||
| @ -33,11 +33,11 @@ from .problem_dialog import ProblemDialog | ||||
| from .util import createActions | ||||
| 
 | ||||
| JOBID2TITLE = { | ||||
|     JOB_SCAN: tr("Scanning for duplicates"), | ||||
|     JOB_LOAD: tr("Loading"), | ||||
|     JOB_MOVE: tr("Moving"), | ||||
|     JOB_COPY: tr("Copying"), | ||||
|     JOB_DELETE: tr("Sending files to the recycle bin"), | ||||
|     JobType.Scan: tr("Scanning for duplicates"), | ||||
|     JobType.Load: tr("Loading"), | ||||
|     JobType.Move: tr("Moving"), | ||||
|     JobType.Copy: tr("Copying"), | ||||
|     JobType.Delete: tr("Sending files to the recycle bin"), | ||||
| } | ||||
| 
 | ||||
| class SysWrapper(io.IOBase): | ||||
| @ -209,20 +209,20 @@ class DupeGuru(QObject): | ||||
|      | ||||
|     def job_finished(self, jobid): | ||||
|         self.model._job_completed(jobid) | ||||
|         if jobid in (JOB_MOVE, JOB_COPY, JOB_DELETE): | ||||
|         if jobid in {JobType.Move, JobType.Copy, JobType.Delete}: | ||||
|             if self.model.results.problems: | ||||
|                 self.problemDialog.show() | ||||
|             else: | ||||
|                 msg = trmsg("OperationSuccessMsg") | ||||
|                 QMessageBox.information(self.resultWindow, tr("Operation Complete"), msg) | ||||
|         elif jobid == JOB_SCAN: | ||||
|         elif jobid == JobType.Scan: | ||||
|             if not self.model.results.groups: | ||||
|                 title = tr("Scan complete") | ||||
|                 msg = trmsg("NoDuplicateFoundMsg") | ||||
|                 QMessageBox.information(self.resultWindow, title, msg) | ||||
|             else: | ||||
|                 self.showResultsWindow() | ||||
|         elif jobid == JOB_LOAD: | ||||
|         elif jobid == JobType.Load: | ||||
|             self.showResultsWindow() | ||||
|      | ||||
|     def openDebugLogTriggered(self): | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user