New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send current synthDriver name and brailleDisplay name to update server for stats gathering. #8217
Changes from 8 commits
06a93fb
294bb1b
f303ca6
f8d0c48
c40db2e
65dabee
da91a7e
50beb08
8d78b01
3dc51c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -633,6 +633,12 @@ def makeSettings(self, settingsSizer): | |
if globalVars.appArgs.secure: | ||
item.Disable() | ||
settingsSizerHelper.addItem(item) | ||
# Translators: The label of a checkbox in general settings to toggle allowing of usage stats gathering | ||
item=self.allowUsageStatsCheckBox=wx.CheckBox(self,label=_("Allow the NVDA project to gather NVDA usage statistics")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually think it makes sense to reposition this checkbox after the notifyForPendingUpdateCheckBox. The current order of check boxes is a bit arbitrary now. |
||
item.Value=config.conf["update"]["allowUsageStats"] | ||
if globalVars.appArgs.secure: | ||
item.Disable() | ||
settingsSizerHelper.addItem(item) | ||
# Translators: The label of a checkbox in general settings to toggle startup notifications | ||
# for a pending NVDA update. | ||
item=self.notifyForPendingUpdateCheckBox=wx.CheckBox(self,label=_("Notify for &pending update on startup")) | ||
|
@@ -703,6 +709,7 @@ def onSave(self): | |
gui.messageBox(_("This change requires administrator privileges."), _("Insufficient Privileges"), style=wx.OK | wx.ICON_ERROR, parent=self) | ||
if updateCheck: | ||
config.conf["update"]["autoCheck"]=self.autoCheckForUpdatesCheckBox.IsChecked() | ||
config.conf["update"]["allowUsageStats"]=self.allowUsageStatsCheckBox.IsChecked() | ||
config.conf["update"]["startupNotification"]=self.notifyForPendingUpdateCheckBox.IsChecked() | ||
updateCheck.terminate() | ||
updateCheck.initialize() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
|
||
import winVersion | ||
import os | ||
import inspect | ||
import threading | ||
import time | ||
import cPickle | ||
|
@@ -30,9 +31,12 @@ | |
import ssl | ||
import wx | ||
import languageHandler | ||
import speech | ||
import braille | ||
import gui | ||
from gui import guiHelper | ||
from logHandler import log | ||
from addonHandler import getCodeAddon, AddonError | ||
from logHandler import log, isPathExternalToNVDA | ||
import config | ||
import shellapi | ||
import winUser | ||
|
@@ -62,6 +66,26 @@ | |
#: C{None} if it is disabled. | ||
autoChecker = None | ||
|
||
def getQualifiedDriverClassNameForStats(cls): | ||
""" fetches the name from a given synthDriver or brailleDisplay class, and appends core for in-built code, the add-on name for code from an add-on, or external for code in the NVDA user profile. | ||
Some examples: | ||
espeak (core) | ||
newfon (external) | ||
eloquence (addon:CodeFactory) | ||
noBraille (core) | ||
""" | ||
name=cls.name | ||
try: | ||
addon=getCodeAddon(cls) | ||
except AddonError: | ||
addon=None | ||
if addon: | ||
return "%s (addon:%s)"%(name,addon.name) | ||
path=inspect.getsourcefile(cls) | ||
if isPathExternalToNVDA(path): | ||
return "%s (external)"%name | ||
return "%s (core)"%name | ||
|
||
def checkForUpdate(auto=False): | ||
"""Check for an updated version of NVDA. | ||
This will block, so it generally shouldn't be called from the main thread. | ||
|
@@ -71,15 +95,28 @@ def checkForUpdate(auto=False): | |
@rtype: dict | ||
@raise RuntimeError: If there is an error checking for an update. | ||
""" | ||
allowUsageStats=config.conf["update"]['allowUsageStats'] | ||
params = { | ||
"autoCheck": auto, | ||
"allowUsageStats":allowUsageStats, | ||
"version": versionInfo.version, | ||
"versionType": versionInfo.updateVersionType, | ||
"osVersion": winVersion.winVersionText, | ||
"x64": os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64", | ||
"language": languageHandler.getLanguage(), | ||
"installed": config.isInstalledCopy(), | ||
} | ||
if auto and allowUsageStats: | ||
synthDriverClass=speech.getSynth().__class__ | ||
brailleDisplayClass=braille.handler.display.__class__ if braille.handler else None | ||
# Following are parameters sent purely for stats gathering. | ||
# If new parameters are added here, they must be documented in the userGuide for transparency. | ||
extraParams={ | ||
"language": languageHandler.getLanguage(), | ||
"installed": config.isInstalledCopy(), | ||
"synthDriver":getQualifiedDriverClassNameForStats(synthDriverClass) if synthDriverClass else None, | ||
"brailleDisplay":getQualifiedDriverClassNameForStats(brailleDisplayClass) if brailleDisplayClass else None, | ||
"outputBrailleTable":config.conf['braille']['translationTable'] if brailleDisplayClass else None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be worth while adding a comment here to say that any additions must be added to the userguide. |
||
} | ||
params.update(extraParams) | ||
url = "%s?%s" % (CHECK_URL, urllib.urlencode(params)) | ||
try: | ||
res = urllib.urlopen(url) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that you don't need to call
EndModal
here? Could it be because of theevt.Skip()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you calling
Skip()
on this?