diff --git a/cocoa/me/dg_cocoa.py b/cocoa/me/dg_cocoa.py index 00ca67e6..999c4f99 100644 --- a/cocoa/me/dg_cocoa.py +++ b/cocoa/me/dg_cocoa.py @@ -5,7 +5,7 @@ # http://www.hardcoded.net/licenses/hs_license import objc -from AppKit import * +from Foundation import NSObject from core_me.app_cocoa import DupeGuruME from core.scanner import (SCAN_TYPE_FILENAME, SCAN_TYPE_FIELDS, SCAN_TYPE_FIELDS_NO_ORDER, diff --git a/cocoa/pe/dg_cocoa.py b/cocoa/pe/dg_cocoa.py index 6d39ba92..4b88c53d 100644 --- a/cocoa/pe/dg_cocoa.py +++ b/cocoa/pe/dg_cocoa.py @@ -5,7 +5,7 @@ # http://www.hardcoded.net/licenses/hs_license import objc -from AppKit import * +from Foundation import NSObject from core_pe import app_cocoa as app_pe_cocoa diff --git a/cocoa/se/dg_cocoa.py b/cocoa/se/dg_cocoa.py index ba4dd8e2..7102d50b 100644 --- a/cocoa/se/dg_cocoa.py +++ b/cocoa/se/dg_cocoa.py @@ -5,7 +5,7 @@ # http://www.hardcoded.net/licenses/hs_license import objc -from AppKit import * +from Foundation import NSObject from core_se.app_cocoa import DupeGuru from core import scanner diff --git a/core/app_cocoa.py b/core/app_cocoa.py index 422c82cc..a5277116 100644 --- a/core/app_cocoa.py +++ b/core/app_cocoa.py @@ -7,12 +7,12 @@ # http://www.hardcoded.net/licenses/hs_license import objc -from Foundation import * -from AppKit import * +from Foundation import (NSNotificationCenter, NSUserDefaults, NSSearchPathForDirectoriesInDomains, + NSApplicationSupportDirectory, NSUserDomainMask) import logging import os.path as op -from hsutil import io, cocoa, job +from hsutil import cocoa, job from hsutil.cocoa import install_exception_hook from hsutil.misc import stripnone from hsutil.reg import RegistrationRequired @@ -53,6 +53,8 @@ class DupeGuru(app.DupeGuru): #--- Override @staticmethod def _recycle_dupe(dupe): + # local import because first appkit import takes a lot of memory. we want to avoid it. + from AppKit import NSWorkspace, NSWorkspaceRecycleOperation directory = unicode(dupe.path[:-1]) filename = dupe.name if objc.__version__ == '1.4': # For a while, we have to support this. @@ -114,6 +116,8 @@ class DupeGuru(app.DupeGuru): self.make_reference(self.selected_dupes) def OpenSelected(self): + # local import because first appkit import takes a lot of memory. we want to avoid it. + from AppKit import NSWorkspace if self.selected_dupes: path = unicode(self.selected_dupes[0].path) NSWorkspace.sharedWorkspace().openFile_(path) @@ -149,6 +153,8 @@ class DupeGuru(app.DupeGuru): return False def RevealSelected(self): + # local import because first appkit import takes a lot of memory. we want to avoid it. + from AppKit import NSWorkspace if self.selected_dupes: path = unicode(self.selected_dupes[0].path) NSWorkspace.sharedWorkspace().selectFile_inFileViewerRootedAtPath_(path,'') diff --git a/core_pe/app_cocoa.py b/core_pe/app_cocoa.py index ebd71755..54db2e14 100644 --- a/core_pe/app_cocoa.py +++ b/core_pe/app_cocoa.py @@ -11,7 +11,7 @@ import logging import plistlib import re -from AppKit import NSBundle, NSUserDefaults, NSURL +from Foundation import NSBundle, NSUserDefaults, NSURL from appscript import app, k, CommandError from hsutil import io diff --git a/core_se/app_cocoa.py b/core_se/app_cocoa.py index 10885cff..689b230c 100644 --- a/core_se/app_cocoa.py +++ b/core_se/app_cocoa.py @@ -11,11 +11,10 @@ from __future__ import unicode_literals import logging import objc -from AppKit import * +from AppKit import NSWorkspace from hsutil import io from hsutil.path import Path -from hsutil.str import get_file_ext from core import fs from core.app_cocoa import DupeGuru as DupeGuruBase