pygpt-net 2.4.37__py3-none-any.whl → 2.4.42__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- CHANGELOG.md +37 -0
- README.md +176 -182
- pygpt_net/CHANGELOG.txt +37 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +3 -1
- pygpt_net/controller/__init__.py +7 -3
- pygpt_net/controller/access/control.py +1 -1
- pygpt_net/controller/access/voice.py +11 -5
- pygpt_net/controller/agent/experts.py +11 -6
- pygpt_net/controller/agent/legacy.py +8 -6
- pygpt_net/controller/agent/llama.py +4 -2
- pygpt_net/controller/assistant/__init__.py +9 -4
- pygpt_net/controller/assistant/batch.py +38 -21
- pygpt_net/controller/assistant/editor.py +7 -6
- pygpt_net/controller/assistant/files.py +23 -7
- pygpt_net/controller/assistant/store.py +20 -7
- pygpt_net/controller/assistant/threads.py +34 -8
- pygpt_net/controller/attachment.py +29 -10
- pygpt_net/controller/audio/__init__.py +26 -5
- pygpt_net/controller/calendar/__init__.py +23 -4
- pygpt_net/controller/calendar/note.py +57 -11
- pygpt_net/controller/camera.py +4 -12
- pygpt_net/controller/chat/__init__.py +5 -3
- pygpt_net/controller/chat/attachment.py +34 -7
- pygpt_net/controller/chat/audio.py +2 -2
- pygpt_net/controller/chat/command.py +4 -2
- pygpt_net/controller/chat/common.py +11 -4
- pygpt_net/controller/chat/files.py +10 -3
- pygpt_net/controller/chat/image.py +17 -5
- pygpt_net/controller/chat/input.py +10 -7
- pygpt_net/controller/chat/output.py +21 -6
- pygpt_net/controller/chat/render.py +100 -21
- pygpt_net/controller/chat/response.py +34 -7
- pygpt_net/controller/chat/stream.py +4 -2
- pygpt_net/controller/chat/text.py +6 -4
- pygpt_net/controller/command.py +11 -3
- pygpt_net/controller/config/__init__.py +34 -6
- pygpt_net/controller/config/field/checkbox.py +7 -4
- pygpt_net/controller/config/field/cmd.py +7 -5
- pygpt_net/controller/config/field/combo.py +14 -6
- pygpt_net/controller/config/field/dictionary.py +14 -11
- pygpt_net/controller/config/field/input.py +9 -6
- pygpt_net/controller/config/field/slider.py +11 -8
- pygpt_net/controller/config/field/textarea.py +8 -5
- pygpt_net/controller/config/placeholder.py +66 -21
- pygpt_net/controller/ctx/__init__.py +138 -49
- pygpt_net/controller/ctx/common.py +15 -4
- pygpt_net/controller/ctx/extra.py +11 -3
- pygpt_net/controller/ctx/summarizer.py +24 -5
- pygpt_net/controller/debug/__init__.py +27 -6
- pygpt_net/controller/dialogs/confirm.py +34 -7
- pygpt_net/controller/dialogs/debug.py +4 -2
- pygpt_net/controller/dialogs/info.py +7 -2
- pygpt_net/controller/files.py +48 -10
- pygpt_net/controller/finder.py +11 -5
- pygpt_net/controller/idx/__init__.py +10 -3
- pygpt_net/controller/idx/common.py +4 -2
- pygpt_net/controller/idx/indexer.py +25 -17
- pygpt_net/controller/idx/settings.py +9 -3
- pygpt_net/controller/kernel/__init__.py +34 -8
- pygpt_net/controller/kernel/reply.py +12 -3
- pygpt_net/controller/kernel/stack.py +5 -3
- pygpt_net/controller/lang/custom.py +2 -7
- pygpt_net/controller/lang/mapping.py +5 -3
- pygpt_net/controller/layout.py +2 -2
- pygpt_net/controller/mode.py +16 -4
- pygpt_net/controller/model/__init__.py +14 -3
- pygpt_net/controller/model/editor.py +8 -3
- pygpt_net/controller/notepad.py +26 -12
- pygpt_net/controller/painter/capture.py +23 -4
- pygpt_net/controller/painter/common.py +9 -7
- pygpt_net/controller/plugins/__init__.py +19 -5
- pygpt_net/controller/plugins/presets.py +15 -6
- pygpt_net/controller/plugins/settings.py +9 -3
- pygpt_net/controller/presets/__init__.py +55 -16
- pygpt_net/controller/presets/editor.py +26 -10
- pygpt_net/controller/settings/__init__.py +3 -2
- pygpt_net/controller/settings/editor.py +29 -7
- pygpt_net/controller/settings/profile.py +22 -5
- pygpt_net/controller/theme/__init__.py +54 -12
- pygpt_net/controller/theme/common.py +24 -2
- pygpt_net/controller/theme/markdown.py +32 -16
- pygpt_net/controller/theme/menu.py +26 -5
- pygpt_net/controller/theme/nodes.py +2 -5
- pygpt_net/controller/tools/__init__.py +40 -2
- pygpt_net/controller/ui/__init__.py +4 -6
- pygpt_net/controller/ui/mode.py +16 -21
- pygpt_net/controller/ui/tabs.py +363 -65
- pygpt_net/core/access/actions.py +6 -4
- pygpt_net/core/access/shortcuts.py +4 -3
- pygpt_net/core/access/voice.py +6 -5
- pygpt_net/core/agents/legacy.py +4 -2
- pygpt_net/core/agents/memory.py +7 -2
- pygpt_net/core/agents/observer/evaluation.py +15 -7
- pygpt_net/core/agents/provider.py +9 -4
- pygpt_net/core/agents/runner.py +61 -15
- pygpt_net/core/agents/tools.py +23 -5
- pygpt_net/core/assistants/__init__.py +6 -4
- pygpt_net/core/assistants/files.py +35 -12
- pygpt_net/core/assistants/store.py +20 -10
- pygpt_net/core/attachments/__init__.py +54 -15
- pygpt_net/core/attachments/context.py +92 -29
- pygpt_net/core/audio/__init__.py +74 -3
- pygpt_net/core/audio/context.py +7 -2
- pygpt_net/core/audio/whisper.py +37 -0
- pygpt_net/core/bridge/__init__.py +22 -6
- pygpt_net/core/bridge/context.py +5 -3
- pygpt_net/core/bridge/worker.py +2 -2
- pygpt_net/core/calendar/__init__.py +57 -11
- pygpt_net/core/chain/__init__.py +8 -2
- pygpt_net/core/chain/chat.py +10 -8
- pygpt_net/core/chain/completion.py +10 -7
- pygpt_net/core/command.py +62 -17
- pygpt_net/core/ctx/__init__.py +260 -58
- pygpt_net/core/ctx/bag.py +25 -4
- pygpt_net/core/ctx/container.py +28 -17
- pygpt_net/core/ctx/idx.py +45 -8
- pygpt_net/core/ctx/output.py +95 -74
- pygpt_net/core/ctx/reply.py +5 -2
- pygpt_net/core/db/__init__.py +8 -7
- pygpt_net/core/db/viewer.py +17 -11
- pygpt_net/core/debug/__init__.py +10 -9
- pygpt_net/core/debug/events.py +22 -10
- pygpt_net/core/debug/tabs.py +9 -3
- pygpt_net/core/docker/__init__.py +11 -5
- pygpt_net/core/docker/builder.py +11 -3
- pygpt_net/core/events/app.py +5 -3
- pygpt_net/core/events/base.py +11 -5
- pygpt_net/core/events/control.py +5 -3
- pygpt_net/core/events/event.py +17 -7
- pygpt_net/core/events/kernel.py +5 -3
- pygpt_net/core/events/render.py +5 -3
- pygpt_net/core/experts/__init__.py +5 -4
- pygpt_net/core/filesystem/__init__.py +52 -34
- pygpt_net/core/filesystem/actions.py +8 -5
- pygpt_net/core/filesystem/editor.py +13 -3
- pygpt_net/core/filesystem/types.py +12 -7
- pygpt_net/core/filesystem/url.py +7 -3
- pygpt_net/core/history.py +3 -2
- pygpt_net/core/idx/__init__.py +48 -27
- pygpt_net/core/idx/chat.py +51 -17
- pygpt_net/core/idx/context.py +6 -2
- pygpt_net/core/idx/indexing.py +107 -42
- pygpt_net/core/idx/llm.py +11 -3
- pygpt_net/core/idx/metadata.py +13 -3
- pygpt_net/core/idx/types/ctx.py +32 -6
- pygpt_net/core/idx/types/external.py +41 -7
- pygpt_net/core/idx/types/files.py +31 -6
- pygpt_net/core/image.py +15 -4
- pygpt_net/core/installer.py +2 -4
- pygpt_net/core/llm/__init__.py +13 -3
- pygpt_net/core/locale.py +34 -8
- pygpt_net/core/models.py +63 -17
- pygpt_net/core/modes.py +11 -13
- pygpt_net/core/notepad.py +10 -5
- pygpt_net/core/plugins.py +31 -19
- pygpt_net/core/presets.py +37 -17
- pygpt_net/core/profile.py +21 -7
- pygpt_net/core/prompt/__init__.py +10 -3
- pygpt_net/core/prompt/custom.py +7 -6
- pygpt_net/core/prompt/template.py +9 -3
- pygpt_net/core/render/base.py +117 -22
- pygpt_net/core/render/markdown/body.py +27 -7
- pygpt_net/core/render/markdown/renderer.py +119 -22
- pygpt_net/core/render/plain/body.py +22 -5
- pygpt_net/core/render/plain/renderer.py +97 -21
- pygpt_net/core/render/web/body.py +75 -25
- pygpt_net/core/render/web/parser.py +3 -1
- pygpt_net/core/render/web/renderer.py +313 -63
- pygpt_net/core/settings.py +10 -5
- pygpt_net/core/tabs/__init__.py +290 -103
- pygpt_net/core/tabs/tab.py +26 -5
- pygpt_net/core/tokens.py +47 -12
- pygpt_net/core/updater/__init__.py +20 -7
- pygpt_net/core/vision/analyzer.py +29 -6
- pygpt_net/core/{web.py → web/__init__.py} +29 -7
- pygpt_net/core/web/helpers.py +237 -0
- pygpt_net/data/config/config.json +15 -4
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/modes.json +3 -3
- pygpt_net/data/config/settings.json +55 -10
- pygpt_net/data/config/settings_section.json +3 -0
- pygpt_net/data/css/style.light.css +1 -0
- pygpt_net/data/css/{web.css → web-blocks.css} +162 -133
- pygpt_net/data/css/{web.light.css → web-blocks.light.css} +7 -0
- pygpt_net/data/css/web-chatgpt.css +350 -0
- pygpt_net/data/css/web-chatgpt.dark.css +64 -0
- pygpt_net/data/css/web-chatgpt.light.css +75 -0
- pygpt_net/data/css/web-chatgpt_wide.css +350 -0
- pygpt_net/data/css/web-chatgpt_wide.dark.css +64 -0
- pygpt_net/data/css/web-chatgpt_wide.light.css +75 -0
- pygpt_net/data/icons/split_screen.svg +1 -0
- pygpt_net/data/locale/locale.de.ini +12 -0
- pygpt_net/data/locale/locale.en.ini +18 -2
- pygpt_net/data/locale/locale.es.ini +12 -0
- pygpt_net/data/locale/locale.fr.ini +12 -0
- pygpt_net/data/locale/locale.it.ini +12 -0
- pygpt_net/data/locale/locale.pl.ini +12 -0
- pygpt_net/data/locale/locale.uk.ini +12 -0
- pygpt_net/data/locale/locale.zh.ini +12 -0
- pygpt_net/data/locale/plugin.cmd_web.de.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.en.ini +22 -10
- pygpt_net/data/locale/plugin.cmd_web.es.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.fr.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.it.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.pl.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.uk.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.zh.ini +2 -0
- pygpt_net/data/locale/plugin.mailer.en.ini +21 -0
- pygpt_net/icons.qrc +1 -0
- pygpt_net/icons_rc.py +165 -136
- pygpt_net/item/ctx.py +58 -25
- pygpt_net/plugin/agent/__init__.py +7 -2
- pygpt_net/plugin/audio_input/simple.py +21 -5
- pygpt_net/plugin/audio_output/__init__.py +9 -1
- pygpt_net/plugin/base/config.py +4 -2
- pygpt_net/plugin/base/plugin.py +75 -23
- pygpt_net/plugin/base/worker.py +42 -11
- pygpt_net/plugin/cmd_code_interpreter/__init__.py +39 -37
- pygpt_net/plugin/cmd_code_interpreter/runner.py +25 -12
- pygpt_net/plugin/cmd_history/config.py +2 -2
- pygpt_net/plugin/cmd_web/__init__.py +48 -9
- pygpt_net/plugin/cmd_web/config.py +135 -41
- pygpt_net/plugin/cmd_web/websearch.py +74 -33
- pygpt_net/plugin/cmd_web/worker.py +142 -13
- pygpt_net/plugin/idx_llama_index/config.py +3 -3
- pygpt_net/plugin/mailer/__init__.py +123 -0
- pygpt_net/plugin/mailer/config.py +149 -0
- pygpt_net/plugin/mailer/runner.py +285 -0
- pygpt_net/plugin/mailer/worker.py +123 -0
- pygpt_net/provider/agents/base.py +5 -2
- pygpt_net/provider/agents/openai.py +4 -2
- pygpt_net/provider/agents/openai_assistant.py +4 -2
- pygpt_net/provider/agents/planner.py +4 -2
- pygpt_net/provider/agents/react.py +4 -2
- pygpt_net/provider/audio_output/openai_tts.py +5 -11
- pygpt_net/provider/core/assistant/base.py +5 -3
- pygpt_net/provider/core/assistant/json_file.py +8 -5
- pygpt_net/provider/core/assistant_file/base.py +4 -3
- pygpt_net/provider/core/assistant_file/db_sqlite/__init__.py +4 -3
- pygpt_net/provider/core/assistant_file/db_sqlite/storage.py +3 -2
- pygpt_net/provider/core/assistant_store/base.py +6 -4
- pygpt_net/provider/core/assistant_store/db_sqlite/__init__.py +5 -4
- pygpt_net/provider/core/assistant_store/db_sqlite/storage.py +5 -3
- pygpt_net/provider/core/attachment/base.py +5 -3
- pygpt_net/provider/core/attachment/json_file.py +4 -3
- pygpt_net/provider/core/calendar/base.py +5 -3
- pygpt_net/provider/core/calendar/db_sqlite/__init__.py +6 -5
- pygpt_net/provider/core/calendar/db_sqlite/storage.py +5 -4
- pygpt_net/provider/core/config/base.py +8 -6
- pygpt_net/provider/core/config/json_file.py +9 -7
- pygpt_net/provider/core/config/patch.py +43 -1
- pygpt_net/provider/core/ctx/base.py +30 -25
- pygpt_net/provider/core/ctx/db_sqlite/__init__.py +59 -34
- pygpt_net/provider/core/ctx/db_sqlite/storage.py +62 -30
- pygpt_net/provider/core/ctx/db_sqlite/utils.py +11 -9
- pygpt_net/provider/core/index/base.py +129 -23
- pygpt_net/provider/core/index/db_sqlite/__init__.py +130 -23
- pygpt_net/provider/core/index/db_sqlite/storage.py +130 -23
- pygpt_net/provider/core/index/db_sqlite/utils.py +4 -2
- pygpt_net/provider/core/mode/base.py +5 -3
- pygpt_net/provider/core/mode/json_file.py +7 -6
- pygpt_net/provider/core/model/base.py +6 -4
- pygpt_net/provider/core/model/json_file.py +9 -7
- pygpt_net/provider/core/notepad/base.py +5 -3
- pygpt_net/provider/core/notepad/db_sqlite/__init__.py +5 -4
- pygpt_net/provider/core/notepad/db_sqlite/storage.py +4 -3
- pygpt_net/provider/core/plugin_preset/base.py +4 -2
- pygpt_net/provider/core/plugin_preset/json_file.py +5 -3
- pygpt_net/provider/core/preset/base.py +6 -4
- pygpt_net/provider/core/preset/json_file.py +9 -9
- pygpt_net/provider/core/prompt/base.py +6 -3
- pygpt_net/provider/core/prompt/json_file.py +11 -6
- pygpt_net/provider/gpt/assistants.py +21 -11
- pygpt_net/provider/gpt/audio.py +6 -5
- pygpt_net/provider/gpt/chat.py +10 -7
- pygpt_net/provider/gpt/completion.py +11 -5
- pygpt_net/provider/gpt/image.py +9 -2
- pygpt_net/provider/gpt/store.py +53 -18
- pygpt_net/provider/gpt/vision.py +17 -11
- pygpt_net/provider/llms/anthropic.py +7 -2
- pygpt_net/provider/llms/azure_openai.py +26 -5
- pygpt_net/provider/llms/base.py +47 -9
- pygpt_net/provider/llms/google.py +7 -2
- pygpt_net/provider/llms/hugging_face.py +13 -3
- pygpt_net/provider/llms/hugging_face_api.py +18 -4
- pygpt_net/provider/llms/local.py +7 -2
- pygpt_net/provider/llms/ollama.py +30 -6
- pygpt_net/provider/llms/openai.py +32 -6
- pygpt_net/provider/vector_stores/__init__.py +45 -14
- pygpt_net/provider/vector_stores/base.py +35 -8
- pygpt_net/provider/vector_stores/chroma.py +13 -3
- pygpt_net/provider/vector_stores/ctx_attachment.py +31 -12
- pygpt_net/provider/vector_stores/elasticsearch.py +12 -3
- pygpt_net/provider/vector_stores/pinecode.py +12 -3
- pygpt_net/provider/vector_stores/redis.py +12 -3
- pygpt_net/provider/vector_stores/simple.py +12 -3
- pygpt_net/provider/vector_stores/temp.py +16 -4
- pygpt_net/provider/web/base.py +10 -3
- pygpt_net/provider/web/google_custom_search.py +9 -3
- pygpt_net/provider/web/microsoft_bing.py +9 -3
- pygpt_net/tools/__init__.py +20 -4
- pygpt_net/tools/audio_transcriber/__init__.py +4 -3
- pygpt_net/tools/base.py +28 -7
- pygpt_net/tools/code_interpreter/__init__.py +177 -77
- pygpt_net/tools/code_interpreter/ui/dialogs.py +21 -103
- pygpt_net/tools/code_interpreter/ui/widgets.py +284 -9
- pygpt_net/tools/html_canvas/__init__.py +81 -25
- pygpt_net/tools/html_canvas/ui/dialogs.py +46 -62
- pygpt_net/tools/html_canvas/ui/widgets.py +96 -3
- pygpt_net/tools/image_viewer/__init__.py +10 -4
- pygpt_net/tools/indexer/__init__.py +8 -7
- pygpt_net/tools/media_player/__init__.py +4 -3
- pygpt_net/tools/text_editor/__init__.py +36 -10
- pygpt_net/ui/base/context_menu.py +2 -2
- pygpt_net/ui/layout/chat/input.py +10 -18
- pygpt_net/ui/layout/chat/output.py +27 -45
- pygpt_net/ui/layout/ctx/ctx_list.py +13 -4
- pygpt_net/ui/layout/toolbox/footer.py +18 -2
- pygpt_net/ui/main.py +2 -2
- pygpt_net/ui/menu/audio.py +12 -1
- pygpt_net/ui/menu/config.py +7 -11
- pygpt_net/ui/menu/debug.py +11 -1
- pygpt_net/ui/menu/theme.py +9 -2
- pygpt_net/ui/widget/filesystem/explorer.py +2 -2
- pygpt_net/ui/widget/lists/context.py +27 -5
- pygpt_net/ui/widget/tabs/Input.py +2 -2
- pygpt_net/ui/widget/tabs/body.py +2 -1
- pygpt_net/ui/widget/tabs/layout.py +195 -0
- pygpt_net/ui/widget/tabs/output.py +218 -55
- pygpt_net/ui/widget/textarea/html.py +11 -1
- pygpt_net/ui/widget/textarea/output.py +10 -1
- pygpt_net/ui/widget/textarea/search_input.py +4 -1
- pygpt_net/ui/widget/textarea/web.py +49 -9
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/METADATA +177 -183
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/RECORD +340 -325
- /pygpt_net/data/css/{web.dark.css → web-blocks.dark.css} +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/entry_points.txt +0 -0
@@ -6,12 +6,13 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
13
|
+
from typing import Dict, Any
|
13
14
|
|
14
|
-
from PySide6.QtWidgets import QHBoxLayout, QLabel, QMenu
|
15
|
+
from PySide6.QtWidgets import QHBoxLayout, QLabel, QMenu, QLayout
|
15
16
|
|
16
17
|
from pygpt_net.ui.widget.element.button import ContextMenuButton
|
17
18
|
from pygpt_net.ui.widget.element.labels import HelpLabel, TitleLabel
|
@@ -35,7 +36,12 @@ class Settings:
|
|
35
36
|
"""
|
36
37
|
return ["update"]
|
37
38
|
|
38
|
-
def append(
|
39
|
+
def append(
|
40
|
+
self,
|
41
|
+
content: Dict[str, QLayout],
|
42
|
+
widgets: Dict[str, Any],
|
43
|
+
options: Dict[str, Any],
|
44
|
+
):
|
39
45
|
"""
|
40
46
|
Append extra settings to settings dialog (section: llama-index)
|
41
47
|
|
@@ -6,10 +6,12 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import time
|
13
|
+
from typing import Any, Dict, Optional, Union, List
|
14
|
+
|
13
15
|
from PySide6.QtCore import QObject, Slot
|
14
16
|
|
15
17
|
from pygpt_net.core.types import (
|
@@ -117,14 +119,18 @@ class Kernel(QObject):
|
|
117
119
|
|
118
120
|
event.data["response"] = response # update response
|
119
121
|
|
120
|
-
def input(
|
122
|
+
def input(
|
123
|
+
self,
|
124
|
+
context: BridgeContext,
|
125
|
+
extra: Dict[str, Any],
|
126
|
+
event: KernelEvent
|
127
|
+
):
|
121
128
|
"""
|
122
129
|
Input message to kernel
|
123
130
|
|
124
131
|
:param context: bridge context
|
125
132
|
:param extra: extra data
|
126
133
|
:param event: kernel event
|
127
|
-
:return: response
|
128
134
|
"""
|
129
135
|
if self.stopped() and event.name != KernelEvent.INPUT_USER:
|
130
136
|
return
|
@@ -135,7 +141,12 @@ class Kernel(QObject):
|
|
135
141
|
]:
|
136
142
|
return self.window.controller.chat.input.send(context, extra)
|
137
143
|
|
138
|
-
def queue(
|
144
|
+
def queue(
|
145
|
+
self,
|
146
|
+
context: BridgeContext,
|
147
|
+
extra: Dict[str, Any],
|
148
|
+
event: KernelEvent
|
149
|
+
) -> Optional[Union[bool, str, List[Dict]]]:
|
139
150
|
"""
|
140
151
|
Queue messages to kernel
|
141
152
|
|
@@ -170,7 +181,12 @@ class Kernel(QObject):
|
|
170
181
|
elif event.name == KernelEvent.CALL:
|
171
182
|
return self.call(context, extra, event)
|
172
183
|
|
173
|
-
def call(
|
184
|
+
def call(
|
185
|
+
self,
|
186
|
+
context: BridgeContext,
|
187
|
+
extra: Dict[str, Any],
|
188
|
+
event: KernelEvent
|
189
|
+
) -> Optional[Union[bool, str]]:
|
174
190
|
"""
|
175
191
|
Execute message
|
176
192
|
|
@@ -189,7 +205,12 @@ class Kernel(QObject):
|
|
189
205
|
elif event.name == KernelEvent.CALL:
|
190
206
|
return self.window.core.bridge.call(context, extra)
|
191
207
|
|
192
|
-
def reply(
|
208
|
+
def reply(
|
209
|
+
self,
|
210
|
+
context: BridgeContext,
|
211
|
+
extra: Dict[str, Any],
|
212
|
+
event: KernelEvent
|
213
|
+
) -> Optional[List[Dict]]:
|
193
214
|
"""
|
194
215
|
Queue reply message
|
195
216
|
|
@@ -206,14 +227,18 @@ class Kernel(QObject):
|
|
206
227
|
elif event.name == KernelEvent.REPLY_RETURN:
|
207
228
|
return self.input(context, extra, KernelEvent(KernelEvent.INPUT_SYSTEM))
|
208
229
|
|
209
|
-
def output(
|
230
|
+
def output(
|
231
|
+
self,
|
232
|
+
context: BridgeContext,
|
233
|
+
extra: Dict[str, Any],
|
234
|
+
event: KernelEvent
|
235
|
+
):
|
210
236
|
"""
|
211
237
|
Handle output from kernel
|
212
238
|
|
213
239
|
:param context: bridge context
|
214
240
|
:param extra: extra data
|
215
241
|
:param event: kernel event
|
216
|
-
:return: response
|
217
242
|
"""
|
218
243
|
if self.stopped():
|
219
244
|
return
|
@@ -251,6 +276,7 @@ class Kernel(QObject):
|
|
251
276
|
"""
|
252
277
|
self.halt = True
|
253
278
|
self.window.controller.chat.common.stop(exit=exit) # it stops legacy agent also
|
279
|
+
self.window.controller.audio.stop_audio()
|
254
280
|
if not exit:
|
255
281
|
self.window.dispatch(KernelEvent(KernelEvent.STOP))
|
256
282
|
self.set_state(KernelEvent(KernelEvent.STATE_IDLE, {"msg": trans("status.stopped")}))
|
@@ -6,10 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import json
|
13
|
+
from typing import Optional, Dict, Any, List
|
13
14
|
|
14
15
|
from pygpt_net.core.events import KernelEvent, RenderEvent
|
15
16
|
from pygpt_net.core.bridge import BridgeContext
|
@@ -28,7 +29,11 @@ class Reply:
|
|
28
29
|
self.last_result = None
|
29
30
|
self.reply_idx = -1
|
30
31
|
|
31
|
-
def add(
|
32
|
+
def add(
|
33
|
+
self,
|
34
|
+
context: BridgeContext,
|
35
|
+
extra: Dict[str, Any] = None
|
36
|
+
) -> List[Dict]:
|
32
37
|
"""
|
33
38
|
Send reply from plugins to model
|
34
39
|
|
@@ -129,7 +134,11 @@ class Reply:
|
|
129
134
|
})
|
130
135
|
self.window.dispatch(event)
|
131
136
|
|
132
|
-
def run_post_response(
|
137
|
+
def run_post_response(
|
138
|
+
self,
|
139
|
+
ctx: CtxItem,
|
140
|
+
extra_data: Optional[Dict[str, Any]] = None
|
141
|
+
):
|
133
142
|
"""
|
134
143
|
Run post-response operations
|
135
144
|
|
@@ -6,9 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Any
|
13
|
+
|
12
14
|
from PySide6.QtWidgets import QApplication
|
13
15
|
|
14
16
|
from pygpt_net.core.events import KernelEvent
|
@@ -118,7 +120,7 @@ class Stack:
|
|
118
120
|
self.execute(self.current)
|
119
121
|
self.processed = True
|
120
122
|
|
121
|
-
def waiting(self):
|
123
|
+
def waiting(self) -> bool:
|
122
124
|
"""
|
123
125
|
Check if reply stack is waiting
|
124
126
|
|
@@ -126,7 +128,7 @@ class Stack:
|
|
126
128
|
"""
|
127
129
|
return self.has() and not self.is_locked()
|
128
130
|
|
129
|
-
def log(self, data:
|
131
|
+
def log(self, data: Any):
|
130
132
|
"""
|
131
133
|
Log data to debug
|
132
134
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.09 00:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtCore import Qt
|
@@ -37,12 +37,7 @@ class Custom:
|
|
37
37
|
|
38
38
|
def apply(self):
|
39
39
|
"""Apply custom mappings"""
|
40
|
-
|
41
|
-
# self.window.ui.tabs['output'].setTabText(0, trans('output.tab.chat'))
|
42
|
-
# self.window.ui.tabs['output'].setTabText(1, trans('output.tab.files'))
|
43
|
-
# self.window.ui.tabs['output'].setTabText(2, trans('output.tab.calendar'))
|
44
|
-
# self.window.ui.tabs['output'].setTabText(3, trans('output.tab.painter'))
|
45
|
-
|
40
|
+
|
46
41
|
# tool: indexer
|
47
42
|
self.window.ui.tabs['tool.indexer'].setTabText(0, trans('tool.indexer.tab.files'))
|
48
43
|
self.window.ui.tabs['tool.indexer'].setTabText(1, trans('tool.indexer.tab.web'))
|
@@ -6,9 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Dict
|
13
|
+
|
12
14
|
from pygpt_net.utils import trans
|
13
15
|
|
14
16
|
|
@@ -69,7 +71,7 @@ class Mapping:
|
|
69
71
|
if k in self.window.ui.menu:
|
70
72
|
self.window.ui.menu[k].setText(trans("output.tab." + self.window.controller.tools.get_tab_tools()[k][0]))
|
71
73
|
|
72
|
-
def get_mapping(self) ->
|
74
|
+
def get_mapping(self) -> Dict[str, Dict[str, str]]:
|
73
75
|
"""
|
74
76
|
Get nodes => locale keys mapping
|
75
77
|
|
@@ -332,6 +334,7 @@ class Mapping:
|
|
332
334
|
menu_title['theme.light'] = 'menu.theme.light'
|
333
335
|
menu_title['theme.syntax'] = 'menu.theme.syntax'
|
334
336
|
menu_title['theme.density'] = 'menu.theme.density'
|
337
|
+
menu_title['theme.style'] = 'menu.theme.style'
|
335
338
|
menu_title['menu.plugins'] = 'menu.plugins'
|
336
339
|
menu_title['menu.plugins.presets'] = 'menu.plugins.presets'
|
337
340
|
menu_title['menu.about'] = 'menu.info'
|
@@ -357,7 +360,6 @@ class Mapping:
|
|
357
360
|
menu_text['config.profile.new'] = 'menu.config.profile.new'
|
358
361
|
menu_text['config.save'] = 'menu.config.save'
|
359
362
|
menu_text['theme.tooltips'] = 'menu.theme.tooltips'
|
360
|
-
menu_text['theme.blocks'] = 'menu.theme.blocks'
|
361
363
|
menu_text['theme.settings'] = 'menu.theme.settings'
|
362
364
|
menu_text['plugins.presets.new'] = 'menu.plugins.presets.new'
|
363
365
|
menu_text['plugins.presets.edit'] = 'menu.plugins.presets.edit'
|
pygpt_net/controller/layout.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.09 03:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
@@ -26,7 +26,7 @@ class Layout:
|
|
26
26
|
"""
|
27
27
|
self.window = window
|
28
28
|
# self.splitters = ["main", "main.output", "toolbox", "toolbox.mode", "toolbox.presets"]
|
29
|
-
self.splitters = ["main", "main.output", "toolbox", "toolbox.mode", "calendar", "interpreter", "interpreter.columns"]
|
29
|
+
self.splitters = ["main", "main.output", "toolbox", "toolbox.mode", "calendar", "interpreter", "interpreter.columns", "columns"]
|
30
30
|
self.text_nodes = ["input"]
|
31
31
|
|
32
32
|
def setup(self):
|
pygpt_net/controller/mode.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from pygpt_net.core.events import Event, AppEvent
|
@@ -87,7 +87,7 @@ class Mode:
|
|
87
87
|
self.window.controller.ctx.common.update_label_by_current()
|
88
88
|
self.locked = False
|
89
89
|
|
90
|
-
def select_on_list(self, mode):
|
90
|
+
def select_on_list(self, mode: str):
|
91
91
|
"""
|
92
92
|
Select mode on the list
|
93
93
|
|
@@ -142,7 +142,14 @@ class Mode:
|
|
142
142
|
hooks=False) # disable hooks to prevent circular update
|
143
143
|
'''
|
144
144
|
|
145
|
-
def hook_global_temperature(
|
145
|
+
def hook_global_temperature(
|
146
|
+
self,
|
147
|
+
key: str,
|
148
|
+
value,
|
149
|
+
caller,
|
150
|
+
*args,
|
151
|
+
**kwargs
|
152
|
+
):
|
146
153
|
"""
|
147
154
|
Hook: on update current temperature global field
|
148
155
|
"""
|
@@ -158,7 +165,12 @@ class Mode:
|
|
158
165
|
preset.temperature = temperature
|
159
166
|
self.window.core.presets.save(preset_id)
|
160
167
|
|
161
|
-
def switch_inline(
|
168
|
+
def switch_inline(
|
169
|
+
self,
|
170
|
+
mode: str,
|
171
|
+
ctx: CtxItem,
|
172
|
+
prompt: str
|
173
|
+
) -> str:
|
162
174
|
"""
|
163
175
|
Switch inline mode
|
164
176
|
|
@@ -6,9 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 00:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Optional
|
13
|
+
|
12
14
|
from pygpt_net.core.events import Event, AppEvent
|
13
15
|
from pygpt_net.item.model import ModelItem
|
14
16
|
|
@@ -94,7 +96,12 @@ class Model:
|
|
94
96
|
})
|
95
97
|
self.window.dispatch(event)
|
96
98
|
|
97
|
-
def select_on_list(self, model):
|
99
|
+
def select_on_list(self, model: str):
|
100
|
+
"""
|
101
|
+
Select model on list
|
102
|
+
|
103
|
+
:param model: model ID
|
104
|
+
"""
|
98
105
|
self.window.ui.nodes["prompt.model"].set_value(model)
|
99
106
|
|
100
107
|
def select_current(self):
|
@@ -122,7 +129,11 @@ class Model:
|
|
122
129
|
# or set default model
|
123
130
|
self.window.core.config.set('model', self.window.core.models.get_default(mode))
|
124
131
|
|
125
|
-
def switch_inline(
|
132
|
+
def switch_inline(
|
133
|
+
self,
|
134
|
+
mode: str,
|
135
|
+
model: Optional[ModelItem] = None
|
136
|
+
) -> ModelItem:
|
126
137
|
"""
|
127
138
|
Switch inline model instance (force change model if needed)
|
128
139
|
|
@@ -6,10 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import copy
|
13
|
+
from typing import Optional
|
13
14
|
|
14
15
|
from pygpt_net.utils import trans
|
15
16
|
|
@@ -261,7 +262,11 @@ class Editor:
|
|
261
262
|
self.set_by_tab(idx)
|
262
263
|
self.init()
|
263
264
|
|
264
|
-
def delete_by_idx(
|
265
|
+
def delete_by_idx(
|
266
|
+
self,
|
267
|
+
idx: int,
|
268
|
+
force: bool = False
|
269
|
+
):
|
265
270
|
"""
|
266
271
|
Delete model by idx
|
267
272
|
|
@@ -387,7 +392,7 @@ class Editor:
|
|
387
392
|
i += 1
|
388
393
|
return model_idx
|
389
394
|
|
390
|
-
def get_model_by_tab_idx(self, idx: int) -> str
|
395
|
+
def get_model_by_tab_idx(self, idx: int) -> Optional[str]:
|
391
396
|
"""
|
392
397
|
Get model key by list index
|
393
398
|
|
pygpt_net/controller/notepad.py
CHANGED
@@ -6,9 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Optional, Tuple
|
13
|
+
|
12
14
|
from PySide6.QtGui import QTextCursor
|
13
15
|
|
14
16
|
from pygpt_net.core.tabs.tab import Tab
|
@@ -16,6 +18,7 @@ from pygpt_net.item.notepad import NotepadItem
|
|
16
18
|
from pygpt_net.ui.widget.tabs.body import TabBody
|
17
19
|
from pygpt_net.ui.widget.textarea.notepad import NotepadWidget
|
18
20
|
from pygpt_net.utils import trans
|
21
|
+
|
19
22
|
import pygpt_net.icons_rc
|
20
23
|
|
21
24
|
|
@@ -29,7 +32,10 @@ class Notepad:
|
|
29
32
|
self.window = window
|
30
33
|
self.opened_once = False
|
31
34
|
|
32
|
-
def create(
|
35
|
+
def create(
|
36
|
+
self,
|
37
|
+
idx: Optional[int] = None
|
38
|
+
) -> Tuple[TabBody, int, int]:
|
33
39
|
"""
|
34
40
|
Create notepad widget
|
35
41
|
|
@@ -38,13 +44,14 @@ class Notepad:
|
|
38
44
|
"""
|
39
45
|
if idx is None:
|
40
46
|
idx = self.window.core.tabs.count_by_type(Tab.TAB_NOTEPAD) + 1
|
41
|
-
|
42
|
-
self.window.ui.notepad[
|
43
|
-
self.window.ui.notepad[
|
47
|
+
data_id = idx
|
48
|
+
self.window.ui.notepad[data_id] = NotepadWidget(self.window)
|
49
|
+
self.window.ui.notepad[data_id].id = idx
|
50
|
+
self.window.ui.notepad[data_id].textarea.id = idx
|
44
51
|
title = trans('output.tab.notepad')
|
45
52
|
title += " " + str(idx)
|
46
|
-
children = self.window.core.tabs.from_widget(self.window.ui.notepad[
|
47
|
-
return children, idx
|
53
|
+
children = self.window.core.tabs.from_widget(self.window.ui.notepad[data_id])
|
54
|
+
return children, idx, data_id
|
48
55
|
|
49
56
|
def load(self):
|
50
57
|
"""Load all notepads contents"""
|
@@ -183,10 +190,11 @@ class Notepad:
|
|
183
190
|
return
|
184
191
|
|
185
192
|
# switch to first notepad tab if current tab is not notepad
|
193
|
+
tabs = self.window.ui.layout.get_active_tabs()
|
186
194
|
if self.window.controller.ui.tabs.get_current_type() != Tab.TAB_NOTEPAD:
|
187
195
|
idx = self.window.core.tabs.get_min_idx_by_type(Tab.TAB_NOTEPAD)
|
188
196
|
if idx is not None:
|
189
|
-
|
197
|
+
tabs.setCurrentIndex(idx)
|
190
198
|
|
191
199
|
self.window.activateWindow() # focus
|
192
200
|
|
@@ -201,7 +209,7 @@ class Notepad:
|
|
201
209
|
self.load()
|
202
210
|
self.window.core.notepad.locked = False
|
203
211
|
|
204
|
-
def switch_to_tab(self, idx: int = None):
|
212
|
+
def switch_to_tab(self, idx: Optional[int] = None):
|
205
213
|
"""
|
206
214
|
Switch to notepad tab
|
207
215
|
|
@@ -209,11 +217,12 @@ class Notepad:
|
|
209
217
|
"""
|
210
218
|
if idx is None:
|
211
219
|
idx = self.get_first_notepad_tab_idx()
|
220
|
+
tabs = self.window.ui.layout.get_active_tabs()
|
212
221
|
tab = self.window.core.tabs.get_tab_by_index(idx)
|
213
222
|
if tab is not None:
|
214
|
-
|
223
|
+
tabs.setCurrentIndex(idx)
|
215
224
|
else:
|
216
|
-
|
225
|
+
tabs.setCurrentIndex(self.get_first_notepad_tab_idx())
|
217
226
|
|
218
227
|
def get_first_notepad_tab_idx(self) -> int:
|
219
228
|
"""
|
@@ -257,11 +266,16 @@ class Notepad:
|
|
257
266
|
return True
|
258
267
|
return False
|
259
268
|
|
260
|
-
def on_open(
|
269
|
+
def on_open(
|
270
|
+
self,
|
271
|
+
tab_idx: int,
|
272
|
+
column_idx: int = 0
|
273
|
+
):
|
261
274
|
"""
|
262
275
|
On open notepad tab
|
263
276
|
|
264
277
|
:param tab_idx: current tab idx
|
278
|
+
:param column_idx: column idx
|
265
279
|
"""
|
266
280
|
tab = self.window.controller.ui.tabs.get_current_tab()
|
267
281
|
if tab is None:
|
@@ -6,12 +6,14 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
13
13
|
import math
|
14
14
|
import os
|
15
|
+
from typing import Optional, Union
|
16
|
+
|
15
17
|
import mss
|
16
18
|
import mss.tools
|
17
19
|
from PIL import Image, ImageDraw
|
@@ -45,7 +47,13 @@ class Capture:
|
|
45
47
|
image = QImage(frame.data, width, height, bytes, QImage.Format_RGB888)
|
46
48
|
self.window.ui.painter.set_image(image)
|
47
49
|
|
48
|
-
def capture_screen_with_custom_cursor(self, save_path) -> str:
|
50
|
+
def capture_screen_with_custom_cursor(self, save_path: str) -> str:
|
51
|
+
"""
|
52
|
+
Capture screen with custom cursor
|
53
|
+
|
54
|
+
:param save_path: Save path
|
55
|
+
:return: Save path
|
56
|
+
"""
|
49
57
|
cursor_path = os.path.join(self.window.core.config.get_app_path(), "data", "icons", "cursor.png")
|
50
58
|
|
51
59
|
with mss.mss() as sct:
|
@@ -72,12 +80,17 @@ class Capture:
|
|
72
80
|
img.save(save_path)
|
73
81
|
return save_path
|
74
82
|
|
75
|
-
def screenshot(
|
83
|
+
def screenshot(
|
84
|
+
self,
|
85
|
+
attach_cursor: bool = False,
|
86
|
+
silent: bool = False
|
87
|
+
) -> Optional[Union[str, bool]]:
|
76
88
|
"""
|
77
89
|
Make screenshot and append to attachments
|
78
90
|
|
79
91
|
:param attach_cursor: True to with custom cursor
|
80
92
|
:param silent: Silent mode
|
93
|
+
:return: Path to screenshot or False if failed
|
81
94
|
"""
|
82
95
|
if not silent:
|
83
96
|
# switch to vision mode if needed
|
@@ -152,7 +165,13 @@ class Capture:
|
|
152
165
|
print("Image capture exception", e)
|
153
166
|
self.window.core.debug.log(e)
|
154
167
|
|
155
|
-
def attach(
|
168
|
+
def attach(
|
169
|
+
self,
|
170
|
+
name: str,
|
171
|
+
path: str,
|
172
|
+
type: str = 'drawing',
|
173
|
+
silent: bool = False
|
174
|
+
):
|
156
175
|
"""
|
157
176
|
Attach image to attachments
|
158
177
|
|
@@ -6,9 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Tuple, Optional, Dict, List
|
13
|
+
|
12
14
|
from PySide6.QtCore import Qt, QSize
|
13
15
|
from PySide6.QtGui import QColor
|
14
16
|
|
@@ -22,7 +24,7 @@ class Common:
|
|
22
24
|
"""
|
23
25
|
self.window = window
|
24
26
|
|
25
|
-
def convert_to_size(self, canvas_size: str) ->
|
27
|
+
def convert_to_size(self, canvas_size: str) -> Tuple[int, int]:
|
26
28
|
"""
|
27
29
|
Convert string to size
|
28
30
|
|
@@ -64,7 +66,7 @@ class Common:
|
|
64
66
|
self.window.core.config.set('painter.brush.mode', "erase")
|
65
67
|
self.window.core.config.save()
|
66
68
|
|
67
|
-
def change_canvas_size(self, selected=None):
|
69
|
+
def change_canvas_size(self, selected: Optional[str] = None):
|
68
70
|
"""
|
69
71
|
Change the canvas size
|
70
72
|
|
@@ -79,7 +81,7 @@ class Common:
|
|
79
81
|
self.window.core.config.set('painter.canvas.size', selected)
|
80
82
|
self.window.core.config.save()
|
81
83
|
|
82
|
-
def change_brush_size(self, size):
|
84
|
+
def change_brush_size(self, size: int):
|
83
85
|
"""
|
84
86
|
Change the brush size
|
85
87
|
|
@@ -143,7 +145,7 @@ class Common:
|
|
143
145
|
self.window.ui.nodes['painter.select.brush.size'].findText(str(size))
|
144
146
|
)
|
145
147
|
|
146
|
-
def get_colors(self) ->
|
148
|
+
def get_colors(self) -> Dict[str, QColor]:
|
147
149
|
"""
|
148
150
|
Get colors dict
|
149
151
|
|
@@ -161,7 +163,7 @@ class Common:
|
|
161
163
|
"Violet": QColor('violet')
|
162
164
|
}
|
163
165
|
|
164
|
-
def get_sizes(self) ->
|
166
|
+
def get_sizes(self) -> List[str]:
|
165
167
|
"""
|
166
168
|
Get brush sizes
|
167
169
|
|
@@ -169,7 +171,7 @@ class Common:
|
|
169
171
|
"""
|
170
172
|
return ['1', '2', '3', '5', '8', '12', '15', '20', '25', '30', '50', '100', '200']
|
171
173
|
|
172
|
-
def get_canvas_sizes(self) ->
|
174
|
+
def get_canvas_sizes(self) -> List[str]:
|
173
175
|
"""
|
174
176
|
Get canvas sizes
|
175
177
|
|