mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
use with open as block
This commit is contained in:
parent
002c020859
commit
99ae08a2aa
@ -48,45 +48,43 @@ s = QSettings(sys.argv[1], QSettings.IniFormat)
|
||||
ba = bytes(s.value("/UI/geometry"))
|
||||
print
|
||||
|
||||
f = open("src/app/ui_defaults.h", "w")
|
||||
with open("src/app/ui_defaults.h", "w") as f:
|
||||
|
||||
f.write("#ifndef UI_DEFAULTS_H\n#define UI_DEFAULTS_H\n" +
|
||||
"\nstatic const unsigned char defaultUIgeometry[] =\n{\n")
|
||||
|
||||
for chunk in chunks(ba, 16):
|
||||
f.write(' {},\n'.format(
|
||||
', '.join(map(hex, struct.unpack('B' * len(chunk), chunk)))))
|
||||
|
||||
f.write("};\n\nstatic const unsigned char defaultUIstate[] =\n{\n")
|
||||
|
||||
ba = bytes(s.value("/UI/state"))
|
||||
|
||||
for chunk in chunks(ba, 16):
|
||||
f.write(' {},\n'.format(
|
||||
', '.join(map(hex, struct.unpack('B' * len(chunk), chunk)))))
|
||||
|
||||
try:
|
||||
ba = bytes(s.value("/app/LayoutDesigner/geometry"))
|
||||
f.write("};\n\nstatic const unsigned char " +
|
||||
"defaultLayerDesignerUIgeometry[] =\n{\n")
|
||||
f.write("#ifndef UI_DEFAULTS_H\n#define UI_DEFAULTS_H\n" +
|
||||
"\nstatic const unsigned char defaultUIgeometry[] =\n{\n")
|
||||
|
||||
for chunk in chunks(ba, 16):
|
||||
f.write(' {},\n'.format(
|
||||
', '.join(map(hex, struct.unpack('B' * len(chunk), chunk)))))
|
||||
except TypeError as ex:
|
||||
pass
|
||||
|
||||
try:
|
||||
ba = bytes(s.value("/app/LayoutDesigner/state"))
|
||||
f.write("};\n\nstatic const unsigned char " +
|
||||
"defaultLayerDesignerUIstate[] =\n{\n")
|
||||
f.write("};\n\nstatic const unsigned char defaultUIstate[] =\n{\n")
|
||||
|
||||
ba = bytes(s.value("/UI/state"))
|
||||
|
||||
for chunk in chunks(ba, 16):
|
||||
f.write(' {},\n'.format(
|
||||
', '.join(map(hex, struct.unpack('B' * len(chunk), chunk)))))
|
||||
except TypeError as ex:
|
||||
pass
|
||||
|
||||
f.write("};\n\n#endif // UI_DEFAULTS_H\n")
|
||||
try:
|
||||
ba = bytes(s.value("/app/LayoutDesigner/geometry"))
|
||||
f.write("};\n\nstatic const unsigned char " +
|
||||
"defaultLayerDesignerUIgeometry[] =\n{\n")
|
||||
|
||||
f.close()
|
||||
for chunk in chunks(ba, 16):
|
||||
f.write(' {},\n'.format(
|
||||
', '.join(map(hex, struct.unpack('B' * len(chunk), chunk)))))
|
||||
except TypeError as ex:
|
||||
pass
|
||||
|
||||
try:
|
||||
ba = bytes(s.value("/app/LayoutDesigner/state"))
|
||||
f.write("};\n\nstatic const unsigned char " +
|
||||
"defaultLayerDesignerUIstate[] =\n{\n")
|
||||
|
||||
for chunk in chunks(ba, 16):
|
||||
f.write(' {},\n'.format(
|
||||
', '.join(map(hex, struct.unpack('B' * len(chunk), chunk)))))
|
||||
except TypeError as ex:
|
||||
pass
|
||||
|
||||
f.write("};\n\n#endif // UI_DEFAULTS_H\n")
|
||||
|
Loading…
x
Reference in New Issue
Block a user