@@ -79,7 +79,7 @@ def possibleToolLocations():
7979 if path .startswith (b'/usr/bin' ): continue
8080 if path in locations : continue
8181 locations .append (path )
82- return locations
82+ return [ pth . decode ( 'utf-8' ) for pth in locations ]
8383
8484
8585
@@ -155,7 +155,6 @@ def bindingsChanged_(self, sender):
155155
156156 def checkAutosave (self ):
157157 enabled = get_default ('autosave' )
158- print ('autosave ==' , enabled )
159158 if enabled :
160159 self .autosaveEnabledRadio .setState_ (NSOnState )
161160 else :
@@ -165,9 +164,6 @@ def checkAutosave(self):
165164 @IBAction
166165 def autosaveChanged_ (self , sender ):
167166 enabled = sender .tag () == 1
168- print ('autosave ->' , enabled )
169- set_default ('autosave' , enabled )
170- # self._notify('AutosaveChanged')
171167
172168 def checkThemes (self ):
173169 light = sorted ([t for t ,m in THEMES .items () if not m ['dark' ]], reverse = True )
@@ -230,10 +226,9 @@ def fontChanged_(self, sender):
230226
231227 def checkTool (self ):
232228 found , valid , action = self ._tool
233-
234229 self .toolAction .setTitle_ (action .title ())
235230 self .toolPath .setSelectable_ (found is not None )
236- self .toolPath .setStringValue_ (found .decode ( 'utf8 ' ) if found else '' )
231+ self .toolPath .setStringValue_ (found .replace ( os . environ [ 'HOME' ], '~ ' ) if found else '' )
237232 self .toolPath .setTextColor_ (NSColor .labelColor () if valid else NSColor .systemRedColor ())
238233 self .toolBoilerplate .setHidden_ (found is not None )
239234 self .toolPath .setHidden_ (found is None )
@@ -244,7 +239,7 @@ def _tool(self):
244239 for path in possibleToolLocations ():
245240 if os .path .islink (path ):
246241 # if it's a symlink, make sure it points to this bundle
247- tool_path = os .path .realpath (path ). decode ( 'utf8' )
242+ tool_path = os .path .realpath (path )
248243 found = path
249244 valid = tool_path .startswith (bundle_path ())
250245 if valid :
@@ -267,9 +262,9 @@ def toolChanged_(self, sender):
267262 found , _ , action = self ._tool
268263
269264 if action == 'reveal' :
270- os .system (b'open --reveal "%s"' % found )
265+ os .system (b'open --reveal "%s"' % found . encode ( 'utf-8' ) )
271266 elif action in ('install' , 'repair' ):
272- locs = [loc .decode ( 'utf8' ). replace (os .environ ['HOME' ], '~' ) for loc in possibleToolLocations ()]
267+ locs = [loc .replace (os .environ ['HOME' ], '~' ) for loc in possibleToolLocations ()]
273268 self .toolInstallMenu .removeAllItems ()
274269 self .toolInstallMenu .addItemsWithTitles_ (locs )
275270 NSApp ().beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_ (self .toolInstallSheet , self .window (), self , None , 0 )
0 commit comments