Skip to content

Commit 93aedcd

Browse files
committedMar 21, 2016
scripts/mkuidefaults.py: switch to PyQt wrappers and reformat
1 parent 06f9953 commit 93aedcd

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed
 

‎scripts/mkuidefaults.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,46 @@
1-
from PyQt4.QtCore import QCoreApplication, QSettings
1+
from PyQt.QtCore import QCoreApplication, QSettings
2+
23

34
def chunks(l, n):
4-
for i in xrange(0, len(l), n):
5-
yield l[i:i+n]
5+
for i in xrange(0, len(l), n):
6+
yield l[i:i + n]
67

7-
QCoreApplication.setOrganizationName( "QGIS" )
8-
QCoreApplication.setOrganizationDomain( "qgis.org" )
9-
QCoreApplication.setApplicationName( "QGIS2" )
8+
QCoreApplication.setOrganizationName("QGIS")
9+
QCoreApplication.setOrganizationDomain("qgis.org")
10+
QCoreApplication.setApplicationName("QGIS2")
1011

1112
s = QSettings()
1213

1314
ba = s.value("/UI/geometry").toByteArray()
1415

1516
f = open("src/app/ui_defaults.h", "w")
1617

17-
f.write( "#ifndef UI_DEFAULTS_H\n#define UI_DEFAULTS_H\n\nstatic const unsigned char defaultUIgeometry[] =\n{\n" )
18+
f.write("#ifndef UI_DEFAULTS_H\n#define UI_DEFAULTS_H\n\nstatic const unsigned char defaultUIgeometry[] =\n{\n")
1819

19-
for chunk in chunks(ba,16):
20-
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
20+
for chunk in chunks(ba, 16):
21+
f.write(" %s,\n" % ", ".join(map(lambda x: "0x%02x" % ord(x), chunk)))
2122

22-
f.write( "};\n\nstatic const unsigned char defaultUIstate[] =\n{\n" )
23+
f.write("};\n\nstatic const unsigned char defaultUIstate[] =\n{\n")
2324

2425
ba = s.value("/UI/state").toByteArray()
2526

26-
for chunk in chunks(ba,16):
27-
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
27+
for chunk in chunks(ba, 16):
28+
f.write(" %s,\n" % ", ".join(map(lambda x: "0x%02x" % ord(x), chunk)))
2829

2930
ba = s.value("/Composer/geometry").toByteArray()
3031

31-
f.write( "};\n\nstatic const unsigned char defaultComposerUIgeometry[] =\n{\n" )
32+
f.write("};\n\nstatic const unsigned char defaultComposerUIgeometry[] =\n{\n")
3233

33-
for chunk in chunks(ba,16):
34-
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
34+
for chunk in chunks(ba, 16):
35+
f.write(" %s,\n" % ", ".join(map(lambda x: "0x%02x" % ord(x), chunk)))
3536

36-
f.write( "};\n\nstatic const unsigned char defaultComposerUIstate[] =\n{\n" )
37+
f.write("};\n\nstatic const unsigned char defaultComposerUIstate[] =\n{\n")
3738

3839
ba = s.value("/ComposerUI/state").toByteArray()
3940

40-
for chunk in chunks(ba,16):
41-
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
41+
for chunk in chunks(ba, 16):
42+
f.write(" %s,\n" % ", ".join(map(lambda x: "0x%02x" % ord(x), chunk)))
4243

43-
f.write( "};\n\n#endif // UI_DEFAULTS_H\n" )
44+
f.write("};\n\n#endif // UI_DEFAULTS_H\n")
4445

4546
f.close()

0 commit comments

Comments
 (0)
Please sign in to comment.