def __init__(self, parent): # Translators: The title of the dialog asking if usage data can be collected super().__init__(parent, title=_("NVDA Usage Data Collection")) mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) message = _( # Translators: A message asking the user if they want to allow usage stats gathering "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\n" "Do you wish to allow NV Access to periodically collect this data in order to improve NVDA?" ) 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( # 600 was fairly arbitrarily chosen by a visual user to look acceptable on their machine. self.scaleFactor * 600) bHelper = sHelper.addDialogDismissButtons( gui.guiHelper.ButtonHelper(wx.HORIZONTAL)) # 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) # Translators: The label of a No button in a dialog 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=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.CentreOnScreen()
def __init__(self, parent): """ @param parent: The parent for this panel; C{None} for no parent. @type parent: wx.Window """ # if gui._isDebug(): # startTime = time.time() super(SettingsPanel, self).__init__(parent, wx.ID_ANY) # the wx.Window must be constructed before we can get the handle. import windowUtils self.scaleFactor = getWindowScalingFactor(self.GetHandle()) self.mainSizer = wx.BoxSizer(wx.VERTICAL) self.settingsSizer = wx.BoxSizer(wx.VERTICAL) self.makeSettings(self.settingsSizer) self.mainSizer.Add(self.settingsSizer, flag=wx.ALL) self.mainSizer.Fit(self) self.SetSizer(self.mainSizer)
def __init__(self, parent): # Translators: The title of the dialog asking if usage data can be collected super(AskAllowUsageStatsDialog, self).__init__(parent, title=_("NVDA Usage Data Collection")) mainSizer = wx.BoxSizer(wx.VERTICAL) 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.\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\n" "Do you wish to allow NV Access to periodically collect this data in order to improve NVDA?") 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)) # 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) # Translators: The label of a No button in a dialog 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) self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
def getScaleFactor(windowHandle): """Helper method to get the window scale factor. The window needs to be constructed first, in order to get the window handle, this likely means calling the wx.window __init__ method prior to calling self.GetHandle()""" import windowUtils return windowUtils.getWindowScalingFactor(windowHandle)
def getScaleFactor(windowHandle): """Helper method to get the window scale factor. The window needs to be constructed first, in order to get the window handle, this likely means calling the wx.window __init__ method prior to calling self.GetHandle()""" import windowUtils return windowUtils.getWindowScalingFactor(windowHandle)
def __init__(self, parent, resizeable=False, hasApplyButton=False, settingsSizerOrientation=wx.VERTICAL, multiInstanceAllowed=False): """ @param parent: The parent for this dialog; C{None} for no parent. @type parent: wx.Window @param resizeable: True if the settings dialog should be resizable by the user, only set this if you have tested that the components resize correctly. @type resizeable: bool @param hasApplyButton: C{True} to add an apply button to the dialog; defaults to C{False} for backwards compatibility. @type hasApplyButton: bool @param settingsSizerOrientation: Either wx.VERTICAL or wx.HORIZONTAL. This controls the orientation of the sizer that is passed into L{makeSettings}. The default is wx.VERTICAL. @type settingsSizerOrientation: wx.Orientation @param multiInstanceAllowed: Whether multiple instances of SettingsDialog may exist. Note that still only one instance of a particular SettingsDialog subclass may exist at one time. @type multiInstanceAllowed: bool """ # if gui._isDebug(): # startTime = time.time() windowStyle = wx.DEFAULT_DIALOG_STYLE | (wx.RESIZE_BORDER if resizeable else 0) super(SettingsDialog, self).__init__(parent, title=self.title, style=windowStyle) self.hasApply = hasApplyButton # the wx.Window must be constructed before we can get the handle. import windowUtils self.scaleFactor = getWindowScalingFactor(self.GetHandle()) self.mainSizer = wx.BoxSizer(wx.VERTICAL) self.settingsSizer = wx.BoxSizer(settingsSizerOrientation) self.makeSettings(self.settingsSizer) self.mainSizer.Add(self.settingsSizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL | wx.EXPAND, proportion=1) self.mainSizer.Add(wx.StaticLine(self), flag=wx.EXPAND) buttonSizer = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: The Ok button on a NVDA dialog. This button will accept any changes and dismiss the dialog. buttonSizer.addButton(self, label=_("OK"), id=wx.ID_OK) # Translators: The cancel button on a NVDA dialog. This button will discard any changes and dismiss the dialog. buttonSizer.addButton(self, label=_("Cancel"), id=wx.ID_CANCEL) if hasApplyButton: # Translators: The Apply button on a NVDA dialog. This button will accept any changes but will not dismiss the dialog. buttonSizer.addButton(self, label=_("Apply"), id=wx.ID_APPLY) self.mainSizer.Add(buttonSizer.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL | wx.ALIGN_RIGHT) self.mainSizer.Fit(self) self.SetSizer(self.mainSizer) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) self.Bind(wx.EVT_BUTTON, self.onApply, id=wx.ID_APPLY) self.Bind(wx.EVT_CHAR_HOOK, self._enterActivatesOk_ctrlSActivatesApply) self.postInit() self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)