@@ -48,45 +48,43 @@ def chunks(l, n):
48
48
ba = bytes (s .value ("/UI/geometry" ))
49
49
print
50
50
51
- f = open ("src/app/ui_defaults.h" , "w" )
51
+ with open ("src/app/ui_defaults.h" , "w" ) as f :
52
52
53
- f .write ("#ifndef UI_DEFAULTS_H\n #define UI_DEFAULTS_H\n " +
54
- "\n static const unsigned char defaultUIgeometry[] =\n {\n " )
55
-
56
- for chunk in chunks (ba , 16 ):
57
- f .write (' {},\n ' .format (
58
- ', ' .join (map (hex , struct .unpack ('B' * len (chunk ), chunk )))))
59
-
60
- f .write ("};\n \n static const unsigned char defaultUIstate[] =\n {\n " )
61
-
62
- ba = bytes (s .value ("/UI/state" ))
63
-
64
- for chunk in chunks (ba , 16 ):
65
- f .write (' {},\n ' .format (
66
- ', ' .join (map (hex , struct .unpack ('B' * len (chunk ), chunk )))))
67
-
68
- try :
69
- ba = bytes (s .value ("/app/LayoutDesigner/geometry" ))
70
- f .write ("};\n \n static const unsigned char " +
71
- "defaultLayerDesignerUIgeometry[] =\n {\n " )
53
+ f .write ("#ifndef UI_DEFAULTS_H\n #define UI_DEFAULTS_H\n " +
54
+ "\n static const unsigned char defaultUIgeometry[] =\n {\n " )
72
55
73
56
for chunk in chunks (ba , 16 ):
74
57
f .write (' {},\n ' .format (
75
58
', ' .join (map (hex , struct .unpack ('B' * len (chunk ), chunk )))))
76
- except TypeError as ex :
77
- pass
78
59
79
- try :
80
- ba = bytes (s .value ("/app/LayoutDesigner/state" ))
81
- f .write ("};\n \n static const unsigned char " +
82
- "defaultLayerDesignerUIstate[] =\n {\n " )
60
+ f .write ("};\n \n static const unsigned char defaultUIstate[] =\n {\n " )
61
+
62
+ ba = bytes (s .value ("/UI/state" ))
83
63
84
64
for chunk in chunks (ba , 16 ):
85
65
f .write (' {},\n ' .format (
86
66
', ' .join (map (hex , struct .unpack ('B' * len (chunk ), chunk )))))
87
- except TypeError as ex :
88
- pass
89
-
90
- f .write ("};\n \n #endif // UI_DEFAULTS_H\n " )
91
67
92
- f .close ()
68
+ try :
69
+ ba = bytes (s .value ("/app/LayoutDesigner/geometry" ))
70
+ f .write ("};\n \n static const unsigned char " +
71
+ "defaultLayerDesignerUIgeometry[] =\n {\n " )
72
+
73
+ for chunk in chunks (ba , 16 ):
74
+ f .write (' {},\n ' .format (
75
+ ', ' .join (map (hex , struct .unpack ('B' * len (chunk ), chunk )))))
76
+ except TypeError as ex :
77
+ pass
78
+
79
+ try :
80
+ ba = bytes (s .value ("/app/LayoutDesigner/state" ))
81
+ f .write ("};\n \n static const unsigned char " +
82
+ "defaultLayerDesignerUIstate[] =\n {\n " )
83
+
84
+ for chunk in chunks (ba , 16 ):
85
+ f .write (' {},\n ' .format (
86
+ ', ' .join (map (hex , struct .unpack ('B' * len (chunk ), chunk )))))
87
+ except TypeError as ex :
88
+ pass
89
+
90
+ f .write ("};\n \n #endif // UI_DEFAULTS_H\n " )
0 commit comments