2013-06-19 23:04:31 +02:00
|
|
|
from PyQt4.QtCore import QCoreApplication, QSettings
|
|
|
|
|
|
|
|
def chunks(l, n):
|
fix python pep8 warnings and fix some revealed errors
pep8 --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701 \
--exclude="ui_*.py,debian/*,python/ext-libs/*" \
.
2015-02-01 14:15:42 +01:00
|
|
|
for i in xrange(0, len(l), n):
|
|
|
|
yield l[i:i+n]
|
2013-06-19 23:04:31 +02:00
|
|
|
|
|
|
|
QCoreApplication.setOrganizationName( "QGIS" )
|
|
|
|
QCoreApplication.setOrganizationDomain( "qgis.org" )
|
|
|
|
QCoreApplication.setApplicationName( "QGIS2" )
|
|
|
|
|
|
|
|
s = QSettings()
|
|
|
|
|
|
|
|
ba = s.value("/UI/geometry").toByteArray()
|
|
|
|
|
|
|
|
f = open("src/app/ui_defaults.h", "w")
|
|
|
|
|
|
|
|
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):
|
fix python pep8 warnings and fix some revealed errors
pep8 --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701 \
--exclude="ui_*.py,debian/*,python/ext-libs/*" \
.
2015-02-01 14:15:42 +01:00
|
|
|
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
|
2013-06-19 23:04:31 +02:00
|
|
|
|
|
|
|
f.write( "};\n\nstatic const unsigned char defaultUIstate[] =\n{\n" )
|
|
|
|
|
|
|
|
ba = s.value("/UI/state").toByteArray()
|
|
|
|
|
2013-07-10 23:16:42 +02:00
|
|
|
for chunk in chunks(ba,16):
|
fix python pep8 warnings and fix some revealed errors
pep8 --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701 \
--exclude="ui_*.py,debian/*,python/ext-libs/*" \
.
2015-02-01 14:15:42 +01:00
|
|
|
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
|
2013-07-10 23:16:42 +02:00
|
|
|
|
|
|
|
ba = s.value("/Composer/geometry").toByteArray()
|
|
|
|
|
|
|
|
f.write( "};\n\nstatic const unsigned char defaultComposerUIgeometry[] =\n{\n" )
|
|
|
|
|
|
|
|
for chunk in chunks(ba,16):
|
|
|
|
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
|
|
|
|
|
|
|
|
f.write( "};\n\nstatic const unsigned char defaultComposerUIstate[] =\n{\n" )
|
|
|
|
|
|
|
|
ba = s.value("/ComposerUI/state").toByteArray()
|
|
|
|
|
2013-06-19 23:04:31 +02:00
|
|
|
for chunk in chunks(ba,16):
|
fix python pep8 warnings and fix some revealed errors
pep8 --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701 \
--exclude="ui_*.py,debian/*,python/ext-libs/*" \
.
2015-02-01 14:15:42 +01:00
|
|
|
f.write( " %s,\n" % ", ".join( map( lambda x : "0x%02x" % ord(x), chunk ) ) )
|
2013-06-19 23:04:31 +02:00
|
|
|
|
|
|
|
f.write( "};\n\n#endif // UI_DEFAULTS_H\n" )
|
|
|
|
|
|
|
|
f.close()
|