mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
A spot of refatoring
This commit is contained in:
parent
46b9d7762e
commit
3c9f17bd2b
@ -924,23 +924,7 @@ def show_temp_dir_error(err):
|
|||||||
'Could not create temporary directory, calibre cannot start.') + ' ' + extra, det_msg=traceback.format_exc(), show=True)
|
'Could not create temporary directory, calibre cannot start.') + ' ' + extra, det_msg=traceback.format_exc(), show=True)
|
||||||
|
|
||||||
|
|
||||||
class Application(QApplication):
|
def setup_hidpi():
|
||||||
|
|
||||||
shutdown_signal_received = pyqtSignal()
|
|
||||||
|
|
||||||
def __init__(self, args, force_calibre_style=False, override_program_name=None, headless=False, color_prefs=gprefs):
|
|
||||||
self.file_event_hook = None
|
|
||||||
if override_program_name:
|
|
||||||
args = [override_program_name] + args[1:]
|
|
||||||
if headless:
|
|
||||||
if not args:
|
|
||||||
args = sys.argv[:1]
|
|
||||||
args.extend(['-platformpluginpath', sys.extensions_location, '-platform', 'headless'])
|
|
||||||
self.headless = headless
|
|
||||||
qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args]
|
|
||||||
self.pi = plugins['progress_indicator'][0]
|
|
||||||
if not isosx and not headless:
|
|
||||||
# On OS X high dpi scaling is turned on automatically by the OS, so we dont need to set it explicitly
|
|
||||||
# This requires Qt >= 5.6
|
# This requires Qt >= 5.6
|
||||||
has_env_setting = False
|
has_env_setting = False
|
||||||
env_vars = ('QT_AUTO_SCREEN_SCALE_FACTOR', 'QT_SCALE_FACTOR', 'QT_SCREEN_SCALE_FACTORS', 'QT_DEVICE_PIXEL_RATIO')
|
env_vars = ('QT_AUTO_SCREEN_SCALE_FACTOR', 'QT_SCALE_FACTOR', 'QT_SCREEN_SCALE_FACTORS', 'QT_DEVICE_PIXEL_RATIO')
|
||||||
@ -961,6 +945,26 @@ class Application(QApplication):
|
|||||||
os.environ.pop(p, None)
|
os.environ.pop(p, None)
|
||||||
elif DEBUG:
|
elif DEBUG:
|
||||||
prints('Not controlling hidpi scaling')
|
prints('Not controlling hidpi scaling')
|
||||||
|
|
||||||
|
|
||||||
|
class Application(QApplication):
|
||||||
|
|
||||||
|
shutdown_signal_received = pyqtSignal()
|
||||||
|
|
||||||
|
def __init__(self, args, force_calibre_style=False, override_program_name=None, headless=False, color_prefs=gprefs):
|
||||||
|
self.file_event_hook = None
|
||||||
|
if override_program_name:
|
||||||
|
args = [override_program_name] + args[1:]
|
||||||
|
if headless:
|
||||||
|
if not args:
|
||||||
|
args = sys.argv[:1]
|
||||||
|
args.extend(['-platformpluginpath', sys.extensions_location, '-platform', 'headless'])
|
||||||
|
self.headless = headless
|
||||||
|
qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args]
|
||||||
|
self.pi = plugins['progress_indicator'][0]
|
||||||
|
if not isosx and not headless:
|
||||||
|
# On OS X high dpi scaling is turned on automatically by the OS, so we dont need to set it explicitly
|
||||||
|
setup_hidpi()
|
||||||
QApplication.setOrganizationName('calibre-ebook.com')
|
QApplication.setOrganizationName('calibre-ebook.com')
|
||||||
QApplication.setOrganizationDomain(QApplication.organizationName())
|
QApplication.setOrganizationDomain(QApplication.organizationName())
|
||||||
QApplication.setApplicationVersion(__version__)
|
QApplication.setApplicationVersion(__version__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user