mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 22:51:39 +00:00
Replaced objcmin with objp-based proxy.
--HG-- branch : objp
This commit is contained in:
@@ -2,10 +2,8 @@ import logging
|
||||
|
||||
from jobprogress import job
|
||||
from hscommon import cocoa
|
||||
from hscommon.cocoa import install_exception_hook
|
||||
from hscommon.cocoa import install_exception_hook, proxy
|
||||
from hscommon.cocoa.inter import signature, subproxy, PyFairware
|
||||
from hscommon.cocoa.objcmin import (NSNotificationCenter, NSSearchPathForDirectoriesInDomains,
|
||||
NSApplicationSupportDirectory, NSUserDomainMask, NSWorkspace)
|
||||
from hscommon.trans import trget
|
||||
|
||||
from core.app import JobType
|
||||
@@ -25,7 +23,7 @@ class PyDupeGuruBase(PyFairware):
|
||||
def _init(self, modelclass):
|
||||
logging.basicConfig(level=logging.WARNING, format='%(levelname)s %(message)s')
|
||||
install_exception_hook()
|
||||
appdata = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, True)[0]
|
||||
appdata = proxy.getAppdataPath()
|
||||
self.py = modelclass(self, appdata)
|
||||
self.progress = cocoa.ThreadedJobPerformer()
|
||||
|
||||
@@ -166,10 +164,10 @@ class PyDupeGuruBase(PyFairware):
|
||||
|
||||
#--- model --> view
|
||||
def open_path(self, path):
|
||||
NSWorkspace.sharedWorkspace().openFile_(str(path))
|
||||
proxy.openPath_(str(path))
|
||||
|
||||
def reveal_path(self, path):
|
||||
NSWorkspace.sharedWorkspace().selectFile_inFileViewerRootedAtPath_(str(path), '')
|
||||
proxy.revealPath_(str(path))
|
||||
|
||||
def start_job(self, jobid, func, args=()):
|
||||
try:
|
||||
@@ -177,10 +175,10 @@ class PyDupeGuruBase(PyFairware):
|
||||
args = tuple([j] + list(args))
|
||||
self.progress.run_threaded(func, args=args)
|
||||
except job.JobInProgressError:
|
||||
NSNotificationCenter.defaultCenter().postNotificationName_object_('JobInProgress', self)
|
||||
proxy.postNotification_userInfo_('JobInProgress', None)
|
||||
else:
|
||||
ud = {'desc': JOBID2TITLE[jobid], 'jobid':jobid}
|
||||
NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_('JobStarted', self, ud)
|
||||
proxy.postNotification_userInfo_('JobStarted', ud)
|
||||
|
||||
def show_extra_fairware_reminder(self):
|
||||
self.cocoa.showExtraFairwareReminder()
|
||||
|
||||
@@ -16,7 +16,7 @@ from appscript import app, its, CommandError, ApplicationNotFoundError
|
||||
from hscommon import io
|
||||
from hscommon.util import remove_invalid_xml
|
||||
from hscommon.path import Path
|
||||
from hscommon.cocoa.objcmin import NSUserDefaults, NSURL
|
||||
from hscommon.cocoa import proxy
|
||||
from hscommon.trans import tr
|
||||
|
||||
from core import directories
|
||||
@@ -49,14 +49,11 @@ class IPhoto(Photo):
|
||||
return IPHOTO_PATH
|
||||
|
||||
def get_iphoto_database_path():
|
||||
ud = NSUserDefaults.standardUserDefaults()
|
||||
prefs = ud.persistentDomainForName_('com.apple.iApps')
|
||||
if prefs is None:
|
||||
plisturls = proxy.prefValue_inDomain_('iPhotoRecentDatabases', 'com.apple.iApps')
|
||||
if not plisturls:
|
||||
raise directories.InvalidPathError()
|
||||
if 'iPhotoRecentDatabases' not in prefs:
|
||||
raise directories.InvalidPathError()
|
||||
plisturl = NSURL.URLWithString_(prefs['iPhotoRecentDatabases'][0])
|
||||
return Path(plisturl.path())
|
||||
plistpath = proxy.url2path_(plisturls[0])
|
||||
return Path(plistpath)
|
||||
|
||||
def get_iphoto_pictures(plistpath):
|
||||
if not io.exists(plistpath):
|
||||
|
||||
@@ -11,18 +11,17 @@ import os.path as op
|
||||
|
||||
from hscommon import io
|
||||
from hscommon.path import Path
|
||||
from hscommon.cocoa.objcmin import NSWorkspace
|
||||
from hscommon.cocoa import proxy
|
||||
|
||||
from core import fs
|
||||
from core.directories import Directories as DirectoriesBase, DirectoryState
|
||||
from core_se.app import DupeGuru as DupeGuruBase
|
||||
|
||||
def is_bundle(str_path):
|
||||
sw = NSWorkspace.sharedWorkspace()
|
||||
uti, error = sw.typeOfFile_error_(str_path, None)
|
||||
if error is not None:
|
||||
uti = proxy.getUTI_(str_path)
|
||||
if uti is None:
|
||||
logging.warning('There was an error trying to detect the UTI of %s', str_path)
|
||||
return sw.type_conformsToType_(uti, 'com.apple.bundle') or sw.type_conformsToType_(uti, 'com.apple.package')
|
||||
return proxy.type_conformsToType_(uti, 'com.apple.bundle') or proxy.type_conformsToType_(uti, 'com.apple.package')
|
||||
|
||||
class Bundle(fs.Folder):
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user