diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-05-16 05:41:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-05-16 05:41:54 +0400 |
commit | 3d2701178ee23a7dc31c842c0330961f2c1311b8 (patch) | |
tree | 345af6bb937364317363833d863579451aa5c8e1 /release | |
parent | aad369c8f9f90e7370893dc7c962c0efde293157 (diff) |
Win32 image opening was broken with the default settings.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/image_edit.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/release/scripts/image_edit.py b/release/scripts/image_edit.py index 17dc182d235..862a2840648 100644 --- a/release/scripts/image_edit.py +++ b/release/scripts/image_edit.py @@ -57,34 +57,58 @@ from Blender import Image, sys, Draw, Registry def main(): image = Image.GetCurrent() if not image: # Image is None - print 'ERROR: You must select an active Image.' + Draw.PupMenu('ERROR: You must select an active Image.') return + if image.packed: + Draw.PupMenu('ERROR: Image is packed, unpack before editing.') + return + imageFileName = sys.expandpath( image.filename ) + if not sys.exists(imageFileName): + Draw.PupMenu('ERROR: Image path does not exist.') + return + pupblock = [imageFileName.split('/')[-1].split('\\')[-1]] + new_text= False try: appstring = Registry.GetKey('ExternalImageEditor', True) appstring = appstring['path'] + + # for ZanQdo if he removed the path from the textbox totaly. ;) - Cam + if not appstring or appstring.find('%f')==-1: + new_text= True except: + new_text= True + + if new_text: pupblock.append('first time, set path.') if platform == 'win32': - appstring = 'start "%f"' + appstring = 'start "" /B "%f"' elif platform == 'darwin': appstring = 'open "%f"' else: appstring = 'gimp-remote "%f"' appstring_but = Draw.Create(appstring) + save_default_but = Draw.Create(0) pupblock.append(('editor: ', appstring_but, 0, 48, 'Path to application, %f will be replaced with the image path.')) + pupblock.append(('Set Default', save_default_but, 'Store this path in the blender registry.')) if not Draw.PupBlock('External Image Editor...', pupblock): return appstring = appstring_but.val + save_default= save_default_but.val + + if save_default: + Registry.SetKey('ExternalImageEditor', {'path':appstring}, True) - Registry.SetKey('ExternalImageEditor', {'path':appstring}, True) + if appstring.find('%f') == -1: + Draw.PupMenu('ERROR: The comment you entered did not contain the filename ("%f")') + return # ------------------------------- |