Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions addon/globalPlugins/clipContentsDesigner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,25 +434,25 @@ def script_showClipboardRawText(self, gesture: KeyboardInputGesture) -> None:

class AddonSettingsPanel(SettingsPanel):
title: str = ADDON_PANEL_TITLE
setSeparatorEdit: wx.TextCtrl
addTextBeforeCheckBox: wx.CheckBox
confirmList: gui.nvdaControls.CustomCheckListBox
confirmRequirementChoices: wx.Choice
formatChoices: wx.Choice
maxLengthEdit: gui.nvdaControls.SelectOnFocusSpinCtrl
runOnInstallCheckBox: wx.CheckBox
restoreDefaultsButton: wx.Button
setSeparatorEdit: wx.TextCtrl # type: ignore[reportUninitializedInstanceVariable]
addTextBeforeCheckBox: wx.CheckBox # type: ignore[reportUninitializedInstanceVariable]
confirmList: gui.nvdaControls.CustomCheckListBox # type: ignore[reportUninitializedInstanceVariable]
confirmRequirementChoices: wx.Choice # type: ignore[reportUninitializedInstanceVariable]
formatChoices: wx.Choice # type: ignore[reportUninitializedInstanceVariable]
maxLengthEdit: gui.nvdaControls.SelectOnFocusSpinCtrl # type: ignore[reportUninitializedInstanceVariable]
runOnInstallCheckBox: wx.CheckBox # type: ignore[reportUninitializedInstanceVariable]
restoreDefaultsButton: wx.Button # type: ignore[reportUninitializedInstanceVariable]

