massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / tkinter / filedialog.pyi
1 from _typeshed import StrOrBytesPath
2 from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, commondialog
3 from typing import IO, Any, ClassVar, Iterable, Tuple
4 from typing_extensions import Literal
5
6 dialogstates: dict[Any, tuple[Any, Any]]
7
8 class FileDialog:
9     title: str
10     master: Any
11     directory: Any | None
12     top: Toplevel
13     botframe: Frame
14     selection: Entry
15     filter: Entry
16     midframe: Entry
17     filesbar: Scrollbar
18     files: Listbox
19     dirsbar: Scrollbar
20     dirs: Listbox
21     ok_button: Button
22     filter_button: Button
23     cancel_button: Button
24     def __init__(
25         self, master, title: Any | None = ...
26     ) -> None: ...  # title is usually a str or None, but e.g. int doesn't raise en exception either
27     how: Any | None
28     def go(self, dir_or_file: Any = ..., pattern: str = ..., default: str = ..., key: Any | None = ...): ...
29     def quit(self, how: Any | None = ...) -> None: ...
30     def dirs_double_event(self, event) -> None: ...
31     def dirs_select_event(self, event) -> None: ...
32     def files_double_event(self, event) -> None: ...
33     def files_select_event(self, event) -> None: ...
34     def ok_event(self, event) -> None: ...
35     def ok_command(self) -> None: ...
36     def filter_command(self, event: Any | None = ...) -> None: ...
37     def get_filter(self): ...
38     def get_selection(self): ...
39     def cancel_command(self, event: Any | None = ...) -> None: ...
40     def set_filter(self, dir, pat) -> None: ...
41     def set_selection(self, file) -> None: ...
42
43 class LoadFileDialog(FileDialog):
44     title: str
45     def ok_command(self) -> None: ...
46
47 class SaveFileDialog(FileDialog):
48     title: str
49     def ok_command(self): ...
50
51 class _Dialog(commondialog.Dialog): ...
52
53 class Open(_Dialog):
54     command: ClassVar[str]
55
56 class SaveAs(_Dialog):
57     command: ClassVar[str]
58
59 class Directory(commondialog.Dialog):
60     command: ClassVar[str]
61
62 # TODO: command kwarg available on macos
63 def asksaveasfilename(
64     *,
65     confirmoverwrite: bool | None = ...,
66     defaultextension: str | None = ...,
67     filetypes: Iterable[tuple[str, str | list[str] | Tuple[str, ...]]] | None = ...,
68     initialdir: StrOrBytesPath | None = ...,
69     initialfile: StrOrBytesPath | None = ...,
70     parent: Misc | None = ...,
71     title: str | None = ...,
72     typevariable: StringVar | str | None = ...,
73 ) -> str: ...  # can be empty string
74 def askopenfilename(
75     *,
76     defaultextension: str | None = ...,
77     filetypes: Iterable[tuple[str, str | list[str] | Tuple[str, ...]]] | None = ...,
78     initialdir: StrOrBytesPath | None = ...,
79     initialfile: StrOrBytesPath | None = ...,
80     parent: Misc | None = ...,
81     title: str | None = ...,
82     typevariable: StringVar | str | None = ...,
83 ) -> str: ...  # can be empty string
84 def askopenfilenames(
85     *,
86     defaultextension: str | None = ...,
87     filetypes: Iterable[tuple[str, str | list[str] | Tuple[str, ...]]] | None = ...,
88     initialdir: StrOrBytesPath | None = ...,
89     initialfile: StrOrBytesPath | None = ...,
90     parent: Misc | None = ...,
91     title: str | None = ...,
92     typevariable: StringVar | str | None = ...,
93 ) -> Literal[""] | Tuple[str, ...]: ...
94 def askdirectory(
95     *, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = ..., parent: Misc | None = ..., title: str | None = ...
96 ) -> str: ...  # can be empty string
97
98 # TODO: If someone actually uses these, overload to have the actual return type of open(..., mode)
99 def asksaveasfile(
100     mode: str = ...,
101     *,
102     confirmoverwrite: bool | None = ...,
103     defaultextension: str | None = ...,
104     filetypes: Iterable[tuple[str, str | list[str] | Tuple[str, ...]]] | None = ...,
105     initialdir: StrOrBytesPath | None = ...,
106     initialfile: StrOrBytesPath | None = ...,
107     parent: Misc | None = ...,
108     title: str | None = ...,
109     typevariable: StringVar | str | None = ...,
110 ) -> IO[Any] | None: ...
111 def askopenfile(
112     mode: str = ...,
113     *,
114     defaultextension: str | None = ...,
115     filetypes: Iterable[tuple[str, str | list[str] | Tuple[str, ...]]] | None = ...,
116     initialdir: StrOrBytesPath | None = ...,
117     initialfile: StrOrBytesPath | None = ...,
118     parent: Misc | None = ...,
119     title: str | None = ...,
120     typevariable: StringVar | str | None = ...,
121 ) -> IO[Any] | None: ...
122 def askopenfiles(
123     mode: str = ...,
124     *,
125     defaultextension: str | None = ...,
126     filetypes: Iterable[tuple[str, str | list[str] | Tuple[str, ...]]] | None = ...,
127     initialdir: StrOrBytesPath | None = ...,
128     initialfile: StrOrBytesPath | None = ...,
129     parent: Misc | None = ...,
130     title: str | None = ...,
131     typevariable: StringVar | str | None = ...,
132 ) -> Tuple[IO[Any], ...]: ...  # can be empty tuple
133 def test() -> None: ...