|
1 |
| -from PyQt4.QtCore import QCoreApplication, QSettings |
| 1 | +from PyQt.QtCore import QCoreApplication, QSettings |
| 2 | + |
2 | 3 |
|
3 | 4 | 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] |
6 | 7 |
|
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") |
10 | 11 |
|
11 | 12 | s = QSettings()
|
12 | 13 |
|
13 | 14 | ba = s.value("/UI/geometry").toByteArray()
|
14 | 15 |
|
15 | 16 | f = open("src/app/ui_defaults.h", "w")
|
16 | 17 |
|
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") |
18 | 19 |
|
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))) |
21 | 22 |
|
22 |
| -f.write( "};\n\nstatic const unsigned char defaultUIstate[] =\n{\n" ) |
| 23 | +f.write("};\n\nstatic const unsigned char defaultUIstate[] =\n{\n") |
23 | 24 |
|
24 | 25 | ba = s.value("/UI/state").toByteArray()
|
25 | 26 |
|
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))) |
28 | 29 |
|
29 | 30 | ba = s.value("/Composer/geometry").toByteArray()
|
30 | 31 |
|
31 |
| -f.write( "};\n\nstatic const unsigned char defaultComposerUIgeometry[] =\n{\n" ) |
| 32 | +f.write("};\n\nstatic const unsigned char defaultComposerUIgeometry[] =\n{\n") |
32 | 33 |
|
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))) |
35 | 36 |
|
36 |
| -f.write( "};\n\nstatic const unsigned char defaultComposerUIstate[] =\n{\n" ) |
| 37 | +f.write("};\n\nstatic const unsigned char defaultComposerUIstate[] =\n{\n") |
37 | 38 |
|
38 | 39 | ba = s.value("/ComposerUI/state").toByteArray()
|
39 | 40 |
|
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))) |
42 | 43 |
|
43 |
| -f.write( "};\n\n#endif // UI_DEFAULTS_H\n" ) |
| 44 | +f.write("};\n\n#endif // UI_DEFAULTS_H\n") |
44 | 45 |
|
45 | 46 | f.close()
|
0 commit comments