Explicitly set python exec and ignore errors from run from source blocks in main

This commit is contained in:
Veronica Berglyd Olsen
2024-04-20 21:31:04 +02:00
parent c2f0d04a35
commit e8bd9b21b5
2 changed files with 6 additions and 9 deletions
+5 -8
View File
@@ -32,7 +32,7 @@ from typing import TYPE_CHECKING
from PyQt5.QtWidgets import QApplication, QErrorMessage from PyQt5.QtWidgets import QApplication, QErrorMessage
from novelwriter.config import Config from novelwriter.config import Config
from novelwriter.error import exceptionHandler, logException from novelwriter.error import exceptionHandler
from novelwriter.shared import SharedData from novelwriter.shared import SharedData
if TYPE_CHECKING: # pragma: no cover if TYPE_CHECKING: # pragma: no cover
@@ -198,24 +198,21 @@ def main(sysArgs: list | None = None) -> GuiMain | None:
# Finish initialising config # Finish initialising config
CONFIG.initConfig(confPath, dataPath) CONFIG.initConfig(confPath, dataPath)
if CONFIG.osDarwin: if sys.platform == "darwin":
try: try:
from Foundation import NSBundle # type: ignore from Foundation import NSBundle # type: ignore
bundle = NSBundle.mainBundle() bundle = NSBundle.mainBundle()
info = bundle.localizedInfoDictionary() or bundle.infoDictionary() info = bundle.localizedInfoDictionary() or bundle.infoDictionary()
info["CFBundleName"] = "novelWriter" info["CFBundleName"] = "novelWriter"
except Exception: except Exception:
logger.error("Failed to set application name") pass # Quietly ignore error
logException() elif sys.platform == "win32":
elif CONFIG.osWindows:
try: try:
import ctypes import ctypes
appID = f"io.novelwriter.{__version__}" appID = f"io.novelwriter.{__version__}"
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(appID) # type: ignore ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(appID) # type: ignore
except Exception: except Exception:
logger.error("Failed to set application name") pass # Quietly ignore error
logException()
# Import GUI (after dependency checks), and launch # Import GUI (after dependency checks), and launch
from novelwriter.guimain import GuiMain from novelwriter.guimain import GuiMain
+1 -1
View File
@@ -139,7 +139,7 @@ echo "Creating entry script ..."
cat > novelWriter.app/Contents/MacOS/novelWriter << EOF cat > novelWriter.app/Contents/MacOS/novelWriter << EOF
#!/bin/bash #!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py \$@ $DIR/../Resources/bin/python$PYTHON -sE $DIR/../Resources/novelWriter/novelWriter.py \$@
EOF EOF
# Make it executable # Make it executable