- fix for keymap test operator
authorCampbell Barton <ideasman42@gmail.com>
Sun, 2 Oct 2011 18:09:36 +0000 (18:09 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 2 Oct 2011 18:09:36 +0000 (18:09 +0000)
- cleanup pep8 warnings and unused py imports
py pep8 cleanup

po/clean_po.py
po/merge_po.py
release/scripts/modules/bpy_extras/keyconfig_utils.py
release/scripts/startup/bl_operators/screen_play_rendered_anim.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_userpref_keymap.py

index 2cbd2cb33ac1bb871fc906200ac556092b7abe47..685ec585ffd7ba4897afef462be9cfdff3f93ae6 100755 (executable)
@@ -133,12 +133,12 @@ def do_clean(po, pot_messages):
         if pot_messages.get(msgid):
             t = po_messages.get(msgid)
             if not t:
-                print(('Reusing full item from commented ' + \
-                       'lines for msgid \'%s\'') % (msgid))
+                print("Reusing full item from commented "
+                       "lines for msgid '%s'" % msgid)
                 po_messages[msgid] = commented_messages[msgid]
             elif not t['translation']:
-                print(('Reusing translation from commented ' + \
-                       'lines for msgid \'%s\'') % (msgid))
+                print("Reusing translation from commented "
+                       "lines for msgid '%s'" % msgid)
                 m = commented_messages[msgid]
                 t['translation'] = m['translation']
                 t['translation_lines'] = m['translation_lines']
@@ -153,17 +153,17 @@ def do_clean(po, pot_messages):
             first = True
             for x in item['message_lines']:
                 if first:
-                    handle.write("msgid \"%s\"\n" % (x))
+                    handle.write("msgid \"%s\"\n" % x)
                 else:
-                    handle.write("\"%s\"\n" % (x))
+                    handle.write("\"%s\"\n" % x)
                 first = False
 
             first = True
             for x in item['translation_lines']:
                 if first:
-                    handle.write("msgstr \"%s\"\n" % (x))
+                    handle.write("msgstr \"%s\"\n" % x)
                 else:
-                    handle.write("\"%s\"\n" % (x))
+                    handle.write("\"%s\"\n" % x)
                 first = False
 
             handle.write("\n")
index b4a1ffa399e4cdb9ab12e5a2438442b88437b6f0..b0b29a3ac8ee0522872a15f023ef55dca8fbe2a4 100755 (executable)
@@ -23,7 +23,6 @@
 
 # update the pot file according the POTFILES.in
 
-import os
 import sys
 import collections
 
@@ -145,17 +144,17 @@ def main():
                 first = True
                 for x in item['message_lines']:
                     if first:
-                        handle.write("msgid \"%s\"\n" % (x))
+                        handle.write("msgid \"%s\"\n" % x)
                     else:
-                        handle.write("\"%s\"\n" % (x))
+                        handle.write("\"%s\"\n" % x)
                     first = False
 
                 first = True
                 for x in item['translation_lines']:
                     if first:
-                        handle.write("msgstr \"%s\"\n" % (x))
+                        handle.write("msgstr \"%s\"\n" % x)
                     else:
-                        handle.write("\"%s\"\n" % (x))
+                        handle.write("\"%s\"\n" % x)
                     first = False
 
                 handle.write("\n")
index e87db6599188bf18d083f5ac90d5f7b0bde41d73..78f010245a030fb115fd0df75e09b96a611b40ad 100644 (file)
@@ -119,14 +119,17 @@ def keyconfig_merge(kc1, kc2):
     """
     merged_keymaps = [(km, kc1) for km in kc1.keymaps]
     if kc1 != kc2:
-        merged_keymaps.extend((km, kc2) for km in kc2.keymaps if not _km_exists_in(km, merged_keymaps))
+        merged_keymaps.extend((km, kc2) for km in kc2.keymaps if not km_exists_in(km, merged_keymaps))
 
     return merged_keymaps
 
 
-def keyconfig_export(wm, kc, filepath):
+def _export_properties(prefix, properties, lines=None):
     from bpy.types import OperatorProperties
 
+    if lines is None:
+        lines = []
+
     def string_value(value):
         if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int):
             result = repr(value)
@@ -137,20 +140,19 @@ def keyconfig_export(wm, kc, filepath):
 
         return result
 
-    def export_properties(prefix, properties, lines=None):
-        if lines is None:
-            lines = []
-
-        for pname in properties.bl_rna.properties.keys():
-            if pname != "rna_type" and not properties.is_property_hidden(pname):
-                value = getattr(properties, pname)
-                if isinstance(value, OperatorProperties):
-                    export_properties(prefix + "." + pname, value, lines)
-                elif properties.is_property_set(pname):
-                    value = string_value(value)
-                    if value != "":
-                        lines.append("%s.%s = %s\n" % (prefix, pname, value))
-        return lines
+    for pname in properties.bl_rna.properties.keys():
+        if pname != "rna_type" and not properties.is_property_hidden(pname):
+            value = getattr(properties, pname)
+            if isinstance(value, OperatorProperties):
+                _export_properties(prefix + "." + pname, value, lines)
+            elif properties.is_property_set(pname):
+                value = string_value(value)
+                if value != "":
+                    lines.append("%s.%s = %s\n" % (prefix, pname, value))
+    return lines
+
+
+def keyconfig_export(wm, kc, filepath):
 
     f = open(filepath, "w")
 
@@ -209,7 +211,7 @@ def keyconfig_export(wm, kc, filepath):
             props = kmi.properties
 
             if props is not None:
-                f.write("".join(export_properties("kmi.properties", props)))
+                f.write("".join(_export_properties("kmi.properties", props)))
 
         f.write("\n")
 
@@ -246,7 +248,7 @@ def keyconfig_test(kc):
             props = kmi.properties
 
             if props is not None:
-                export_properties("kmi.properties", props, s)
+                _export_properties("kmi.properties", props, s)
 
             return "".join(s).strip()
 
index 3c5bc68203f5f0947a4eae5895dddc12de6705d1..3479a3f9e53e4100b6937c532bb1cb96ffc8d5ee 100644 (file)
@@ -136,7 +136,8 @@ class PlayRenderedAnim(Operator):
             del process
             # -----------------------------------------------------------------
 
-            opts = ["-a", "-f", str(rd.fps), str(rd.fps_base), "-j", str(scene.frame_step), file]
+            opts = ["-a", "-f", str(rd.fps), str(rd.fps_base),
+                    "-j", str(scene.frame_step), file]
             cmd.extend(opts)
         elif preset == 'DJV':
             opts = [file, "-playback_speed", "%d" % int(rd.fps / rd.fps_base)]
@@ -166,9 +167,8 @@ class PlayRenderedAnim(Operator):
         print("Executing command:\n  %r" % " ".join(cmd))
 
         try:
-            process = subprocess.Popen(cmd)
+            subprocess.Popen(cmd)
         except Exception as e:
-            import traceback
             self.report({'ERROR'},
                         "Couldn't run external animation player with command "
                         "%r\n%s" % (" ".join(cmd), str(e)))
index 5670b912c7b442fef245aa28765baa4278f99015..1ec6cc391649f77907408ce7c9ac2380aa95f555 100644 (file)
@@ -22,8 +22,6 @@ from bpy.types import Header, Menu, Panel
 import os
 import addon_utils
 
-from bpy.props import StringProperty, BoolProperty, EnumProperty
-
 
 def ui_items_general(col, context):
     """ General UI Theme Settings (User Interface)
index 79b13e3bec0d0608089ddeedec7bdafddc2b9bbd..25f955085f6f87e779dc71e03adcd6b5c89e6609 100644 (file)
@@ -19,7 +19,6 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Menu, OperatorProperties
-import os
 
 
 class USERPREF_MT_keyconfigs(Menu):