Ejemplo n.º 1
0
 def _add_more_threads(self, sconn, tids):
     emit_signal(eband, 'log', 'in _add_more_threads')
     to_join = get_members(sconn, tids)
     emit_signal(eband, 'log', 'thread is now %s convs' % str(len(self.container)))
     emit_signal(eband, 'log', 'got %s messages to thread' % str(len(to_join)))
     self.container.thread(to_join)
     emit_signal(eband, 'log', 'thread is now %s convs' % str(len(self.container)))
     self._modified()
     emit_signal(eband, 'redisplay')
Ejemplo n.º 2
0
    def _focus_modify1(self, mthd, status=None):
        emit_signal(eband, 'log', 'doing focus modifier, %s' % str(self.focus))
        beg_focus = self.focus
        #if beg_focus == (0,0,0): raise TypeError
        self._listbox().set_focus((beg_focus[0], 0, 0))
        #self.set_focus((beg_focus[0], 0, 0))

        cllps = self._cache[beg_focus]
        getattr(cllps, mthd)(status)

        return self._listbox().set_focus(beg_focus)
Ejemplo n.º 3
0
    def __init__(self, convobj, box):
        def quack(__x):
            __x.allconn_4cache()

        self._listbox = ref(box)
        self._cache = map(message_widget, convobj.messages)
        map(quack, self._cache)
        map(self.all_connect, self._cache)
        self.focus = 0, 0, 0
        self.find_oldest_new()

        emit_signal(eband, 'log', str(self._listbox()))
        emit_signal(eband, 'log', str(dir(self._listbox())))
Ejemplo n.º 4
0
    def _more_threads(self):
        emit_signal(eband, 'log', 'running more_threads')
        cur = len(self.container)
        emit_signal(eband, 'log', 'len container at start: %s' % str(cur))
        sconn = xappy.SearchConnection(srchidx)
        self._update_tids(sconn)

        to_get = filter(lambda x: x not in self.container._map, self._tids[:cur])
        to_get = filterNone(set(to_get))
        #emit_signal(eband, 'log', str(to_get))
        to_get.extend(self._tids[cur:(cur+self._rows-len(to_get))])
        #emit_signal(eband, 'log', str(to_get))

        self._add_more_threads(sconn, to_get)
        
        sconn.close()
Ejemplo n.º 5
0
def set_read(muuid):
    """
    Set the Seen flag in the index as well as on the filesystem.
    """
    emit_signal(eband, 'log', 'doing set_read on muuid %s' % muuid)
    msg = mail_grab.get(muuid)
    subdir = msg.get_subdir()
    if subdir == 'new':
        msg.set_subdir('cur')
    if 'S' not in msg.get_flags():
        msg.add_flag('S')
        t = time.time()
        mail_grab.update(muuid, msg)
        t = time.time() - t
        emit_signal(eband, 'log', 'update took %s seconds' % t)
        return (muuid, [('flags', 'S')])
    else:
        mail_grab.update(muuid, msg)
    return None
Ejemplo n.º 6
0
def set_unread(muuid):
    """
    Remove the seen flag both from the xapian index and from the filesystem.
    """
    emit_signal(eband, 'log', 'doing set_unread on muuid %s' % muuid)
    msg = mail_grab.get(muuid)
    subdir = msg.get_subdir()
    if subdir == 'new':
        msg.set_subdir('cur')
    if 'S' in msg.get_flags():
        msg.remove_flag('S')
        t = time.time()
        mail_grab.update(muuid, msg)
        t = time.time() - t
        emit_signal(eband, 'log', 'update took %s seconds' % t)
        return (muuid, [('flags', 'S')])
    else:
        mail_grab.update(muuid, msg)
    return None
Ejemplo n.º 7
0
    def new(self, new):
        if type(new) is not bool: raise TypeError("The heck you think you're doing? msg.new can be True or False, not type %s with value %s" % (str(type(new)), str(new)))
        if new:
            id_dat_tple = set_unread(self.msgobj.muuid())
            emit_signal(eband, 'log', str(id_dat_tple))
            if id_dat_tple:
                docs = modify_factory([id_dat_tple], remove_fields)
                map(xconn.replace, docs)
                xconn.flush()

            if self.new: return
            #else: set_unread(self.msgobj.muuid())
            else: self.msgobj.flags.remove('S')
        else:
            id_dat_tple = set_read(self.msgobj.muuid())
            emit_signal(eband, 'log', str(id_dat_tple))
            if id_dat_tple:
                docs = modify_factory([id_dat_tple], update_existing)
                map(xconn.replace, docs)
                xconn.flush()

            if not self.new: return
            self.msgobj.flags.append('S')
Ejemplo n.º 8
0
 def _invalidate(self):
     emit_signal(self, 'modified')
     return self.__super._invalidate()
