diff --git a/addon/globalPlugins/clipContentsDesigner/__init__.py b/addon/globalPlugins/clipContentsDesigner/__init__.py index 19a2f44..6729fa1 100644 --- a/addon/globalPlugins/clipContentsDesigner/__init__.py +++ b/addon/globalPlugins/clipContentsDesigner/__init__.py @@ -434,14 +434,14 @@ 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) @@ -449,10 +449,10 @@ def makeSettings(self, sizer: object) -> None: # type: ignore[reportImplicitOve # 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") @@ -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, @@ -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, @@ -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: diff --git a/stubs/__builtins__.pyi b/stubs/__builtins__.pyi new file mode 100644 index 0000000..d0ab127 --- /dev/null +++ b/stubs/__builtins__.pyi @@ -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: ... diff --git a/stubs/controlTypes.pyi b/stubs/controlTypes.pyi new file mode 100644 index 0000000..bf36960 --- /dev/null +++ b/stubs/controlTypes.pyi @@ -0,0 +1,8 @@ +# Stub for controlTypes module +from enum import IntEnum + +class Role(IntEnum): + MATH = ... + +class State(IntEnum): + pass diff --git a/stubs/globalVars.pyi b/stubs/globalVars.pyi new file mode 100644 index 0000000..1dd882f --- /dev/null +++ b/stubs/globalVars.pyi @@ -0,0 +1,7 @@ +# Stub for globalVars module +from typing import Any + +class AppArgs: + secure: bool + +appArgs: AppArgs diff --git a/stubs/gui/guiHelper.pyi b/stubs/gui/guiHelper.pyi new file mode 100644 index 0000000..4ccbd4f --- /dev/null +++ b/stubs/gui/guiHelper.pyi @@ -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: ... diff --git a/stubs/gui/settingsDialogs.pyi b/stubs/gui/settingsDialogs.pyi new file mode 100644 index 0000000..9f0f6ba --- /dev/null +++ b/stubs/gui/settingsDialogs.pyi @@ -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]] diff --git a/stubs/logHandler.pyi b/stubs/logHandler.pyi new file mode 100644 index 0000000..6598105 --- /dev/null +++ b/stubs/logHandler.pyi @@ -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 diff --git a/stubs/scriptHandler.pyi b/stubs/scriptHandler.pyi new file mode 100644 index 0000000..61aea0f --- /dev/null +++ b/stubs/scriptHandler.pyi @@ -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]: ... diff --git a/stubs/ui.pyi b/stubs/ui.pyi new file mode 100644 index 0000000..c5020de --- /dev/null +++ b/stubs/ui.pyi @@ -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: ...