Ejemplo n.º 1
0
 def _populateforums(self):
     """Populates the forums tables (live and archived filters)."""
     self.tableForums.clear()
     forums = FourChanForum.forums()
     sortedforums = sorted(forums, key = lambda x: x)
     tables = (self.tableForums, self.tableForumFilter)
     for table in tables:
         table.setRowCount(len(forums))
         table.setColumnCount(2)
         i = 0
         for short in sortedforums:
             data = forums[short]
             i1 = QTableWidgetItem(short)
             i2 = QTableWidgetItem(data[1])
             i1.setData(Qt.UserRole, data)
             i2.setData(Qt.UserRole, data)
             table.setItem(i, 0, i1)
             table.setItem(i, 1, i2)
             i += 1
Ejemplo n.º 2
0
 def data(self, index, role=Qt.DisplayRole):
     if index.isValid() and role==Qt.DisplayRole:
         t = self._observer.thread(index.row())
         c = index.column()
         if c == 0:
             return FourChanForum.forums()[t.forum()][1]
         elif c == 1:
             return t.threadid()
         elif c == 2:
             txt = "Idle"
             if t.isrefreshing():
                 txt = "Refreshing"
             if t in self._threadsdownloading:
                 txt = "Downloading"
             if t.is404ed():
                 txt = "Dead (404)"
             return txt
         else:
             return None
     return None