forked from openlp/openlp
resolve merge proposal comments
This commit is contained in:
parent
190a6d4819
commit
32c635b2f0
@ -124,6 +124,7 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||||||
log.error(u'getIconFromTitle - no icon for %s' % title)
|
log.error(u'getIconFromTitle - no icon for %s' % title)
|
||||||
return QtGui.QIcon()
|
return QtGui.QIcon()
|
||||||
except:
|
except:
|
||||||
|
log.exception(u'getIconFromTitle - title %s not found' % title)
|
||||||
return QtGui.QIcon()
|
return QtGui.QIcon()
|
||||||
|
|
||||||
def makeWidgetsInvisible(self, widgets):
|
def makeWidgetsInvisible(self, widgets):
|
||||||
|
@ -167,8 +167,7 @@ class Ui_AboutDialog(object):
|
|||||||
self.AboutNotebook.indexOf(self.CreditsTab),
|
self.AboutNotebook.indexOf(self.CreditsTab),
|
||||||
translate('AboutForm', 'Credits'))
|
translate('AboutForm', 'Credits'))
|
||||||
self.LicenseTextEdit.setPlainText(translate('AboutForm',
|
self.LicenseTextEdit.setPlainText(translate('AboutForm',
|
||||||
'Copyright \xa9 2004-2010 Raoul '
|
'Copyright \xa9 2004-2010 Raoul Snyman\n'
|
||||||
'Snyman\n'
|
|
||||||
'Portions copyright \xa9 2004-2010 '
|
'Portions copyright \xa9 2004-2010 '
|
||||||
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, '
|
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, '
|
||||||
'Christian Richter, Maikel Stuivenberg, Martin Thompson, Jon '
|
'Christian Richter, Maikel Stuivenberg, Martin Thompson, Jon '
|
||||||
|
@ -202,17 +202,17 @@ This General Public License does not permit incorporating your program into prop
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="openlp/core/ui/aboutdialog.py" line="559"/>
|
<location filename="openlp/core/ui/aboutdialog.py" line="558"/>
|
||||||
<source>License</source>
|
<source>License</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="openlp/core/ui/aboutdialog.py" line="562"/>
|
<location filename="openlp/core/ui/aboutdialog.py" line="561"/>
|
||||||
<source>Contribute</source>
|
<source>Contribute</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="openlp/core/ui/aboutdialog.py" line="563"/>
|
<location filename="openlp/core/ui/aboutdialog.py" line="562"/>
|
||||||
<source>Close</source>
|
<source>Close</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -1,172 +1,172 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
||||||
# Thompson, Jon Tibble, Carsten Tinggaard #
|
# Thompson, Jon Tibble, Carsten Tinggaard #
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
# This program is free software; you can redistribute it and/or modify it #
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
# under the terms of the GNU General Public License as published by the Free #
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
# Software Foundation; version 2 of the License. #
|
# Software Foundation; version 2 of the License. #
|
||||||
# #
|
# #
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
# more details. #
|
# more details. #
|
||||||
# #
|
# #
|
||||||
# You should have received a copy of the GNU General Public License along #
|
# You should have received a copy of the GNU General Public License along #
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Short description
|
# Short description
|
||||||
# Steps for creating languages:
|
# Steps for creating languages:
|
||||||
# 1. make shure that the openlp_en.ts file exist
|
# 1. make shure that the openlp_en.ts file exist
|
||||||
# 2. go to scripts folder and start:
|
# 2. go to scripts folder and start:
|
||||||
# python translation_utils.py -a
|
# python translation_utils.py -a
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import urllib
|
import urllib
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
ignore_pathes = ["./scripts", "./openlp/core/test"]
|
ignore_pathes = [u"./scripts", u"./openlp/core/test"]
|
||||||
ignore_files = ["setup.py"]
|
ignore_files = [u"setup.py"]
|
||||||
translation_path = "http://pootle.projecthq.biz/export/openlp/"
|
translation_path = u"http://pootle.projecthq.biz/export/openlp/"
|
||||||
translations = [ "af"
|
translations = [ u"af"
|
||||||
, "en_ZA"
|
, u"en_ZA"
|
||||||
, "en_GB"
|
, u"en_GB"
|
||||||
, "de"
|
, u"de"
|
||||||
, "hu"
|
, u"hu"
|
||||||
, "ko"
|
, u"ko"
|
||||||
, "nb"
|
, u"nb"
|
||||||
, "pt_BR"
|
, u"pt_BR"
|
||||||
, "es"
|
, u"es"
|
||||||
, "sv"]
|
, u"sv"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def write_file(filename, stringlist):
|
def write_file(filename, stringlist):
|
||||||
content = u''
|
content = u''
|
||||||
for line in stringlist:
|
for line in stringlist:
|
||||||
content = u'%s%s\n' % (content, line)
|
content = u'%s%s\n' % (content, line)
|
||||||
file = open(filename, u'w')
|
file = open(filename, u'w')
|
||||||
file.write(content.encode('utf8'))
|
file.write(content.encode('utf8'))
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Set up command line options.
|
# Set up command line options.
|
||||||
usage = u'Usage: %prog [options]'
|
usage = u'Usage: %prog [options]'
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
parser.add_option("-d", "--download-ts", action="store_true", dest="download",
|
parser.add_option("-d", "--download-ts", action="store_true", dest="download",
|
||||||
help="Load languages from Pootle Server")
|
help="Load languages from Pootle Server")
|
||||||
parser.add_option("-p", "--prepare", action="store_true", dest="prepare",
|
parser.add_option("-p", "--prepare", action="store_true", dest="prepare",
|
||||||
help="preparation (generate pro file)")
|
help="preparation (generate pro file)")
|
||||||
parser.add_option("-u", "--update", action="store_true", dest="update",
|
parser.add_option("-u", "--update", action="store_true", dest="update",
|
||||||
help="update translation files")
|
help="update translation files")
|
||||||
parser.add_option("-g", "--generate", action="store_true", dest="generate",
|
parser.add_option("-g", "--generate", action="store_true", dest="generate",
|
||||||
help="generate qm files")
|
help="generate qm files")
|
||||||
parser.add_option("-a", "--all", action="store_true", dest="all",
|
parser.add_option("-a", "--all", action="store_true", dest="all",
|
||||||
help="proceed all options")
|
help="proceed all options")
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
qt_args = []
|
qt_args = []
|
||||||
if options.download:
|
if options.download:
|
||||||
downloadTranslations()
|
downloadTranslations()
|
||||||
elif options.prepare:
|
elif options.prepare:
|
||||||
preparation()
|
preparation()
|
||||||
elif options.update:
|
elif options.update:
|
||||||
update()
|
update()
|
||||||
elif options.generate:
|
elif options.generate:
|
||||||
generate()
|
generate()
|
||||||
elif options.all:
|
elif options.all:
|
||||||
all()
|
all()
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def downloadTranslations():
|
def downloadTranslations():
|
||||||
print "download()"
|
print "download()"
|
||||||
for language in translations:
|
for language in translations:
|
||||||
filename = os.path.join('..','resources', 'i18n', "openlp_%s.ts" % language)
|
filename = os.path.join(u'..',u'resources', u'i18n', u"openlp_%s.ts" % language)
|
||||||
print filename
|
print filename
|
||||||
page = urllib.urlopen("%s%s.ts" % (translation_path, language))
|
page = urllib.urlopen(u"%s%s.ts" % (translation_path, language))
|
||||||
content = page.read().decode("utf8")
|
content = page.read().decode("utf8")
|
||||||
page.close()
|
page.close()
|
||||||
file = open(filename, u'w')
|
file = open(filename, u'w')
|
||||||
file.write(content.encode('utf8'))
|
file.write(content.encode('utf8'))
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
def preparation():
|
def preparation():
|
||||||
stringlist = []
|
stringlist = []
|
||||||
start_dir = os.path.join(u'..')
|
start_dir = os.path.join(u'..')
|
||||||
for root, dirs, files in os.walk(start_dir):
|
for root, dirs, files in os.walk(start_dir):
|
||||||
for file in files:
|
for file in files:
|
||||||
path = "%s" % root
|
path = u"%s" % root
|
||||||
path = path.replace("\\","/")
|
path = path.replace("\\","/")
|
||||||
path = path.replace("..",".")
|
path = path.replace("..",".")
|
||||||
|
|
||||||
if file.startswith(u'hook-') or file.startswith(u'test_'):
|
if file.startswith(u'hook-') or file.startswith(u'test_'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
cond = False
|
cond = False
|
||||||
for search in ignore_pathes:
|
for search in ignore_pathes:
|
||||||
if path.startswith(search):
|
if path.startswith(search):
|
||||||
cond = True
|
cond = True
|
||||||
if cond == True:
|
if cond == True:
|
||||||
continue
|
continue
|
||||||
cond = False
|
cond = False
|
||||||
for search in ignore_files:
|
for search in ignore_files:
|
||||||
if search == file:
|
if search == file:
|
||||||
cond = True
|
cond = True
|
||||||
if cond == True:
|
if cond == True:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if file.endswith(u'.py'):
|
if file.endswith(u'.py'):
|
||||||
line = "%s/%s" % (path, file)
|
line = u"%s/%s" % (path, file)
|
||||||
print u'Parsing "%s"' % line
|
print u'Parsing "%s"' % line
|
||||||
stringlist.append("SOURCES += %s" % line)
|
stringlist.append(u"SOURCES += %s" % line)
|
||||||
elif file.endswith(u'.pyw'):
|
elif file.endswith(u'.pyw'):
|
||||||
line = "%s/%s" % (path, file)
|
line = u"%s/%s" % (path, file)
|
||||||
print u'Parsing "%s"' % line
|
print u'Parsing "%s"' % line
|
||||||
stringlist.append("SOURCES += %s" % line)
|
stringlist.append(u"SOURCES += %s" % line)
|
||||||
elif file.endswith(u'.ts'):
|
elif file.endswith(u'.ts'):
|
||||||
line = "%s/%s" % (path, file)
|
line = u"%s/%s" % (path, file)
|
||||||
print u'Parsing "%s"' % line
|
print u'Parsing "%s"' % line
|
||||||
stringlist.append("TRANSLATIONS += %s" % line)
|
stringlist.append(u"TRANSLATIONS += %s" % line)
|
||||||
|
|
||||||
print u'Generating PRO file...',
|
print u'Generating PRO file...',
|
||||||
stringlist.sort()
|
stringlist.sort()
|
||||||
write_file(os.path.join(start_dir, u'openlp.pro'), stringlist)
|
write_file(os.path.join(start_dir, u'openlp.pro'), stringlist)
|
||||||
print u'done.'
|
print u'done.'
|
||||||
|
|
||||||
|
|
||||||
def update():
|
def update():
|
||||||
print "update()"
|
print "update()"
|
||||||
updateProcess = QtCore.QProcess()
|
updateProcess = QtCore.QProcess()
|
||||||
updateProcess.start("pylupdate4 -noobsolete ../openlp.pro")
|
updateProcess.start(u"pylupdate4 -noobsolete ../openlp.pro")
|
||||||
updateProcess.waitForFinished(60000)
|
updateProcess.waitForFinished(60000)
|
||||||
|
|
||||||
def generate():
|
def generate():
|
||||||
print "generate()"
|
print "generate()"
|
||||||
generateProcess = QtCore.QProcess()
|
generateProcess = QtCore.QProcess()
|
||||||
generateProcess.start("lrelease ../openlp.pro")
|
generateProcess.start(u"lrelease ../openlp.pro")
|
||||||
generateProcess.waitForFinished(60000)
|
generateProcess.waitForFinished(60000)
|
||||||
|
|
||||||
def all():
|
def all():
|
||||||
print "all()"
|
print "all()"
|
||||||
downloadTranslations()
|
downloadTranslations()
|
||||||
preparation()
|
preparation()
|
||||||
update()
|
update()
|
||||||
generate()
|
generate()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == u'__main__':
|
if __name__ == u'__main__':
|
||||||
if os.path.split(os.path.abspath(u'.'))[1] != u'scripts':
|
if os.path.split(os.path.abspath(u'.'))[1] != u'scripts':
|
||||||
print u'You need to run this script from the scripts directory.'
|
print u'You need to run this script from the scripts directory.'
|
||||||
else:
|
else:
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user