Editorial changes & Fixes from QuLogic

This commit is contained in:
Sam Manzi 2016-04-19 09:15:05 +10:00
parent 5dc5615bfd
commit 3f86dd3e25
No known key found for this signature in database
GPG Key ID: F4A16068AE36B402
3 changed files with 76 additions and 93 deletions

View File

@ -219,7 +219,6 @@ class DbState(Callback):
fname = os.path.join(dirpath, "lock")
with open(fname, 'r', encoding='utf8') as ifile:
locked_by = ifile.read().strip()
ifile.close()
except (OSError, IOError):
pass
return (dirpath, locked, locked_by, backend)

View File

@ -436,7 +436,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
def __log_error(self):
mypath = os.path.join(self.get_save_path(),DBRECOVFN)
with open(mypath, "w") as ofile:
ofile = open(mypath, "w")
ofile.close()
try:
clear_lock_file(self.get_save_path())
except:

View File

@ -113,7 +113,6 @@ def tests():
print ('Please, install %(program)s for listing groups of messages'
% {'program': msgattribCmd})
try:
print("\n===='xgettext' =(generate a new template)==============\n")
os.system('''%(program)s -V''' % {'program': xgettextCmd})
@ -127,12 +126,10 @@ def tests():
except:
print ('Please, install python')
def TipsParse(filename, mark):
"""
Experimental alternative to 'intltool-extract' for 'tips.xml'.
"""
from xml.etree import ElementTree
tree = ElementTree.parse(filename)
@ -189,7 +186,6 @@ def HolidaysParse(filename, mark):
"""
Experimental alternative to 'intltool-extract' for 'holidays.xml'.
"""
from xml.etree import ElementTree
tree = ElementTree.parse(filename)
@ -213,7 +209,6 @@ def HolidaysParse(filename, mark):
msgid "Jewish Holidays"
msgid "Yom Kippur"
'''
with open('../data/holidays.xml.in.h', 'w') as holidays:
for key in ellist:
if key.attrib.get(mark):
@ -230,7 +225,6 @@ def XmlParse(filename, mark):
"""
Experimental alternative to 'intltool-extract' for 'file.xml.in'.
"""
from xml.etree import ElementTree
tree = ElementTree.parse(filename)
@ -261,7 +255,6 @@ def XmlParse(filename, mark):
'''
with open(filename + '.h', 'w') as head:
for key in root.iter():
if key.tag == '{http://www.freedesktop.org/standards/shared-mime-info}%s' % mark:
comment = 'char *s = N_("%s");\n' % key.text
@ -276,7 +269,6 @@ def XmlParse(filename, mark):
print ('Wrote %s' % filename)
root.clear()
def DesktopParse(filename):
"""
Experimental alternative to 'intltool-extract' for 'gramps.desktop'.
@ -297,7 +289,6 @@ def DesktopParse(filename):
"Manage genealogical information,
perform genealogical research and analysis"
'''
with open('../data/gramps.desktop.in.h', 'w') as desktop:
with open(filename) as f:
@ -336,7 +327,6 @@ def KeyParse(filename, mark):
msgid "Gramps XML database"
msgid "GEDCOM"
'''
with open('../data/gramps.keys.in.h', 'w') as key:
with open(filename) as f:
@ -409,7 +399,6 @@ def main():
choices=[file for file in os.listdir('.') if file.endswith('.po')],
help="list fuzzy messages")
args = parser.parse_args()
namespace, extra = parser.parse_known_args()
@ -505,7 +494,6 @@ def listing(name, extensionlist):
files = [file.strip() for file in f if file and not file[0]=='#']
with open(name, 'w') as temp:
for entry in files:
for ext in extensionlist:
if entry.endswith(ext):
@ -544,7 +532,6 @@ def extract_xml():
Extract translation strings from XML based, keys, mime and desktop
files. Own XML files parsing and custom translation marks.
"""
HolidaysParse('../data/holidays.xml.in', '_name')
TipsParse('../data/tips.xml.in', '_tip')
XmlParse('../data/gramps.xml.in', '_comment')
@ -557,6 +544,7 @@ def create_template():
Create a new file for template, if it does not exist.
"""
with open('gramps.pot', 'w') as template:
pass
def extract_glade():
"""
@ -610,7 +598,6 @@ def extract_gtkbuilder():
files = ['../gramps/plugins/importer/importgedcom.glade', '../gramps/gui/glade/rule.glade']
with open('gtklist.h', 'w') as temp:
for filename in files:
tree = ElementTree.parse(filename)
root = tree.getroot()
@ -680,7 +667,6 @@ def merge(args):
"""
Merge messages with 'gramps.pot'
"""
for arg in args:
if arg == 'all':
continue
@ -693,7 +679,6 @@ def check(args):
"""
Check the translation file
"""
for arg in args:
if arg == 'all':
continue
@ -708,14 +693,12 @@ def untranslated(arg):
"""
List untranslated messages
"""
os.system('''%(msgattrib)s --untranslated %(lang.po)s''' % {'msgattrib': msgattribCmd, 'lang.po': arg[0]})
def fuzzy(arg):
"""
List fuzzy messages
"""
os.system('''%(msgattrib)s --only-fuzzy --no-obsolete %(lang.po)s''' % {'msgattrib': msgattribCmd, 'lang.po': arg[0]})
if __name__ == "__main__":