Exemplo n.º 1
0
 def cmd_sel(self, args):
     'usage: sel [-q] [selection]'
     try:
         (opts, args) = getopt(args, 'q')
     except GetoptError:
         raise Kernel.ShowUsage()
     #
     verbose = 1
     for (k, v) in opts:
         if k == '-q': verbose = 0
     #
     selections = self.list_selections()
     if args:
         selection = self.get_selection(Kernel.safeint(args[0]))
         if verbose:
             self.cmd_scan([])
     else:
         for (i, fname) in enumerate(selections):
             fp = file(fname, 'rb')
             MailCorpus.register_singleton_handler(self.get_corpus)
             selection = pickle.load(fp)
             fp.close()
             self.terminal.notice(
                 '%2d: %s (%s)' %
                 (i, selection.description(), selection.estimation()))
     return
Exemplo n.º 2
0
 def cmd_sel(self, args):
   'usage: sel [-q] [selection]'
   try:
     (opts, args) = getopt(args, 'q')
   except GetoptError:
     raise Kernel.ShowUsage()
   #
   verbose = 1
   for (k,v) in opts:
     if k == '-q': verbose = 0
   #
   selections = self.list_selections()
   if args:
     selection = self.get_selection(Kernel.safeint(args[0]))
     if verbose:
       self.cmd_scan([])
   else:
     for (i,fname) in enumerate(selections):
       fp = file(fname, 'rb')
       MailCorpus.register_singleton_handler(self.get_corpus)
       selection = pickle.load(fp)
       fp.close()
       self.terminal.notice('%2d: %s (%s)' %
                            (i, selection.description(),
                             selection.estimation()))
   return
Exemplo n.º 3
0
 def get_corpus(self, dirname=config.INBOX_DIR):
     if dirname in self.corpus:
         corpus = self.corpus[dirname]
     else:
         corpus = MailCorpus(dirname)
         self.corpus[dirname] = corpus
         corpus.open()
     return corpus
Exemplo n.º 4
0
 def get_corpus(self, dirname=config.INBOX_DIR):
   if dirname in self.corpus:
     corpus = self.corpus[dirname]
   else:
     corpus = MailCorpus(dirname)
     self.corpus[dirname] = corpus
     corpus.open()
   return corpus
Exemplo n.º 5
0
 def get_selection(self, i=0):
     if i == 0 and self.current_selection != None:
         return self.current_selection
     selections = self.list_selections()
     if not selections:
         raise Kernel.ValueError('No message is selected.')
     self.save_current_selection()
     fp = file(selections[i], 'rb')
     MailCorpus.register_singleton_handler(self.get_corpus)
     self.current_selection = pickle.load(fp)
     fp.close()
     return self.current_selection
Exemplo n.º 6
0
 def get_selection(self, i=0):
   if i == 0 and self.current_selection != None:
     return self.current_selection
   selections = self.list_selections()
   if not selections:
     raise Kernel.ValueError('No message is selected.')
   self.save_current_selection()
   fp = file(selections[i], 'rb')
   MailCorpus.register_singleton_handler(self.get_corpus)
   self.current_selection = pickle.load(fp)
   fp.close()
   return self.current_selection