Esempio n. 1
0
    def on_time_button_pressed(self):
        simple_time = datetimeutil.str_time_simplify(self.time_edit.text())
        fixed_time = datetimeutil.fix_time_format(simple_time, self.info.time_format)

        dialog = TimeDialog(fixed_time, self)
        dialog.update.connect(self.time_updated)
        dialog.exec_()
Esempio n. 2
0
    def on_time_button_pressed(self):
        simple_time = datetimeutil.str_time_simplify(self.time_edit.text())
        fixed_time = datetimeutil.fix_time_format(simple_time,
                                                  self.info.time_format_num)

        dialog = TimeDialog(fixed_time, self)
        dialog.update.connect(self.time_updated)
        dialog.exec_()
Esempio n. 3
0
    def reminder(self, label, time, date, command, notes, popup, dialog, boxcar, play,
                sound_file, sound_length, sound_loop, pushbullet_device, delete_id, check_warning = False):
        time = datetimeutil.str_time_simplify(time)
        if time == None:
            return (self.time_error, -1)

        date = datetimeutil.str_date_simplify(date, self.settings.date_format)
        if date == None:
            return (self.date_error, -1)

        if play:
            if sound_file == None:
                return (self.file_error, -1)
            else:
                try:
                    with open(sound_file) as f: pass
                except IOError as e:
                    return (self.file_error, -1)

        if label == "" and notes == "" and check_warning and (boxcar or popup or dialog or pushbullet_device):
            return (self.notify_warn, -1)

        if not play:
            sound_file = ""
        if sound_loop:
            sound_length = 0

        r = db.Alarm(-1)
        r.set_data(label, notes, time, date, sound_file, sound_length, sound_loop,
                popup, command, boxcar, dialog, pushbullet_device)

        self.database = db.Database(self.filename)
        id = self.database.insert_alarm(r)

        if delete_id != -1:
            self.database.delete_alarm(delete_id)

        self.database.close()

        if self.pushbullet_devices_updated:
            self.settings.dump()

        return (self.ok, id)
Esempio n. 4
0
def valid_time(time_s):
    return datetimeutil.str_time_simplify(time_s) != None
    "every minutes to 3",
    "2500",
    "25",
    "-1",
    "every -2 minutes",
    "every minute from 5 to 1",
    "every minute from 5 to 5",
    "8/12/13",
    "October 12",
    "7-21-2013"
    ]

print "testing valid singular times"
for row in valid_singular:
    print "?" + row + "?"
    value = d.str_time_simplify(row)
    print "!" + str(value) + "!"

    if value == None:
        print "value should not be None!"
        exit()

print ""
print "testing valid repeating times"
for row in valid_repeating:
    print "?" + row + "?"
    value = d.str_time_simplify(row)
    print "!" + str(value) + "!"

    if value == None:
        print "value should not be None!"
Esempio n. 6
0
 def fix_time(self):
     reminder_list = self.all_alarms()
     for reminder in reminder_list:
         time = datetimeutil.str_time_simplify(reminder.time)
         sql = """UPDATE alarms SET time = ?"""
         self.execute(sql, [time])