pygpt-net 2.4.39__py3-none-any.whl → 2.4.40__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 +13 -0
- README.md +19 -2
- pygpt_net/CHANGELOG.txt +13 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/controller/__init__.py +5 -3
- pygpt_net/controller/audio/__init__.py +9 -1
- pygpt_net/controller/chat/input.py +2 -1
- pygpt_net/controller/chat/render.py +2 -2
- pygpt_net/controller/ctx/__init__.py +2 -2
- pygpt_net/controller/debug/__init__.py +13 -2
- pygpt_net/controller/kernel/__init__.py +2 -1
- pygpt_net/controller/notepad.py +7 -6
- pygpt_net/controller/theme/nodes.py +2 -5
- pygpt_net/controller/tools/__init__.py +37 -1
- pygpt_net/controller/ui/__init__.py +1 -5
- pygpt_net/controller/ui/tabs.py +104 -12
- pygpt_net/core/command.py +3 -1
- pygpt_net/core/ctx/__init__.py +6 -2
- pygpt_net/core/ctx/container.py +5 -5
- pygpt_net/core/debug/tabs.py +3 -1
- pygpt_net/core/render/base.py +2 -2
- pygpt_net/core/render/web/body.py +1 -1
- pygpt_net/core/render/web/renderer.py +208 -38
- pygpt_net/core/tabs/__init__.py +104 -43
- pygpt_net/core/tabs/tab.py +4 -1
- pygpt_net/core/web.py +127 -1
- pygpt_net/data/config/config.json +4 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/modes.json +3 -3
- pygpt_net/data/css/web-blocks.css +18 -0
- pygpt_net/data/css/web-blocks.light.css +7 -0
- pygpt_net/data/css/web-chatgpt.css +8 -0
- pygpt_net/data/css/web-chatgpt_wide.css +8 -0
- pygpt_net/data/icons/split_screen.svg +1 -0
- pygpt_net/data/locale/locale.de.ini +1 -1
- pygpt_net/data/locale/locale.en.ini +4 -2
- pygpt_net/data/locale/locale.es.ini +1 -1
- pygpt_net/data/locale/locale.fr.ini +1 -1
- pygpt_net/data/locale/locale.it.ini +1 -1
- pygpt_net/data/locale/locale.pl.ini +2 -2
- pygpt_net/data/locale/locale.uk.ini +1 -1
- pygpt_net/data/locale/locale.zh.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.de.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.en.ini +20 -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/icons.qrc +1 -0
- pygpt_net/icons_rc.py +165 -136
- pygpt_net/item/ctx.py +46 -24
- pygpt_net/plugin/audio_output/__init__.py +4 -1
- pygpt_net/plugin/base/plugin.py +18 -4
- pygpt_net/plugin/cmd_code_interpreter/__init__.py +39 -37
- pygpt_net/plugin/cmd_code_interpreter/runner.py +25 -12
- pygpt_net/plugin/cmd_web/__init__.py +46 -6
- pygpt_net/plugin/cmd_web/config.py +74 -48
- pygpt_net/plugin/cmd_web/websearch.py +61 -28
- pygpt_net/plugin/cmd_web/worker.py +79 -13
- pygpt_net/provider/core/config/patch.py +22 -1
- pygpt_net/tools/__init__.py +9 -1
- pygpt_net/tools/base.py +15 -1
- pygpt_net/tools/code_interpreter/__init__.py +174 -75
- 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 +78 -23
- pygpt_net/tools/html_canvas/ui/dialogs.py +46 -62
- pygpt_net/tools/html_canvas/ui/widgets.py +96 -3
- pygpt_net/ui/base/context_menu.py +2 -2
- pygpt_net/ui/layout/ctx/ctx_list.py +13 -4
- pygpt_net/ui/layout/toolbox/footer.py +1 -1
- pygpt_net/ui/main.py +2 -2
- pygpt_net/ui/menu/debug.py +11 -1
- pygpt_net/ui/widget/filesystem/explorer.py +2 -2
- pygpt_net/ui/widget/lists/context.py +26 -5
- pygpt_net/ui/widget/tabs/Input.py +2 -2
- pygpt_net/ui/widget/tabs/body.py +2 -1
- pygpt_net/ui/widget/tabs/output.py +126 -61
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/METADATA +20 -3
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/RECORD +85 -84
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/entry_points.txt +0 -0
@@ -6,29 +6,32 @@
|
|
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 23:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import re
|
13
13
|
|
14
14
|
from PySide6.QtCore import Qt
|
15
15
|
from PySide6.QtGui import QAction, QIcon
|
16
|
-
from PySide6.QtWidgets import
|
16
|
+
from PySide6.QtWidgets import QMenuBar, QVBoxLayout
|
17
17
|
|
18
|
-
from pygpt_net.tools.html_canvas.ui.widgets import CanvasOutput, CanvasEdit
|
19
18
|
from pygpt_net.ui.widget.dialog.base import BaseDialog
|
20
|
-
from pygpt_net.ui.widget.element.labels import HelpLabel
|
21
|
-
from pygpt_net.ui.widget.textarea.html import CustomWebEnginePage
|
22
19
|
from pygpt_net.utils import trans
|
23
20
|
|
24
|
-
|
25
|
-
|
21
|
+
from .widgets import ToolWidget
|
22
|
+
|
23
|
+
class Tool:
|
24
|
+
def __init__(self, window=None, tool=None):
|
26
25
|
"""
|
27
26
|
HTML/JS canvas dialog
|
28
27
|
|
29
28
|
:param window: Window instance
|
29
|
+
:param tool: Tool instance
|
30
30
|
"""
|
31
31
|
self.window = window
|
32
|
+
self.tool = tool # tool instance
|
33
|
+
self.widget = ToolWidget(window, tool)
|
34
|
+
self.layout = None
|
32
35
|
self.menu_bar = None
|
33
36
|
self.menu = {}
|
34
37
|
self.actions = {} # menu actions
|
@@ -45,20 +48,20 @@ class Canvas:
|
|
45
48
|
|
46
49
|
self.actions["file.open"] = QAction(QIcon(":/icons/folder.svg"), trans("tool.html_canvas.menu.file.open"))
|
47
50
|
self.actions["file.open"].triggered.connect(
|
48
|
-
lambda: self.
|
51
|
+
lambda: self.tool.open_file()
|
49
52
|
)
|
50
53
|
self.actions["file.save_as"] = QAction(QIcon(":/icons/save.svg"), trans("tool.html_canvas.menu.file.save_as"))
|
51
54
|
self.actions["file.save_as"].triggered.connect(
|
52
|
-
lambda: self.
|
53
|
-
re.sub(r'\n{2,}', '\n\n', self.
|
55
|
+
lambda: self.widget.output.signals.save_as.emit(
|
56
|
+
re.sub(r'\n{2,}', '\n\n', self.widget.output.html_content), 'html')
|
54
57
|
)
|
55
58
|
self.actions["file.reload"] = QAction(QIcon(":/icons/reload.svg"), trans("tool.html_canvas.menu.file.reload"))
|
56
59
|
self.actions["file.reload"].triggered.connect(
|
57
|
-
lambda: self.
|
60
|
+
lambda: self.tool.reload_output()
|
58
61
|
)
|
59
62
|
self.actions["file.clear"] = QAction(QIcon(":/icons/close.svg"), trans("tool.html_canvas.menu.file.clear"))
|
60
63
|
self.actions["file.clear"].triggered.connect(
|
61
|
-
lambda: self.
|
64
|
+
lambda: self.tool.clear()
|
62
65
|
)
|
63
66
|
|
64
67
|
# add actions
|
@@ -70,61 +73,44 @@ class Canvas:
|
|
70
73
|
|
71
74
|
def setup(self):
|
72
75
|
"""Setup canvas dialog"""
|
73
|
-
self.
|
74
|
-
self.
|
75
|
-
CustomWebEnginePage(self.window, self.window.ui.nodes['html_canvas.output'])
|
76
|
-
)
|
77
|
-
self.window.ui.nodes['html_canvas.edit'] = CanvasEdit(self.window)
|
78
|
-
self.window.ui.nodes['html_canvas.edit'].setVisible(False)
|
79
|
-
self.window.ui.nodes['html_canvas.edit'].textChanged.connect(
|
80
|
-
lambda: self.window.tools.get("html_canvas").save_output()
|
81
|
-
)
|
82
|
-
|
83
|
-
# edit checkbox
|
84
|
-
self.window.ui.nodes['html_canvas.btn.edit'] = QCheckBox(trans("html_canvas.btn.edit"))
|
85
|
-
self.window.ui.nodes['html_canvas.btn.edit'].stateChanged.connect(
|
86
|
-
lambda: self.window.tools.get("html_canvas").toggle_edit()
|
87
|
-
)
|
88
|
-
|
89
|
-
path = self.window.tools.get("html_canvas").get_current_path()
|
90
|
-
path_label = HelpLabel(path)
|
91
|
-
path_label.setMaximumHeight(30)
|
92
|
-
path_label.setAlignment(Qt.AlignRight)
|
76
|
+
self.layout = self.widget.setup()
|
77
|
+
self.layout.setMenuBar(self.setup_menu()) # add menu bar
|
93
78
|
|
94
|
-
|
95
|
-
|
96
|
-
|
79
|
+
id = self.tool.get_dialog_id()
|
80
|
+
dialog = ToolDialog(window=self.window, tool=self.tool)
|
81
|
+
dialog.setLayout(self.layout)
|
82
|
+
dialog.setWindowTitle(trans("dialog.html_canvas.title"))
|
83
|
+
dialog.resize(800, 500)
|
84
|
+
self.window.ui.dialog[id] = dialog
|
97
85
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
output_layout.setContentsMargins(0, 0, 0, 0)
|
86
|
+
def get_widget(self) -> ToolWidget:
|
87
|
+
"""
|
88
|
+
Get widget
|
102
89
|
|
103
|
-
|
104
|
-
|
105
|
-
self.
|
90
|
+
:return: ToolWidget
|
91
|
+
"""
|
92
|
+
return self.widget
|
106
93
|
|
107
|
-
|
108
|
-
|
109
|
-
layout
|
110
|
-
layout.addLayout(bottom_layout)
|
94
|
+
def get_tab(self) -> QVBoxLayout:
|
95
|
+
"""
|
96
|
+
Get layout
|
111
97
|
|
112
|
-
|
113
|
-
|
114
|
-
self.
|
115
|
-
self.window.ui.dialog['html_canvas'].resize(800, 500)
|
98
|
+
:return: QVBoxLayout
|
99
|
+
"""
|
100
|
+
return self.layout
|
116
101
|
|
117
102
|
|
118
|
-
class
|
119
|
-
def __init__(self, window=None, id="html_canvas"):
|
103
|
+
class ToolDialog(BaseDialog):
|
104
|
+
def __init__(self, window=None, id="html_canvas", tool=None):
|
120
105
|
"""
|
121
106
|
HTML canvas dialog
|
122
107
|
|
123
108
|
:param window: main window
|
124
109
|
:param id: logger id
|
125
110
|
"""
|
126
|
-
super(
|
111
|
+
super(ToolDialog, self).__init__(window, id)
|
127
112
|
self.window = window
|
113
|
+
self.tool = tool
|
128
114
|
|
129
115
|
def closeEvent(self, event):
|
130
116
|
"""
|
@@ -133,7 +119,7 @@ class CanvasDialog(BaseDialog):
|
|
133
119
|
:param event: close event
|
134
120
|
"""
|
135
121
|
self.cleanup()
|
136
|
-
super(
|
122
|
+
super(ToolDialog, self).closeEvent(event)
|
137
123
|
|
138
124
|
def keyPressEvent(self, event):
|
139
125
|
"""
|
@@ -145,14 +131,12 @@ class CanvasDialog(BaseDialog):
|
|
145
131
|
self.cleanup()
|
146
132
|
self.close() # close dialog when the Esc key is pressed.
|
147
133
|
else:
|
148
|
-
super(
|
134
|
+
super(ToolDialog, self).keyPressEvent(event)
|
149
135
|
|
150
136
|
def cleanup(self):
|
151
|
-
"""
|
152
|
-
|
153
|
-
"""
|
154
|
-
if self.window is None:
|
137
|
+
"""Cleanup on close"""
|
138
|
+
if self.window is None or self.tool is None:
|
155
139
|
return
|
156
|
-
self.
|
157
|
-
self.
|
158
|
-
self.
|
140
|
+
self.tool.opened = False
|
141
|
+
self.tool.close()
|
142
|
+
self.tool.update()
|
@@ -6,13 +6,101 @@
|
|
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 23:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from PySide6.QtCore import Qt, Slot, QUrl, QObject, Signal
|
13
|
+
from PySide6.QtWidgets import QVBoxLayout, QCheckBox, QHBoxLayout
|
14
|
+
|
15
|
+
from pygpt_net.ui.widget.element.labels import HelpLabel
|
12
16
|
from pygpt_net.ui.widget.textarea.editor import BaseCodeEditor
|
13
|
-
from pygpt_net.ui.widget.textarea.html import HtmlOutput
|
17
|
+
from pygpt_net.ui.widget.textarea.html import HtmlOutput, CustomWebEnginePage
|
14
18
|
|
15
19
|
import pygpt_net.icons_rc
|
20
|
+
from pygpt_net.utils import trans
|
21
|
+
|
22
|
+
|
23
|
+
class ToolWidget:
|
24
|
+
def __init__(self, window=None, tool=None):
|
25
|
+
"""
|
26
|
+
HTML/JS canvas widget
|
27
|
+
|
28
|
+
:param window: Window instance
|
29
|
+
:param tool: Tool instance
|
30
|
+
"""
|
31
|
+
self.window = window
|
32
|
+
self.tool = tool # tool instance
|
33
|
+
self.output = None # canvas output
|
34
|
+
self.edit = None # canvas edit
|
35
|
+
self.btn_edit = None # edit checkbox
|
36
|
+
|
37
|
+
def setup(self) -> QVBoxLayout:
|
38
|
+
"""
|
39
|
+
Setup widget body
|
40
|
+
|
41
|
+
:return: QVBoxLayout
|
42
|
+
"""
|
43
|
+
self.output = CanvasOutput(self.window)
|
44
|
+
self.output.setPage(
|
45
|
+
CustomWebEnginePage(self.window, self.output)
|
46
|
+
)
|
47
|
+
self.edit = CanvasEdit(self.window)
|
48
|
+
self.edit.setVisible(False)
|
49
|
+
self.edit.textChanged.connect(
|
50
|
+
lambda: self.tool.save_output()
|
51
|
+
)
|
52
|
+
|
53
|
+
# edit checkbox
|
54
|
+
self.btn_edit = QCheckBox(trans("html_canvas.btn.edit"))
|
55
|
+
self.btn_edit.stateChanged.connect(
|
56
|
+
lambda: self.tool.toggle_edit(self)
|
57
|
+
)
|
58
|
+
|
59
|
+
path = self.tool.get_current_path()
|
60
|
+
path_label = HelpLabel(path)
|
61
|
+
path_label.setMaximumHeight(30)
|
62
|
+
path_label.setAlignment(Qt.AlignRight)
|
63
|
+
|
64
|
+
bottom_layout = QHBoxLayout()
|
65
|
+
bottom_layout.addWidget(self.btn_edit)
|
66
|
+
bottom_layout.addWidget(path_label)
|
67
|
+
|
68
|
+
output_layout = QVBoxLayout()
|
69
|
+
output_layout.addWidget(self.output)
|
70
|
+
output_layout.addWidget(self.edit)
|
71
|
+
output_layout.setContentsMargins(0, 0, 0, 0)
|
72
|
+
|
73
|
+
# connect signals
|
74
|
+
self.output.signals.save_as.connect(
|
75
|
+
self.tool.handle_save_as)
|
76
|
+
self.output.signals.audio_read.connect(
|
77
|
+
self.window.controller.chat.render.handle_audio_read)
|
78
|
+
|
79
|
+
self.tool.signals.update.connect(self.set_output)
|
80
|
+
self.tool.signals.reload.connect(self.load_output)
|
81
|
+
|
82
|
+
layout = QVBoxLayout()
|
83
|
+
layout.addLayout(output_layout)
|
84
|
+
layout.addLayout(bottom_layout)
|
85
|
+
return layout
|
86
|
+
|
87
|
+
@Slot(str)
|
88
|
+
def set_output(self, content: str):
|
89
|
+
"""
|
90
|
+
Set output content
|
91
|
+
|
92
|
+
:param content: Content
|
93
|
+
"""
|
94
|
+
self.edit.setPlainText(content)
|
95
|
+
|
96
|
+
@Slot(str)
|
97
|
+
def load_output(self, path: str):
|
98
|
+
"""
|
99
|
+
Load output content
|
100
|
+
|
101
|
+
:param path: Content
|
102
|
+
"""
|
103
|
+
self.output.setUrl(QUrl().fromLocalFile(path))
|
16
104
|
|
17
105
|
class CanvasOutput(HtmlOutput):
|
18
106
|
def __init__(self, window=None):
|
@@ -39,4 +127,9 @@ class CanvasEdit(BaseCodeEditor):
|
|
39
127
|
self.min_font_size = 8
|
40
128
|
self.setProperty('class', 'interpreter-output')
|
41
129
|
self.default_stylesheet = ""
|
42
|
-
self.setStyleSheet(self.default_stylesheet)
|
130
|
+
self.setStyleSheet(self.default_stylesheet)
|
131
|
+
|
132
|
+
|
133
|
+
class ToolSignals(QObject):
|
134
|
+
update = Signal(str) # data
|
135
|
+
reload = Signal(str) # path
|
@@ -6,13 +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.12 04:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtWidgets import QMenu
|
13
13
|
from PySide6.QtGui import QAction, QIcon
|
14
14
|
|
15
|
-
from pygpt_net.core.tabs import Tab
|
15
|
+
from pygpt_net.core.tabs.tab import Tab
|
16
16
|
from pygpt_net.utils import trans
|
17
17
|
import pygpt_net.icons_rc
|
18
18
|
|
@@ -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.12 04:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6 import QtCore
|
@@ -211,10 +211,19 @@ class CtxList:
|
|
211
211
|
item.dt = dt
|
212
212
|
item.isPinned = data.important
|
213
213
|
item.setData(tooltip_text, QtCore.Qt.ToolTipRole)
|
214
|
+
is_important = False
|
215
|
+
is_attachment = False
|
216
|
+
label = data.label
|
214
217
|
if data.important:
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
+
is_important = True
|
219
|
+
if data.additional_ctx and len(data.additional_ctx) > 0:
|
220
|
+
is_attachment = True
|
221
|
+
custom_data = {
|
222
|
+
"label": label,
|
223
|
+
"is_important": is_important,
|
224
|
+
"is_attachment": is_attachment,
|
225
|
+
}
|
226
|
+
item.setData(custom_data, QtCore.Qt.ItemDataRole.UserRole)
|
218
227
|
item.setData(name)
|
219
228
|
return item
|
220
229
|
|
@@ -77,7 +77,7 @@ class Footer:
|
|
77
77
|
rows.setContentsMargins(2, 0, 0, 0)
|
78
78
|
|
79
79
|
self.window.ui.nodes['layout.split'] = ToggleLabel(trans('layout.split'), label_position="left",
|
80
|
-
icon=":/icons/
|
80
|
+
icon=":/icons/split_screen.svg")
|
81
81
|
self.window.ui.nodes['layout.split'].box.stateChanged.connect(
|
82
82
|
lambda: self.window.controller.ui.tabs.toggle_split_screen(self.window.ui.nodes['layout.split'].box.isChecked())
|
83
83
|
)
|
pygpt_net/ui/main.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 23:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
@@ -192,8 +192,8 @@ class MainWindow(QMainWindow, QtStyleTools):
|
|
192
192
|
|
193
193
|
def setup(self):
|
194
194
|
"""Setup app"""
|
195
|
-
self.controller.setup()
|
196
195
|
self.tools.setup()
|
196
|
+
self.controller.setup()
|
197
197
|
self.controller.plugins.setup()
|
198
198
|
self.controller.post_setup()
|
199
199
|
|
pygpt_net/ui/menu/debug.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.13 19:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtGui import QAction
|
@@ -41,6 +41,7 @@ class Debug:
|
|
41
41
|
self.window.ui.menu['debug.logger'] = QAction(trans("menu.debug.logger"), self.window, checkable=True)
|
42
42
|
self.window.ui.menu['debug.app.log'] = QAction(trans("menu.debug.app.log"), self.window, checkable=True)
|
43
43
|
self.window.ui.menu['debug.kernel'] = QAction(trans("menu.debug.kernel"), self.window, checkable=True)
|
44
|
+
self.window.ui.menu['debug.render'] = QAction(trans("menu.debug.render"), self.window, checkable=True)
|
44
45
|
|
45
46
|
self.window.ui.menu['debug.config'].triggered.connect(
|
46
47
|
lambda: self.window.controller.debug.toggle('config'))
|
@@ -74,9 +75,12 @@ class Debug:
|
|
74
75
|
lambda: self.window.controller.debug.toggle('db'))
|
75
76
|
self.window.ui.menu['debug.kernel'].triggered.connect(
|
76
77
|
lambda: self.window.controller.debug.toggle('kernel'))
|
78
|
+
self.window.ui.menu['debug.render'].triggered.connect(
|
79
|
+
lambda: self.window.controller.debug.toggle_render())
|
77
80
|
|
78
81
|
self.window.ui.menu['menu.debug'] = self.window.menuBar().addMenu(trans("menu.debug"))
|
79
82
|
self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.logger'])
|
83
|
+
self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.render'])
|
80
84
|
self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.db'])
|
81
85
|
self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.app.log'])
|
82
86
|
self.window.ui.menu['menu.debug'].addSeparator()
|
@@ -94,4 +98,10 @@ class Debug:
|
|
94
98
|
self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.tabs'])
|
95
99
|
self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.ui'])
|
96
100
|
|
101
|
+
# restore state
|
102
|
+
if self.window.core.config.get('debug.render'):
|
103
|
+
self.window.ui.menu['debug.render'].setChecked(True)
|
104
|
+
else:
|
105
|
+
self.window.ui.menu['debug.render'].setChecked(False)
|
106
|
+
|
97
107
|
|
@@ -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.12 04:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
@@ -17,7 +17,7 @@ from PySide6.QtGui import QAction, QIcon, QCursor, QResizeEvent
|
|
17
17
|
from PySide6.QtWidgets import QTreeView, QMenu, QWidget, QVBoxLayout, QFileSystemModel, QLabel, QHBoxLayout, \
|
18
18
|
QPushButton, QSizePolicy
|
19
19
|
|
20
|
-
from pygpt_net.core.tabs import Tab
|
20
|
+
from pygpt_net.core.tabs.tab import Tab
|
21
21
|
from pygpt_net.ui.widget.element.button import ContextMenuButton
|
22
22
|
from pygpt_net.ui.widget.element.labels import HelpLabel
|
23
23
|
from pygpt_net.utils import trans
|
@@ -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.12 04:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
@@ -402,11 +402,32 @@ class ImportantItemDelegate(QtWidgets.QStyledItemDelegate):
|
|
402
402
|
super(ImportantItemDelegate, self).paint(painter, option, index)
|
403
403
|
|
404
404
|
# pin (>= 10)
|
405
|
-
if index.data(QtCore.Qt.ItemDataRole.UserRole)
|
406
|
-
|
405
|
+
if index.data(QtCore.Qt.ItemDataRole.UserRole):
|
406
|
+
data = index.data(QtCore.Qt.ItemDataRole.UserRole)
|
407
|
+
label = 0
|
408
|
+
is_important = False
|
409
|
+
is_attachment = False
|
410
|
+
if "label" in data:
|
411
|
+
label = data["label"]
|
412
|
+
if "is_important" in data and data["is_important"]:
|
413
|
+
is_important = True
|
414
|
+
if "is_attachment" in data and data["is_attachment"]:
|
415
|
+
is_attachment = True
|
416
|
+
|
407
417
|
painter.save()
|
408
418
|
|
409
|
-
if
|
419
|
+
if is_attachment:
|
420
|
+
icon = QtGui.QIcon(":/icons/attachment.svg")
|
421
|
+
icon_size = option.decorationSize or QtCore.QSize(16, 16)
|
422
|
+
icon_rect = QtCore.QRect(
|
423
|
+
option.rect.right() - icon_size.width(),
|
424
|
+
option.rect.top() + (option.rect.height() - icon_size.height()) / 2,
|
425
|
+
icon_size.width(),
|
426
|
+
icon_size.height()
|
427
|
+
)
|
428
|
+
icon.paint(painter, icon_rect, QtCore.Qt.AlignCenter)
|
429
|
+
|
430
|
+
if is_important:
|
410
431
|
color = self.get_color_for_status(3)
|
411
432
|
square_size = 3
|
412
433
|
square_margin = 0
|
@@ -426,7 +447,7 @@ class ImportantItemDelegate(QtWidgets.QStyledItemDelegate):
|
|
426
447
|
)
|
427
448
|
painter.drawRect(square_rect)
|
428
449
|
|
429
|
-
label = label - 10 # remove pin status
|
450
|
+
#label = label - 10 # remove pin status
|
430
451
|
|
431
452
|
# label (0-9)
|
432
453
|
if label > 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: 2024.
|
9
|
+
# Updated Date: 2024.12.09 23:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtWidgets import QTabWidget, QMenu
|
@@ -40,7 +40,7 @@ class InputTabs(QTabWidget):
|
|
40
40
|
|
41
41
|
:param global_pos: QPoint
|
42
42
|
"""
|
43
|
-
context_menu = QMenu()
|
43
|
+
context_menu = QMenu(self)
|
44
44
|
actions = {}
|
45
45
|
actions['clear'] = QAction(QIcon(":/icons/delete.svg"), trans('attachments.btn.clear'), self)
|
46
46
|
actions['clear'].triggered.connect(
|
pygpt_net/ui/widget/tabs/body.py
CHANGED
@@ -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.09 23:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtWidgets import QTabWidget
|
13
|
+
|
13
14
|
from pygpt_net.core.tabs.tab import Tab
|
14
15
|
|
15
16
|
|