Skip to content

Commit

Permalink
Trying to move new class, and initialize without super.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Davis authored and Luke Davis committed Sep 30, 2024
1 parent eb9c334 commit b5bc1f7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
29 changes: 28 additions & 1 deletion addon/globalPlugins/speechLogger/configUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import wx
from wx.lib.expando import ExpandoTextCtrl
from typing import Any

import addonHandler
Expand All @@ -19,10 +20,11 @@
import globalVars
import gui
from gui.settingsDialogs import PANEL_DESCRIPTION_WIDTH
from gui.dpiScalingHelper import scaleSize
from gui import guiHelper
from logHandler import log

from . import extensionPoint
from .slPathSelectionHelper import SLPathSelectionHelper

try:
addonHandler.initTranslation()
Expand Down Expand Up @@ -291,3 +293,28 @@ def onSeparatorChoiceChange(self, evt):
else:
self.customSeparatorControl.Enable(False)


class SLPathSelectionHelper(guiHelper.PathSelectionHelper):
"""
Abstracts away details for creating a path selection helper. The path selection helper is a textCtrl with a
button in horizontal layout. The Button launches a directory explorer. To get the path selected by the user, use the
`pathControl` property which exposes a wx.TextCtrl.
"""

def __init__(self, parent: wx.Dialog, buttonText: str, browseForDirectoryTitle: str) -> None:
"""
:param parent: An instance of the parent wx window. EG wx.Dialog
:param buttonText: The text for the button to launch a directory dialog (wx.DirDialog). This is typically 'Browse'
:param browseForDirectoryTitle: The text for the title of the directory dialog (wx.DirDialog)
"""
object.__init__(self)
self._textCtrl = ExpandoTextCtrl(
parent,
size=(scaleSize(250), -1),
style=wx.TE_READONLY,
)
self._browseButton = wx.Button(parent, label=buttonText)
self._browseForDirectoryTitle = browseForDirectoryTitle
self._browseButton.Bind(wx.EVT_BUTTON, self.onBrowseForDirectory)
self._sizer = associateElements(self._textCtrl, self._browseButton)

29 changes: 0 additions & 29 deletions addon/globalPlugins/speechLogger/slPathSelectionHelper.py

This file was deleted.

2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _(arg):
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description": _("""Logs speech utterances to a file, after the user presses an initiating key. Can also log NVDA remote session speech from the NVDA Remote add-on, to the same or another file. Optionally includes speech from say-all."""),
# version
"addon_version": "24.2.507",
"addon_version": "24.2.508",
# Author(s)
"addon_author": "Luke Davis <XLTechie@newanswertech.com>, James Scholes",
# URL for the add-on documentation support
Expand Down

0 comments on commit b5bc1f7

Please sign in to comment.