pygpt-net 2.6.20__py3-none-any.whl → 2.6.22__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.
- pygpt_net/CHANGELOG.txt +13 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +3 -1
- pygpt_net/controller/__init__.py +4 -8
- pygpt_net/controller/access/voice.py +2 -2
- pygpt_net/controller/agent/agent.py +130 -2
- pygpt_net/controller/agent/experts.py +93 -96
- pygpt_net/controller/agent/llama.py +2 -1
- pygpt_net/controller/assistant/assistant.py +18 -1
- pygpt_net/controller/assistant/batch.py +2 -3
- pygpt_net/controller/assistant/editor.py +2 -2
- pygpt_net/controller/assistant/files.py +2 -3
- pygpt_net/controller/assistant/store.py +2 -2
- pygpt_net/controller/attachment/attachment.py +17 -1
- pygpt_net/controller/audio/audio.py +2 -2
- pygpt_net/controller/camera/camera.py +15 -7
- pygpt_net/controller/chat/chat.py +2 -2
- pygpt_net/controller/chat/common.py +50 -33
- pygpt_net/controller/chat/image.py +67 -77
- pygpt_net/controller/chat/input.py +94 -166
- pygpt_net/controller/chat/output.py +83 -140
- pygpt_net/controller/chat/response.py +83 -102
- pygpt_net/controller/chat/text.py +116 -149
- pygpt_net/controller/ctx/common.py +2 -1
- pygpt_net/controller/ctx/ctx.py +87 -6
- pygpt_net/controller/files/files.py +13 -1
- pygpt_net/controller/idx/idx.py +26 -2
- pygpt_net/controller/idx/indexer.py +85 -76
- pygpt_net/controller/kernel/reply.py +53 -66
- pygpt_net/controller/kernel/stack.py +16 -16
- pygpt_net/controller/lang/lang.py +52 -34
- pygpt_net/controller/model/importer.py +3 -2
- pygpt_net/controller/model/model.py +62 -3
- pygpt_net/controller/notepad/notepad.py +86 -84
- pygpt_net/controller/plugins/settings.py +3 -4
- pygpt_net/controller/settings/editor.py +4 -4
- pygpt_net/controller/settings/profile.py +105 -124
- pygpt_net/controller/theme/menu.py +154 -57
- pygpt_net/controller/theme/nodes.py +51 -44
- pygpt_net/controller/theme/theme.py +33 -9
- pygpt_net/controller/tools/tools.py +2 -2
- pygpt_net/controller/ui/tabs.py +2 -3
- pygpt_net/controller/ui/ui.py +16 -2
- pygpt_net/core/agents/observer/evaluation.py +3 -3
- pygpt_net/core/agents/provider.py +25 -3
- pygpt_net/core/agents/runner.py +4 -1
- pygpt_net/core/agents/runners/llama_workflow.py +19 -7
- pygpt_net/core/agents/runners/loop.py +3 -1
- pygpt_net/core/agents/runners/openai_workflow.py +17 -3
- pygpt_net/core/agents/tools.py +4 -1
- pygpt_net/core/bridge/context.py +34 -37
- pygpt_net/core/ctx/container.py +13 -12
- pygpt_net/core/ctx/ctx.py +1 -1
- pygpt_net/core/ctx/output.py +7 -4
- pygpt_net/core/db/database.py +2 -2
- pygpt_net/core/debug/console/console.py +2 -2
- pygpt_net/core/debug/debug.py +12 -1
- pygpt_net/core/dispatcher/dispatcher.py +24 -1
- pygpt_net/core/events/app.py +7 -7
- pygpt_net/core/events/control.py +26 -26
- pygpt_net/core/events/event.py +6 -3
- pygpt_net/core/events/kernel.py +2 -2
- pygpt_net/core/events/render.py +13 -13
- pygpt_net/core/experts/experts.py +76 -82
- pygpt_net/core/experts/worker.py +12 -12
- pygpt_net/core/filesystem/actions.py +1 -2
- pygpt_net/core/models/models.py +5 -1
- pygpt_net/core/models/ollama.py +14 -5
- pygpt_net/core/render/plain/helpers.py +2 -5
- pygpt_net/core/render/plain/renderer.py +26 -30
- pygpt_net/core/render/web/body.py +1 -1
- pygpt_net/core/render/web/helpers.py +2 -2
- pygpt_net/core/render/web/renderer.py +4 -4
- pygpt_net/core/settings/settings.py +43 -13
- pygpt_net/core/tabs/tabs.py +20 -13
- pygpt_net/core/types/__init__.py +2 -1
- pygpt_net/core/types/agent.py +4 -4
- pygpt_net/core/types/base.py +19 -0
- pygpt_net/core/types/console.py +6 -6
- pygpt_net/core/types/mode.py +8 -8
- pygpt_net/core/types/multimodal.py +3 -3
- pygpt_net/core/types/openai.py +2 -1
- pygpt_net/data/config/config.json +5 -5
- pygpt_net/data/config/models.json +19 -3
- pygpt_net/data/config/settings.json +14 -14
- pygpt_net/data/locale/locale.de.ini +4 -1
- pygpt_net/data/locale/locale.en.ini +6 -3
- pygpt_net/data/locale/locale.es.ini +4 -1
- pygpt_net/data/locale/locale.fr.ini +4 -1
- pygpt_net/data/locale/locale.it.ini +4 -1
- pygpt_net/data/locale/locale.pl.ini +5 -4
- pygpt_net/data/locale/locale.uk.ini +4 -1
- pygpt_net/data/locale/locale.zh.ini +4 -1
- pygpt_net/item/ctx.py +256 -240
- pygpt_net/item/model.py +59 -116
- pygpt_net/item/preset.py +122 -105
- pygpt_net/plugin/twitter/plugin.py +2 -2
- pygpt_net/provider/agents/llama_index/workflow/planner.py +3 -3
- pygpt_net/provider/agents/openai/agent.py +4 -12
- pygpt_net/provider/agents/openai/agent_b2b.py +10 -15
- pygpt_net/provider/agents/openai/agent_planner.py +4 -4
- pygpt_net/provider/agents/openai/agent_with_experts.py +3 -7
- pygpt_net/provider/agents/openai/agent_with_experts_feedback.py +4 -8
- pygpt_net/provider/agents/openai/agent_with_feedback.py +4 -8
- pygpt_net/provider/agents/openai/bot_researcher.py +2 -18
- pygpt_net/provider/agents/openai/bots/__init__.py +0 -0
- pygpt_net/provider/agents/openai/bots/research_bot/__init__.py +0 -0
- pygpt_net/provider/agents/openai/bots/research_bot/agents/__init__.py +0 -0
- pygpt_net/provider/agents/openai/bots/research_bot/agents/planner_agent.py +1 -1
- pygpt_net/provider/agents/openai/bots/research_bot/agents/search_agent.py +1 -0
- pygpt_net/provider/agents/openai/bots/research_bot/agents/writer_agent.py +1 -1
- pygpt_net/provider/agents/openai/bots/research_bot/manager.py +1 -10
- pygpt_net/provider/agents/openai/evolve.py +5 -9
- pygpt_net/provider/agents/openai/supervisor.py +4 -8
- pygpt_net/provider/core/config/patch.py +10 -3
- pygpt_net/provider/core/ctx/db_sqlite/utils.py +43 -43
- pygpt_net/provider/core/model/patch.py +11 -1
- pygpt_net/provider/core/preset/json_file.py +47 -49
- pygpt_net/provider/gpt/agents/experts.py +2 -2
- pygpt_net/tools/audio_transcriber/ui/dialogs.py +44 -54
- pygpt_net/tools/code_interpreter/body.py +1 -2
- pygpt_net/tools/code_interpreter/tool.py +7 -4
- pygpt_net/tools/code_interpreter/ui/html.py +1 -3
- pygpt_net/tools/code_interpreter/ui/widgets.py +2 -3
- pygpt_net/tools/html_canvas/ui/widgets.py +1 -3
- pygpt_net/tools/image_viewer/ui/dialogs.py +40 -37
- pygpt_net/tools/indexer/ui/widgets.py +2 -4
- pygpt_net/tools/media_player/tool.py +2 -5
- pygpt_net/tools/media_player/ui/widgets.py +60 -36
- pygpt_net/tools/text_editor/ui/widgets.py +18 -19
- pygpt_net/tools/translator/ui/widgets.py +39 -35
- pygpt_net/ui/base/context_menu.py +9 -4
- pygpt_net/ui/dialog/db.py +1 -3
- pygpt_net/ui/dialog/models.py +1 -3
- pygpt_net/ui/dialog/models_importer.py +2 -4
- pygpt_net/ui/dialogs.py +34 -30
- pygpt_net/ui/layout/chat/attachments.py +72 -84
- pygpt_net/ui/layout/chat/attachments_ctx.py +40 -44
- pygpt_net/ui/layout/chat/attachments_uploaded.py +36 -39
- pygpt_net/ui/layout/chat/calendar.py +100 -70
- pygpt_net/ui/layout/chat/chat.py +23 -17
- pygpt_net/ui/layout/chat/input.py +95 -118
- pygpt_net/ui/layout/chat/output.py +100 -162
- pygpt_net/ui/layout/chat/painter.py +89 -61
- pygpt_net/ui/layout/ctx/ctx_list.py +43 -52
- pygpt_net/ui/layout/status.py +23 -14
- pygpt_net/ui/layout/toolbox/agent.py +27 -38
- pygpt_net/ui/layout/toolbox/agent_llama.py +42 -45
- pygpt_net/ui/layout/toolbox/assistants.py +42 -38
- pygpt_net/ui/layout/toolbox/computer_env.py +32 -23
- pygpt_net/ui/layout/toolbox/footer.py +13 -16
- pygpt_net/ui/layout/toolbox/image.py +18 -21
- pygpt_net/ui/layout/toolbox/indexes.py +46 -89
- pygpt_net/ui/layout/toolbox/mode.py +20 -7
- pygpt_net/ui/layout/toolbox/model.py +12 -10
- pygpt_net/ui/layout/toolbox/presets.py +68 -52
- pygpt_net/ui/layout/toolbox/prompt.py +31 -58
- pygpt_net/ui/layout/toolbox/toolbox.py +25 -21
- pygpt_net/ui/layout/toolbox/vision.py +20 -22
- pygpt_net/ui/main.py +2 -4
- pygpt_net/ui/menu/about.py +64 -84
- pygpt_net/ui/menu/audio.py +87 -63
- pygpt_net/ui/menu/config.py +121 -127
- pygpt_net/ui/menu/debug.py +69 -76
- pygpt_net/ui/menu/file.py +32 -35
- pygpt_net/ui/menu/menu.py +2 -3
- pygpt_net/ui/menu/plugins.py +69 -33
- pygpt_net/ui/menu/theme.py +45 -46
- pygpt_net/ui/menu/tools.py +56 -60
- pygpt_net/ui/menu/video.py +20 -25
- pygpt_net/ui/tray.py +1 -2
- pygpt_net/ui/widget/audio/bar.py +1 -3
- pygpt_net/ui/widget/audio/input_button.py +3 -4
- pygpt_net/ui/widget/calendar/select.py +1 -2
- pygpt_net/ui/widget/dialog/base.py +12 -9
- pygpt_net/ui/widget/dialog/editor_file.py +20 -23
- pygpt_net/ui/widget/dialog/find.py +25 -24
- pygpt_net/ui/widget/dialog/profile.py +57 -53
- pygpt_net/ui/widget/draw/painter.py +62 -93
- pygpt_net/ui/widget/element/button.py +42 -30
- pygpt_net/ui/widget/element/checkbox.py +23 -15
- pygpt_net/ui/widget/element/group.py +6 -5
- pygpt_net/ui/widget/element/labels.py +1 -2
- pygpt_net/ui/widget/filesystem/explorer.py +93 -102
- pygpt_net/ui/widget/image/display.py +1 -2
- pygpt_net/ui/widget/lists/assistant.py +1 -2
- pygpt_net/ui/widget/lists/attachment.py +1 -2
- pygpt_net/ui/widget/lists/attachment_ctx.py +1 -2
- pygpt_net/ui/widget/lists/context.py +2 -4
- pygpt_net/ui/widget/lists/index.py +1 -2
- pygpt_net/ui/widget/lists/model.py +1 -2
- pygpt_net/ui/widget/lists/model_editor.py +1 -2
- pygpt_net/ui/widget/lists/model_importer.py +1 -2
- pygpt_net/ui/widget/lists/preset.py +1 -2
- pygpt_net/ui/widget/lists/preset_plugins.py +1 -2
- pygpt_net/ui/widget/lists/profile.py +1 -2
- pygpt_net/ui/widget/lists/uploaded.py +1 -2
- pygpt_net/ui/widget/option/checkbox.py +2 -4
- pygpt_net/ui/widget/option/checkbox_list.py +1 -4
- pygpt_net/ui/widget/option/cmd.py +1 -4
- pygpt_net/ui/widget/option/dictionary.py +25 -28
- pygpt_net/ui/widget/option/input.py +1 -3
- pygpt_net/ui/widget/tabs/Input.py +16 -12
- pygpt_net/ui/widget/tabs/body.py +5 -3
- pygpt_net/ui/widget/tabs/layout.py +36 -25
- pygpt_net/ui/widget/tabs/output.py +96 -74
- pygpt_net/ui/widget/textarea/calendar_note.py +1 -2
- pygpt_net/ui/widget/textarea/editor.py +41 -73
- pygpt_net/ui/widget/textarea/find.py +11 -10
- pygpt_net/ui/widget/textarea/html.py +3 -6
- pygpt_net/ui/widget/textarea/input.py +63 -64
- pygpt_net/ui/widget/textarea/notepad.py +54 -38
- pygpt_net/ui/widget/textarea/output.py +65 -54
- pygpt_net/ui/widget/textarea/search_input.py +5 -4
- pygpt_net/ui/widget/textarea/web.py +2 -4
- pygpt_net/ui/widget/vision/camera.py +2 -31
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/METADATA +25 -154
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/RECORD +218 -217
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/entry_points.txt +0 -0
|
@@ -6,28 +6,23 @@
|
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
7
|
# MIT License #
|
|
8
8
|
# Created By : Marcin Szczygliński #
|
|
9
|
-
# Updated Date: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.24 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from PySide6.QtCore import Qt
|
|
13
|
-
from PySide6.QtWidgets import QVBoxLayout,
|
|
14
|
-
QGridLayout
|
|
13
|
+
from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout, QCheckBox, QWidget, QSizePolicy, \
|
|
14
|
+
QGridLayout
|
|
15
15
|
|
|
16
16
|
from pygpt_net.ui.widget.audio.output import AudioOutput
|
|
17
17
|
from pygpt_net.ui.widget.element.labels import ChatStatusLabel, IconLabel, HelpLabel
|
|
18
|
-
from pygpt_net.ui.widget.anims.loader import Loading
|
|
19
18
|
from pygpt_net.ui.widget.tabs.layout import OutputLayout
|
|
19
|
+
from pygpt_net.utils import trans
|
|
20
20
|
|
|
21
21
|
from .explorer import Explorer
|
|
22
22
|
from .input import Input
|
|
23
23
|
from .calendar import Calendar
|
|
24
24
|
from .painter import Painter
|
|
25
25
|
|
|
26
|
-
from pygpt_net.utils import trans
|
|
27
|
-
import pygpt_net.icons_rc
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
26
|
class Output:
|
|
32
27
|
def __init__(self, window=None):
|
|
33
28
|
"""
|
|
@@ -47,10 +42,7 @@ class Output:
|
|
|
47
42
|
|
|
48
43
|
:return: QWidget
|
|
49
44
|
"""
|
|
50
|
-
# prepare columns
|
|
51
45
|
self.window.ui.layout = OutputLayout(self.window)
|
|
52
|
-
|
|
53
|
-
# create empty containers for chat output
|
|
54
46
|
self.window.ui.nodes['output'] = {}
|
|
55
47
|
self.window.ui.nodes['output_plain'] = {}
|
|
56
48
|
|
|
@@ -69,176 +61,122 @@ class Output:
|
|
|
69
61
|
|
|
70
62
|
:return: QHBoxLayout
|
|
71
63
|
"""
|
|
72
|
-
|
|
73
|
-
self.window.ui.
|
|
74
|
-
self.window.
|
|
75
|
-
self.window.
|
|
76
|
-
lambda:self.window.controller.camera.toggle_capture()
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
# audio output icon
|
|
80
|
-
self.window.ui.nodes['icon.audio.output'] = IconLabel(":/icons/volume.svg", window=self.window)
|
|
81
|
-
self.window.ui.nodes['icon.audio.output'].setToolTip(trans("icon.audio.output"))
|
|
82
|
-
self.window.ui.nodes['icon.audio.output'].clicked.connect(
|
|
83
|
-
lambda: self.window.controller.plugins.toggle('audio_output')
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
# audio input icon
|
|
87
|
-
self.window.ui.nodes['icon.audio.input'] = IconLabel(":/icons/mic.svg", window=self.window)
|
|
88
|
-
self.window.ui.nodes['icon.audio.input'].setToolTip(trans("icon.audio.input"))
|
|
89
|
-
self.window.ui.nodes['icon.audio.input'].clicked.connect(
|
|
90
|
-
lambda: self.window.controller.plugins.toggle('audio_input')
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
# interpreter icon
|
|
94
|
-
self.window.ui.nodes['icon.interpreter'] = IconLabel(":/icons/code.svg", window=self.window)
|
|
95
|
-
self.window.ui.nodes['icon.interpreter'].setToolTip("Python Code Interpreter")
|
|
96
|
-
self.window.ui.nodes['icon.interpreter'].clicked.connect(
|
|
97
|
-
lambda: self.window.tools.get("interpreter").toggle()
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
# indexer icon
|
|
101
|
-
self.window.ui.nodes['icon.indexer'] = IconLabel(":/icons/db.svg", window=self.window)
|
|
102
|
-
self.window.ui.nodes['icon.indexer'].setToolTip("Indexer")
|
|
103
|
-
self.window.ui.nodes['icon.indexer'].clicked.connect(
|
|
104
|
-
lambda: self.window.tools.get("indexer").toggle()
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
# mode
|
|
108
|
-
self.window.ui.nodes['chat.label'] = ChatStatusLabel("")
|
|
109
|
-
self.window.ui.nodes['chat.label'].setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
|
110
|
-
self.window.ui.nodes['chat.label'].setWordWrap(False)
|
|
111
|
-
|
|
112
|
-
# model
|
|
113
|
-
self.window.ui.nodes['chat.model'] = ChatStatusLabel("")
|
|
114
|
-
self.window.ui.nodes['chat.model'].setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
|
115
|
-
self.window.ui.nodes['chat.model'].setWordWrap(False)
|
|
116
|
-
|
|
117
|
-
# plugins
|
|
118
|
-
self.window.ui.nodes['chat.plugins'] = ChatStatusLabel("")
|
|
119
|
-
self.window.ui.nodes['chat.plugins'].setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
|
120
|
-
|
|
121
|
-
# timestamp
|
|
122
|
-
self.window.ui.nodes['output.timestamp'] = QCheckBox(trans('output.timestamp'))
|
|
123
|
-
self.window.ui.nodes['output.timestamp'].stateChanged.connect(
|
|
124
|
-
lambda: self.window.controller.chat.common.toggle_timestamp(
|
|
125
|
-
self.window.ui.nodes['output.timestamp'].isChecked())
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
# plain text
|
|
129
|
-
self.window.ui.nodes['output.raw'] = QCheckBox(trans('output.raw'))
|
|
130
|
-
self.window.ui.nodes['output.raw'].clicked.connect(
|
|
131
|
-
lambda: self.window.controller.chat.common.toggle_raw(
|
|
132
|
-
self.window.ui.nodes['output.raw'].isChecked())
|
|
133
|
-
)
|
|
64
|
+
nodes = self.window.ui.nodes
|
|
65
|
+
plugin_addon = self.window.ui.plugin_addon
|
|
66
|
+
ctrl = self.window.controller
|
|
67
|
+
tools = self.window.tools
|
|
134
68
|
|
|
135
|
-
""
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
)
|
|
142
|
-
"""
|
|
69
|
+
nodes['icon.video.capture'] = IconLabel(":/icons/webcam.svg", window=self.window)
|
|
70
|
+
nodes['icon.video.capture'].setToolTip(trans("icon.video.capture"))
|
|
71
|
+
nodes['icon.video.capture'].clicked.connect(lambda: ctrl.camera.toggle_capture())
|
|
72
|
+
|
|
73
|
+
nodes['icon.audio.output'] = IconLabel(":/icons/volume.svg", window=self.window)
|
|
74
|
+
nodes['icon.audio.output'].setToolTip(trans("icon.audio.output"))
|
|
75
|
+
nodes['icon.audio.output'].clicked.connect(lambda: ctrl.plugins.toggle('audio_output'))
|
|
143
76
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
self.window.ui.nodes['prompt.context'].setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
|
77
|
+
nodes['icon.audio.input'] = IconLabel(":/icons/mic.svg", window=self.window)
|
|
78
|
+
nodes['icon.audio.input'].setToolTip(trans("icon.audio.input"))
|
|
79
|
+
nodes['icon.audio.input'].clicked.connect(lambda: ctrl.plugins.toggle('audio_input'))
|
|
148
80
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
81
|
+
nodes['icon.interpreter'] = IconLabel(":/icons/code.svg", window=self.window)
|
|
82
|
+
nodes['icon.interpreter'].setToolTip("Python Code Interpreter")
|
|
83
|
+
nodes['icon.interpreter'].clicked.connect(lambda: tools.get("interpreter").toggle())
|
|
152
84
|
|
|
153
|
-
|
|
154
|
-
|
|
85
|
+
nodes['icon.indexer'] = IconLabel(":/icons/db.svg", window=self.window)
|
|
86
|
+
nodes['icon.indexer'].setToolTip("Indexer")
|
|
87
|
+
nodes['icon.indexer'].clicked.connect(lambda: tools.get("indexer").toggle())
|
|
155
88
|
|
|
156
|
-
|
|
157
|
-
self.window.ui.plugin_addon['schedule'] = ChatStatusLabel("")
|
|
89
|
+
min_policy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
|
158
90
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
91
|
+
nodes['chat.label'] = ChatStatusLabel("")
|
|
92
|
+
nodes['chat.label'].setSizePolicy(min_policy)
|
|
93
|
+
nodes['chat.label'].setWordWrap(False)
|
|
94
|
+
|
|
95
|
+
nodes['chat.model'] = ChatStatusLabel("")
|
|
96
|
+
nodes['chat.model'].setSizePolicy(min_policy)
|
|
97
|
+
nodes['chat.model'].setWordWrap(False)
|
|
98
|
+
|
|
99
|
+
nodes['chat.plugins'] = ChatStatusLabel("")
|
|
100
|
+
nodes['chat.plugins'].setSizePolicy(min_policy)
|
|
101
|
+
|
|
102
|
+
nodes['output.timestamp'] = QCheckBox(trans('output.timestamp'))
|
|
103
|
+
nodes['output.timestamp'].toggled.connect(ctrl.chat.common.toggle_timestamp)
|
|
104
|
+
|
|
105
|
+
nodes['output.raw'] = QCheckBox(trans('output.raw'))
|
|
106
|
+
nodes['output.raw'].toggled.connect(ctrl.chat.common.toggle_raw)
|
|
107
|
+
|
|
108
|
+
nodes['prompt.context'] = ChatStatusLabel("")
|
|
109
|
+
nodes['prompt.context'].setToolTip(trans('tip.tokens.ctx'))
|
|
110
|
+
nodes['prompt.context'].setSizePolicy(min_policy)
|
|
111
|
+
|
|
112
|
+
nodes['input.counter'] = ChatStatusLabel("")
|
|
113
|
+
nodes['input.counter'].setToolTip(trans('tip.tokens.input'))
|
|
114
|
+
nodes['input.counter'].setWordWrap(False)
|
|
115
|
+
|
|
116
|
+
plugin_addon['audio.output'] = AudioOutput(self.window)
|
|
117
|
+
plugin_addon['schedule'] = ChatStatusLabel("")
|
|
118
|
+
|
|
119
|
+
nodes['inline.vision'] = HelpLabel(trans('inline.vision'))
|
|
120
|
+
nodes['inline.vision'].setVisible(False)
|
|
121
|
+
nodes['inline.vision'].setContentsMargins(0, 0, 0, 0)
|
|
163
122
|
|
|
164
123
|
opts_layout = QHBoxLayout()
|
|
165
|
-
# opts_layout.setSpacing(2) #
|
|
166
124
|
opts_layout.setContentsMargins(0, 0, 0, 0)
|
|
167
|
-
opts_layout.addWidget(
|
|
168
|
-
opts_layout.addWidget(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
opts_layout.addWidget(self.window.ui.nodes['inline.vision'])
|
|
125
|
+
opts_layout.addWidget(nodes['output.raw'])
|
|
126
|
+
opts_layout.addWidget(nodes['output.timestamp'])
|
|
127
|
+
opts_layout.addWidget(nodes['inline.vision'])
|
|
172
128
|
opts_layout.setAlignment(Qt.AlignLeft)
|
|
173
129
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
right_widget = QWidget()
|
|
200
|
-
right_widget.setLayout(right_layout)
|
|
201
|
-
|
|
202
|
-
self.window.ui.nodes['anim.loading'] = QWidget()
|
|
203
|
-
self.window.ui.nodes['anim.loading'].hide()
|
|
130
|
+
left_bar_layout = QHBoxLayout()
|
|
131
|
+
left_bar_layout.addLayout(opts_layout)
|
|
132
|
+
left_bar_layout.setContentsMargins(0, 0, 0, 0)
|
|
133
|
+
|
|
134
|
+
nodes['anim.loading'] = QWidget()
|
|
135
|
+
nodes['anim.loading'].hide()
|
|
136
|
+
|
|
137
|
+
right_bar_layout = QHBoxLayout()
|
|
138
|
+
right_bar_layout.addWidget(nodes['icon.video.capture'])
|
|
139
|
+
right_bar_layout.addWidget(nodes['icon.audio.input'])
|
|
140
|
+
right_bar_layout.addWidget(nodes['icon.audio.output'])
|
|
141
|
+
right_bar_layout.addWidget(nodes['icon.interpreter'])
|
|
142
|
+
right_bar_layout.addWidget(nodes['icon.indexer'])
|
|
143
|
+
right_bar_layout.addWidget(plugin_addon['schedule'])
|
|
144
|
+
right_bar_layout.addSpacing(6)
|
|
145
|
+
right_bar_layout.addWidget(nodes['chat.plugins'])
|
|
146
|
+
right_bar_layout.addSpacing(6)
|
|
147
|
+
right_bar_layout.addWidget(nodes['chat.label'])
|
|
148
|
+
right_bar_layout.addSpacing(12)
|
|
149
|
+
right_bar_layout.addWidget(nodes['chat.model'])
|
|
150
|
+
right_bar_layout.addSpacing(12)
|
|
151
|
+
right_bar_layout.addWidget(nodes['prompt.context'])
|
|
152
|
+
right_bar_layout.addSpacing(12)
|
|
153
|
+
right_bar_layout.addWidget(nodes['input.counter'])
|
|
154
|
+
right_bar_layout.setContentsMargins(0, 8, 20, 0)
|
|
204
155
|
|
|
205
156
|
grid = QGridLayout()
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
center_layout = QHBoxLayout()
|
|
213
|
-
#center_layout.addStretch()
|
|
214
|
-
center_layout.addWidget(self.window.ui.nodes['anim.loading'])
|
|
215
|
-
center_layout.addStretch()
|
|
216
|
-
center_layout.setContentsMargins(20, 0, 0, 0)
|
|
217
|
-
|
|
218
|
-
right_layout = QHBoxLayout()
|
|
219
|
-
right_layout.addStretch(1)
|
|
220
|
-
right_layout.addWidget(right_widget)
|
|
221
|
-
right_layout.setContentsMargins(0, 0, 0, 0)
|
|
222
|
-
|
|
223
|
-
grid.addLayout(left_layout, 0, 0)
|
|
224
|
-
grid.addLayout(center_layout, 0, 1, alignment=Qt.AlignCenter)
|
|
225
|
-
grid.addLayout(right_layout, 0, 2, alignment=Qt.AlignRight)
|
|
157
|
+
grid.addLayout(left_bar_layout, 0, 0)
|
|
158
|
+
grid.addWidget(nodes['anim.loading'], 0, 1, alignment=Qt.AlignCenter)
|
|
159
|
+
grid.addLayout(right_bar_layout, 0, 2, alignment=Qt.AlignRight)
|
|
160
|
+
grid.setColumnStretch(0, 0)
|
|
161
|
+
grid.setColumnStretch(1, 1)
|
|
162
|
+
grid.setColumnStretch(2, 0)
|
|
226
163
|
grid.setContentsMargins(0, 0, 0, 0)
|
|
227
164
|
|
|
228
|
-
|
|
229
|
-
|
|
165
|
+
nodes['chat.footer'] = QWidget()
|
|
166
|
+
nodes['chat.footer'].setLayout(grid)
|
|
230
167
|
|
|
231
168
|
bottom_layout = QVBoxLayout()
|
|
232
|
-
bottom_layout.addWidget(
|
|
169
|
+
bottom_layout.addWidget(nodes['chat.footer'])
|
|
233
170
|
bottom_layout.setContentsMargins(2, 0, 2, 0)
|
|
234
171
|
return bottom_layout
|
|
235
172
|
|
|
236
173
|
def set_fixed_size_policy(self, layout):
|
|
237
174
|
for i in range(layout.count()):
|
|
238
175
|
item = layout.itemAt(i)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
176
|
+
w = item.widget()
|
|
177
|
+
if w is not None:
|
|
178
|
+
w.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
|
179
|
+
else:
|
|
180
|
+
l = item.layout()
|
|
181
|
+
if l is not None:
|
|
182
|
+
self.set_fixed_size_policy(l)
|
|
@@ -6,11 +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: 2025.
|
|
9
|
+
# Updated Date: 2025.08.24 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from PySide6.QtGui import QPixmap, QIcon
|
|
13
13
|
from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout, QWidget, QRadioButton, QPushButton, QComboBox, QScrollArea
|
|
14
|
+
from PySide6.QtCore import QSize
|
|
14
15
|
|
|
15
16
|
from pygpt_net.ui.widget.draw.painter import PainterWidget
|
|
16
17
|
from pygpt_net.ui.widget.element.labels import HelpLabel
|
|
@@ -26,6 +27,7 @@ class Painter:
|
|
|
26
27
|
:param window: Window instance
|
|
27
28
|
"""
|
|
28
29
|
self.window = window
|
|
30
|
+
self._initialized = False
|
|
29
31
|
|
|
30
32
|
def init(self):
|
|
31
33
|
"""
|
|
@@ -33,47 +35,62 @@ class Painter:
|
|
|
33
35
|
|
|
34
36
|
:return: QWidget
|
|
35
37
|
"""
|
|
36
|
-
|
|
38
|
+
ui = self.window.ui
|
|
39
|
+
nodes = ui.nodes
|
|
40
|
+
common = self.window.controller.painter.common
|
|
41
|
+
|
|
42
|
+
if getattr(ui, 'painter', None) is None:
|
|
43
|
+
ui.painter = PainterWidget(self.window)
|
|
37
44
|
|
|
38
45
|
key = 'painter.btn.brush'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
if nodes.get(key) is None:
|
|
47
|
+
rb = QRadioButton(trans('painter.mode.paint'))
|
|
48
|
+
rb.setChecked(True)
|
|
49
|
+
rb.toggled.connect(self.window.controller.painter.common.set_brush_mode)
|
|
50
|
+
nodes[key] = rb
|
|
42
51
|
|
|
43
52
|
key = 'painter.btn.erase'
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
if nodes.get(key) is None:
|
|
54
|
+
rb = QRadioButton(trans('painter.mode.erase'))
|
|
55
|
+
rb.toggled.connect(self.window.controller.painter.common.set_erase_mode)
|
|
56
|
+
nodes[key] = rb
|
|
46
57
|
|
|
47
58
|
key = 'painter.select.brush.size'
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
if nodes.get(key) is None:
|
|
60
|
+
sizes = common.get_sizes()
|
|
61
|
+
cb = QComboBox()
|
|
62
|
+
cb.addItems(sizes)
|
|
63
|
+
cb.currentTextChanged.connect(common.change_brush_size)
|
|
64
|
+
cb.setMinimumContentsLength(10)
|
|
65
|
+
cb.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
|
66
|
+
nodes[key] = cb
|
|
55
67
|
|
|
56
68
|
key = 'painter.select.canvas.size'
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
if nodes.get(key) is None:
|
|
70
|
+
canvas_sizes = common.get_canvas_sizes()
|
|
71
|
+
cb = QComboBox()
|
|
72
|
+
cb.addItems(canvas_sizes)
|
|
73
|
+
cb.setMinimumContentsLength(20)
|
|
74
|
+
cb.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
|
75
|
+
cb.currentTextChanged.connect(common.change_canvas_size)
|
|
76
|
+
nodes[key] = cb
|
|
64
77
|
|
|
65
78
|
key = 'painter.select.brush.color'
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
if nodes.get(key) is None:
|
|
80
|
+
cb = QComboBox()
|
|
81
|
+
cb.setIconSize(QSize(16, 16))
|
|
82
|
+
colors = common.get_colors()
|
|
83
|
+
for color_name, color_value in colors.items():
|
|
84
|
+
pixmap = QPixmap(16, 16)
|
|
85
|
+
pixmap.fill(color_value)
|
|
86
|
+
icon = QIcon(pixmap)
|
|
87
|
+
cb.addItem(icon, color_name, color_value)
|
|
88
|
+
cb.currentTextChanged.connect(common.change_brush_color)
|
|
89
|
+
cb.setMinimumContentsLength(10)
|
|
90
|
+
cb.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
|
91
|
+
nodes[key] = cb
|
|
92
|
+
|
|
93
|
+
self._initialized = True
|
|
77
94
|
|
|
78
95
|
def setup(self) -> QWidget:
|
|
79
96
|
"""
|
|
@@ -81,7 +98,6 @@ class Painter:
|
|
|
81
98
|
|
|
82
99
|
:return: QWidget
|
|
83
100
|
"""
|
|
84
|
-
# build tab body
|
|
85
101
|
self.init()
|
|
86
102
|
body = self.window.core.tabs.from_layout(self.setup_painter())
|
|
87
103
|
body.append(self.window.ui.painter)
|
|
@@ -93,39 +109,51 @@ class Painter:
|
|
|
93
109
|
|
|
94
110
|
:return: QVBoxLayout
|
|
95
111
|
"""
|
|
112
|
+
ui = self.window.ui
|
|
113
|
+
nodes = ui.nodes
|
|
114
|
+
|
|
96
115
|
top = QHBoxLayout()
|
|
97
|
-
top.addWidget(
|
|
98
|
-
top.addWidget(
|
|
99
|
-
top.addWidget(
|
|
100
|
-
top.addWidget(
|
|
101
|
-
top.addWidget(
|
|
116
|
+
top.addWidget(nodes['painter.btn.brush'])
|
|
117
|
+
top.addWidget(nodes['painter.btn.erase'])
|
|
118
|
+
top.addWidget(nodes['painter.select.brush.size'])
|
|
119
|
+
top.addWidget(nodes['painter.select.brush.color'])
|
|
120
|
+
top.addWidget(nodes['painter.select.canvas.size'])
|
|
102
121
|
top.addStretch(1)
|
|
103
122
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
top.addWidget(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
if nodes.get('painter.btn.capture') is None:
|
|
124
|
+
btn = QPushButton(trans('painter.btn.capture'))
|
|
125
|
+
btn.clicked.connect(self.window.controller.painter.capture.use)
|
|
126
|
+
nodes['painter.btn.capture'] = btn
|
|
127
|
+
top.addWidget(nodes['painter.btn.capture'])
|
|
128
|
+
|
|
129
|
+
if nodes.get('painter.btn.camera.capture') is None:
|
|
130
|
+
btn = QPushButton(trans('painter.btn.camera.capture'))
|
|
131
|
+
btn.clicked.connect(self.window.controller.painter.capture.camera)
|
|
132
|
+
nodes['painter.btn.camera.capture'] = btn
|
|
133
|
+
top.addWidget(nodes['painter.btn.camera.capture'])
|
|
134
|
+
|
|
135
|
+
if nodes.get('painter.btn.clear') is None:
|
|
136
|
+
btn = QPushButton(trans('painter.btn.clear'))
|
|
137
|
+
btn.clicked.connect(ui.painter.clear_image)
|
|
138
|
+
nodes['painter.btn.clear'] = btn
|
|
139
|
+
top.addWidget(nodes['painter.btn.clear'])
|
|
140
|
+
|
|
141
|
+
if getattr(ui, 'painter_scroll', None) is None:
|
|
142
|
+
ui.painter_scroll = QScrollArea()
|
|
143
|
+
ui.painter_scroll.setWidget(ui.painter)
|
|
144
|
+
ui.painter_scroll.setWidgetResizable(True)
|
|
145
|
+
else:
|
|
146
|
+
if ui.painter_scroll.widget() is not ui.painter:
|
|
147
|
+
ui.painter_scroll.setWidget(ui.painter)
|
|
148
|
+
ui.painter_scroll.setWidgetResizable(True)
|
|
149
|
+
|
|
150
|
+
if nodes.get('tip.output.tab.draw') is None:
|
|
151
|
+
nodes['tip.output.tab.draw'] = HelpLabel(trans('tip.output.tab.draw'), self.window)
|
|
121
152
|
|
|
122
153
|
layout = QVBoxLayout()
|
|
123
154
|
layout.addLayout(top)
|
|
124
|
-
layout.addWidget(
|
|
125
|
-
layout.addWidget(
|
|
155
|
+
layout.addWidget(ui.painter_scroll)
|
|
156
|
+
layout.addWidget(nodes['tip.output.tab.draw'])
|
|
126
157
|
layout.setContentsMargins(0, 0, 0, 0)
|
|
127
158
|
|
|
128
|
-
return layout
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
159
|
+
return layout
|