Exemple #1
0
    def do_search(self):
        query = str(self.search_text.text())
        if not query:
            d = error_dialog(
                self.gui, _('Match books'),
                _('You must enter a search expression into the search field'))
            d.exec()
            return
        try:
            self.search_button.setEnabled(False)
            QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
            books = self.library_db.data.search(query, return_matches=True)
            self.books_table.setRowCount(len(books))

            self.books_table.setSortingEnabled(False)
            for row, b in enumerate(books):
                mi = self.library_db.get_metadata(b,
                                                  index_is_id=True,
                                                  get_user_categories=False)
                a = TableItem(mi.title, mi.title_sort)
                a.setData(Qt.ItemDataRole.UserRole, b)
                self.books_table.setItem(row, 0, a)
                a = TableItem(' & '.join(mi.authors), mi.author_sort)
                self.books_table.setItem(row, 1, a)
                series = mi.format_field('series')[1]
                if series is None:
                    series = ''
                a = TableItem(series, mi.series, mi.series_index)
                self.books_table.setItem(row, 2, a)
                self.books_table.setRowHeight(row, self.books_table_row_height)

            self.books_table.setSortingEnabled(True)
        finally:
            self.search_button.setEnabled(True)
            QApplication.restoreOverrideCursor()
Exemple #2
0
 def __enter__(self):
     self.stacks.setCurrentIndex(0)
     self.busy.setVisible(True)
     self.busy.pi.startAnimation()
     QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
     QApplication.processEvents(
         QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents
         | QEventLoop.ProcessEventsFlag.ExcludeSocketNotifiers)
Exemple #3
0
 def start(self):
     self.setGeometry(0, 0, self.parent().width(), self.parent().height())
     self.setVisible(True)
     # Prevent any actions from being triggered by key presses
     self.parent().setEnabled(False)
     self.raise_()
     self.setFocus(Qt.FocusReason.OtherFocusReason)
     self.pi.startAnimation()
     QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
Exemple #4
0
 def __enter__(self):
     QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
Exemple #5
0
 def rehighlight(self):
     QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
     super().rehighlight()
     QApplication.restoreOverrideCursor()
Exemple #6
0
 def rehighlight(self):
     QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
     QSyntaxHighlighter.rehighlight(self)
     QApplication.restoreOverrideCursor()