Beispiel #1
0
    def _addtabondemand(self, thread):
        """Adds a new tab for the given thread, if it doesn't exist yet.
        If it does, it will be made the current tab.
        @param thread Instance of FourChanThreahHeader
        """
        i = thread.id_()
        if not i in self._openthreads.keys():
            table = QTableView(self)
            table.setModel(LiveFeedModel(self))
            table.setAlternatingRowColors(True)
            table.setEditTriggers(QAbstractItemView.NoEditTriggers)
            table.setIconSize(QSize(192, 192))
            table.horizontalHeader().setVisible(False)
            table.horizontalHeader().setDefaultSectionSize(192)
            table.horizontalHeader().setStretchLastSection(True)
            table.verticalHeader().setVisible(False)
            table.verticalHeader().setDefaultSectionSize(192)

            table.doubleClicked.connect(self._showlivepost)

            idx = self.tabPosts.addTab(table, "/%s/%s" % (thread.forum(), i))
            self._openthreads[i] = (idx, thread, table)
            fct = FourChanThread(
                    FourChanThreadUrl(thread.url()), self._masterobserver)
            fct.postadded.connect(self._updatethread)
            self._masterobserver.addobserver(
                    FourChanThreadObserver(fct, parent=self))
            fct.refresh(True)
        else:
            idx = self._openthreads[i][0]
        self.tabPosts.setCurrentIndex(idx)
Beispiel #2
0
    def _archivethread(self):
        """Adds the current post's thread to the list of observed threads, which
        will cause the thread to be archived."""
        pk, cat, tags = self._getthreadpk()
        if not pk is None:
#           create copy of thread to get all posts persisted
            thread = FourChanThread(self._post.thread().url())
            observer = FourChanThreadObserver(thread, 30,
                    self._masterobserver)
            self._masterobserver.addobserver(observer)
            thread.refresh()
Beispiel #3
0
 def _archivethreadmanually(self):
     """Shows a DialogObserveThread to manually archive a thread by pasting
     its url.
     """
     d = DialogObserveThread(self._backend)
     doit = d.exec_() == QDialog.Accepted
     if doit:
         thread = FourChanThread(FourChanThreadUrl(d.url()))
         observer = FourChanThreadObserver(thread, 30,
                 self._masterobserver)
         self._masterobserver.addobserver(observer)
         thread.refresh()