1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added ability to quickly access previous and next timerange

This commit is contained in:
Krateng
2019-04-26 17:05:29 +02:00
parent 0938eb57bc
commit f3fe8bb121
2 changed files with 35 additions and 0 deletions

View File

@@ -84,6 +84,13 @@ class MRangeDescriptor:
def unlimited(self):
return False
# returns the description of the range including buttons to go back and forth
#def desc_interactive(self,**kwargs):
# if self.next(1) is None:
# return self.desc(**kwargs)
# else:
# prevrange = self.next(-1)
# nextrange = self.next(1)
# a range that is exactly a gregorian calendar unit (year, month or day)
class MTime(MRangeDescriptor):
@@ -362,6 +369,7 @@ class MRange(MRangeDescriptor):
def next(self,step=1):
if abs(step) == math.inf: return None
if self.since is None or self.to is None: return None
# hop from the start element by one until we reach the end element
diff = 1
nxt = self.since