0003428: When running with pythonw.exe, Windows may crash if you write to stdout. Some more print statements changed to log.warning.
svn: r21511
This commit is contained in:
parent
7c9ec32d22
commit
98fa69b717
@ -24,8 +24,15 @@
|
|||||||
Class handling language-specific selection for date parser and displayer.
|
Class handling language-specific selection for date parser and displayer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# set up logging
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
|
_ = glocale.get_translation().sgettext
|
||||||
# import prerequisites for localized handlers
|
# import prerequisites for localized handlers
|
||||||
from ._datehandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY,
|
from ._datehandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY,
|
||||||
register_datehandler)
|
register_datehandler)
|
||||||
@ -59,7 +66,7 @@ try:
|
|||||||
else:
|
else:
|
||||||
parser = LANG_TO_PARSER[LANG_SHORT]()
|
parser = LANG_TO_PARSER[LANG_SHORT]()
|
||||||
except:
|
except:
|
||||||
print("Date parser for", LANG, "not available, using default")
|
logging.warning(_("Date parser for '%s' not available, using default") % LANG)
|
||||||
parser = LANG_TO_PARSER["C"]()
|
parser = LANG_TO_PARSER["C"]()
|
||||||
|
|
||||||
# Initialize global displayer
|
# Initialize global displayer
|
||||||
@ -75,7 +82,7 @@ try:
|
|||||||
else:
|
else:
|
||||||
displayer = LANG_TO_DISPLAY[LANG_SHORT](val)
|
displayer = LANG_TO_DISPLAY[LANG_SHORT](val)
|
||||||
except:
|
except:
|
||||||
print("Date displayer for", LANG, "not available, using default")
|
logging.warning(_("Date displayer for '%s' not available, using default") % LANG)
|
||||||
displayer = LANG_TO_DISPLAY["C"](val)
|
displayer = LANG_TO_DISPLAY["C"](val)
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,15 @@ Option class representing an enumerated list of possible values.
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from . import Option
|
from . import Option
|
||||||
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
|
_ = glocale.get_translation().sgettext
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# set up logging
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import logging
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -115,5 +124,5 @@ class EnumeratedListOption(Option):
|
|||||||
if value in (v for v, d in self.__items):
|
if value in (v for v, d in self.__items):
|
||||||
Option.set_value(self, value)
|
Option.set_value(self, value)
|
||||||
else:
|
else:
|
||||||
print("Value '%s' not found for option '%s'" % (str(value),
|
logging.warning(_("Value '%(val)s' not found for option '%(opt)s'") %
|
||||||
self.get_label()))
|
{'val' : str(value), 'opt' : self.get_label()})
|
||||||
|
Loading…
Reference in New Issue
Block a user