Пример #1
0
 def _get(self, pos):
     if not pos:
         return None, None
     if pos.parent and pos.field != pos.parent.field[pos.index]:
         hachoir_log.error(_("assertion failed at urwid_ui.Walker._get"))
     if not (pos.flags is None and pos.hidden()) and pos.flags != self.flags:
         self.update(pos)
     return pos.getWidget(self.start), pos
Пример #2
0
 def _get(self, pos):
     if not pos:
         return None, None
     if pos.parent and pos.field != pos.parent.field[pos.index]:
         hachoir_log.error(_("assertion failed at urwid_ui.Walker._get"))
     if not (pos.flags is None and pos.hidden()) and pos.flags != self.flags:
         self.update(pos)
     return pos.getWidget(self.start), pos
Пример #3
0
 def run():
     msg = _resize = retry = 0
     events = ( "window resize", )
     profile_display = args.profile_display
     while True:
         for e in events:
             try:
                 if e == "window resize":
                     size = ui.get_cols_rows()
                     resize = log.height
                 else:
                     e = top.keypress(size, e)
                     if e is None:
                         pass
                     elif e in ('f1', '?'):
                         try:
                             body.select(body.tabs.index(help))
                         except ValueError:
                             body.append(help)
                             resize = log.height
                     elif e in ('esc', 'ctrl w'):
                         body.close()
                         if body.box_widget is None:
                             return
                         resize = log.height
                     elif e == '+':
                         if log.height:
                             resize = log.height - 1
                     elif e == '-':
                         resize = log.height + 1
                     elif e == 'q':
                         return
             #except AssertionError:
             #    hachoir_log.error(getBacktrace())
             except NewTab_Stream, e:
                 stream = e.field.getSubIStream()
                 logger.objects[stream] = e = "%u/%s" % (body.active, e.field.absolute_address)
                 parser = guessParser(stream)
                 if not parser:
                     hachoir_log.error(_("No parser found for %s") % stream.source)
                 else:
                     logger.objects[parser] = e
                     body.append((e, TreeBox(charset, Node(parser, None), preload_fields, None, options)))
                     resize = log.height
             except NeedInput, e:
                 input.do(*e.args)
             if profile_display:
                 events = events[1:]
                 break
Пример #4
0
 def run():
     msg = _resize = retry = 0
     events = ( "window resize", )
     profile_display = args.profile_display
     while True:
         for e in events:
             try:
                 if e == "window resize":
                     size = ui.get_cols_rows()
                     resize = log.height
                 else:
                     e = top.keypress(size, e)
                     if e is None:
                         pass
                     elif e in ('f1', '?'):
                         try:
                             body.select(body.tabs.index(help))
                         except ValueError:
                             body.append(help)
                             resize = log.height
                     elif e in ('esc', 'ctrl w'):
                         body.close()
                         if body.box_widget is None:
                             return
                         resize = log.height
                     elif e == '+':
                         if log.height:
                             resize = log.height - 1
                     elif e == '-':
                         resize = log.height + 1
                     elif e == 'q':
                         return
             #except AssertionError:
             #    hachoir_log.error(getBacktrace())
             except NewTab_Stream, e:
                 stream = e.field.getSubIStream()
                 logger.objects[stream] = e = "%u/%s" % (body.active, e.field.absolute_address)
                 parser = guessParser(stream)
                 if not parser:
                     hachoir_log.error(_("No parser found for %s") % stream.source)
                 else:
                     logger.objects[parser] = e
                     body.append((e, TreeBox(charset, Node(parser, None), preload_fields, None, options)))
                     resize = log.height
             except NeedInput, e:
                 input.do(*e.args)
             if profile_display:
                 events = events[1:]
                 break
Пример #5
0
 def save_field(self, path, raw):
     try:
         fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
     except OSError, err:
         hachoir_log.error(unicode(str(err), self.charset))
Пример #6
0
 def fromField(self, root, path):
     try:
         field = self.focus.field[path]
     except MissingField, e:
         field = e.field
         hachoir_log.error(unicode(e))
Пример #7
0
 def save_field(self, path, raw):
     try:
         fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
     except OSError, err:
         hachoir_log.error(unicode(str(err), self.charset))
Пример #8
0
 def fromField(self, root, path):
     try:
         field = self.focus.field[path]
     except MissingField, e:
         field = e.field
         hachoir_log.error(unicode(e))