def makeSettings(self, sizer: wx.Sizer) -> None: """Populate the dialog with WX controls. @param sizer: The sizer to which to add the WX controls. @type sizer: wx.Sizer """ sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=sizer) self.gesturesList = sHelper.addLabeledControl( # Translators: Label above the list of found gestures _("Select a gesture from the list"), AutoWidthColumnListCtrl, autoSizeColumn=1, # The replacement column is likely to need the most space itemTextCallable=None, style=wx.LC_REPORT | wx.LC_SINGLE_SEL ) # Translators: The label for a first column in the list of gestures self.gesturesList.InsertColumn(0, _("Gesture"), width=150) # Translators: The label for the second column in the list of gestures self.gesturesList.InsertColumn(1, _("Script description or function name")) # Translators: The label for the third column in the list of gestures self.gesturesList.InsertColumn(2, _("Category"), width=150) sizer.Fit(self) self.Center(wx.BOTH | wx.Center) # Fill in the list of available input gestures gestureDisplayText = lambda gest: "{1} ({0})".format(*getDisplayTextForGestureIdentifier(gest)) # noqa E731 do not assign a lambda expression, use a def for gesture in sorted(self.gestures, key=lambda x: x.gesture): self.gesturesList.Append(( gestureDisplayText(gesture.gesture), gesture.displayName or gesture.scriptName, gesture.category or f"[{gesture.moduleName}]" )) self.gesturesList.SetFocus() self.gesturesList.Focus(0) self.gesturesList.Select(0)
def makeSettings(self, sizer: wx.Sizer) -> None: """Populate the panel with settings controls. @param sizer: The sizer to which to add the settings controls. @type sizer: wx.Sizer """ self.sizer = sizer addonHelper = guiHelper.BoxSizerHelper(self, sizer=sizer) addonHelper.addItem( wx.StaticText( self, # Translators: Help message for a dialog. label= _("Select the initial sound system settings that will be set when NVDA starts:" ), style=wx.ALIGN_LEFT)) self._customVolumeSlider = addonHelper.addLabeledControl( # Translators: A setting in addon settings dialog. _("Set &custom volume level:"), nvdaControls.EnhancedInputSlider, value=config.conf[ADDON_NAME]['volume'], minValue=0, maxValue=100, size=(250, -1)) self._minVolumeSlider = addonHelper.addLabeledControl( # Translators: A setting in addon settings dialog. _("Increase the volume if it is &lower than:"), nvdaControls.EnhancedInputSlider, value=config.conf[ADDON_NAME]['minlevel'], minValue=0, maxValue=100, size=(250, -1)) self._driverChk = addonHelper.addItem( # Translators: A setting in addon settings dialog. wx.CheckBox( self, label= _("&Repeat attempts to initialize the voice synthesizer driver" ))) self._driverChk.SetValue(config.conf[ADDON_NAME]['reinit']) self._retriesCountSpin = addonHelper.addLabeledControl( # Translators: A setting in addon settings dialog. _("&Number of retries (0 - infinitely):"), nvdaControls.SelectOnFocusSpinCtrl, value=str(config.conf[ADDON_NAME]['retries']), min=0, max=10000000) self._retriesCountSpin.Show(self._driverChk.GetValue()) self._driverChk.Bind(wx.EVT_CHECKBOX, self.onDriverChk) self._switchDeviceChk = addonHelper.addItem( # Translators: A setting in addon settings dialog. wx.CheckBox(self, label=_("Switch to the default audio output &device"))) self._switchDeviceChk.SetValue(config.conf[ADDON_NAME]['switchdevice']) self._playSoundChk = addonHelper.addItem( # Translators: A setting in addon settings dialog. wx.CheckBox( self, label=_( "Play &sound when audio has been successfully turned on"))) self._playSoundChk.SetValue(config.conf[ADDON_NAME]['playsound']) sizer.Fit(self)