Merge branch 'main' into editor_features
This commit is contained in:
@@ -241,6 +241,16 @@ def main(sysArgs=None):
|
||||
# Finish initialising config
|
||||
CONFIG.initConfig(confPath, dataPath)
|
||||
|
||||
if CONFIG.osDarwin:
|
||||
try:
|
||||
from Foundation import NSBundle
|
||||
bundle = NSBundle.mainBundle()
|
||||
info = bundle.localizedInfoDictionary() or bundle.infoDictionary()
|
||||
info["CFBundleName"] = "novelWriter"
|
||||
except ImportError as e:
|
||||
logger.error("Failed to set application name")
|
||||
logger.error(str(e))
|
||||
|
||||
# Import GUI (after dependency checks), and launch
|
||||
from nw.guimain import GuiMain
|
||||
if testMode:
|
||||
|
||||
+5
-4
@@ -762,12 +762,10 @@ class GuiBuildNovel(QDialog):
|
||||
if self.mainConf.showGUI:
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
saveTo = QFileDialog.getSaveFileName(
|
||||
savePath, _ = QFileDialog.getSaveFileName(
|
||||
self, "Save Document As", savePath, options=dlgOpt
|
||||
)
|
||||
if saveTo[0]:
|
||||
savePath = saveTo[0]
|
||||
else:
|
||||
if not savePath:
|
||||
return False
|
||||
|
||||
self.mainConf.setLastPath(savePath)
|
||||
@@ -915,6 +913,9 @@ class GuiBuildNovel(QDialog):
|
||||
if theStatus:
|
||||
self.textFont.setText(theFont.family())
|
||||
self.textSize.setValue(theFont.pointSize())
|
||||
|
||||
self.raise_() # Move the dialog to front (fixes a bug on macOS)
|
||||
|
||||
return
|
||||
|
||||
def _loadCache(self):
|
||||
|
||||
@@ -341,9 +341,11 @@ class GuiDocEditor(QTextEdit):
|
||||
) % (docSize/1.0e6, nwConst.maxDocSize/1.0e6), nwAlert.ERROR)
|
||||
return False
|
||||
|
||||
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||
self.setPlainText(theText)
|
||||
self.setDocumentChanged(True)
|
||||
self.updateDocMargins()
|
||||
qApp.restoreOverrideCursor()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -276,6 +276,7 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aExitNW = QAction("Exit", self)
|
||||
self.aExitNW.setStatusTip("Exit %s" % self.mainConf.appName)
|
||||
self.aExitNW.setShortcut("Ctrl+Q")
|
||||
self.aExitNW.setMenuRole(QAction.QuitRole)
|
||||
self.aExitNW.triggered.connect(lambda: self.theParent.closeMain())
|
||||
self.projMenu.addAction(self.aExitNW)
|
||||
|
||||
@@ -843,6 +844,7 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aPreferences = QAction("Preferences", self)
|
||||
self.aPreferences.setStatusTip("Preferences")
|
||||
self.aPreferences.setShortcut("Ctrl+,")
|
||||
self.aPreferences.setMenuRole(QAction.PreferencesRole)
|
||||
self.aPreferences.triggered.connect(lambda: self.theParent.showPreferencesDialog())
|
||||
self.toolsMenu.addAction(self.aPreferences)
|
||||
|
||||
@@ -857,12 +859,14 @@ class GuiMainMenu(QMenuBar):
|
||||
# Help > About
|
||||
self.aAboutNW = QAction("About %s" % self.mainConf.appName, self)
|
||||
self.aAboutNW.setStatusTip("About %s" % self.mainConf.appName)
|
||||
self.aAboutNW.setMenuRole(QAction.AboutRole)
|
||||
self.aAboutNW.triggered.connect(lambda: self.theParent.showAboutNWDialog())
|
||||
self.helpMenu.addAction(self.aAboutNW)
|
||||
|
||||
# Help > About Qt5
|
||||
self.aAboutQt = QAction("About Qt5", self)
|
||||
self.aAboutQt.setStatusTip("About Qt5")
|
||||
self.aAboutQt.setMenuRole(QAction.AboutQtRole)
|
||||
self.aAboutQt.triggered.connect(lambda: self.theParent.showAboutQtDialog())
|
||||
self.helpMenu.addAction(self.aAboutQt)
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ class GuiConfigEditGeneralTab(QWidget):
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.ShowDirsOnly
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
newDir = QFileDialog.getExistingDirectory(
|
||||
newDir = QFileDialog.getExistingDirectory(
|
||||
self, "Backup Directory", currDir, options=dlgOpt
|
||||
)
|
||||
if newDir:
|
||||
|
||||
@@ -334,12 +334,11 @@ class GuiWritingStats(QDialog):
|
||||
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
saveTo = QFileDialog.getSaveFileName(
|
||||
savePath, _ = QFileDialog.getSaveFileName(
|
||||
self, "Save Document As", savePath, options=dlgOpt
|
||||
)
|
||||
if saveTo:
|
||||
savePath = saveTo[0]
|
||||
else:
|
||||
|
||||
if not savePath:
|
||||
return False
|
||||
|
||||
self.mainConf.setLastPath(savePath)
|
||||
|
||||
+3
-4
@@ -559,16 +559,15 @@ class GuiMain(QMainWindow):
|
||||
extFilter = [
|
||||
"Text files (*.txt)",
|
||||
"Markdown files (*.md)",
|
||||
"novelWriter files (*.nwd)",
|
||||
"All files (*.*)",
|
||||
]
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
inPath = QFileDialog.getOpenFileName(
|
||||
loadFile, _ = QFileDialog.getOpenFileName(
|
||||
self, "Import File", lastPath, options=dlgOpt, filter=";;".join(extFilter)
|
||||
)
|
||||
if inPath:
|
||||
loadFile = inPath[0]
|
||||
else:
|
||||
if not loadFile:
|
||||
return False
|
||||
|
||||
if loadFile.strip() == "":
|
||||
|
||||
Reference in New Issue
Block a user