def makeSettings(self, sizer: object) -> None: # type: ignore[reportImplicitOverride]
sHelper = guiHelper.BoxSizerHelper(self, sizer=sizer)
setSeparatorLabel = _(
# Translators: label of a dialog.
"Type the string to be used as a &separator between contents added to the clipboard.",
)
self.setSeparatorEdit = sHelper.addLabeledControl(setSeparatorLabel, wx.TextCtrl) # type: ignore[reportUnknownMemberType]
self.setSeparatorEdit = sHelper.addLabeledControl(setSeparatorLabel, wx.TextCtrl)
self.setSeparatorEdit.SetValue(config.conf["clipContentsDesigner"]["separator"])
# Translators: label of a dialog.
self.addTextBeforeCheckBox = sHelper.addItem(wx.CheckBox(self, label=_("&Add text before clip data"))) # type: ignore[reportUnknownMemberType]
self.addTextBeforeCheckBox = sHelper.addItem(wx.CheckBox(self, label=_("&Add text before clip data")))
self.addTextBeforeCheckBox.SetValue(config.conf["clipContentsDesigner"]["addTextBefore"])
# Translators: label of a dialog.
confirmBoxLabel = _("Sele&ct the actions which require previous confirmation")
Expand All @@ -466,7 +466,7 @@ def makeSettings(self, sizer: object) -> None: # type: ignore[reportImplicitOve
# Translators: label of a dialog.
_("Confirm to emulate cut"),
]
self.confirmList = sHelper.addLabeledControl( # type: ignore[reportUnknownMemberType]
self.confirmList = sHelper.addLabeledControl(
confirmBoxLabel,
gui.nvdaControls.CustomCheckListBox,
choices=confirmChoices,
Expand All @@ -492,7 +492,7 @@ def makeSettings(self, sizer: object) -> None: # type: ignore[reportImplicitOve
# Translators: label of a dialog.
_("If the clipboard is not empty"),
]
self.confirmRequirementChoices = sHelper.addLabeledControl( # type: ignore[reportUnknownMemberType]
self.confirmRequirementChoices = sHelper.addLabeledControl(
confirmRequirementsLabel,
wx.Choice,
choices=requirementChoices,
Expand All @@ -502,24 +502,24 @@ def makeSettings(self, sizer: object) -> None: # type: ignore[reportImplicitOve
)
# Translators: label of a dialog.
formatLabel = _("&Format to show the clipboard text as HTML in browse mode:")
self.formatChoices = sHelper.addLabeledControl(formatLabel, wx.Choice, choices=BROWSEABLETEXT_FORMATS) # type: ignore[reportUnknownMemberType]
self.formatChoices = sHelper.addLabeledControl(formatLabel, wx.Choice, choices=BROWSEABLETEXT_FORMATS)
self.formatChoices.SetSelection(config.conf["clipContentsDesigner"]["browseableTextFormat"])
# Translators: label of a dialog.
maxLengthLabel = _("&Maximum number of characters when showing clipboard text in browse mode")
self.maxLengthEdit = sHelper.addLabeledControl( # type: ignore[reportUnknownMemberType]
self.maxLengthEdit = sHelper.addLabeledControl(
maxLengthLabel,
gui.nvdaControls.SelectOnFocusSpinCtrl,
min=1,
max=1000000,
initial=config.conf["clipContentsDesigner"]["maxLengthForBrowseableText"],
)
self.runOnInstallCheckBox = sHelper.addItem( # type: ignore[reportUnknownMemberType]
self.runOnInstallCheckBox = sHelper.addItem(
# Translators: label of a dialog.
wx.CheckBox(self, label=_("Show configuration dialog when &updating")),
)
self.runOnInstallCheckBox.SetValue(config.conf["clipContentsDesigner"]["runOnInstall"])
# Translators: label of a dialog.
self.restoreDefaultsButton = sHelper.addItem(wx.Button(self, label=_("Restore defaults"))) # type: ignore[reportUnknownMemberType]
self.restoreDefaultsButton = sHelper.addItem(wx.Button(self, label=_("Restore defaults")))
self.restoreDefaultsButton.Bind(wx.EVT_BUTTON, self.onRestoreDefaults)

def onRestoreDefaults(self, evt: object) -> None:
Expand Down
5 changes: 5 additions & 0 deletions stubs/__builtins__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Stub for builtin translation functions
def _(msg: str) -> str: ...
def pgettext(context: str, message: str) -> str: ...
def ngettext(msgid1: str, msgid2: str, n: int) -> str: ...
def npgettext(context: str, msgid1: str, msgid2: str, n: int) -> str: ...
8 changes: 8 additions & 0 deletions stubs/controlTypes.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Stub for controlTypes module
from enum import IntEnum

class Role(IntEnum):
MATH = ...

class State(IntEnum):
pass
7 changes: 7 additions & 0 deletions stubs/globalVars.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Stub for globalVars module
from typing import Any

class AppArgs:
secure: bool

appArgs: AppArgs
9 changes: 9 additions & 0 deletions stubs/gui/guiHelper.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Stub for gui.guiHelper module
from typing import Any, TypeVar

_T = TypeVar("_T")

class BoxSizerHelper:
def __init__(self, parent: Any, sizer: Any = None) -> None: ...
def addLabeledControl(self, labelText: str, wxCtrlClass: type[_T], **kwargs: Any) -> _T: ...
def addItem(self, item: _T, **kwargs: Any) -> _T: ...
10 changes: 10 additions & 0 deletions stubs/gui/settingsDialogs.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Stub for gui.settingsDialogs module
from typing import Any

class SettingsPanel:
def __init__(self, parent: Any) -> None: ...
def makeSettings(self, sizer: Any) -> None: ...
def onSave(self) -> None: ...

class NVDASettingsDialog:
categoryClasses: list[type[SettingsPanel]]
10 changes: 10 additions & 0 deletions stubs/logHandler.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Stub for logHandler module
from typing import Any

class Logger:
def debug(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
def info(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
def warning(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
def error(self, msg: str, *args: Any, **kwargs: Any) -> None: ...

log: Logger
6 changes: 6 additions & 0 deletions stubs/scriptHandler.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Stub for scriptHandler module
from typing import Any, Callable, TypeVar

F = TypeVar('F', bound=Callable[..., Any])

def script(**kwargs: Any) -> Callable[[F], F]: ...
5 changes: 5 additions & 0 deletions stubs/ui.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Stub for ui module
from typing import Any

def message(text: str) -> None: ...
def browseableMessage(message: str, title: str = "", isHtml: bool = False, closeButton: bool = False) -> None: ...