mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use only a single BusyCursor class
This commit is contained in:
parent
edb8e805b2
commit
86fca5e201
@ -29,7 +29,7 @@ class AuthorMapAction(InterfaceAction):
|
|||||||
def do_map(self, book_ids, selected):
|
def do_map(self, book_ids, selected):
|
||||||
from calibre.ebooks.metadata.author_mapper import map_authors, compile_rules
|
from calibre.ebooks.metadata.author_mapper import map_authors, compile_rules
|
||||||
from calibre.gui2.author_mapper import RulesDialog
|
from calibre.gui2.author_mapper import RulesDialog
|
||||||
from calibre.gui2.device import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
d = RulesDialog(self.gui)
|
d = RulesDialog(self.gui)
|
||||||
d.setWindowTitle(ngettext(
|
d.setWindowTitle(ngettext(
|
||||||
'Map authors for one book in the library',
|
'Map authors for one book in the library',
|
||||||
|
@ -30,7 +30,7 @@ class TagMapAction(InterfaceAction):
|
|||||||
def do_map(self, book_ids, selected):
|
def do_map(self, book_ids, selected):
|
||||||
from calibre.ebooks.metadata.tag_mapper import map_tags
|
from calibre.ebooks.metadata.tag_mapper import map_tags
|
||||||
from calibre.gui2.tag_mapper import RulesDialog
|
from calibre.gui2.tag_mapper import RulesDialog
|
||||||
from calibre.gui2.device import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
d = RulesDialog(self.gui)
|
d = RulesDialog(self.gui)
|
||||||
d.setWindowTitle(ngettext(
|
d.setWindowTitle(ngettext(
|
||||||
'Map tags for one book in the library',
|
'Map tags for one book in the library',
|
||||||
|
@ -9,7 +9,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from qt.core import QAction, QIcon, Qt, pyqtSignal, QDialog, QApplication, QCursor
|
from qt.core import QAction, QIcon, pyqtSignal, QDialog
|
||||||
|
|
||||||
from calibre.constants import ismacos, iswindows
|
from calibre.constants import ismacos, iswindows
|
||||||
from calibre.gui2 import (
|
from calibre.gui2 import (
|
||||||
@ -23,15 +23,6 @@ from calibre.utils.config import prefs, tweaks
|
|||||||
from polyglot.builtins import as_bytes
|
from polyglot.builtins import as_bytes
|
||||||
|
|
||||||
|
|
||||||
class BusyCursor:
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
|
||||||
|
|
||||||
def __exit__(self, *args):
|
|
||||||
QApplication.restoreOverrideCursor()
|
|
||||||
|
|
||||||
|
|
||||||
def preferred_format(formats):
|
def preferred_format(formats):
|
||||||
formats = tuple(x.upper() for x in formats if x)
|
formats = tuple(x.upper() for x in formats if x)
|
||||||
fmt = formats[0]
|
fmt = formats[0]
|
||||||
@ -168,6 +159,7 @@ class ViewAction(InterfaceAction):
|
|||||||
self._view_file(job.result)
|
self._view_file(job.result)
|
||||||
|
|
||||||
def _launch_viewer(self, name=None, viewer='ebook-viewer', internal=True, calibre_book_data=None, open_at=None):
|
def _launch_viewer(self, name=None, viewer='ebook-viewer', internal=True, calibre_book_data=None, open_at=None):
|
||||||
|
from calibre.gui2.widgets import BusyCursor
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
if internal:
|
if internal:
|
||||||
args = [viewer]
|
args = [viewer]
|
||||||
|
@ -6,9 +6,9 @@ import os, traceback, time, io, re, sys, weakref
|
|||||||
from threading import Thread, Event
|
from threading import Thread, Event
|
||||||
|
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QMenu, QAction, QActionGroup, QIcon, Qt, pyqtSignal, QDialog,
|
QMenu, QAction, QActionGroup, QIcon, pyqtSignal, QDialog,
|
||||||
QObject, QVBoxLayout, QDialogButtonBox, QCursor, QCoreApplication,
|
QObject, QVBoxLayout, QDialogButtonBox, QCoreApplication,
|
||||||
QApplication, QEventLoop, QTimer)
|
QEventLoop, QTimer)
|
||||||
|
|
||||||
from calibre.customize.ui import (available_input_formats, available_output_formats,
|
from calibre.customize.ui import (available_input_formats, available_output_formats,
|
||||||
device_plugins, disabled_device_plugins)
|
device_plugins, disabled_device_plugins)
|
||||||
@ -22,6 +22,7 @@ from calibre.devices.scanner import DeviceScanner
|
|||||||
from calibre.gui2 import (config, error_dialog, Dispatcher, dynamic,
|
from calibre.gui2 import (config, error_dialog, Dispatcher, dynamic,
|
||||||
warning_dialog, info_dialog, choose_dir, FunctionDispatcher,
|
warning_dialog, info_dialog, choose_dir, FunctionDispatcher,
|
||||||
show_restart_warning, gprefs, question_dialog)
|
show_restart_warning, gprefs, question_dialog)
|
||||||
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.ebooks.metadata import authors_to_string
|
from calibre.ebooks.metadata import authors_to_string
|
||||||
from calibre import preferred_encoding, prints, force_unicode, as_unicode, sanitize_file_name
|
from calibre import preferred_encoding, prints, force_unicode, as_unicode, sanitize_file_name
|
||||||
from calibre.utils.filenames import ascii_filename
|
from calibre.utils.filenames import ascii_filename
|
||||||
@ -123,15 +124,6 @@ def device_name_for_plugboards(device_class):
|
|||||||
return device_class.__class__.__name__
|
return device_class.__class__.__name__
|
||||||
|
|
||||||
|
|
||||||
class BusyCursor:
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
|
||||||
|
|
||||||
def __exit__(self, *args):
|
|
||||||
QApplication.restoreOverrideCursor()
|
|
||||||
|
|
||||||
|
|
||||||
def convert_open_popup(opm, skip_key):
|
def convert_open_popup(opm, skip_key):
|
||||||
class OPM(OpenFeedback):
|
class OPM(OpenFeedback):
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class ScanStatus(QWidget):
|
|||||||
'This will force calibre to re-index all the books in this library, which'
|
'This will force calibre to re-index all the books in this library, which'
|
||||||
' can take a long time. Are you sure?'), 'fts-reindex-confirm', self):
|
' can take a long time. Are you sure?'), 'fts-reindex-confirm', self):
|
||||||
return
|
return
|
||||||
from calibre.gui2.device import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
self.db.reindex_fts()
|
self.db.reindex_fts()
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ from calibre.db import FTSQueryError
|
|||||||
from calibre.ebooks.metadata import authors_to_string, fmt_sidx
|
from calibre.ebooks.metadata import authors_to_string, fmt_sidx
|
||||||
from calibre.gui2 import config, error_dialog, gprefs, question_dialog, safe_open_url
|
from calibre.gui2 import config, error_dialog, gprefs, question_dialog, safe_open_url
|
||||||
from calibre.gui2.fts.utils import get_db
|
from calibre.gui2.fts.utils import get_db
|
||||||
from calibre.gui2.library.annotations import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.gui2.progress_indicator import ProgressIndicator
|
from calibre.gui2.progress_indicator import ProgressIndicator
|
||||||
from calibre.gui2.ui import get_gui
|
from calibre.gui2.ui import get_gui
|
||||||
from calibre.gui2.viewer.widgets import ResultsDelegate, SearchBox
|
from calibre.gui2.viewer.widgets import ResultsDelegate, SearchBox
|
||||||
|
@ -767,7 +767,7 @@ class LayoutMixin: # {{{
|
|||||||
fmt), show=True)
|
fmt), show=True)
|
||||||
|
|
||||||
def bd_edit_book(self, book_id, fmt):
|
def bd_edit_book(self, book_id, fmt):
|
||||||
from calibre.gui2.device import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
self.iactions['Tweak ePub'].ebook_edit_format(book_id, fmt)
|
self.iactions['Tweak ePub'].ebook_edit_format(book_id, fmt)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
from functools import lru_cache, partial
|
from functools import lru_cache, partial
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QAbstractItemView, QApplication, QCheckBox, QComboBox, QCursor, QDateTime,
|
QAbstractItemView, QApplication, QCheckBox, QComboBox, QDateTime,
|
||||||
QDialog, QDialogButtonBox, QFont, QFormLayout, QFrame, QHBoxLayout, QIcon,
|
QDialog, QDialogButtonBox, QFont, QFormLayout, QFrame, QHBoxLayout, QIcon,
|
||||||
QKeySequence, QLabel, QLocale, QMenu, QPalette, QPlainTextEdit, QSize, QSplitter,
|
QKeySequence, QLabel, QLocale, QMenu, QPalette, QPlainTextEdit, QSize, QSplitter,
|
||||||
Qt, QTextBrowser, QTimer, QToolButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout,
|
Qt, QTextBrowser, QTimer, QToolButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout,
|
||||||
@ -27,6 +27,7 @@ from calibre.gui2 import (
|
|||||||
)
|
)
|
||||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
from calibre.gui2.viewer.widgets import ResultsDelegate, SearchBox
|
from calibre.gui2.viewer.widgets import ResultsDelegate, SearchBox
|
||||||
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.gui2.widgets2 import Dialog, RightClickButton
|
from calibre.gui2.widgets2 import Dialog, RightClickButton
|
||||||
|
|
||||||
|
|
||||||
@ -328,15 +329,6 @@ def current_db():
|
|||||||
return (getattr(current_db, 'ans', None) or get_gui().current_db).new_api
|
return (getattr(current_db, 'ans', None) or get_gui().current_db).new_api
|
||||||
|
|
||||||
|
|
||||||
class BusyCursor:
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
|
||||||
|
|
||||||
def __exit__(self, *args):
|
|
||||||
QApplication.restoreOverrideCursor()
|
|
||||||
|
|
||||||
|
|
||||||
class ResultsList(QTreeWidget):
|
class ResultsList(QTreeWidget):
|
||||||
|
|
||||||
current_result_changed = pyqtSignal(object)
|
current_result_changed = pyqtSignal(object)
|
||||||
|
@ -1040,7 +1040,7 @@ class FormatsManager(QWidget):
|
|||||||
self.dialog.do_view_format(item.path, item.ext)
|
self.dialog.do_view_format(item.path, item.ext)
|
||||||
|
|
||||||
def edit_format(self, item, *args):
|
def edit_format(self, item, *args):
|
||||||
from calibre.gui2.device import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
self.dialog.do_edit_format(item.path, item.ext)
|
self.dialog.do_edit_format(item.path, item.ext)
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ from threading import Thread
|
|||||||
|
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QApplication, QFont, QFontInfo, QFontDialog, QColorDialog, QPainter, QDialog,
|
QApplication, QFont, QFontInfo, QFontDialog, QColorDialog, QPainter, QDialog,
|
||||||
QAbstractListModel, Qt, QIcon, QKeySequence, QColor, pyqtSignal, QCursor, QHeaderView, QListWidgetItem,
|
QAbstractListModel, Qt, QIcon, QKeySequence, QColor, pyqtSignal, QHeaderView, QListWidgetItem,
|
||||||
QWidget, QSizePolicy, QBrush, QPixmap, QSize, QPushButton, QVBoxLayout, QItemSelectionModel,
|
QWidget, QSizePolicy, QBrush, QPixmap, QSize, QPushButton, QVBoxLayout, QItemSelectionModel,
|
||||||
QTableWidget, QTableWidgetItem, QLabel, QFormLayout, QLineEdit, QComboBox, QDialogButtonBox
|
QTableWidget, QTableWidgetItem, QLabel, QFormLayout, QLineEdit, QComboBox, QDialogButtonBox
|
||||||
)
|
)
|
||||||
@ -34,21 +34,13 @@ from calibre.gui2.book_details import get_field_list
|
|||||||
from calibre.gui2.dialogs.quickview import get_qv_field_list
|
from calibre.gui2.dialogs.quickview import get_qv_field_list
|
||||||
from calibre.gui2.preferences.coloring import EditRules
|
from calibre.gui2.preferences.coloring import EditRules
|
||||||
from calibre.gui2.library.alternate_views import auto_height, CM_TO_INCH
|
from calibre.gui2.library.alternate_views import auto_height, CM_TO_INCH
|
||||||
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.gui2.widgets2 import Dialog
|
from calibre.gui2.widgets2 import Dialog
|
||||||
from calibre.gui2.actions.show_quickview import get_quickview_action_plugin
|
from calibre.gui2.actions.show_quickview import get_quickview_action_plugin
|
||||||
from calibre.utils.resources import set_data
|
from calibre.utils.resources import set_data
|
||||||
from polyglot.builtins import iteritems
|
from polyglot.builtins import iteritems
|
||||||
|
|
||||||
|
|
||||||
class BusyCursor:
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
|
||||||
|
|
||||||
def __exit__(self, *args):
|
|
||||||
QApplication.restoreOverrideCursor()
|
|
||||||
|
|
||||||
|
|
||||||
class DefaultAuthorLink(QWidget): # {{{
|
class DefaultAuthorLink(QWidget): # {{{
|
||||||
|
|
||||||
changed_signal = pyqtSignal()
|
changed_signal = pyqtSignal()
|
||||||
|
@ -8,7 +8,7 @@ from qt.core import (
|
|||||||
QWidget
|
QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.gui2.preferences.look_feel import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
|
|
||||||
|
|
||||||
class VoicesModel(QAbstractTableModel):
|
class VoicesModel(QAbstractTableModel):
|
||||||
|
@ -7,7 +7,7 @@ from qt.core import (
|
|||||||
QItemSelectionModel, QSlider, QSortFilterProxyModel, Qt, QTableView, QWidget
|
QItemSelectionModel, QSlider, QSortFilterProxyModel, Qt, QTableView, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.gui2.preferences.look_feel import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
|
|
||||||
|
|
||||||
class VoicesModel(QAbstractTableModel):
|
class VoicesModel(QAbstractTableModel):
|
||||||
|
@ -8,7 +8,7 @@ from qt.core import (
|
|||||||
QWidget
|
QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.gui2.preferences.look_feel import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
|
|
||||||
|
|
||||||
class VoicesModel(QAbstractTableModel):
|
class VoicesModel(QAbstractTableModel):
|
||||||
|
@ -60,11 +60,12 @@ from calibre.gui2.tweak_book.spell import (
|
|||||||
from calibre.gui2.tweak_book.toc import TOCEditor
|
from calibre.gui2.tweak_book.toc import TOCEditor
|
||||||
from calibre.gui2.tweak_book.undo import GlobalUndoHistory
|
from calibre.gui2.tweak_book.undo import GlobalUndoHistory
|
||||||
from calibre.gui2.tweak_book.widgets import (
|
from calibre.gui2.tweak_book.widgets import (
|
||||||
AddCover, BusyCursor, FilterCSS, ImportForeign, InsertLink, InsertSemantics,
|
AddCover, FilterCSS, ImportForeign, InsertLink, InsertSemantics,
|
||||||
InsertTag, MultiSplit, QuickOpen, RationalizeFolders
|
InsertTag, MultiSplit, QuickOpen, RationalizeFolders
|
||||||
)
|
)
|
||||||
from calibre.ptempfile import PersistentTemporaryDirectory, TemporaryDirectory
|
from calibre.ptempfile import PersistentTemporaryDirectory, TemporaryDirectory
|
||||||
from calibre.utils.config import JSONConfig
|
from calibre.utils.config import JSONConfig
|
||||||
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.utils.icu import numeric_sort_key
|
from calibre.utils.icu import numeric_sort_key
|
||||||
from calibre.utils.imghdr import identify
|
from calibre.utils.imghdr import identify
|
||||||
from calibre.utils.tdir_in_cache import tdir_in_cache
|
from calibre.utils.tdir_in_cache import tdir_in_cache
|
||||||
|
@ -16,7 +16,8 @@ from qt.core import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from calibre.gui2.tweak_book import tprefs
|
from calibre.gui2.tweak_book import tprefs
|
||||||
from calibre.gui2.tweak_book.widgets import BusyCursor, Dialog
|
from calibre.gui2.tweak_book.widgets import Dialog
|
||||||
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.gui2.widgets2 import HistoryLineEdit2
|
from calibre.gui2.widgets2 import HistoryLineEdit2
|
||||||
from calibre.utils.icu import safe_chr as codepoint_to_chr
|
from calibre.utils.icu import safe_chr as codepoint_to_chr
|
||||||
from calibre.utils.unicode_names import character_name_from_code, points_for_word
|
from calibre.utils.unicode_names import character_name_from_code, points_for_word
|
||||||
|
@ -15,7 +15,7 @@ from calibre.ebooks.oeb.polish.check.base import WARN, INFO, DEBUG, ERROR, CRITI
|
|||||||
from calibre.ebooks.oeb.polish.check.main import run_checks, fix_errors
|
from calibre.ebooks.oeb.polish.check.main import run_checks, fix_errors
|
||||||
from calibre.gui2 import NO_URL_FORMATTING, safe_open_url
|
from calibre.gui2 import NO_URL_FORMATTING, safe_open_url
|
||||||
from calibre.gui2.tweak_book import tprefs
|
from calibre.gui2.tweak_book import tprefs
|
||||||
from calibre.gui2.tweak_book.widgets import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
|
|
||||||
|
|
||||||
def icon_for_level(level):
|
def icon_for_level(level):
|
||||||
|
@ -10,7 +10,7 @@ from functools import partial
|
|||||||
from itertools import chain
|
from itertools import chain
|
||||||
from math import ceil
|
from math import ceil
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QApplication, QBrush, QColor, QCursor, QEvent, QEventLoop, QFont, QHBoxLayout,
|
QApplication, QBrush, QColor, QEvent, QEventLoop, QFont, QHBoxLayout,
|
||||||
QIcon, QImage, QKeySequence, QMenu, QPainter, QPainterPath, QPalette, QPen,
|
QIcon, QImage, QKeySequence, QMenu, QPainter, QPainterPath, QPalette, QPen,
|
||||||
QPixmap, QPlainTextEdit, QRect, QScrollBar, QSplitter, QSplitterHandle, Qt,
|
QPixmap, QPlainTextEdit, QRect, QScrollBar, QSplitter, QSplitterHandle, Qt,
|
||||||
QTextCharFormat, QTextCursor, QTextLayout, QTimer, QWidget, pyqtSignal
|
QTextCharFormat, QTextCursor, QTextLayout, QTimer, QWidget, pyqtSignal
|
||||||
@ -25,6 +25,7 @@ from calibre.gui2.tweak_book.editor.text import (
|
|||||||
LineNumbers, PlainTextEdit, default_font_family
|
LineNumbers, PlainTextEdit, default_font_family
|
||||||
)
|
)
|
||||||
from calibre.gui2.tweak_book.editor.themes import get_theme, theme_color
|
from calibre.gui2.tweak_book.editor.themes import get_theme, theme_color
|
||||||
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.utils.icu import utf16_length
|
from calibre.utils.icu import utf16_length
|
||||||
from calibre.utils.xml_parse import safe_xml_fromstring
|
from calibre.utils.xml_parse import safe_xml_fromstring
|
||||||
from polyglot.builtins import as_bytes, iteritems
|
from polyglot.builtins import as_bytes, iteritems
|
||||||
@ -32,15 +33,6 @@ from polyglot.builtins import as_bytes, iteritems
|
|||||||
Change = namedtuple('Change', 'ltop lbot rtop rbot kind')
|
Change = namedtuple('Change', 'ltop lbot rtop rbot kind')
|
||||||
|
|
||||||
|
|
||||||
class BusyCursor:
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
|
||||||
|
|
||||||
def __exit__(self, *args):
|
|
||||||
QApplication.restoreOverrideCursor()
|
|
||||||
|
|
||||||
|
|
||||||
def beautify_text(raw, syntax):
|
def beautify_text(raw, syntax):
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from collections import defaultdict, deque
|
|||||||
from qt.core import QTextCursor, QTextBlockUserData, QTextLayout, QTimer
|
from qt.core import QTextCursor, QTextBlockUserData, QTextLayout, QTimer
|
||||||
|
|
||||||
from ..themes import highlight_to_char_format
|
from ..themes import highlight_to_char_format
|
||||||
from calibre.gui2.tweak_book.widgets import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.utils.icu import utf16_length
|
from calibre.utils.icu import utf16_length
|
||||||
from polyglot.builtins import iteritems
|
from polyglot.builtins import iteritems
|
||||||
|
|
||||||
|
@ -16,7 +16,8 @@ from calibre.ebooks.oeb.polish.container import get_container
|
|||||||
from calibre.ebooks.oeb.polish.fonts import font_family_data, change_font
|
from calibre.ebooks.oeb.polish.fonts import font_family_data, change_font
|
||||||
from calibre.gui2 import error_dialog, info_dialog
|
from calibre.gui2 import error_dialog, info_dialog
|
||||||
from calibre.gui2.tweak_book import current_container, set_current_container
|
from calibre.gui2.tweak_book import current_container, set_current_container
|
||||||
from calibre.gui2.tweak_book.widgets import Dialog, BusyCursor
|
from calibre.gui2.tweak_book.widgets import Dialog
|
||||||
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.utils.icu import primary_sort_key as sort_key
|
from calibre.utils.icu import primary_sort_key as sort_key
|
||||||
from calibre.utils.fonts.scanner import font_scanner, NoFonts
|
from calibre.utils.fonts.scanner import font_scanner, NoFonts
|
||||||
from calibre.utils.fonts.metadata import FontMetadata, UnsupportedFont
|
from calibre.utils.fonts.metadata import FontMetadata, UnsupportedFont
|
||||||
|
@ -33,7 +33,7 @@ from calibre.gui2.tweak_book.function_replace import (
|
|||||||
Function, FunctionBox, FunctionEditor, functions as replace_functions,
|
Function, FunctionBox, FunctionEditor, functions as replace_functions,
|
||||||
remove_function
|
remove_function
|
||||||
)
|
)
|
||||||
from calibre.gui2.tweak_book.widgets import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.gui2.widgets2 import FlowLayout, HistoryComboBox
|
from calibre.gui2.widgets2 import FlowLayout, HistoryComboBox
|
||||||
from calibre.utils.icu import primary_contains
|
from calibre.utils.icu import primary_contains
|
||||||
from polyglot.builtins import error_message, iteritems
|
from polyglot.builtins import error_message, iteritems
|
||||||
|
@ -12,7 +12,7 @@ from calibre import prepare_string_for_xml
|
|||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
from calibre.gui2.tweak_book import tprefs, editors, current_container
|
from calibre.gui2.tweak_book import tprefs, editors, current_container
|
||||||
from calibre.gui2.tweak_book.search import get_search_regex, InvalidRegex, initialize_search_request
|
from calibre.gui2.tweak_book.search import get_search_regex, InvalidRegex, initialize_search_request
|
||||||
from calibre.gui2.tweak_book.widgets import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
from calibre.gui2.widgets2 import HistoryComboBox
|
from calibre.gui2.widgets2 import HistoryComboBox
|
||||||
from polyglot.builtins import iteritems, error_message
|
from polyglot.builtins import iteritems, error_message
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import unicodedata
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from math import ceil
|
from math import ceil
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QAbstractListModel, QApplication, QCheckBox, QComboBox, QCursor, QDialog,
|
QAbstractListModel, QApplication, QCheckBox, QComboBox, QDialog,
|
||||||
QDialogButtonBox, QEvent, QFormLayout, QFrame, QGridLayout, QGroupBox,
|
QDialogButtonBox, QEvent, QFormLayout, QFrame, QGridLayout, QGroupBox,
|
||||||
QHBoxLayout, QIcon, QItemSelectionModel, QLabel, QLineEdit, QListView, QMimeData,
|
QHBoxLayout, QIcon, QItemSelectionModel, QLabel, QLineEdit, QListView, QMimeData,
|
||||||
QModelIndex, QPainter, QPalette, QPixmap, QPlainTextEdit, QPoint, QRect, QSize,
|
QModelIndex, QPainter, QPalette, QPixmap, QPlainTextEdit, QPoint, QRect, QSize,
|
||||||
@ -45,15 +45,6 @@ from polyglot.builtins import iteritems
|
|||||||
ROOT = QModelIndex()
|
ROOT = QModelIndex()
|
||||||
|
|
||||||
|
|
||||||
class BusyCursor:
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
|
||||||
|
|
||||||
def __exit__(self, *args):
|
|
||||||
QApplication.restoreOverrideCursor()
|
|
||||||
|
|
||||||
|
|
||||||
class Dialog(BaseDialog):
|
class Dialog(BaseDialog):
|
||||||
|
|
||||||
def __init__(self, title, name, parent=None):
|
def __init__(self, title, name, parent=None):
|
||||||
|
@ -741,7 +741,7 @@ class EbookViewer(MainWindow):
|
|||||||
cmd = [exe]
|
cmd = [exe]
|
||||||
if selected_text:
|
if selected_text:
|
||||||
cmd += ['--select-text', selected_text]
|
cmd += ['--select-text', selected_text]
|
||||||
from calibre.gui2.tweak_book.widgets import BusyCursor
|
from calibre.gui2.widgets import BusyCursor
|
||||||
with sanitize_env_vars():
|
with sanitize_env_vars():
|
||||||
subprocess.Popen(cmd + [path, file_name])
|
subprocess.Popen(cmd + [path, file_name])
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
|
@ -1299,6 +1299,16 @@ class PaperSizes(QComboBox): # {{{
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
class BusyCursor: # {{{
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
|
||||||
|
|
||||||
|
def __exit__(self, *args):
|
||||||
|
QApplication.restoreOverrideCursor()
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from qt.core import QTextEdit
|
from qt.core import QTextEdit
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user