Ejemplo n.º 9
0
 def yank(self, size=None):
     emit_signal(eband, 'log', str(self.__size))
     emit_signal(eband, 'log', str(self.offset_rows))
     emit_signal(eband, 'log', str(self.get_focus()))
     vis = self.calculate_visible(self.__size, True)
     emit_signal(eband, 'log', 'middle:\n%s' % str(vis[0]))
     emit_signal(eband, 'log', 'top:\n%s' % str(vis[1]))
     emit_signal(eband, 'log', 'bottom:\n%s' % str(vis[2]))
Ejemplo n.º 10
0
 def __init__(self, convobj):
     self.__size = None
     w = read_walker(convobj, self)
     connect_signal(w, 'yank', self.yank)
     self.__super.__init__(w)
     emit_signal(eband, 'frame_connect', self)
Ejemplo n.º 11
0
        #__r = u"Sent %s by %s" % (__fd[0], __fd[1])
        return __r

    def do_num_rows(self, (maxcol,), key):
        lines = self.label.pack()
        emit_signal(eband, 'log', '%s' % str(lines))

    def top_down_rerender(self):
        def func(x):
            try: map(lambda y: y.update_widget(), x._cache)
            except: pass
        map(func, self._cache)
        map(lambda x: x.update_widget(), self._cache)

    def do_set_read(self, (maxcol,), key):
        emit_signal(eband, 'log', 'in do_set_read, new was %s' % str(self.new))
        self.new = False
        self.top_down_rerender()
        self.update_widget()

    def do_set_unread(self, (maxcol,), key):
        emit_signal(eband, 'log', 'in do_set_unread, new was %s' % str(self.new))
        self.new = True
        self.top_down_rerender()
        self.update_widget()

    def do_msg_set_expanded(self, *args, **kwargs): return self._do_set_expanded(*args, **kwargs)
    def do_msg_toggle_expanded(self, *args, **kwargs): return self._do_toggle_expanded(*args, **kwargs)
    def do_msg_open_expanded(self, *args, **kwargs): return self._do_open_expanded(*args, **kwargs)
    def do_msg_close_expanded(self, *args, **kwargs): return self._do_close_expanded(*args, **kwargs)
Ejemplo n.º 12
0
 def update(self):
     self.set_text( self.idx_repr() )
     self._invalidate()
     emit_signal(self, 'modified')
Ejemplo n.º 13
0
 def _emit(self, signal, *args, **kwargs):
     emit_signal(self, signal, *args, **kwargs)
Ejemplo n.º 14
0
 def _keypress(self, key):
     if key == "r":
         emit_signal(eband, 'log', str(len(self.container)))
     elif key == "e":
         self._more_threads()
Ejemplo n.º 15
0
        w[1].set_text(markup[1])
        w[2].set_text(markup[2])
        w[3].set_text(markup[3:])

    def do_activate(self, size, key):
        try: buffer_manager.set_buffer(self._conv)
        except TypeError:
            buffer_manager.register_support(self._conv, read_box)
            buffer_manager.set_buffer(self._conv)

    def do_nomap(self, size, key):
        return key

    def _keypress(self, (maxcol,), key):
        if key in ('r', 'e'):
            emit_signal(self, 'keypress', key)
            return key
        elif key not in (' ','enter'):
            return key
        try: buffer_manager.set_buffer(self._conv)
        except TypeError:
            buffer_manager.register_support(self._conv, read_box)
            buffer_manager.set_buffer(self._conv)



conv_widget = conv_widget_columns



class sigthread_container(thread_container):
Ejemplo n.º 16
0
 def __init__(self, query):
     w = index_walker(query)
     emit_signal(eband, 'frame_connect', self)
     self.__super.__init__(w)
Ejemplo n.º 17
0
    __slots__ = ()
    def keypress(self, (maxcol,), key):
        emit_signal(eband, 'log', 'in keypress trying key %s from class %s' % (key, self.__class__.__name__))
        try:
            __method = getattr(self, 'do_%s' % kbm[self.context, key])
            emit_signal(eband, 'log', 'was directed to method %s' % __method)
            return __method((maxcol,), key)
        except AttributeError:
            emit_signal(eband, 'log', 'got attrerror')
            return self._keybind_failover((maxcol,), key)

    def _keybind_failover(self, (maxcol,), key):
        raise NotImplemented("Not set by default! Don't forget to set this method!")

    def do_global(self, (maxcol,), key):
        emit_signal(eband, 'log', 'in global trying key %s from class %s' % (key, self.__class__.__name__))
        try:
            __method = getattr(self, 'do_%s' % kbm['global', key])
            emit_signal(eband, 'log', 'was directed to method %s' % __method)
            return __method((maxcol,), key)
        except AttributeError:
            emit_signal(eband, 'log', 'got attrerror')
            return self._keybind_failover((maxcol,), key)

    def do_nomap(self, (maxcol,), key):
        raise BindError("Omg! What do I do!?")

#class MetaMelt(MetaBind, MetaSuperSignals):

class ScrollMixin(object):
    def do_cursor_up(self, (maxcol,), key):