예제 #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()
예제 #2
0
파일: main.py 프로젝트: smdx023/calibre
 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)
예제 #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))
예제 #4
0
 def ans(self, *args, **kwargs):
     if self.original_image_data is None:
         return error_dialog(self, _('No image'), _('No image loaded'), show=True)
     if not self.is_valid:
         return error_dialog(self, _('Invalid image'), _('The current image is not valid'), show=True)
     QApplication.setOverrideCursor(Qt.CursorShape.BusyCursor)
     try:
         return func(self, *args, **kwargs)
     finally:
         QApplication.restoreOverrideCursor()
예제 #5
0
 def __enter__(self):
     QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
예제 #6
0
파일: widgets.py 프로젝트: cbhaley/calibre
 def rehighlight(self):
     QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
     super().rehighlight()
     QApplication.restoreOverrideCursor()
예제 #7
0
 def rehighlight(self):
     QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
     QSyntaxHighlighter.rehighlight(self)
     QApplication.restoreOverrideCursor()