mirror of
https://gitlab.com/openlp/openlp.git
synced 2024-12-25 11:14:07 +00:00
Fixing orphan code [skip ci]
This commit is contained in:
parent
5ad3f739d4
commit
b8f0c62149
@ -396,10 +396,6 @@ def backup_if_version_changed(settings):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def get_hidpi_mode(args, settings):
|
|
||||||
return settings.value('advanced/hidpi mode')
|
|
||||||
|
|
||||||
|
|
||||||
def apply_dpi_adjustments_stage_qt(hidpi_mode, qt_args):
|
def apply_dpi_adjustments_stage_qt(hidpi_mode, qt_args):
|
||||||
if hidpi_mode == HiDPIMode.Windows_Unaware:
|
if hidpi_mode == HiDPIMode.Windows_Unaware:
|
||||||
os.environ['QT_SCALE_FACTOR'] = '1'
|
os.environ['QT_SCALE_FACTOR'] = '1'
|
||||||
@ -484,6 +480,7 @@ def main():
|
|||||||
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
|
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
|
||||||
init_webview_custom_schemes()
|
init_webview_custom_schemes()
|
||||||
application = QtWidgets.QApplication(qt_args)
|
application = QtWidgets.QApplication(qt_args)
|
||||||
|
application.setApplicationName('OpenLP')
|
||||||
application.setOrganizationDomain('openlp.org')
|
application.setOrganizationDomain('openlp.org')
|
||||||
application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
|
application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
|
||||||
application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
|
application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
|
||||||
@ -497,7 +494,7 @@ def main():
|
|||||||
font.setPointSizeF(font.pointSizeF() * application.devicePixelRatio())
|
font.setPointSizeF(font.pointSizeF() * application.devicePixelRatio())
|
||||||
application.setFont(font)
|
application.setFont(font)
|
||||||
if args.portable:
|
if args.portable:
|
||||||
QtWidgets.QApplication.setApplicationName('OpenLPPortable')
|
application.setApplicationName('OpenLPPortable')
|
||||||
Settings.setDefaultFormat(Settings.IniFormat)
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
# Get location OpenLPPortable.ini
|
# Get location OpenLPPortable.ini
|
||||||
if args.portablepath:
|
if args.portablepath:
|
||||||
@ -510,6 +507,7 @@ def main():
|
|||||||
portable_path = resolve(portable_path)
|
portable_path = resolve(portable_path)
|
||||||
data_path = portable_path / 'Data'
|
data_path = portable_path / 'Data'
|
||||||
set_up_logging(portable_path / 'Other')
|
set_up_logging(portable_path / 'Other')
|
||||||
|
set_up_web_engine_cache(portable_path / 'Other' / 'web_cache')
|
||||||
log.info('Running portable')
|
log.info('Running portable')
|
||||||
portable_settings_path = data_path / 'OpenLP.ini'
|
portable_settings_path = data_path / 'OpenLP.ini'
|
||||||
# Make this our settings file
|
# Make this our settings file
|
||||||
@ -523,8 +521,9 @@ def main():
|
|||||||
portable_settings.setValue('advanced/is portable', True)
|
portable_settings.setValue('advanced/is portable', True)
|
||||||
portable_settings.sync()
|
portable_settings.sync()
|
||||||
else:
|
else:
|
||||||
QtWidgets.QApplication.setApplicationName('OpenLP')
|
application.setApplicationName('OpenLP')
|
||||||
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
|
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
|
||||||
|
set_up_web_engine_cache(AppLocation.get_directory(AppLocation.CacheDir) / 'web_cache')
|
||||||
# Set the libvlc environment variable if we're frozen
|
# Set the libvlc environment variable if we're frozen
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
# Path to libvlc and the plugins
|
# Path to libvlc and the plugins
|
||||||
@ -544,7 +543,7 @@ def main():
|
|||||||
Registry.create()
|
Registry.create()
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
# Doing HiDPI adjustments that need to be done before QCoreApplication instantiation.
|
# Doing HiDPI adjustments that need to be done before QCoreApplication instantiation.
|
||||||
hidpi_mode = get_hidpi_mode(args, settings)
|
hidpi_mode = settings.value('advanced/hidpi mode')
|
||||||
apply_dpi_adjustments_stage_qt(hidpi_mode, qt_args)
|
apply_dpi_adjustments_stage_qt(hidpi_mode, qt_args)
|
||||||
# Instantiating QCoreApplication
|
# Instantiating QCoreApplication
|
||||||
application = QtWidgets.QApplication(qt_args)
|
application = QtWidgets.QApplication(qt_args)
|
||||||
|
@ -164,13 +164,3 @@ class HiDPIMode(IntEnum):
|
|||||||
Legacy = 1,
|
Legacy = 1,
|
||||||
# (Windows only) Make the OpenLP run unaware of any screen scaling.
|
# (Windows only) Make the OpenLP run unaware of any screen scaling.
|
||||||
Windows_Unaware = 2
|
Windows_Unaware = 2
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def parse(value):
|
|
||||||
value = value.lower() if isinstance(value, str) else value
|
|
||||||
if value in [0, '0', 'default']:
|
|
||||||
return HiDPIMode.Default
|
|
||||||
elif value in [1, '1', 'legacy']:
|
|
||||||
return HiDPIMode.Legacy
|
|
||||||
elif value in [2, '2', 'windows_unaware']:
|
|
||||||
return HiDPIMode.Windows_Unaware
|
|
||||||
|
@ -317,7 +317,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
|
|
||||||
:param checked: The state of the check box (boolean).
|
:param checked: The state of the check box (boolean).
|
||||||
"""
|
"""
|
||||||
if (self.isVisible()):
|
if self.isVisible():
|
||||||
QtWidgets.QMessageBox.information(self, translate('OpenLP.AdvancedTab', 'Restart Required'),
|
QtWidgets.QMessageBox.information(self, translate('OpenLP.AdvancedTab', 'Restart Required'),
|
||||||
translate('OpenLP.AdvancedTab',
|
translate('OpenLP.AdvancedTab',
|
||||||
'This change will only take effect once OpenLP '
|
'This change will only take effect once OpenLP '
|
||||||
|
Loading…
Reference in New Issue
Block a user