116 elif status.state==backup.State.SCHEDULED: |
117 elif status.state==backup.State.SCHEDULED: |
117 # Operation scheduled |
118 # Operation scheduled |
118 when=status.when() |
119 when=status.when() |
119 now=time.time() |
120 now=time.time() |
120 |
121 |
121 if when<now: |
122 if when==math.inf: |
122 whenstr='overdue' |
123 whenstr='--' |
123 info='' |
|
124 else: |
124 else: |
125 tnow=datetime.datetime.fromtimestamp(now) |
125 tnow=datetime.datetime.fromtimestamp(now) |
126 twhen=datetime.datetime.fromtimestamp(when) |
126 twhen=datetime.datetime.fromtimestamp(when) |
127 tendtoday=twhen.replace(hour=23,minute=59,second=59) |
127 tendtoday=twhen.replace(hour=23,minute=59,second=59) |
128 tendtomorrow=tendtoday+datetime.timedelta(days=1) |
128 tendtomorrow=tendtoday+datetime.timedelta(days=1) |
129 diff=datetime.timedelta(seconds=when-now) |
129 diff=datetime.timedelta(seconds=when-now) |
130 |
130 |
131 if twhen>tendtomorrow: |
131 if twhen<tnow: |
|
132 whenstr='overdue' |
|
133 elif twhen>tendtomorrow: |
132 # Display date if scheduled event is after tomorrow |
134 # Display date if scheduled event is after tomorrow |
133 whenday=datetime.date.fromtimestamp(when) |
135 whenday=datetime.date.fromtimestamp(when) |
134 whenstr='on %s' % twhen.date().isoformat() |
136 whenstr='on %s' % twhen.date().isoformat() |
135 this_refresh_time=tendtoday+datetime.timedelta(seconds=1) |
137 this_refresh_time=tendtoday+datetime.timedelta(seconds=1) |
136 elif twhen>tendtoday and diff.seconds>=12*60*60: # 12 hours |
138 elif twhen>tendtoday and diff.seconds>=12*60*60: # 12 hours |
144 if twhen.tm_sec>30: |
146 if twhen.tm_sec>30: |
145 # Round up minute display to avoid user confusion |
147 # Round up minute display to avoid user confusion |
146 twhen=time.localtime(when+30) |
148 twhen=time.localtime(when+30) |
147 whenstr='at %02d:%02d' % (twhen.tm_hour, twhen.tm_min) |
149 whenstr='at %02d:%02d' % (twhen.tm_hour, twhen.tm_min) |
148 |
150 |
149 this_info='' |
151 this_info='' |
150 if 'reason' in status.detail: |
152 if 'reason' in status.detail: |
151 this_info=status.detail['reason'] + ' ' |
153 this_info=status.detail['reason'] + ' ' |
152 |
154 |
153 when_how_sched= "%s%s %s" % (this_info, status.type, whenstr) |
155 when_how_sched= "%s%s %s" % (this_info, status.type, whenstr) |
154 |
156 |
155 info=add_info(info, when_how_sched) |
157 info=add_info(info, when_how_sched) |
156 |
158 |
157 elif status.state==backup.State.QUEUED: |
159 elif status.state==backup.State.QUEUED: |
158 info=add_info(info, "queued %s" % status.type) |
160 info=add_info(info, "queued %s" % status.type) |
159 elif status.state==backup.State.ACTIVE: |
161 elif status.state==backup.State.ACTIVE: |
160 # Operation running |
162 # Operation running |