This commit is contained in:
Romain Bignon 2010-10-01 13:53:38 +02:00
commit c216690351
2 changed files with 82 additions and 55 deletions

View file

@ -46,12 +46,13 @@ class MessagesManager(QWidget):
self.backend = None self.backend = None
self.connect(self.ui.backendsList, SIGNAL('itemSelectionChanged()'), self._backendChanged) self.connect(self.ui.backendsList, SIGNAL('itemSelectionChanged()'), self._backendChanged)
self.connect(self.ui.threadsList, SIGNAL('itemSelectionChanged()'), self._threadChanged)
self.connect(self.ui.messagesTree, SIGNAL('itemClicked(QTreeWidgetItem *, int)'), self._messageSelected) self.connect(self.ui.messagesTree, SIGNAL('itemClicked(QTreeWidgetItem *, int)'), self._messageSelected)
self.connect(self.ui.messagesTree, SIGNAL('itemActivated(QTreeWidgetItem *, int)'), self._messageSelected) self.connect(self.ui.messagesTree, SIGNAL('itemActivated(QTreeWidgetItem *, int)'), self._messageSelected)
self.connect(self, SIGNAL('gotMessage'), self._gotMessage) self.connect(self, SIGNAL('gotMessage'), self._gotMessage)
def load(self): def load(self):
self.refresh() self.refreshThreads()
def _backendChanged(self): def _backendChanged(self):
selection = self.ui.backendsList.selectedItems() selection = self.ui.backendsList.selectedItems()
@ -61,8 +62,21 @@ class MessagesManager(QWidget):
self.backend = selection[0].data(Qt.UserRole).toPyObject() self.backend = selection[0].data(Qt.UserRole).toPyObject()
def refreshThreads(self):
self.ui.messagesTree.clear()
self.ui.threadsList.clear()
self.process_threads = QtDo(self.weboob, self._gotThread)
self.process_threads.do('iter_threads', backends=self.backends, caps=ICapMessages)
def _gotThread(self, backend, thread):
if not backend:
return
def _threadChanged(self):
self.ui.messagesTree.clear() self.ui.messagesTree.clear()
self.refresh() self.refresh()
pass
def refresh(self): def refresh(self):
if self.ui.messagesTree.topLevelItemCount() > 0: if self.ui.messagesTree.topLevelItemCount() > 0:

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>767</width> <width>696</width>
<height>591</height> <height>592</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -15,11 +15,11 @@
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QSplitter" name="splitter_2"> <widget class="QSplitter" name="splitter_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QListWidget" name="backendsList"> <widget class="QListWidget" name="backendsList_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -27,68 +27,81 @@
</sizepolicy> </sizepolicy>
</property> </property>
</widget> </widget>
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>2</horstretch> <horstretch>10</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<widget class="QTreeWidget" name="messagesTree"> <widget class="QSplitter" name="splitter">
<property name="editTriggers"> <property name="orientation">
<set>QAbstractItemView::NoEditTriggers</set> <enum>Qt::Vertical</enum>
</property> </property>
<property name="tabKeyNavigation"> <widget class="QListWidget" name="threadsList">
<bool>true</bool> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<property name="sortingEnabled"> <horstretch>0</horstretch>
<bool>true</bool> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="animated">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Date</string>
</property> </property>
<property name="textAlignment"> </widget>
<set>AlignLeft|AlignVCenter</set> <widget class="QTreeWidget" name="messagesTree">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
</column> <property name="tabKeyNavigation">
<column> <bool>true</bool>
<property name="text">
<string>From</string>
</property> </property>
</column> <property name="sortingEnabled">
<column> <bool>true</bool>
<property name="text">
<string>Title</string>
</property> </property>
</column> <property name="animated">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Date</string>
</property>
<property name="textAlignment">
<set>AlignLeft|AlignVCenter</set>
</property>
</column>
<column>
<property name="text">
<string>From</string>
</property>
</column>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
</widget>
</widget> </widget>
<widget class="QTextEdit" name="messageBody"> <widget class="QTextEdit" name="messageBody">
<property name="readOnly"> <property name="readOnly">