New date formats

svn: r206
This commit is contained in:
Don Allingham 2001-06-30 23:01:38 +00:00
parent aff15f8638
commit 0963b42290
3 changed files with 100 additions and 79 deletions

View File

@ -63,15 +63,18 @@ _date_format_list = [
"Month Day, Year", "Month Day, Year",
"MON Day, Year", "MON Day, Year",
"Day MON Year", "Day MON Year",
"MM/DD/YY", "MM/DD/YYYY",
"MM-DD-YY", "MM-DD-YYYY",
"DD/MM/YY", "DD/MM/YYYY",
"DD-MM-YY" "DD-MM-YYYY",
"MM.DD.YYYY",
"DD.MM.YYYY",
"DD. Month Year"
] ]
_date_entry_list = [ _date_entry_list = [
"MM/DD/YY", "MM/DD/YYYY, MM.DD.YYYY, MM-DD-YYYY",
"DD/MM/YY" "DD/MM/YYYY, DD.MM.YYYY, DD-MM-YYYY"
] ]
_name_format_list = [ _name_format_list = [
@ -174,14 +177,14 @@ def loadConfig(call):
db_dir = gnome.config.get_string("/gramps/config/DbDirectory") db_dir = gnome.config.get_string("/gramps/config/DbDirectory")
if report_dir == None: if report_dir == None:
report_dir = "." report_dir = "./"
else: else:
report_dir = report_dir + os.sep report_dir = os.path.normpath(report_dir) + os.sep
if db_dir == None: if db_dir == None:
db_dir = "." db_dir = "./"
else: else:
db_dir = db_dir + os.sep db_dir = os.path.normpath(db_dir) + os.sep
name = gnome.config.get_string("/gramps/researcher/name") name = gnome.config.get_string("/gramps/researcher/name")
addr = gnome.config.get_string("/gramps/researcher/addr") addr = gnome.config.get_string("/gramps/researcher/addr")
@ -339,11 +342,11 @@ def on_propertybox_apply(obj,page):
dbdir_temp = prefsTop.get_widget("dbdir").get_full_path(1) dbdir_temp = prefsTop.get_widget("dbdir").get_full_path(1)
if os.path.isdir(dbdir_temp): if os.path.isdir(dbdir_temp):
db_dir = dbdir_temp + os.sep db_dir = os.path.normpath(dbdir_temp) + os.sep
repdir_temp = prefsTop.get_widget("repdir").get_full_path(1) repdir_temp = prefsTop.get_widget("repdir").get_full_path(1)
if os.path.isdir(repdir_temp): if os.path.isdir(repdir_temp):
report_dir = repdir_temp + os.sep report_dir = os.path.normpath(repdir_temp) + os.sep
paper_preference = paper_obj.get_data("d") paper_preference = paper_obj.get_data("d")
output_preference = output_obj.get_data("d") output_preference = output_obj.get_data("d")

View File

@ -292,7 +292,7 @@ class SingleDate:
fmt1 = re.compile(start + "(\S+)(\s+\d+\s*,)?\s*(\d+)?\s*$", fmt1 = re.compile(start + "(\S+)(\s+\d+\s*,)?\s*(\d+)?\s*$",
re.IGNORECASE) re.IGNORECASE)
fmt2 = re.compile(start + "(\d+)\s+(\S+)(\s+\d+)?\s*$", fmt2 = re.compile(start + "(\d+)\.?\s+(\S+)(\s+\d+)?\s*$",
re.IGNORECASE) re.IGNORECASE)
quick= re.compile(start + "(\d+)?\s(\S\S\S)?\s(\d+)?", quick= re.compile(start + "(\d+)?\s(\S\S\S)?\s(\d+)?",
re.IGNORECASE) re.IGNORECASE)
@ -579,7 +579,7 @@ class SingleDate:
# #
# #
#-------------------------------------------------------------------- #--------------------------------------------------------------------
def getFmt4(self): def getFmt10(self):
retval = "" retval = ""
if self.month == -1 and self.day == -1 and self.year == -1 : if self.month == -1 and self.day == -1 and self.year == -1 :
@ -588,16 +588,52 @@ class SingleDate:
if self.month == -1: if self.month == -1:
retval = str(self.year) retval = str(self.year)
elif self.year == -1: elif self.year == -1:
retval = "%d/??/??" % self.month+1 retval = SingleDate.mname[self.month]
else: else:
retval = "%d/??/%d" % (self.month+1,self.year) month = SingleDate.mname[self.month]
retval = "%s %d" % (month,self.year)
elif self.month == -1: elif self.month == -1:
retval = "??-%d-%d" % (self.day,self.year) retval = str(self.year)
else:
month = SingleDate.mname[self.month]
if self.year == -1:
retval = "%d. %s ????" % (self.day,month)
else:
retval = "%d. %s %d" % (self.day,month,self.year)
if self.mode == SingleDate.about:
retval = "%s %s" % (_("ABT"),retval)
if self.mode == SingleDate.before:
retval = "%s %s" % (_("BEFORE"),retval)
elif self.mode == SingleDate.after:
retval = "%s %s" % (_("AFTER"),retval)
return retval
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def get_mmddyyyy(self,sep):
retval = ""
if self.month == -1 and self.day == -1 and self.year == -1 :
pass
elif self.day == -1:
if self.month == -1:
retval = str(self.year)
elif self.year == -1:
retval = "%d%s??%s??" % (self.month+1,sep,sep)
else:
retval = "%d%s??%s%d" % (self.month+1,sep,sep,self.year)
elif self.month == -1:
retval = "??%s%d%s%d" % (sep,self.day,sep,self.year)
else: else:
if self.year == -1: if self.year == -1:
retval = "%d/%d/????" % (self.month+1,self.day) retval = "%d%s%d%s????" % (self.month+1,sep,self.day,sep)
else: else:
retval = "%d/%d/%d" % (self.month+1,self.day,self.year) retval = "%d%s%d%s%d" % (self.month+1,sep,self.day,sep,self.year)
if self.mode == SingleDate.about: if self.mode == SingleDate.about:
retval = "%s %s" % (_("ABT"),retval) retval = "%s %s" % (_("ABT"),retval)
@ -609,46 +645,36 @@ class SingleDate:
return retval return retval
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def getFmt4(self):
return self.get_mmddyyyy("/")
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
# #
# #
#-------------------------------------------------------------------- #--------------------------------------------------------------------
def getFmt5(self): def getFmt5(self):
retval = "" return self.get_mmddyyyy("-")
if self.month == -1 and self.day == -1 and self.year == -1 :
pass
elif self.day == -1:
if self.month == -1:
retval = str(self.year)
elif self.year == -1:
retval = "%d-??-??" % self.month+1
else:
retval = "%d-??-%d" % (self.month+1,self.year)
elif self.month == -1:
retval = "??-%d-%d" % (self.day,self.year)
else:
if self.year == -1:
retval = "%d-%d-????" % (self.month+1,self.day)
else:
retval = "%d-%d-%d" % (self.month+1,self.day,self.year)
if self.mode == SingleDate.about:
retval = "%s %s" % (_("ABT"),retval)
if self.mode == SingleDate.before:
retval = "%s %s" % (_("BEFORE"),retval)
elif self.mode == SingleDate.after:
retval = "%s %s" % (_("AFTER"),retval)
return retval
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
# #
# #
#-------------------------------------------------------------------- #--------------------------------------------------------------------
def getFmt6(self): def getFmt8(self):
return self.get_mmddyyyy(".")
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def get_ddmmyyyy(self,sep):
retval = "" retval = ""
if self.month == -1 and self.day == -1 and self.year == -1 : if self.month == -1 and self.day == -1 and self.year == -1 :
@ -657,16 +683,16 @@ class SingleDate:
if self.month == -1: if self.month == -1:
retval = str(self.year) retval = str(self.year)
elif self.year == -1: elif self.year == -1:
retval = "??/%d/??" % self.month+1 retval = "??%s%d%s??" % (sep,self.month+1,sep)
else: else:
retval = "??/%d/%d" % (self.month+1,self.year) retval = "??%s%d%s%d" % (sep,self.month+1,sep,self.year)
elif self.month == -1: elif self.month == -1:
retval = "%d/??/%d" % (self.day,self.year) retval = "%d%s??%s%d" % (self.day,sep,sep,self.year)
else: else:
if self.year == -1: if self.year == -1:
retval = "%d/%d/????" % (self.day,self.month+1) retval = "%d%s%d%s????" % (self.day,sep,self.month+1,sep)
else: else:
retval = "%d/%d/%d" % (self.day,self.month+1,self.year) retval = "%d%s%d%s%d" % (self.day,sep,self.month+1,sep,self.year)
if self.mode == SingleDate.about: if self.mode == SingleDate.about:
retval = "%s %s" % (_("ABT"),retval) retval = "%s %s" % (_("ABT"),retval)
@ -676,6 +702,13 @@ class SingleDate:
retval = "%s %s" % (_("AFTER"),retval) retval = "%s %s" % (_("AFTER"),retval)
return retval return retval
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def getFmt6(self):
return self.get_ddmmyyyy("/")
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
@ -683,38 +716,23 @@ class SingleDate:
# #
#-------------------------------------------------------------------- #--------------------------------------------------------------------
def getFmt7(self): def getFmt7(self):
retval = "" return self.get_ddmmyyyy("-")
if self.month == -1 and self.day == -1 and self.year == -1 :
pass
elif self.day == -1:
if self.month == -1:
retval = "%d" % self.year
elif self.year == -1:
retval = "??-%d-??" % self.month+1
else:
retval = "??-%d-%d" % (self.month+1,self.year)
elif self.month == -1:
retval = "%d-??-%d" % (self.day,self.year)
elif self.year == -1:
retval = "%d-%d-????" % (self.day,self.month+1)
else:
retval = "%d-%d-%d" % (self.day,self.month+1,self.year)
if self.mode == SingleDate.about:
retval = "%s %s" % (_("ABT"),retval)
if self.mode == SingleDate.before:
retval = "%s %s" % (_("BEFORE"),retval)
elif self.mode == SingleDate.after:
retval = "%s %s" % (_("AFTER"),retval)
return retval
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
# #
# #
#-------------------------------------------------------------------- #--------------------------------------------------------------------
fmtFunc = [ getFmt1, getFmt2, getFmt3, getFmt4, getFmt5, getFmt6, getFmt7 ] def getFmt9(self):
return self.get_ddmmyyyy(".")
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
fmtFunc = [ getFmt1, getFmt2, getFmt3, getFmt4, getFmt5, getFmt6,
getFmt7, getFmt8, getFmt9, getFmt10 ]
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #

View File

@ -74,7 +74,7 @@ gtkrcFile = rootDir + os.sep + "gtkrc"
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
progName = "gramps" progName = "gramps"
version = "0.3.2pre" version = "0.3.2"
copyright = "(C) 2001 Donald N. Allingham" copyright = "(C) 2001 Donald N. Allingham"
authors = ["Donald N. Allingham"] authors = ["Donald N. Allingham"]
comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program that can be extended by using the Python programming language.") comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program that can be extended by using the Python programming language.")