def saveBodyText(self):
     title = self.name_entry.get(1.0, 'end')
     content = self.body_text.get(1.0, 'end')
     # check that title input isn't empty
     if title != '\n':
         # check that body input isn't empty
         if content != '\n':
             # check that title doesn't already exist in database
             if self.sameName() == False:
                 # save the page
                 HTMLdb.newPage(title, content)
                 self.clearListbox()
                 self.clearTextboxes()
                 self.populateListbox()
             else:
                 # tell user they're trying to use a pre-existing title
                 messagebox.showwarning(
                     'Title already in use',
                     '{} already exists. Rename your page \n or delete the previous entry'
                     .format(title.strip().capitalize()))
         # tell user they need to add content
         else:
             messagebox.showwarning(
                 'No content', 'Please add body content before saving')
     # if title input is empty, check if body input is also empty
     elif content == '\n':
         # if so, do nothing
         return
     # tell user to title their page
     else:
         messagebox.showwarning('No title', 'Please title this page.')
 def deleteItem(self):
     titlelist = self.name_list.curselection()
     item = titlelist[0]
     title = self.name_list.get(item)
     HTMLdb.deletePage(title)
     self.clearListbox()
     self.clearTextboxes()
     self.populateListbox()
 def deleteItem(self):
     titlelist = self.name_list.curselection()
     item = titlelist[0]
     title = self.name_list.get(item)
     HTMLdb.deletePage(title)
     self.clearListbox()
     self.clearTextboxes()
     self.populateListbox()
 def select(self, evt):
     titlelist = self.name_list.curselection()
     self.body_text.delete(1.0, END)
     for item in titlelist:
         title = str(self.name_list.get(item))
         page = HTMLdb.displayItem(title)
         for item in page:
             i = item[0]
             self.body_text.insert(END, i)
 def select(self, evt):
     titlelist = self.name_list.curselection()
     self.body_text.delete(1.0, END)
     for item in titlelist:
         title = str(self.name_list.get(item))
         page = HTMLdb.displayItem(title)
         for item in page:
             i = item[0]
             self.body_text.insert(END, i)
 def saveBodyText(self):
     title = self.name_entry.get(1.0, 'end')
     content = self.body_text.get(1.0, 'end')
     # check that title input isn't empty
     if title != '\n':
         # check that body input isn't empty
         if content != '\n':
             # check that title doesn't already exist in database
             if self.sameName() == False:
                 # save the page
                 HTMLdb.newPage(title, content)
                 self.clearListbox()
                 self.clearTextboxes()
                 self.populateListbox()
             else:
                 # tell user they're trying to use a pre-existing title
                 messagebox.showwarning(
                     'Title already in use',
                     '{} already exists. Rename your page \n or delete the previous entry'.format(title.strip().capitalize())
                     )
         # tell user they need to add content
         else:
             messagebox.showwarning(
                         'No content',
                         'Please add body content before saving'
                         )
     # if title input is empty, check if body input is also empty
     elif content == '\n':
         # if so, do nothing
         return
     # tell user to title their page
     else:
         messagebox.showwarning(
                     'No title',
                     'Please title this page.'
                     )
 def sameName(self):
     title = self.name_entry.get(1.0, 'end')
     if HTMLdb.findTitle(title):
         return True
     else:
         return False
 def updateItem(self):
     titlelist = self.name_list.curselection()
     item = titlelist[0]
     title = self.name_list.get(item)
     content = self.body_text.get(1.0, 'end')
     HTMLdb.updatePage(title, content)
 def populateListbox(self):
     for item in HTMLdb.displayAll():
         # itemnumber = str(item[0])
         name = item[1]
         self.name_list.insert(END, name)
 def updateItem(self):
     titlelist = self.name_list.curselection()
     item = titlelist[0]
     title = self.name_list.get(item)
     content = self.body_text.get(1.0, 'end')
     HTMLdb.updatePage(title, content)
 def populateListbox(self):
     for item in HTMLdb.displayAll():
         # itemnumber = str(item[0])
         name = item[1]
         self.name_list.insert(END, name)
 def sameName(self):
     title = self.name_entry.get(1.0, 'end')
     if HTMLdb.findTitle(title):
         return True
     else:
         return False