Example #1
0
	def __delitem__(self, id):
		id = self._effective_id(id)
		if id in self:
			reminders.delete_reminder(self.items[id])
			del self.items[id]
			if self.cached:
				del self.cache[id]
		else:
			raise KeyError
Example #2
0
 def __delitem__(self, id):
     id = self._effective_id(id)
     if id in self:
         reminders.delete_reminder(self.items[id])
         del self.items[id]
         if self.cached:
             del self.cache[id]
     else:
         raise KeyError
Example #3
0
 def tableview_move_row(self, tableview, from_section, from_row, to_section,
                        to_row):
     # Called when the user moves a row with the reordering control (in editing mode).
     print('moving from [{}][{}] to [{}][{}]'.format(
         from_section, from_row, to_section, to_row))
     if to_section != from_section:
         try:
             r_old = self.get_rem(from_section, from_row)
             print(r_old)
             r_new = reminders.Reminder(self.get_cal(to_section))
             print('r_new: {}'.format(dir(r_new)))
             r_new.title = r_old.title
             if r_old.notes is not None:
                 r_new.notes = r_old.notes
             r_new.completed = r_old.completed
             r_new.completion_date = r_old.completion_date
             r_new.due_date = r_old.due_date
             if r_old.alarms is not None:
                 r_new.alarms = r_old.alarms
             print('new reminder created')
             r_new.save()
             keys = [
                 'alarms', 'completed', 'completion_date', 'due_date',
                 'notes', 'title'
             ]
             for k in keys:
                 print('{}: {}'.format(k, r_new.__getattribute__(k)))
             reminders.delete_reminder(r_old)
             #console.show_activity()
             #tableview.superview.a.start()
             #tableview.superview.a.bring_to_front()
             self.table_array = self.get_items()
             #time.sleep(5)
             #console.hide_activity()
             #tableview.superview.a.stop()
             tableview.reload_data()
         except:
             raise
             print('move failed')
Example #4
0
	store['to be changed'] = 'sample'
	
	# Simulate changes to the Reminders synced from another device
	
	# Add
	a = reminders.Reminder(store.list_calendar)
	a.title = 'has been added'
	a.notes = 'sample'
	a.save()
	
	# Change
	list_reminders = reminders.get_reminders(store.list_calendar)
	for item in list_reminders:
		if item.title == 'to be changed':
			item.notes = 'new value'
			item.save()
	
	# Delete
	reminders.delete_reminder(store.items['to be deleted'])
	
	diff = store.refresh_cache()
	
	print
	print 'DIFF: ' + str(diff)
	
	del store['to be changed']
	del store['has been added']
	
	print
	print 'ITEMS IN STORE: ' + str(len(store))
	print 
Example #5
0
    # Simulate changes to the Reminders synced from another device

    # Add
    a = reminders.Reminder(store.list_calendar)
    a.title = 'has been added'
    a.notes = 'sample'
    a.save()

    # Change
    list_reminders = reminders.get_reminders(store.list_calendar)
    for item in list_reminders:
        if item.title == 'to be changed':
            item.notes = 'new value'
            item.save()

    # Delete
    reminders.delete_reminder(store.items['to be deleted'])

    diff = store.refresh_cache()

    print()
    print('DIFF: ' + str(diff))

    del store['to be changed']
    del store['has been added']

    print()
    print('ITEMS IN STORE: ' + str(len(store)))
    print()