diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2016-10-30 18:44:57 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-11-01 00:33:51 +0100 |
commit | 97c8508f5e4f57b1048830d44e76e1f4517fd449 (patch) | |
tree | 3d6af30f519a2a7788e596f21d91f3ecfa399864 /tools/editor | |
parent | 681575fa7123592897090c6cce44402c4e45baeb (diff) |
style: Start applying PEP8 to Python files, indentation issues
Done with `autopep8 --select=E1`, fixes:
- E101 - Reindent all lines.
- E112 - Fix under-indented comments.
- E113 - Fix over-indented comments.
- E115 - Fix under-indented comments.
- E116 - Fix over-indented comments.
- E121 - Fix a badly indented line.
- E122 - Fix a badly indented line.
- E123 - Fix a badly indented line.
- E124 - Fix a badly indented line.
- E125 - Fix indentation undistinguish from the next logical line.
- E126 - Fix a badly indented line.
- E127 - Fix a badly indented line.
- E128 - Fix a badly indented line.
- E129 - Fix a badly indented line.
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/SCsub | 126 | ||||
-rw-r--r-- | tools/editor/icons/SCsub | 120 |
2 files changed, 123 insertions, 123 deletions
diff --git a/tools/editor/SCsub b/tools/editor/SCsub index f6cb16dc24..41b4386e21 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -5,51 +5,51 @@ Import('env') def make_doc_header(target,source,env): - src = source[0].srcnode().abspath - dst = target[0].srcnode().abspath - f = open(src,"rb") - g = open(dst,"wb") - buf = f.read() - decomp_size = len(buf) - import zlib - buf = zlib.compress(buf) + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open(src,"rb") + g = open(dst,"wb") + buf = f.read() + decomp_size = len(buf) + import zlib + buf = zlib.compress(buf) - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _DOC_DATA_RAW_H\n") - g.write("#define _DOC_DATA_RAW_H\n") - g.write("static const int _doc_data_compressed_size="+str(len(buf))+";\n") - g.write("static const int _doc_data_uncompressed_size="+str(decomp_size)+";\n") - g.write("static const unsigned char _doc_data_compressed[]={\n") - for i in range(len(buf)): - g.write(str(ord(buf[i]))+",\n") - g.write("};\n") - g.write("#endif") + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _DOC_DATA_RAW_H\n") + g.write("#define _DOC_DATA_RAW_H\n") + g.write("static const int _doc_data_compressed_size="+str(len(buf))+";\n") + g.write("static const int _doc_data_uncompressed_size="+str(decomp_size)+";\n") + g.write("static const unsigned char _doc_data_compressed[]={\n") + for i in range(len(buf)): + g.write(str(ord(buf[i]))+",\n") + g.write("};\n") + g.write("#endif") def make_certs_header(target,source,env): - src = source[0].srcnode().abspath - dst = target[0].srcnode().abspath - f = open(src,"rb") - g = open(dst,"wb") - buf = f.read() - decomp_size = len(buf) - import zlib - buf = zlib.compress(buf) + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open(src,"rb") + g = open(dst,"wb") + buf = f.read() + decomp_size = len(buf) + import zlib + buf = zlib.compress(buf) - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _CERTS_RAW_H\n") - g.write("#define _CERTS_RAW_H\n") - g.write("static const int _certs_compressed_size="+str(len(buf))+";\n") - g.write("static const int _certs_uncompressed_size="+str(decomp_size)+";\n") - g.write("static const unsigned char _certs_compressed[]={\n") - for i in range(len(buf)): - g.write(str(ord(buf[i]))+",\n") - g.write("};\n") - g.write("#endif") + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _CERTS_RAW_H\n") + g.write("#define _CERTS_RAW_H\n") + g.write("static const int _certs_compressed_size="+str(len(buf))+";\n") + g.write("static const int _certs_uncompressed_size="+str(decomp_size)+";\n") + g.write("static const unsigned char _certs_compressed[]={\n") + for i in range(len(buf)): + g.write(str(ord(buf[i]))+",\n") + g.write("};\n") + g.write("#endif") @@ -59,30 +59,30 @@ def make_certs_header(target,source,env): if (env["tools"]=="yes"): - reg_exporters_inc='#include "register_exporters.h"\n' - reg_exporters='void register_exporters() {\n' - for e in env.platform_exporters: - env.tool_sources.append("#platform/"+e+"/export/export.cpp") - reg_exporters+='\tregister_'+e+'_exporter();\n' - reg_exporters_inc+='#include "platform/'+e+'/export/export.h"\n' - reg_exporters+='}\n' - f = open("register_exporters.cpp","wb") - f.write(reg_exporters_inc) - f.write(reg_exporters) - f.close() - - env.Depends("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml") - env.Command("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml",make_doc_header) - - env.Depends("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt") - env.Command("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt",make_certs_header) - - #make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env) - - env.add_source_files(env.tool_sources,"*.cpp") - - Export('env') - SConscript('icons/SCsub'); - SConscript('plugins/SCsub'); - SConscript('fileserver/SCsub'); - SConscript('io_plugins/SCsub'); + reg_exporters_inc='#include "register_exporters.h"\n' + reg_exporters='void register_exporters() {\n' + for e in env.platform_exporters: + env.tool_sources.append("#platform/"+e+"/export/export.cpp") + reg_exporters+='\tregister_'+e+'_exporter();\n' + reg_exporters_inc+='#include "platform/'+e+'/export/export.h"\n' + reg_exporters+='}\n' + f = open("register_exporters.cpp","wb") + f.write(reg_exporters_inc) + f.write(reg_exporters) + f.close() + + env.Depends("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml") + env.Command("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml",make_doc_header) + + env.Depends("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt") + env.Command("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt",make_certs_header) + + #make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env) + + env.add_source_files(env.tool_sources,"*.cpp") + + Export('env') + SConscript('icons/SCsub'); + SConscript('plugins/SCsub'); + SConscript('fileserver/SCsub'); + SConscript('io_plugins/SCsub'); diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index 9e05d8f391..4806a89df2 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -4,93 +4,93 @@ Import('env') def make_editor_icons_action(target, source, env): - import os - import cStringIO + import os + import cStringIO - dst = target[0].srcnode().abspath - pixmaps = source + dst = target[0].srcnode().abspath + pixmaps = source - s = cStringIO.StringIO() + s = cStringIO.StringIO() - s.write("#include \"editor_icons.h\"\n\n") - s.write("#include \"editor_scale.h\"\n\n") - s.write("#include \"scene/resources/theme.h\"\n\n") + s.write("#include \"editor_icons.h\"\n\n") + s.write("#include \"editor_scale.h\"\n\n") + s.write("#include \"scene/resources/theme.h\"\n\n") - hidpi_list=[] + hidpi_list=[] - for x in pixmaps: + for x in pixmaps: - x=str(x) - var_str=os.path.basename(x)[:-4]+"_png"; - #print(var_str) + x=str(x) + var_str=os.path.basename(x)[:-4]+"_png"; + #print(var_str) - s.write("static const unsigned char "+ var_str +"[]={\n"); + s.write("static const unsigned char "+ var_str +"[]={\n"); - pngf=open(x,"rb"); + pngf=open(x,"rb"); - b=pngf.read(1); - while(len(b)==1): - s.write(hex(ord(b))) - b=pngf.read(1); - if (len(b)==1): - s.write(",") + b=pngf.read(1); + while(len(b)==1): + s.write(hex(ord(b))) + b=pngf.read(1); + if (len(b)==1): + s.write(",") - s.write("\n};\n\n"); + s.write("\n};\n\n"); - pngf.close(); - var_str=os.path.basename(x)[:-4]+"_hidpi_png"; - try: + pngf.close(); + var_str=os.path.basename(x)[:-4]+"_hidpi_png"; + try: - pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb") + pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb") - s.write("static const unsigned char "+ var_str +"[]={\n"); + s.write("static const unsigned char "+ var_str +"[]={\n"); - b=pngf.read(1); - while(len(b)==1): - s.write(hex(ord(b))) - b=pngf.read(1); - if (len(b)==1): - s.write(",") + b=pngf.read(1); + while(len(b)==1): + s.write(hex(ord(b))) + b=pngf.read(1); + if (len(b)==1): + s.write(",") - s.write("\n};\n\n\n"); - hidpi_list.append(x) + s.write("\n};\n\n\n"); + hidpi_list.append(x) - except: - s.write("static const unsigned char* "+ var_str +"=NULL;\n\n\n"); + except: + s.write("static const unsigned char* "+ var_str +"=NULL;\n\n\n"); - s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") - s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") - s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n") - s.write("\tImage img(use_hidpi_image?p_hidpi_png:p_png);\n") - s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); use_hidpi_image=true;}\n") - s.write("\timg.resize(img.get_width()*EDSCALE/(use_hidpi_image?2:1),img.get_height()*EDSCALE/(use_hidpi_image?2:1));\n") - s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") - s.write("\treturn texture;\n") - s.write("}\n\n") + s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") + s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") + s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n") + s.write("\tImage img(use_hidpi_image?p_hidpi_png:p_png);\n") + s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); use_hidpi_image=true;}\n") + s.write("\timg.resize(img.get_width()*EDSCALE/(use_hidpi_image?2:1),img.get_height()*EDSCALE/(use_hidpi_image?2:1));\n") + s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") + s.write("\treturn texture;\n") + s.write("}\n\n") - s.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n") + s.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n") - for x in pixmaps: + for x in pixmaps: - x=os.path.basename(str(x)) - type=x[5:-4].title().replace("_",""); - var_str=x[:-4]+"_png"; - var_str_hidpi=x[:-4]+"_hidpi_png"; - s.write("\tp_theme->set_icon(\""+type+"\",\"EditorIcons\",make_icon("+var_str+","+var_str_hidpi+"));\n"); + x=os.path.basename(str(x)) + type=x[5:-4].title().replace("_",""); + var_str=x[:-4]+"_png"; + var_str_hidpi=x[:-4]+"_hidpi_png"; + s.write("\tp_theme->set_icon(\""+type+"\",\"EditorIcons\",make_icon("+var_str+","+var_str_hidpi+"));\n"); - s.write("\n\n}\n\n"); + s.write("\n\n}\n\n"); - f = open(dst,"wb") - f.write(s.getvalue()) - f.close() - s.close() + f = open(dst,"wb") + f.write(s.getvalue()) + f.close() + s.close() make_editor_icons_builder = Builder(action=make_editor_icons_action, - suffix = '.cpp', - src_suffix = '.png') + suffix = '.cpp', + src_suffix = '.png') env['BUILDERS']['MakeEditorIconsBuilder']=make_editor_icons_builder env.Alias('editor_icons',[env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp',Glob("*.png"))]) |