Ejemplo n.º 1
0
 def _select(self, *args):
     """
     Select an attribute.
     """
     try:
         selected_index = self.list_box.curselection()[0]
         field = self.book.get_fields()[int(selected_index)]
         self.result = NON_DISPLAY_NAMES.get(field, field)
         self.destroy()
     except:
         mb.message(mb.WARNING,"Please select an attribute!",parent=self)
Ejemplo n.º 2
0
 def _open(self, *args):
     """
     Open the address book selected by the user.
     """
     name = self.e.get()
     if name not in data.get_book_names() and len(name.strip()) > 0:
         self.result = address.gui.MainWindow(name, NEW)
         self.destroy()
     elif len(name.strip()) == 0:
         mb.message(mb.WARNING, "Book name cannot be empty!", parent=self.parent)
     else:
         mb.message(mb.WARNING, ("There is already a book named %s, new name pls!") % name, parent=self.parent)
Ejemplo n.º 3
0
 def _open(self, *args):
     """
     Open the address book selected by the user.
     """
     try:
         selected_index = self.list_box.curselection()[0]
         name = self.metadata[int(selected_index)]
         self.destroy()
         self.result = address.gui.MainWindow(name, OPEN)
     except IOError:
         mb.message(mb.ERROR,"Cannot open the file!",parent=self.parent)
     except IndexError:
         mb.message(mb.WARNING,"Please select a book!",parent=self)
Ejemplo n.º 4
0
 def _open(self, *args):
     """
     Open the address book selected by the user.
     """
     name = self.e.get()
     if name not in data.get_book_names() and len(name.strip()) > 0:
         self.destroy()
         try:
             self.result = address.gui.MainWindow(name, IMPORT, self.import_path)
         except ValueError:
             mb.message(mb.ERROR,"File is corrupted!",parent=self.parent)
     elif len(name.strip()) == 0:
         mb.message(mb.WARNING, "Book name cannot be empty!", parent=self.parent)
     else:
         mb.message(mb.WARNING, ("There is already a book named %s, new name pls!") % name, parent=self.parent)