class1 : memobee_note:
specs:
- properties
- id
- title
- date
- body
- Methods
- add(memobee_fman)
- edit(memobee_fman)
- delete(memobee_fman)
- past()
- properties
- id
- date
- command
- terminal
- methods
- add(memobee_fman)
- edit(memobee_fman)
- delete(memobee_fman)
- past()
DONE: Wednesday, August 06 2008
1 comment:
import datetime
class memobee_note:
def __init__(self,id='0',title='',date='',body=''):
# to put new id if it's not set
if id =='0' or id == 0 or id ='':
id_obj = datetime.datetime.today()
id_text = str(id_obj).replace(' ','').replace('-','').replace(':','').replace('.','')
self.id = id_text
else:
self.id = id
self.title = str(title)
# to put the date = now if not set
if date == '':
date = datetime.datetime.today()
#to convert the date of it's a string into a date instance
if isinstance(date,str):
self.date = datetime.datetime.strptime(date,'%Y-%m-%d %H:%M:%S')
else:
date = datetime.datetime(date.year,date.month,date.day,date.hour,date.minute,date.second)
self.date = date
self.body = str(body)
def add(self, fman):
fman.add_note(self)
def edit(self, fman):
fman.edit_note(self.id, self)
def delete(fman):
fman.del_note(self.id)
def past(self):
now_date = datetime.datetime.today()
time_delta = now_date-self.date
print time_delta.days
if time_delta.days <0:
return False
else:
return True
class memobee_launcher:
def __init__(self,id='0',date='',command='',terminal='0'):
#putting an id if not set
if id =='0' or id == 0 or id = '' :
id_obj = datetime.datetime.today()
id_text = str(id_obj).replace(' ','').replace('-','').replace(':','').replace('.','')
self.id = id_text
else:
self.id = id
# to put the date = now if not set
if date == '':
date = datetime.datetime.today()
#to convert the date of it's a string into a date instance
if isinstance(date,str):
self.date = datetime.datetime.strptime(date,'%Y-%m-%d %H:%M:%S')
else:
date = datetime.datetime(date.year,date.month,date.day,date.hour,date.minute,date.second)
self.date = date
self.command = str(command)
self.terminal = bool(int(terminal))
def add(self, fman):
fman.add_launcher(self)
def edit(self, fman):
fman.edit_launcher(self.id, self)
def delete(fman):
fman.del_launcher(self.id)
def past(self):
now_date = datetime.datetime.today()
time_delta = now_date-self.date
print time_delta.days
if time_delta.days <0:
return False
else:
return True
Post a Comment