コード例 #1
0
    def trace_punish(self):
        self.punish += 1
        if self.punish < 3:
            self.speak('trace_punish_d', {
                'elapsed_detail': common.seconds2str(self.elapsed_secs - self.count_secs),
                'trace_gap': common.seconds2str(self.trace_gap),
            }, True)
        elif self.punish < 6:
            self.speak('trace_punish_c', {
                'elapsed_detail': common.seconds2str(self.elapsed_secs - self.count_secs),
                'trace_gap': common.seconds2str(self.trace_gap),
            }, True)
        elif self.punish < 9:
            self.speak('trace_punish_b', {
                'elapsed_detail': common.seconds2str(self.elapsed_secs - self.count_secs),
                'trace_gap': common.seconds2str(self.trace_gap),
            }, True)
        elif self.punish < 12:
            self.speak('trace_punish_a', {
                'elapsed_detail': common.seconds2str(self.elapsed_secs - self.count_secs),
                'trace_gap': common.seconds2str(self.trace_gap),
            }, True)
        else:
            self.speak('trace_punish_s', {
                'elapsed_detail': common.seconds2str(self.elapsed_secs - self.count_secs),
                'trace_gap': common.seconds2str(self.trace_gap),
            }, True)

        self.elapsed_secs += self.punish_gap
        time.sleep(self.punish_gap)
コード例 #2
0
    def trace_finally(self):

        self.speak('trace_finally', {
            'elapsed_detail': common.seconds2str(self.elapsed_secs - self.count_secs),
            'trace_gap': common.seconds2str(self.trace_gap),
        }, True)

        self.running = False
        time.sleep(self.trace_gap)
コード例 #3
0
    def trace_abort(self):

        self.speak('trace_abort', {
            'count_detail': common.seconds2str(self.count_secs),
            'elapsed_detail': common.seconds2str(self.elapsed_secs - self.count_secs),
            'trace_gap': common.seconds2str(self.trace_gap),
        })

        self.running = False
        time.sleep(self.trace_gap)
コード例 #4
0
 def count_minus(self, num):
     if num * 60 > self.count_secs:
         self.count_secs = 0
         self.elapsed_secs -= self.count_secs
         self.speak('minus_minutes', {
             'change_detail': str(num) + '分钟',
             'count_detail': common.seconds2str(self.count_secs),
         })
         time.sleep(3)
     else:
         self.count_secs -= num * 60
         self.elapsed_secs -= num * 60
         self.speak('minus_minutes', {
             'change_detail': str(num) + '分钟',
             'count_detail': common.seconds2str(self.count_secs),
         })
コード例 #5
0
 def count_plus(self, num):
     self.count_secs += num * 60
     self.elapsed_secs += num * 60
     self.speak('plus_minutes', {
         'change_detail': str(num) + '分钟',
         'count_detail': common.seconds2str(self.count_secs),
     })
コード例 #6
0
    def trace_remind(self):
        for level in self.remind_pattern.keys():
            if self.count_secs in self.remind_pattern[level]:

                self.speak('trace_remind_' + level, {
                    'count_detail': common.seconds2str(self.count_secs),
                    'count_secs': self.count_secs,
                })
コード例 #7
0
    def trace_start(self):
        self.bomb_name = self.bombs_conf.pick_item()
        self.running = True
        self.shutdown = False
        self.abort = False
        self.punish = 0

        self.count_secs = common.str2seconds(self.target_conf['count_short'])
        self.elapsed_secs = self.count_secs

        self.targets_conf.add_weight(self.target_name)

        self.speak('trace_start', {
            'count_detail': common.seconds2str(self.count_secs)
        }, True)