Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'hour(s)': 3600,
'day(s)': 86400,
'week(s)': 604800,
'month(s)': 2592000,
'year(s)': 31536000}
# Se snoozo di n minuti l'allarme in generale non combacia più con ***
# i minuti esatti
# Controllare bene da tutte le parti che non facessi affidamento
# sulla separazione a minuti esatti anche per altri motivi
newalarm = ((alarmswindow.number.get() *
mult[alarmswindow.unit.get()] +
int(_time.time())) // 60 + 1) * 60
elif mode == 'dismiss':
newalarm = 'NULL'
if not group:
group = databases.memory.get_next_history_group()
qconn = databases.dbs[filename].connection.get()
cursor = qconn.cursor()
query_redo = queries.occurrences_update_id_alarm.format(newalarm, # @UndefinedVariable
self.id_)
query_undo = queries.occurrences_update_id_alarm.format(alarm, # @UndefinedVariable
self.id_)
cursor.execute(query_redo)
databases.dbs[filename].connection.give(qconn)
qmemory = databases.memory.get()
cursorh = qmemory.cursor()
cursorh.execute(queries.history_insert, (group, filename, self.id_,
'alarm', query_redo, '', query_undo, ''))
databases.memory.give(qmemory)
timer.refresh_timer()
self.close()
newalarm = ((alarmswindow.number.get() *
mult[alarmswindow.unit.get()] +
int(_time.time())) // 60 + 1) * 60
elif mode == 'dismiss':
newalarm = 'NULL'
if not group:
group = databases.memory.get_next_history_group()
qconn = databases.dbs[filename].connection.get()
cursor = qconn.cursor()
query_redo = queries.occurrences_update_id_alarm.format(newalarm, # @UndefinedVariable
self.id_)
query_undo = queries.occurrences_update_id_alarm.format(alarm, # @UndefinedVariable
self.id_)
cursor.execute(query_redo)
databases.dbs[filename].connection.give(qconn)
qmemory = databases.memory.get()
cursorh = qmemory.cursor()
cursorh.execute(queries.history_insert, (group, filename, self.id_,
'alarm', query_redo, '', query_undo, ''))
databases.memory.give(qmemory)
timer.refresh_timer()
self.close()
def snooze_all(self):
databases.protection.block()
group = databases.memory.get_next_history_group()
for alarm in tuple(self.alarms.keys()):
self.alarms[alarm].action(group=group, mode='snooze')
databases.protection.release()
def apply(self, textbool=None, schedbool=None):
item = self.item
if textbool == None:
textbool = textarea.textareas[item].is_modified()
if schedbool == None:
schedbool = scheduler.panels[item].is_modified()
kwargs = {}
if textbool:
kwargs.update(textarea.textareas[item].apply())
if schedbool:
kwargs.update(scheduler.panels[item].apply())
if textbool or schedbool:
filename = items.items[item].get_filename()
id_ = items.items[item].get_id()
group = databases.memory.get_next_history_group()
items.items[items.Item.make_tree_id(filename, id_)].update(group,
**kwargs)
if textbool:
textarea.textareas[item].refresh_mod_state()
if schedbool:
timer.refresh_timer()
scheduler.panels[item].refresh_originals()
newalarm = 'NULL'
if not group:
group = databases.memory.get_next_history_group()
qconn = databases.dbs[filename].connection.get()
cursor = qconn.cursor()
query_redo = queries.occurrences_update_id_alarm.format(newalarm, # @UndefinedVariable
self.id_)
query_undo = queries.occurrences_update_id_alarm.format(alarm, # @UndefinedVariable
self.id_)
cursor.execute(query_redo)
databases.dbs[filename].connection.give(qconn)
qmemory = databases.memory.get()
cursorh = qmemory.cursor()
cursorh.execute(queries.history_insert, (group, filename, self.id_,
'alarm', query_redo, '', query_undo, ''))
databases.memory.give(qmemory)
timer.refresh_timer()
self.close()
def main():
databases.protection = databases.Protection()
databases.memory = databases.MemoryDB()
def main():
databases.protection = databases.Protection()
databases.memory = databases.MemoryDB()
rootwindow.initialize()
rootwindow.root.mainloop()