コード例 #1
0
ファイル: except_once.py プロジェクト: mikpim01/outspline
    def create_random_rule():
        start = int((random.gauss(_time.time(), 15000)) // 60 * 60)

        endtype = random.choice((0, 1))

        end = start + random.randint(1, 360) * 60

        inclusive = random.choice((True, False))

        stdn = random.randint(0, 1)

        if stdn == 0:
            return organism_basicrules_api.make_except_once_rule_local(
                start, end, inclusive, (endtype, ))
        else:
            return organism_basicrules_api.make_except_once_rule_UTC(
                start, end, inclusive, (endtype, ))
コード例 #2
0
ファイル: except_once.py プロジェクト: xguse/outspline
    def create_random_rule():
        start = int((random.gauss(_time.time(), 15000)) // 60 * 60)

        endtype = random.choice((0, 1))

        end = start + random.randint(1, 360) * 60

        inclusive = random.choice((True, False))

        stdn = random.randint(0, 1)

        if stdn == 0:
            return organism_basicrules_api.make_except_once_rule_local(start,
                                                end, inclusive, (endtype, ))
        else:
            return organism_basicrules_api.make_except_once_rule_UTC(start,
                                                end, inclusive, (endtype, ))
コード例 #3
0
ファイル: except_once.py プロジェクト: mikpim01/outspline
    def apply_rule(self, filename, id_):
        values = self.ui.get_values()
        start = values['start_unix_time']
        endtype = values['end_type']
        end = values['end_unix_time']
        rendn = values['end_relative_number']
        rendu = values['end_relative_unit']
        inclusive = values['inclusive']
        standard = values['time_standard']

        try:
            if standard == 'UTC':
                ruled = organism_basicrules_api.make_except_once_rule_UTC(
                    start, end, inclusive, (endtype, ))
            else:
                ruled = organism_basicrules_api.make_except_once_rule_local(
                    start, end, inclusive, (endtype, ))
        except organism_basicrules_api.BadRuleError:
            msgboxes.warn_bad_rule(msgboxes.end_time).ShowModal()
        else:
            label = self._make_label(start, end, inclusive, endtype, rendn,
                                     rendu, standard)
            wxscheduler_api.apply_rule(filename, id_, ruled, label)
コード例 #4
0
ファイル: except_once.py プロジェクト: xguse/outspline
    def apply_rule(self, filename, id_):
        values = self.ui.get_values()
        start = values['start_unix_time']
        endtype = values['end_type']
        end = values['end_unix_time']
        rendn = values['end_relative_number']
        rendu = values['end_relative_unit']
        inclusive = values['inclusive']
        standard = values['time_standard']

        try:
            if standard == 'UTC':
                ruled = organism_basicrules_api.make_except_once_rule_UTC(
                                            start, end, inclusive, (endtype, ))
            else:
                ruled = organism_basicrules_api.make_except_once_rule_local(
                                            start, end, inclusive, (endtype, ))
        except organism_basicrules_api.BadRuleError:
            msgboxes.warn_bad_rule(msgboxes.end_time).ShowModal()
        else:
            label = self._make_label(start, end, inclusive, endtype, rendn,
                                                            rendu, standard)
            wxscheduler_api.apply_rule(filename, id_, ruled, label)