This commit is contained in:
Bertrand Chenal committed 2008-10-29 17:36:41 +01:00
commit 66b52069fc
2 files changed
+9 -9

No files matched your search

+6 -6
View File
@@ -245,20 +245,20 @@ class ComplexEntry(gtk.HBox):
def compute_date(cmd, dt, format):
lst = {
'^=(\d+)w$': lambda dt, r: dt + \
RelativeDateTime(day=0, month=0, weeks=int(r.group(1))),
'^=(\d+)d$': lambda dt, r: dt + \
RelativeDateTime(day=int(r.group(1))),
'^=(\d+)m$': lambda dt, r: dt + \
RelativeDateTime(day=0, month=int(r.group(1))),
'^=(2\d\d\d)y$': lambda dt, r: dt + \
RelativeDateTime(month=int(r.group(1))),
'^=(\d\d)y$': lambda dt, r: dt + \
RelativeDateTime(year=int(str(dt.year)[:-2] + r.group(1))),
'^=(\d+)y$': lambda dt, r: dt + \
RelativeDateTime(year=int(r.group(1))),
'^=(\d+)h$': lambda dt, r: dt + \
RelativeDateTime(hour=int(r.group(1))),
'^([\\+-]\d+)h$': lambda dt, r: dt + \
RelativeDateTime(hours=int(r.group(1))),
'^([\\+-]\d+)w$': lambda dt, r: dt + \
RelativeDateTime(days=7 * int(r.group(1))),
RelativeDateTime(weeks=int(r.group(1))),
'^([\\+-]\d+)d$': lambda dt, r: dt + \
RelativeDateTime(days=int(r.group(1))),
'^([\\+-]\d+)$': lambda dt, r: dt + \
@@ -270,7 +270,7 @@ def compute_date(cmd, dt, format):
'^=$': lambda dt,r: now(),
'^-$': lambda dt,r: False
}
for r,f in lst.items():
for r, f in lst.items():
groups = re.match(r, cmd)
if groups:
if not dt:
+3 -3
View File
@@ -63,14 +63,14 @@ class Shortcuts(object):
Available variables are:
h for hours
d for days
w for weeks
w for weeks (only with +/-)
m for months
y for years
Examples:
"+21d" increase of 21 days the date
"=23w" set the date to the 23th week of the year
"-10m" decrease of 10 months the date'''),)
"=11m" set the date to the 11th month of the year
"-2w" decrease of 2 weeks the date'''),)
]
notebook.append_page(self._fill_table(shortcuts),
gtk.Label(_('Edition Widgets')))