Skip to content
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

Merged
merged 10 commits into from Jun 17, 2018
4 changes: 2 additions & 2 deletions source/core.py
Expand Up @@ -61,8 +61,8 @@ def doStartupDialogs():
gui.messageBox(_("Your gesture map file contains errors.\n"
"More details about the errors can be found in the log file."),
_("gesture map File Error"), wx.OK|wx.ICON_EXCLAMATION)
if not config.conf['update']['askedAllowUsageStats']:
gui.AskAllowUsageStatsDialog.run()
if not globalVars.appArgs.secure and not config.isAppX and not config.conf['update']['askedAllowUsageStats']:
gui.runScriptModalDialog(gui.AskAllowUsageStatsDialog(None))

def restart(disableAddons=False, debugLogging=False):
"""Restarts NVDA by starting a new copy with -r."""
Expand Down
35 changes: 15 additions & 20 deletions source/gui/__init__.py
Expand Up @@ -926,7 +926,7 @@ def _isDebug():
return config.conf["debugLog"]["gui"]

class AskAllowUsageStatsDialog(wx.Dialog):
"""A dialog asking if the user whishes to allow NVDA usage stats to be collected by NV Access."""
"""A dialog asking if the user wishes to allow NVDA usage stats to be collected by NV Access."""

def __init__(self, parent):
# Translators: The title of the dialog asking if usage data can be collected
Expand All @@ -935,21 +935,18 @@ def __init__(self, parent):
sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)

# Translators: A message asking the user if they want to allow usage stats gathering
message=_("In order to improve NVDA in the future, NV Access wishes to collect usage data from running copies of NVDA. "
message=_("In order to improve NVDA in the future, NV Access wishes to collect usage data from running copies of NVDA.\n\n"
"Data includes Operating System version, NVDA version, language, country of origin, plus certain NVDA configuration such as current synthesizer, braille display and braille table. "
"No spoken or braille content will be ever sent to NV Access. Please refer to the User Guide for a current list of all data collected.\n"
"No spoken or braille content will be ever sent to NV Access. Please refer to the User Guide for a current list of all data collected.\n\n"
"Do you wish to allow NV Access to periodically collect this data in order to improve NVDA?")
sHelper.addItem(wx.StaticText(self, label=message))
sText=sHelper.addItem(wx.StaticText(self, label=message))
# the wx.Window must be constructed before we can get the handle.
import windowUtils
self.scaleFactor = windowUtils.getWindowScalingFactor(self.GetHandle())
sText.Wrap(self.scaleFactor*600) # 600 was fairly arbitrarily chosen by a visual user to look acceptable on their machine.

bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL))

remindMeButtonID=wx.NewId()
# Translators: The label of a button to remind the user later about performing some action.
remindMeButton = bHelper.addButton(self, remindMeButtonID, label=_("Remind me &later"))
remindMeButton.Bind(wx.EVT_BUTTON, self.onLaterButton)
remindMeButton.SetFocus()
self.EscapeId=remindMeButtonID

# Translators: The label of a Yes button in a dialog
yesButton = bHelper.addButton(self, wx.ID_YES, label=_("&Yes"))
yesButton.Bind(wx.EVT_BUTTON, self.onYesButton)
Expand All @@ -958,6 +955,11 @@ def __init__(self, parent):
noButton = bHelper.addButton(self, wx.ID_NO, label=_("&No"))
noButton.Bind(wx.EVT_BUTTON, self.onNoButton)

# Translators: The label of a button to remind the user later about performing some action.
remindMeButton = bHelper.addButton(self, wx.ID_CANCEL, label=_("Remind me &later"))
remindMeButton.Bind(wx.EVT_BUTTON, self.onLaterButton)
remindMeButton.SetFocus()

mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
self.Sizer = mainSizer
mainSizer.Fit(self)
Expand All @@ -967,21 +969,14 @@ def onYesButton(self,evt):
log.debug("Usage stats gathering has been allowed")
config.conf['update']['askedAllowUsageStats']=True
config.conf['update']['allowUsageStats']=True
self.Destroy()
self.EndModal(wx.ID_YES)

def onNoButton(self,evt):
log.debug("Usage stats gathering has been disallowed")
config.conf['update']['askedAllowUsageStats']=True
config.conf['update']['allowUsageStats']=False
self.Destroy()
self.EndModal(wx.ID_NO)

def onLaterButton(self,evt):
log.debug("Usage stats gathering question has been deferred")
evt.Skip()
Copy link
Contributor

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 the evt.Skip()?

Copy link
Contributor

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?


@classmethod
def run(self):
d=self(mainFrame)
mainFrame.prePopup()
d.Show()
mainFrame.postPopup()