コード例 #1
0
ファイル: cairo-clock.py プロジェクト: FPar/gnome15
 def get_next_tick(self):
     now = datetime.datetime.now()
     
     if self.second_sweep:
         next_tick = now + datetime.timedelta(0, 0.1)
     elif self.display_seconds:
         next_tick = now + datetime.timedelta(0, 1.0)
         next_tick = datetime.datetime(next_tick.year,next_tick.month,next_tick.day,next_tick.hour, next_tick.minute, int(next_tick.second))
     else:
         next_tick = now + datetime.timedelta(0, 60.0)
         next_tick = datetime.datetime(next_tick.year,next_tick.month,next_tick.day,next_tick.hour, next_tick.minute, 0)
         
     return g15pythonlang.total_seconds( next_tick - now )
コード例 #2
0
ファイル: cairo-clock.py プロジェクト: AgenttiX/gnome15
    def get_next_tick(self):
        now = datetime.datetime.now()

        if self.second_sweep:
            next_tick = now + datetime.timedelta(0, 0.1)
        elif self.display_seconds:
            next_tick = now + datetime.timedelta(0, 1.0)
            next_tick = datetime.datetime(next_tick.year, next_tick.month,
                                          next_tick.day, next_tick.hour,
                                          next_tick.minute,
                                          int(next_tick.second))
        else:
            next_tick = now + datetime.timedelta(0, 60.0)
            next_tick = datetime.datetime(next_tick.year, next_tick.month,
                                          next_tick.day, next_tick.hour,
                                          next_tick.minute, 0)

        return g15pythonlang.total_seconds(next_tick - now)
コード例 #3
0
ファイル: clock.py プロジェクト: FPar/gnome15
 def _schedule_redraw(self):
     if not self.active:
         return
     
     '''
     Determine when to schedule the next redraw for. 
     '''        
     now = datetime.datetime.now()
     if self.display_seconds:
         next_tick = now + datetime.timedelta(0, 1.0)
         next_tick = datetime.datetime(next_tick.year,next_tick.month,next_tick.day,next_tick.hour, next_tick.minute, int(next_tick.second))
     else:
         next_tick = now + datetime.timedelta(0, 60.0)
         next_tick = datetime.datetime(next_tick.year,next_tick.month,next_tick.day,next_tick.hour, next_tick.minute, 0)
     delay = g15pythonlang.total_seconds( next_tick - now )
     
     '''
     Try not to create threads or timers if possible. Use g15scheduler.schedule) instead
     '''
     self.timer = g15scheduler.schedule("ClockRedraw", delay, self._redraw)
コード例 #4
0
ファイル: clock.py プロジェクト: tanktarta/gnome15
 def _schedule_redraw(self):
     if not self.active:
         return
     '''
     Determine when to schedule the next redraw for. 
     '''
     now = datetime.datetime.now()
     if self.display_seconds:
         next_tick = now + datetime.timedelta(0, 1.0)
         next_tick = datetime.datetime(next_tick.year, next_tick.month,
                                       next_tick.day, next_tick.hour,
                                       next_tick.minute,
                                       int(next_tick.second))
     else:
         next_tick = now + datetime.timedelta(0, 60.0)
         next_tick = datetime.datetime(next_tick.year, next_tick.month,
                                       next_tick.day, next_tick.hour,
                                       next_tick.minute, 0)
     delay = g15pythonlang.total_seconds(next_tick - now)
     '''
     Try not to create threads or timers if possible. Use g15scheduler.schedule) instead
     '''
     self.timer = g15scheduler.schedule("ClockRedraw", delay, self._redraw)
コード例 #5
0
ファイル: stopwatch.py プロジェクト: tanktarta/gnome15
 def get_next_tick(self):
     return g15pythonlang.total_seconds( datetime.timedelta( seconds = 1 ))
コード例 #6
0
def total_seconds(time_delta):
    return g15pythonlang.total_seconds(time_delta)