Skip to content

Commit b0b47f7

Browse files
authored
Merge 6d07360 into 5c91755
2 parents 5c91755 + 6d07360 commit b0b47f7

12 files changed

Lines changed: 362 additions & 313 deletions

source/NVDAObjects/window/excel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ class ElementsListDialog(browseMode.ElementsListDialog):
597597

598598

599599
class EditCommentDialog(
600-
gui.ContextHelpMixin,
600+
gui.contextHelp.ContextHelpMixin,
601601
wx.TextEntryDialog, # wxPython does not seem to call base class initializer, put last in MRO
602602
):
603603
helpId = "ExcelReportingComments"

source/core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def doStartupDialogs():
7878
_("Configuration File Error"),
7979
wx.OK | wx.ICON_EXCLAMATION)
8080
if config.conf["general"]["showWelcomeDialogAtStartup"]:
81-
gui.WelcomeDialog.run()
81+
from gui.startupDialogs import WelcomeDialog
82+
WelcomeDialog.run()
8283
if config.conf["brailleViewer"]["showBrailleViewerAtStartup"]:
8384
gui.mainFrame.onToggleBrailleViewerCommand(evt=None)
8485
if config.conf["speechViewer"]["showSpeechViewerAtStartup"]:
@@ -104,7 +105,7 @@ def onResult(ID):
104105
except:
105106
pass
106107
# Ask the user if usage stats can be collected.
107-
gui.runScriptModalDialog(gui.AskAllowUsageStatsDialog(None),onResult)
108+
gui.runScriptModalDialog(gui.startupDialogs.AskAllowUsageStatsDialog(None), onResult)
108109

109110
def restart(disableAddons=False, debugLogging=False):
110111
"""Restarts NVDA by starting a new copy."""
@@ -509,7 +510,8 @@ def handlePowerStatusChange(self):
509510
except:
510511
log.error("", exc_info=True)
511512
if globalVars.appArgs.launcher:
512-
gui.LauncherDialog.run()
513+
from gui.startupDialogs import LauncherDialog
514+
LauncherDialog.run()
513515
# LauncherDialog will call doStartupDialogs() afterwards if required.
514516
else:
515517
wx.CallAfter(doStartupDialogs)

source/cursorManager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232

3333
class FindDialog(
34-
gui.ContextHelpMixin,
34+
gui.contextHelp.ContextHelpMixin,
3535
wx.Dialog, # wxPython does not seem to call base class initializer, put last in MRO
3636
):
3737
"""A dialog used to specify text to find in a cursor manager.

source/documentationUtils.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# -*- coding: UTF-8 -*-
2+
# A part of NonVisual Desktop Access (NVDA)
3+
# Copyright (C) 2006-2020 NV Access Limited, Łukasz Golonka
4+
# This file may be used under the terms of the GNU General Public License, version 2 or later.
5+
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
6+
7+
import os
8+
import sys
9+
10+
import globalVars
11+
import languageHandler
12+
13+
14+
def getDocFilePath(fileName, localized=True):
15+
if not getDocFilePath.rootPath:
16+
if hasattr(sys, "frozen"):
17+
getDocFilePath.rootPath = os.path.join(globalVars.appDir, "documentation")
18+
else:
19+
getDocFilePath.rootPath = os.path.join(globalVars.appDir, "..", "user_docs")
20+
21+
if localized:
22+
lang = languageHandler.getLanguage()
23+
tryLangs = [lang]
24+
if "_" in lang:
25+
# This locale has a sub-locale, but documentation might not exist for the sub-locale, so try stripping it.
26+
tryLangs.append(lang.split("_")[0])
27+
# If all else fails, use English.
28+
tryLangs.append("en")
29+
30+
fileName, fileExt = os.path.splitext(fileName)
31+
for tryLang in tryLangs:
32+
tryDir = os.path.join(getDocFilePath.rootPath, tryLang)
33+
if not os.path.isdir(tryDir):
34+
continue
35+
36+
# Some out of date translations might include .txt files which are now .html files in newer translations.
37+
# Therefore, ignore the extension and try both .html and .txt.
38+
for tryExt in ("html", "txt"):
39+
tryPath = os.path.join(tryDir, f"{fileName}.{tryExt}")
40+
if os.path.isfile(tryPath):
41+
return tryPath
42+
return None
43+
else:
44+
# Not localized.
45+
if not hasattr(sys, "frozen") and fileName in ("copying.txt", "contributors.txt"):
46+
# If running from source, these two files are in the root dir.
47+
return os.path.join(globalVars.appDir, "..", fileName)
48+
else:
49+
return os.path.join(getDocFilePath.rootPath, fileName)
50+
51+
52+
getDocFilePath.rootPath = None

0 commit comments

Comments
 (0)