when refresh() is recall, get only the new messages

This commit is contained in:
Romain Bignon 2010-06-30 22:37:49 +02:00
commit 9d9a22eabb
2 changed files with 8 additions and 3 deletions

View file

@ -58,9 +58,15 @@ class MessagesManager(QWidget):
self.backend = selection[0].data(Qt.UserRole).toPyObject() self.backend = selection[0].data(Qt.UserRole).toPyObject()
self.ui.messagesTree.clear()
self.refresh() self.refresh()
def refresh(self): def refresh(self):
if self.ui.messagesTree.topLevelItemCount() > 0:
command = 'iter_new_messages'
else:
command = 'iter_messages'
self.ui.backendsList.setEnabled(False) self.ui.backendsList.setEnabled(False)
def cb(backend, message): def cb(backend, message):
@ -71,9 +77,9 @@ class MessagesManager(QWidget):
print backtrace print backtrace
if self.backend: if self.backend:
process = self.weboob.do_backends(self.backend.name, 'iter_messages') process = self.weboob.do_backends(self.backend.name, command)
else: else:
process = self.weboob.do_caps(ICapMessages, 'iter_messages') process = self.weboob.do_caps(ICapMessages, command)
self.process = process.callback_thread(cb, eb) self.process = process.callback_thread(cb, eb)
def _gotMessage(self, backend, message): def _gotMessage(self, backend, message):

View file

@ -21,7 +21,6 @@ import os
import subprocess import subprocess
import re import re
import weboob
from weboob.tools.application import ConsoleApplication from weboob.tools.application import ConsoleApplication