def edit(self): self.content = edit.editor( box=False, title=self.title, inittext=self.content, win_location=(2, 2) )
def __init__(self): self.title = input('Enter the note title :') self.tags = input('Enter Tags :').split(', ') self.content = edit.editor( box=False, title=self.title, win_location=(2, 2) ) os.system('touch notebook/'+self.title+'.txt') self.file = open('notebook/'+self.title+'.txt', 'r+') self.rewrite()
def __init__( self, title='', tags=[], content='', node='bare' ): if len(title): self.title = title else: self.title = input('Enter Note title : ') if os.path.isfile('notebook/'+self.title+'.json'): # If file exists, load note from the file self.file = open('notebook/'+self.title+'.json', 'r+') jload = json.loads(self.file.read()) self.title = jload['title'] self.tags = jload['tags'] self.content = jload['content'] self.node = jload['node'] else: if len(tags): self.tags = tags else: self.tags = input('Enter tags : ').split(', ') if len(content) == 0: self.content = edit.editor( box=False, title=self.title, win_location=(2, 2) ) else: self.content = content self.node = node self.file = open('notebook/'+self.title+'.json', 'w') self.rewrite()