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,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: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.24 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from PySide6.QtWidgets import QApplication
|
|
@@ -58,42 +58,45 @@ class BaseDialog(QDialog):
|
|
|
58
58
|
if self.window is None or self.id is None:
|
|
59
59
|
return False
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
config = self.window.core.config
|
|
62
|
+
if not config.has("layout.dialog.geometry.store") \
|
|
63
|
+
or not config.get("layout.dialog.geometry.store"):
|
|
63
64
|
return False
|
|
64
65
|
|
|
65
66
|
return True
|
|
66
67
|
|
|
67
68
|
def save_geometry(self):
|
|
68
69
|
"""Save dialog geometry"""
|
|
70
|
+
config = self.window.core.config
|
|
69
71
|
item = {
|
|
70
72
|
"size": [self.size().width(), self.size().height()],
|
|
71
73
|
"pos": [self.pos().x(), self.pos().y()]
|
|
72
74
|
}
|
|
73
75
|
if self.store_geometry_enabled():
|
|
74
|
-
data =
|
|
76
|
+
data = config.get("layout.dialog.geometry", {})
|
|
75
77
|
else:
|
|
76
|
-
data =
|
|
78
|
+
data = config.get_session("layout.dialog.geometry", {})
|
|
77
79
|
|
|
78
80
|
if not isinstance(data, dict):
|
|
79
81
|
data = {}
|
|
80
82
|
data[self.id] = item
|
|
81
83
|
|
|
82
84
|
if self.store_geometry_enabled():
|
|
83
|
-
|
|
85
|
+
config.set("layout.dialog.geometry", data)
|
|
84
86
|
else:
|
|
85
|
-
|
|
87
|
+
config.set_session("layout.dialog.geometry", data)
|
|
86
88
|
|
|
87
89
|
def restore_geometry(self):
|
|
88
90
|
"""Restore dialog geometry"""
|
|
89
91
|
# get available screen geometry
|
|
90
92
|
screen = QApplication.primaryScreen()
|
|
91
93
|
available_geometry = screen.availableGeometry()
|
|
94
|
+
config = self.window.core.config
|
|
92
95
|
|
|
93
96
|
if self.store_geometry_enabled():
|
|
94
|
-
data =
|
|
97
|
+
data = config.get("layout.dialog.geometry", {})
|
|
95
98
|
else:
|
|
96
|
-
data =
|
|
99
|
+
data = config.get_session("layout.dialog.geometry", {})
|
|
97
100
|
|
|
98
101
|
if not isinstance(data, dict):
|
|
99
102
|
data = {}
|
|
@@ -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:
|
|
9
|
+
# Updated Date: 2025.08.24 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import datetime
|
|
@@ -19,8 +19,6 @@ from PySide6.QtWidgets import QMenuBar
|
|
|
19
19
|
from pygpt_net.utils import trans
|
|
20
20
|
from .base import BaseDialog
|
|
21
21
|
|
|
22
|
-
import pygpt_net.icons_rc
|
|
23
|
-
|
|
24
22
|
class EditorFileDialog(BaseDialog):
|
|
25
23
|
def __init__(self, window=None, id="editor_file"):
|
|
26
24
|
"""
|
|
@@ -47,17 +45,16 @@ class EditorFileDialog(BaseDialog):
|
|
|
47
45
|
|
|
48
46
|
:param force: force update
|
|
49
47
|
"""
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if
|
|
48
|
+
file = self.file
|
|
49
|
+
changed = self.is_changed()
|
|
50
|
+
title = os.path.basename(file) if file else trans("untitled")
|
|
51
|
+
if changed:
|
|
54
52
|
title += "*"
|
|
55
|
-
if
|
|
56
|
-
file_size = self.window.core.filesystem.sizeof_fmt(os.path.getsize(
|
|
57
|
-
title += " - {}"
|
|
58
|
-
if
|
|
59
|
-
|
|
60
|
-
title += " (" + time + ")"
|
|
53
|
+
if file and os.path.exists(file):
|
|
54
|
+
file_size = self.window.core.filesystem.sizeof_fmt(os.path.getsize(file))
|
|
55
|
+
title += f" - {file_size}"
|
|
56
|
+
if changed or force:
|
|
57
|
+
title += f" ({datetime.datetime.now().strftime('%H:%M')})"
|
|
61
58
|
self.setWindowTitle(title)
|
|
62
59
|
|
|
63
60
|
def is_changed(self) -> bool:
|
|
@@ -66,7 +63,7 @@ class EditorFileDialog(BaseDialog):
|
|
|
66
63
|
|
|
67
64
|
:return: True if file was changed
|
|
68
65
|
"""
|
|
69
|
-
return
|
|
66
|
+
return self.window.ui.editor[self.id].toPlainText() != self.base_content
|
|
70
67
|
|
|
71
68
|
def setup_menu(self) -> QMenuBar:
|
|
72
69
|
"""
|
|
@@ -74,48 +71,48 @@ class EditorFileDialog(BaseDialog):
|
|
|
74
71
|
|
|
75
72
|
:return: menu bar
|
|
76
73
|
"""
|
|
77
|
-
self.menu_bar = QMenuBar()
|
|
74
|
+
self.menu_bar = QMenuBar(self)
|
|
78
75
|
self.file_menu = self.menu_bar.addMenu(trans("menu.file"))
|
|
79
76
|
self.actions = {}
|
|
80
77
|
|
|
81
78
|
# new
|
|
82
|
-
self.actions["new"] = QAction(QIcon(":/icons/add.svg"), trans("action.new"))
|
|
79
|
+
self.actions["new"] = QAction(QIcon(":/icons/add.svg"), trans("action.new"), self)
|
|
83
80
|
self.actions["new"].triggered.connect(
|
|
84
81
|
lambda: self.window.tools.get("editor").new()
|
|
85
82
|
)
|
|
86
83
|
|
|
87
84
|
# open
|
|
88
|
-
self.actions["open"] = QAction(QIcon(":/icons/folder.svg"), trans("action.open"))
|
|
85
|
+
self.actions["open"] = QAction(QIcon(":/icons/folder.svg"), trans("action.open"), self)
|
|
89
86
|
self.actions["open"].triggered.connect(
|
|
90
87
|
lambda: self.window.tools.get("editor").open_file(self.id, auto_close=True)
|
|
91
88
|
)
|
|
92
89
|
|
|
93
90
|
# open (new window)
|
|
94
|
-
self.actions["open_new"] = QAction(QIcon(":/icons/folder.svg"), trans("action.open_new_window"))
|
|
91
|
+
self.actions["open_new"] = QAction(QIcon(":/icons/folder.svg"), trans("action.open_new_window"), self)
|
|
95
92
|
self.actions["open_new"].triggered.connect(
|
|
96
93
|
lambda: self.window.tools.get("editor").open_file(self.id, auto_close=False)
|
|
97
94
|
)
|
|
98
95
|
|
|
99
96
|
# save
|
|
100
|
-
self.actions["save"] = QAction(QIcon(":/icons/save.svg"), trans("action.save"))
|
|
97
|
+
self.actions["save"] = QAction(QIcon(":/icons/save.svg"), trans("action.save"), self)
|
|
101
98
|
self.actions["save"].triggered.connect(
|
|
102
99
|
lambda: self.window.tools.get("editor").save(self.id)
|
|
103
100
|
)
|
|
104
101
|
|
|
105
102
|
# save as
|
|
106
|
-
self.actions["save_as"] = QAction(QIcon(":/icons/save.svg"), trans("action.save_as"))
|
|
103
|
+
self.actions["save_as"] = QAction(QIcon(":/icons/save.svg"), trans("action.save_as"), self)
|
|
107
104
|
self.actions["save_as"].triggered.connect(
|
|
108
105
|
lambda: self.window.tools.get("editor").save_as_file(self.id)
|
|
109
106
|
)
|
|
110
107
|
|
|
111
108
|
# clear
|
|
112
|
-
self.actions["clear"] = QAction(QIcon(":/icons/close.svg"), trans("action.clear"))
|
|
109
|
+
self.actions["clear"] = QAction(QIcon(":/icons/close.svg"), trans("action.clear"), self)
|
|
113
110
|
self.actions["clear"].triggered.connect(
|
|
114
111
|
lambda: self.window.tools.get("editor").clear(self.id)
|
|
115
112
|
)
|
|
116
113
|
|
|
117
114
|
# close
|
|
118
|
-
self.actions["exit"] = QAction(QIcon(":/icons/logout.svg"), trans("menu.file.exit"))
|
|
115
|
+
self.actions["exit"] = QAction(QIcon(":/icons/logout.svg"), trans("menu.file.exit"), self)
|
|
119
116
|
self.actions["exit"].triggered.connect(
|
|
120
117
|
lambda: self.window.tools.get("editor").close(self.id)
|
|
121
118
|
)
|
|
@@ -182,4 +179,4 @@ class EditorFileDialog(BaseDialog):
|
|
|
182
179
|
if self.id == "editor_file":
|
|
183
180
|
self.window.core.settings.active['editor'] = False
|
|
184
181
|
self.window.controller.settings.close('editor')
|
|
185
|
-
self.window.controller.settings.update()
|
|
182
|
+
self.window.controller.settings.update()
|
|
@@ -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:
|
|
9
|
+
# Updated Date: 2025.08.24 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from PySide6.QtCore import Qt
|
|
@@ -25,7 +25,7 @@ class FindDialog(QDialog):
|
|
|
25
25
|
:param window: main window
|
|
26
26
|
:param id: info window id
|
|
27
27
|
"""
|
|
28
|
-
super(
|
|
28
|
+
super().__init__(window)
|
|
29
29
|
self.window = window
|
|
30
30
|
self.id = id
|
|
31
31
|
self.current = None
|
|
@@ -34,29 +34,29 @@ class FindDialog(QDialog):
|
|
|
34
34
|
self.input.setMinimumWidth(400)
|
|
35
35
|
self.counter = HelpLabel('0/0')
|
|
36
36
|
self.counter.setAlignment(Qt.AlignCenter)
|
|
37
|
-
self.counter.
|
|
38
|
-
self.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
self.counter.setFixedWidth(70)
|
|
38
|
+
self.setWindowFlag(Qt.WindowStaysOnTopHint, True)
|
|
39
|
+
|
|
40
|
+
nodes = self.window.ui.nodes
|
|
41
|
+
nodes['dialog.find.input'] = self.input
|
|
42
|
+
nodes['dialog.find.counter'] = self.counter
|
|
43
|
+
|
|
44
|
+
btn_clear = QPushButton(trans('dialog.find.btn.clear'))
|
|
45
|
+
btn_clear.clicked.connect(self.window.controller.finder.clear_input)
|
|
46
|
+
nodes['dialog.find.btn.clear'] = btn_clear
|
|
47
|
+
|
|
48
|
+
btn_prev = QPushButton(trans('dialog.find.btn.find_prev'))
|
|
49
|
+
btn_prev.clicked.connect(self.window.controller.finder.prev)
|
|
50
|
+
nodes['dialog.find.btn.find_prev'] = btn_prev
|
|
51
|
+
|
|
52
|
+
btn_next = QPushButton(trans('dialog.find.btn.find_next'))
|
|
53
|
+
btn_next.clicked.connect(self.window.controller.finder.next)
|
|
54
|
+
nodes['dialog.find.btn.find_next'] = btn_next
|
|
55
55
|
|
|
56
56
|
bottom = QHBoxLayout()
|
|
57
|
-
bottom.addWidget(
|
|
58
|
-
bottom.addWidget(
|
|
59
|
-
bottom.addWidget(
|
|
57
|
+
bottom.addWidget(btn_clear)
|
|
58
|
+
bottom.addWidget(btn_prev)
|
|
59
|
+
bottom.addWidget(btn_next)
|
|
60
60
|
|
|
61
61
|
input_layout = QHBoxLayout()
|
|
62
62
|
input_layout.addWidget(self.input)
|
|
@@ -84,5 +84,6 @@ class FindDialog(QDialog):
|
|
|
84
84
|
:param event: key press event
|
|
85
85
|
"""
|
|
86
86
|
if event.key() == Qt.Key_Escape:
|
|
87
|
-
self.window.controller.finder.close(reset=False)
|
|
88
87
|
self.close()
|
|
88
|
+
return
|
|
89
|
+
super().keyPressEvent(event)
|
|
@@ -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:
|
|
9
|
+
# Updated Date: 2025.08.24 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from PySide6 import QtCore
|
|
@@ -15,7 +15,6 @@ from PySide6.QtWidgets import QDialog, QPushButton, QHBoxLayout, QLabel, QVBoxLa
|
|
|
15
15
|
|
|
16
16
|
from pygpt_net.utils import trans
|
|
17
17
|
from .base import BaseDialog
|
|
18
|
-
from ..element.labels import HelpLabel
|
|
19
18
|
from ..option.input import DirectoryInput
|
|
20
19
|
|
|
21
20
|
|
|
@@ -27,7 +26,7 @@ class ProfileDialog(BaseDialog):
|
|
|
27
26
|
:param window: main window
|
|
28
27
|
:param id: settings id
|
|
29
28
|
"""
|
|
30
|
-
super(
|
|
29
|
+
super().__init__(window, id)
|
|
31
30
|
self.window = window
|
|
32
31
|
self.id = id
|
|
33
32
|
|
|
@@ -39,7 +38,7 @@ class ProfileDialog(BaseDialog):
|
|
|
39
38
|
"""
|
|
40
39
|
self.window.controller.settings.profile.dialog = False
|
|
41
40
|
self.window.controller.settings.profile.update_menu()
|
|
42
|
-
super(
|
|
41
|
+
super().closeEvent(event)
|
|
43
42
|
|
|
44
43
|
def keyPressEvent(self, event):
|
|
45
44
|
"""
|
|
@@ -48,10 +47,9 @@ class ProfileDialog(BaseDialog):
|
|
|
48
47
|
:param event: key press event
|
|
49
48
|
"""
|
|
50
49
|
if event.key() == Qt.Key_Escape:
|
|
51
|
-
self.
|
|
52
|
-
self.close() # close dialog when the Esc key is pressed.
|
|
50
|
+
self.close()
|
|
53
51
|
else:
|
|
54
|
-
super(
|
|
52
|
+
super().keyPressEvent(event)
|
|
55
53
|
|
|
56
54
|
def cleanup(self):
|
|
57
55
|
"""
|
|
@@ -61,7 +59,6 @@ class ProfileDialog(BaseDialog):
|
|
|
61
59
|
self.window.controller.settings.profile.update_menu()
|
|
62
60
|
|
|
63
61
|
|
|
64
|
-
|
|
65
62
|
class ProfileEditDialog(QDialog):
|
|
66
63
|
def __init__(self, window=None, id=None):
|
|
67
64
|
"""
|
|
@@ -69,7 +66,7 @@ class ProfileEditDialog(QDialog):
|
|
|
69
66
|
|
|
70
67
|
:param window: main window
|
|
71
68
|
"""
|
|
72
|
-
super(
|
|
69
|
+
super().__init__(window)
|
|
73
70
|
self.window = window
|
|
74
71
|
self.id = id
|
|
75
72
|
self.uuid = None
|
|
@@ -77,29 +74,25 @@ class ProfileEditDialog(QDialog):
|
|
|
77
74
|
self.name = ""
|
|
78
75
|
self.mode = "create" # create | update
|
|
79
76
|
self.input = ProfileNameInput(window, id)
|
|
77
|
+
self.input.setParent(self)
|
|
80
78
|
self.input.setMinimumWidth(400)
|
|
81
79
|
|
|
82
|
-
self.window.ui.nodes
|
|
83
|
-
self.window.ui.nodes['dialog.profile.item.btn.update'].clicked.connect(
|
|
84
|
-
lambda: self.window.controller.settings.profile.handle_update(
|
|
85
|
-
self.mode,
|
|
86
|
-
self.input.text(),
|
|
87
|
-
self.workdir.text(),
|
|
88
|
-
self.uuid,
|
|
89
|
-
)
|
|
90
|
-
)
|
|
80
|
+
nodes = self.window.ui.nodes
|
|
91
81
|
|
|
92
|
-
self.
|
|
93
|
-
self.
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
self.btn_update = QPushButton(trans('dialog.profile.item.btn.update'), self)
|
|
83
|
+
self.btn_update.clicked.connect(self._on_update_clicked)
|
|
84
|
+
nodes['dialog.profile.item.btn.update'] = self.btn_update
|
|
85
|
+
|
|
86
|
+
self.btn_dismiss = QPushButton(trans('dialog.profile.item.btn.dismiss'), self)
|
|
87
|
+
self.btn_dismiss.clicked.connect(self._on_dismiss_clicked)
|
|
88
|
+
nodes['dialog.profile.item.btn.dismiss'] = self.btn_dismiss
|
|
96
89
|
|
|
97
90
|
bottom = QHBoxLayout()
|
|
98
|
-
bottom.addWidget(
|
|
99
|
-
bottom.addWidget(
|
|
91
|
+
bottom.addWidget(nodes['dialog.profile.item.btn.dismiss'])
|
|
92
|
+
bottom.addWidget(nodes['dialog.profile.item.btn.update'])
|
|
100
93
|
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
nodes['dialog.profile.name.label'] = QLabel(trans("dialog.profile.name.label"), self)
|
|
95
|
+
nodes['dialog.profile.workdir.label'] = QLabel(trans("dialog.profile.workdir.label"), self)
|
|
103
96
|
|
|
104
97
|
option = {
|
|
105
98
|
'type': 'text',
|
|
@@ -107,42 +100,56 @@ class ProfileEditDialog(QDialog):
|
|
|
107
100
|
'value': "",
|
|
108
101
|
}
|
|
109
102
|
self.workdir = DirectoryInput(self.window, 'profile', 'item', option)
|
|
103
|
+
self.workdir.setParent(self)
|
|
110
104
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
self.window.ui.nodes['dialog.profile.checkbox.db'] = QCheckBox(trans("dialog.profile.checkbox.include_db"))
|
|
114
|
-
self.window.ui.nodes['dialog.profile.checkbox.db'].setChecked(True)
|
|
115
|
-
self.window.ui.nodes['dialog.profile.checkbox.data'] = QCheckBox(trans("dialog.profile.checkbox.include_datadir"))
|
|
116
|
-
self.window.ui.nodes['dialog.profile.checkbox.data'].setChecked(True)
|
|
105
|
+
nodes['dialog.profile.checkbox.switch'] = QCheckBox(trans("dialog.profile.checkbox.switch"), self)
|
|
106
|
+
nodes['dialog.profile.checkbox.switch'].setChecked(True)
|
|
117
107
|
|
|
118
|
-
|
|
108
|
+
self.checkboxes = QWidget(self)
|
|
119
109
|
checkboxes_layout = QHBoxLayout()
|
|
120
110
|
checkboxes_layout.setContentsMargins(0, 0, 0, 0)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
|
|
112
|
+
nodes['dialog.profile.checkbox.db'] = QCheckBox(trans("dialog.profile.checkbox.include_db"), self.checkboxes)
|
|
113
|
+
nodes['dialog.profile.checkbox.db'].setChecked(True)
|
|
114
|
+
nodes['dialog.profile.checkbox.data'] = QCheckBox(trans("dialog.profile.checkbox.include_datadir"), self.checkboxes)
|
|
115
|
+
nodes['dialog.profile.checkbox.data'].setChecked(True)
|
|
116
|
+
|
|
117
|
+
checkboxes_layout.addWidget(nodes['dialog.profile.checkbox.db'])
|
|
118
|
+
checkboxes_layout.addWidget(nodes['dialog.profile.checkbox.data'])
|
|
124
119
|
self.checkboxes.setLayout(checkboxes_layout)
|
|
125
120
|
|
|
126
121
|
layout = QVBoxLayout()
|
|
127
|
-
layout.addWidget(
|
|
122
|
+
layout.addWidget(nodes['dialog.profile.name.label'])
|
|
128
123
|
layout.addWidget(self.input)
|
|
129
|
-
layout.addWidget(
|
|
124
|
+
layout.addWidget(nodes['dialog.profile.workdir.label'])
|
|
130
125
|
layout.addWidget(self.workdir)
|
|
131
126
|
layout.addWidget(self.checkboxes)
|
|
132
|
-
layout.addWidget(
|
|
127
|
+
layout.addWidget(nodes['dialog.profile.checkbox.switch'])
|
|
133
128
|
layout.addLayout(bottom)
|
|
134
129
|
|
|
135
130
|
self.setLayout(layout)
|
|
136
131
|
|
|
132
|
+
def _on_update_clicked(self):
|
|
133
|
+
self.window.controller.settings.profile.handle_update(
|
|
134
|
+
self.mode,
|
|
135
|
+
self.input.text(),
|
|
136
|
+
self.workdir.text(),
|
|
137
|
+
self.uuid,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
def _on_dismiss_clicked(self):
|
|
141
|
+
self.window.controller.settings.profile.dismiss_update()
|
|
142
|
+
|
|
137
143
|
def prepare(self):
|
|
138
144
|
"""Prepare dialog before show"""
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
mapping = {
|
|
146
|
+
'create': 'dialog.profile.item.btn.create',
|
|
147
|
+
'edit': 'dialog.profile.item.btn.update',
|
|
148
|
+
'duplicate': 'dialog.profile.item.btn.duplicate',
|
|
149
|
+
}
|
|
150
|
+
key = mapping.get(self.mode)
|
|
151
|
+
if key:
|
|
152
|
+
self.window.ui.nodes['dialog.profile.item.btn.update'].setText(trans(key))
|
|
146
153
|
self.workdir.setText(self.path)
|
|
147
154
|
|
|
148
155
|
|
|
@@ -154,8 +161,7 @@ class ProfileNameInput(QLineEdit):
|
|
|
154
161
|
:param window: main window
|
|
155
162
|
:param id: info window id
|
|
156
163
|
"""
|
|
157
|
-
super(
|
|
158
|
-
|
|
164
|
+
super().__init__(window)
|
|
159
165
|
self.window = window
|
|
160
166
|
self.id = id
|
|
161
167
|
|
|
@@ -165,13 +171,11 @@ class ProfileNameInput(QLineEdit):
|
|
|
165
171
|
|
|
166
172
|
:param event: key event
|
|
167
173
|
"""
|
|
168
|
-
super(
|
|
169
|
-
|
|
170
|
-
# save on Enter
|
|
171
|
-
if event.key() == QtCore.Qt.Key_Return or event.key() == QtCore.Qt.Key_Enter:
|
|
174
|
+
super().keyPressEvent(event)
|
|
175
|
+
if event.key() in (Qt.Key_Return, Qt.Key_Enter):
|
|
172
176
|
self.window.controller.settings.profile.handle_update(
|
|
173
177
|
self.window.ui.dialog['profile.item'].mode,
|
|
174
178
|
self.window.ui.dialog['profile.item'].input.text(),
|
|
175
179
|
self.window.ui.dialog['profile.item'].workdir.text(),
|
|
176
180
|
self.window.ui.dialog['profile.item'].uuid,
|
|
177
|
-
)
|
|
181
|
+
)
|