Explicitly set python exec and ignore errors from run from source blocks in main
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user