diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-11 04:24:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-11 04:24:16 +0300 |
commit | 9c032756e9243f7c62b6a2b0dd1e2c319e0affcd (patch) | |
tree | 99fcf3fd8ad5ee34b6b278409933e4f3d0eb1d2f /release | |
parent | 1008137f724902dbd5041caf8660432b3e5e1549 (diff) |
when checking for windows check sys.platform starts with "win" rather then '== "win32"' & avoid importing platform.
also add some notes to CMake options.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/op/image.py | 15 | ||||
-rw-r--r-- | release/scripts/op/screen_play_rendered_anim.py | 14 | ||||
-rw-r--r-- | release/scripts/op/wm.py | 2 | ||||
-rw-r--r-- | release/scripts/ui/space_info.py | 2 |
4 files changed, 12 insertions, 21 deletions
diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index e1d471f8254..67188e9c5fb 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -31,25 +31,20 @@ class EditExternally(bpy.types.Operator): filepath = StringProperty(name="File Path", description="Path to an image file", maxlen=1024, default="") def _editor_guess(self, context): - import platform - try: - system = platform.system() - except UnicodeDecodeError: - import sys - system = sys.platform + import sys image_editor = context.user_preferences.filepaths.image_editor # use image editor in the preferences when available. if not image_editor: - if system in ('Windows', 'win32'): + if sys.platform[:3] == "win": image_editor = ["start"] # not tested! - elif system == 'Darwin': + elif sys.platform == "darwin": image_editor = ["open"] else: image_editor = ["gimp"] else: - if system == 'Darwin': + if sys.platform == "darwin": # blender file selector treats .app as a folder # and will include a trailing backslash, so we strip it. image_editor.rstrip('\\') @@ -65,7 +60,7 @@ class EditExternally(bpy.types.Operator): filepath = bpy.path.abspath(self.filepath) if not os.path.exists(filepath): - self.report('ERROR', "Image path '%s' not found." % filepath) + self.report('ERROR', "Image path %r not found." % filepath) return {'CANCELLED'} cmd = self._editor_guess(context) + [filepath] diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index 579af9b34b3..4c28f352164 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -29,19 +29,14 @@ import os def guess_player_path(preset): - import platform - try: - system = platform.system() - except UnicodeDecodeError: - import sys - system = sys.platform + import sys if preset == 'BLENDER24': player_path = "blender" - if system == 'Darwin': + if sys.platform == "darwin": test_path = "/Applications/blender 2.49.app/Contents/MacOS/blender" - elif system in ('Windows', 'win32'): + elif sys.platform[:3] == "win": test_path = "/Program Files/Blender Foundation/Blender/blender.exe" if os.path.exists(test_path): @@ -50,7 +45,8 @@ def guess_player_path(preset): elif preset == 'DJV': player_path = "djv_view" - if system == 'Darwin': + if sys.platform == "darwin": + # TODO, crummy supporting only 1 version, could find the newest installed version test_path = '/Applications/djv-0.8.2.app/Contents/Resources/bin/djv_view' if os.path.exists(test_path): player_path = test_path diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py index 505fa347878..a90b691afb7 100644 --- a/release/scripts/op/wm.py +++ b/release/scripts/op/wm.py @@ -575,7 +575,7 @@ class WM_OT_path_open(bpy.types.Operator): self.report({'ERROR'}, "File '%s' not found" % filepath) return {'CANCELLED'} - if sys.platform == 'win32': + if sys.platform[:3] == "win": subprocess.Popen(['start', filepath], shell=True) elif sys.platform == 'darwin': subprocess.Popen(['open', filepath]) diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index 0c7dabf7ae5..2ec099dc051 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -364,7 +364,7 @@ class INFO_MT_help(bpy.types.Menu): layout.operator("help.operator_cheat_sheet", icon='TEXT') layout.operator("wm.sysinfo", icon='TEXT') layout.separator() - if sys.platform == "win32": + if sys.platform[:3] == "win": layout.operator("wm.toggle_console", icon='CONSOLE') layout.separator() layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP') |