Use a busy cursor so user knows something is happening while editor is loaded

This commit is contained in:
Kovid Goyal 2021-03-09 20:43:32 +05:30
parent 943f08e50e
commit 6ba3aba70d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -2,11 +2,11 @@
# vim:fileencoding=utf-8 # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net> # License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import json import json
import os import os
import re import re
import sys import sys
import time
from collections import defaultdict, namedtuple from collections import defaultdict, namedtuple
from hashlib import sha256 from hashlib import sha256
from qt.core import ( from qt.core import (
@ -643,6 +643,7 @@ class EbookViewer(MainWindow):
def edit_book(self, file_name, progress_frac, selected_text): def edit_book(self, file_name, progress_frac, selected_text):
import subprocess import subprocess
from calibre.ebooks.oeb.polish.main import SUPPORTED from calibre.ebooks.oeb.polish.main import SUPPORTED
from calibre.utils.ipc.launch import exe_path, macos_edit_book_bundle_path from calibre.utils.ipc.launch import exe_path, macos_edit_book_bundle_path
try: try:
@ -664,8 +665,11 @@ 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
with sanitize_env_vars(): with sanitize_env_vars():
subprocess.Popen(cmd + [path, file_name]) subprocess.Popen(cmd + [path, file_name])
with BusyCursor():
time.sleep(2)
def save_state(self): def save_state(self):
with vprefs: with vprefs: