pygpt-net 2.6.21__py3-none-any.whl → 2.6.23__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.
Files changed (160) hide show
  1. pygpt_net/CHANGELOG.txt +12 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +3 -1
  4. pygpt_net/controller/__init__.py +4 -8
  5. pygpt_net/controller/access/voice.py +2 -2
  6. pygpt_net/controller/agent/llama.py +3 -0
  7. pygpt_net/controller/assistant/batch.py +2 -3
  8. pygpt_net/controller/assistant/editor.py +2 -2
  9. pygpt_net/controller/assistant/files.py +2 -3
  10. pygpt_net/controller/assistant/store.py +2 -2
  11. pygpt_net/controller/audio/audio.py +2 -2
  12. pygpt_net/controller/chat/response.py +4 -0
  13. pygpt_net/controller/ctx/ctx.py +2 -1
  14. pygpt_net/controller/files/files.py +24 -55
  15. pygpt_net/controller/idx/indexer.py +85 -76
  16. pygpt_net/controller/lang/lang.py +52 -34
  17. pygpt_net/controller/model/importer.py +2 -2
  18. pygpt_net/controller/notepad/notepad.py +86 -84
  19. pygpt_net/controller/plugins/settings.py +3 -4
  20. pygpt_net/controller/settings/profile.py +105 -124
  21. pygpt_net/controller/theme/menu.py +154 -57
  22. pygpt_net/controller/theme/nodes.py +51 -44
  23. pygpt_net/controller/theme/theme.py +33 -9
  24. pygpt_net/controller/tools/tools.py +2 -2
  25. pygpt_net/controller/ui/tabs.py +2 -3
  26. pygpt_net/core/agents/observer/evaluation.py +2 -2
  27. pygpt_net/core/agents/runners/loop.py +1 -0
  28. pygpt_net/core/bridge/bridge.py +2 -0
  29. pygpt_net/core/ctx/container.py +13 -12
  30. pygpt_net/core/ctx/output.py +7 -4
  31. pygpt_net/core/debug/console/console.py +2 -2
  32. pygpt_net/core/filesystem/actions.py +1 -2
  33. pygpt_net/core/filesystem/opener.py +261 -0
  34. pygpt_net/core/filesystem/url.py +13 -10
  35. pygpt_net/core/platforms/platforms.py +5 -4
  36. pygpt_net/core/render/plain/helpers.py +2 -5
  37. pygpt_net/core/render/plain/renderer.py +26 -30
  38. pygpt_net/core/render/web/body.py +1 -1
  39. pygpt_net/core/settings/settings.py +43 -13
  40. pygpt_net/core/tabs/tabs.py +20 -13
  41. pygpt_net/data/config/config.json +4 -4
  42. pygpt_net/data/config/models.json +3 -3
  43. pygpt_net/data/css/web-blocks.dark.css +7 -1
  44. pygpt_net/data/css/web-blocks.light.css +5 -2
  45. pygpt_net/data/css/web-chatgpt.dark.css +7 -1
  46. pygpt_net/data/css/web-chatgpt.light.css +3 -0
  47. pygpt_net/data/css/web-chatgpt_wide.dark.css +7 -1
  48. pygpt_net/data/css/web-chatgpt_wide.light.css +3 -0
  49. pygpt_net/data/locale/locale.de.ini +5 -1
  50. pygpt_net/data/locale/locale.en.ini +5 -1
  51. pygpt_net/data/locale/locale.es.ini +5 -1
  52. pygpt_net/data/locale/locale.fr.ini +5 -1
  53. pygpt_net/data/locale/locale.it.ini +5 -1
  54. pygpt_net/data/locale/locale.pl.ini +6 -4
  55. pygpt_net/data/locale/locale.uk.ini +5 -1
  56. pygpt_net/data/locale/locale.zh.ini +5 -1
  57. pygpt_net/plugin/twitter/plugin.py +2 -2
  58. pygpt_net/provider/core/config/patch.py +12 -1
  59. pygpt_net/tools/audio_transcriber/ui/dialogs.py +44 -54
  60. pygpt_net/tools/code_interpreter/body.py +1 -2
  61. pygpt_net/tools/code_interpreter/tool.py +7 -4
  62. pygpt_net/tools/code_interpreter/ui/html.py +1 -3
  63. pygpt_net/tools/code_interpreter/ui/widgets.py +2 -3
  64. pygpt_net/tools/html_canvas/ui/widgets.py +1 -3
  65. pygpt_net/tools/image_viewer/ui/dialogs.py +40 -37
  66. pygpt_net/tools/indexer/ui/widgets.py +2 -4
  67. pygpt_net/tools/media_player/tool.py +2 -5
  68. pygpt_net/tools/media_player/ui/widgets.py +60 -36
  69. pygpt_net/tools/text_editor/ui/widgets.py +18 -19
  70. pygpt_net/tools/translator/ui/widgets.py +39 -35
  71. pygpt_net/ui/base/context_menu.py +9 -4
  72. pygpt_net/ui/dialog/db.py +1 -3
  73. pygpt_net/ui/dialog/models.py +1 -3
  74. pygpt_net/ui/dialog/models_importer.py +2 -4
  75. pygpt_net/ui/dialogs.py +34 -30
  76. pygpt_net/ui/layout/chat/attachments.py +72 -84
  77. pygpt_net/ui/layout/chat/attachments_ctx.py +40 -44
  78. pygpt_net/ui/layout/chat/attachments_uploaded.py +36 -39
  79. pygpt_net/ui/layout/chat/calendar.py +100 -70
  80. pygpt_net/ui/layout/chat/chat.py +23 -17
  81. pygpt_net/ui/layout/chat/input.py +95 -118
  82. pygpt_net/ui/layout/chat/output.py +100 -162
  83. pygpt_net/ui/layout/chat/painter.py +89 -61
  84. pygpt_net/ui/layout/ctx/ctx_list.py +43 -52
  85. pygpt_net/ui/layout/status.py +23 -14
  86. pygpt_net/ui/layout/toolbox/agent.py +27 -38
  87. pygpt_net/ui/layout/toolbox/agent_llama.py +41 -45
  88. pygpt_net/ui/layout/toolbox/assistants.py +42 -38
  89. pygpt_net/ui/layout/toolbox/computer_env.py +32 -23
  90. pygpt_net/ui/layout/toolbox/footer.py +13 -16
  91. pygpt_net/ui/layout/toolbox/image.py +18 -21
  92. pygpt_net/ui/layout/toolbox/indexes.py +46 -89
  93. pygpt_net/ui/layout/toolbox/mode.py +20 -7
  94. pygpt_net/ui/layout/toolbox/model.py +12 -10
  95. pygpt_net/ui/layout/toolbox/presets.py +68 -52
  96. pygpt_net/ui/layout/toolbox/prompt.py +31 -58
  97. pygpt_net/ui/layout/toolbox/toolbox.py +25 -21
  98. pygpt_net/ui/layout/toolbox/vision.py +20 -22
  99. pygpt_net/ui/main.py +2 -4
  100. pygpt_net/ui/menu/about.py +64 -84
  101. pygpt_net/ui/menu/audio.py +87 -63
  102. pygpt_net/ui/menu/config.py +121 -127
  103. pygpt_net/ui/menu/debug.py +69 -76
  104. pygpt_net/ui/menu/file.py +32 -35
  105. pygpt_net/ui/menu/menu.py +2 -3
  106. pygpt_net/ui/menu/plugins.py +69 -33
  107. pygpt_net/ui/menu/theme.py +45 -46
  108. pygpt_net/ui/menu/tools.py +56 -60
  109. pygpt_net/ui/menu/video.py +20 -25
  110. pygpt_net/ui/tray.py +1 -2
  111. pygpt_net/ui/widget/audio/bar.py +1 -3
  112. pygpt_net/ui/widget/audio/input_button.py +3 -4
  113. pygpt_net/ui/widget/calendar/select.py +1 -2
  114. pygpt_net/ui/widget/dialog/base.py +12 -9
  115. pygpt_net/ui/widget/dialog/editor_file.py +20 -23
  116. pygpt_net/ui/widget/dialog/find.py +25 -24
  117. pygpt_net/ui/widget/dialog/profile.py +57 -53
  118. pygpt_net/ui/widget/draw/painter.py +62 -93
  119. pygpt_net/ui/widget/element/button.py +42 -30
  120. pygpt_net/ui/widget/element/checkbox.py +23 -15
  121. pygpt_net/ui/widget/element/group.py +6 -5
  122. pygpt_net/ui/widget/element/labels.py +1 -2
  123. pygpt_net/ui/widget/filesystem/explorer.py +93 -102
  124. pygpt_net/ui/widget/image/display.py +1 -2
  125. pygpt_net/ui/widget/lists/assistant.py +1 -2
  126. pygpt_net/ui/widget/lists/attachment.py +1 -2
  127. pygpt_net/ui/widget/lists/attachment_ctx.py +1 -2
  128. pygpt_net/ui/widget/lists/context.py +2 -4
  129. pygpt_net/ui/widget/lists/index.py +1 -2
  130. pygpt_net/ui/widget/lists/model.py +1 -2
  131. pygpt_net/ui/widget/lists/model_editor.py +1 -2
  132. pygpt_net/ui/widget/lists/model_importer.py +1 -2
  133. pygpt_net/ui/widget/lists/preset.py +1 -2
  134. pygpt_net/ui/widget/lists/preset_plugins.py +1 -2
  135. pygpt_net/ui/widget/lists/profile.py +1 -2
  136. pygpt_net/ui/widget/lists/uploaded.py +1 -2
  137. pygpt_net/ui/widget/option/checkbox.py +2 -4
  138. pygpt_net/ui/widget/option/checkbox_list.py +1 -4
  139. pygpt_net/ui/widget/option/cmd.py +1 -4
  140. pygpt_net/ui/widget/option/dictionary.py +25 -28
  141. pygpt_net/ui/widget/option/input.py +1 -3
  142. pygpt_net/ui/widget/tabs/Input.py +16 -12
  143. pygpt_net/ui/widget/tabs/body.py +5 -3
  144. pygpt_net/ui/widget/tabs/layout.py +41 -28
  145. pygpt_net/ui/widget/tabs/output.py +442 -85
  146. pygpt_net/ui/widget/textarea/calendar_note.py +1 -2
  147. pygpt_net/ui/widget/textarea/editor.py +41 -73
  148. pygpt_net/ui/widget/textarea/find.py +11 -10
  149. pygpt_net/ui/widget/textarea/html.py +3 -6
  150. pygpt_net/ui/widget/textarea/input.py +134 -69
  151. pygpt_net/ui/widget/textarea/notepad.py +54 -38
  152. pygpt_net/ui/widget/textarea/output.py +65 -54
  153. pygpt_net/ui/widget/textarea/search_input.py +5 -4
  154. pygpt_net/ui/widget/textarea/web.py +2 -4
  155. pygpt_net/ui/widget/vision/camera.py +2 -31
  156. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.23.dist-info}/METADATA +38 -174
  157. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.23.dist-info}/RECORD +160 -159
  158. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.23.dist-info}/LICENSE +0 -0
  159. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.23.dist-info}/WHEEL +0 -0
  160. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.23.dist-info}/entry_points.txt +0 -0
@@ -6,13 +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.11.24 22:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtGui import QAction, QIcon
13
13
 
14
14
  from pygpt_net.utils import trans
15
- import pygpt_net.icons_rc
16
15
 
17
16
  class Tools:
18
17
  def __init__(self, window=None):
@@ -23,70 +22,67 @@ class Tools:
23
22
  """
24
23
  self.window = window
25
24
 
25
+ def _open_tab_action(self, checked=False):
26
+ action = self.window.sender()
27
+ self.window.controller.tools.open_tab(action.data())
28
+
29
+ def _toggle_assistant_store(self, checked=False):
30
+ self.window.controller.assistant.store.toggle_editor()
31
+
32
+ def _rebuild_ipython(self, checked=False):
33
+ self.window.core.plugins.get("cmd_code_interpreter").builder.build_and_restart()
34
+
35
+ def _rebuild_python_legacy(self, checked=False):
36
+ self.window.core.plugins.get("cmd_code_interpreter").docker.build_and_restart()
37
+
38
+ def _rebuild_system(self, checked=False):
39
+ self.window.core.plugins.get("cmd_system").docker.build_and_restart()
40
+
26
41
  def setup(self):
27
42
  """Setup tools menu"""
28
- # tab tools
29
- tab_tools = self.window.controller.tools.get_tab_tools()
30
- for key in tab_tools:
31
- self.window.ui.menu[key] = QAction(QIcon(":/icons/" + tab_tools[key][1] + ".svg"),
32
- trans("output.tab." + tab_tools[key][0]), self.window)
33
- self.window.ui.menu[key].triggered.connect(
34
- lambda checked=False, type=tab_tools[key][2] : self.window.controller.tools.open_tab(type)
35
- )
36
- self.window.ui.menu[key].setCheckable(False)
37
-
38
- # add menu
39
- self.window.ui.menu['menu.tools'] = self.window.menuBar().addMenu(trans("menu.tools"))
40
-
41
- # add tab tools
42
- for key in tab_tools:
43
- self.window.ui.menu['menu.tools'].addAction(self.window.ui.menu[key])
44
-
45
- # add custom tools
46
- actions = self.window.tools.setup_menu_actions()
43
+ window = self.window
44
+ ui_menu = window.ui.menu
45
+
46
+ tab_tools = window.controller.tools.get_tab_tools()
47
+ ui_menu['menu.tools'] = window.menuBar().addMenu(trans("menu.tools"))
48
+ menu_tools = ui_menu['menu.tools']
49
+
50
+ for key, val in tab_tools.items():
51
+ label_key, icon_name, type_ = val[0], val[1], val[2]
52
+ action = QAction(QIcon(f":/icons/{icon_name}.svg"), trans(f"output.tab.{label_key}"), window)
53
+ action.setCheckable(False)
54
+ action.triggered.connect(lambda checked=False, t=type_: window.controller.tools.open_tab(t))
55
+ ui_menu[key] = action
56
+ menu_tools.addAction(action)
57
+
58
+ actions = window.tools.setup_menu_actions()
47
59
  if len(actions) == 0:
48
60
  return
49
61
 
50
- # add separator
51
- self.window.ui.menu['menu.tools'].addSeparator()
62
+ menu_tools.addSeparator()
52
63
 
53
- # build custom tools menu
54
- for key in actions:
55
- self.window.ui.menu[key] = actions[key]
56
- self.window.ui.menu['menu.tools'].addAction(self.window.ui.menu[key])
64
+ for key, action in actions.items():
65
+ ui_menu[key] = action
66
+ menu_tools.addAction(action)
57
67
 
58
68
  # ------------------------------------------------- #
59
69
 
60
- # OpenAI vector stores
61
- self.window.ui.menu['menu.tools'].addSeparator()
62
- self.window.ui.menu['menu.tools.openai.stores'] = QAction(QIcon(":/icons/db.svg"),
63
- trans("dialog.assistant.store"), self.window)
64
- self.window.ui.menu['menu.tools'].addAction(self.window.ui.menu['menu.tools.openai.stores'])
65
- self.window.ui.menu['menu.tools.openai.stores'].triggered.connect(
66
- lambda: self.window.controller.assistant.store.toggle_editor()
67
- )
68
-
69
- # Docker images rebuild:
70
-
71
- # IPython container
72
- self.window.ui.menu['menu.tools'].addSeparator()
73
- self.window.ui.menu['menu.tools.ipython.rebuild'] = QAction(QIcon(":/icons/reload.svg"),
74
- "Rebuild IPython Docker Image", self.window)
75
- self.window.ui.menu['menu.tools'].addAction(self.window.ui.menu['menu.tools.ipython.rebuild'])
76
- self.window.ui.menu['menu.tools.ipython.rebuild'].triggered.connect(
77
- lambda: self.window.core.plugins.get("cmd_code_interpreter").builder.build_and_restart()
78
- )
79
- # Python Legacy container
80
- self.window.ui.menu['menu.tools.python_legacy.rebuild'] = QAction(QIcon(":/icons/reload.svg"),
81
- "Rebuild Python (Legacy) Docker Image", self.window)
82
- self.window.ui.menu['menu.tools'].addAction(self.window.ui.menu['menu.tools.python_legacy.rebuild'])
83
- self.window.ui.menu['menu.tools.python_legacy.rebuild'].triggered.connect(
84
- lambda: self.window.core.plugins.get("cmd_code_interpreter").docker.build_and_restart()
85
- )
86
- # System container
87
- self.window.ui.menu['menu.tools.system.rebuild'] = QAction(QIcon(":/icons/reload.svg"),
88
- "Rebuild System Sandbox Docker Image", self.window)
89
- self.window.ui.menu['menu.tools'].addAction(self.window.ui.menu['menu.tools.system.rebuild'])
90
- self.window.ui.menu['menu.tools.system.rebuild'].triggered.connect(
91
- lambda: self.window.core.plugins.get("cmd_system").docker.build_and_restart()
92
- )
70
+ menu_tools.addSeparator()
71
+ db_icon = QIcon(":/icons/db.svg")
72
+ ui_menu['menu.tools.openai.stores'] = QAction(db_icon, trans("dialog.assistant.store"), window)
73
+ menu_tools.addAction(ui_menu['menu.tools.openai.stores'])
74
+ ui_menu['menu.tools.openai.stores'].triggered.connect(self._toggle_assistant_store)
75
+
76
+ menu_tools.addSeparator()
77
+ reload_icon = QIcon(":/icons/reload.svg")
78
+ ui_menu['menu.tools.ipython.rebuild'] = QAction(reload_icon, "Rebuild IPython Docker Image", window)
79
+ menu_tools.addAction(ui_menu['menu.tools.ipython.rebuild'])
80
+ ui_menu['menu.tools.ipython.rebuild'].triggered.connect(self._rebuild_ipython)
81
+
82
+ ui_menu['menu.tools.python_legacy.rebuild'] = QAction(reload_icon, "Rebuild Python (Legacy) Docker Image", window)
83
+ menu_tools.addAction(ui_menu['menu.tools.python_legacy.rebuild'])
84
+ ui_menu['menu.tools.python_legacy.rebuild'].triggered.connect(self._rebuild_python_legacy)
85
+
86
+ ui_menu['menu.tools.system.rebuild'] = QAction(reload_icon, "Rebuild System Sandbox Docker Image", window)
87
+ menu_tools.addAction(ui_menu['menu.tools.system.rebuild'])
88
+ ui_menu['menu.tools.system.rebuild'].triggered.connect(self._rebuild_system)
@@ -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.03.20 06:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtGui import QAction
@@ -25,27 +25,22 @@ class Video:
25
25
 
26
26
  def setup(self):
27
27
  """Setup video menu"""
28
- self.window.ui.menu['video.capture'] = QAction(
29
- trans("menu.video.capture"),
30
- self.window,
31
- checkable=True,
32
- )
33
- self.window.ui.menu['video.capture'].setToolTip(trans('vision.capture.enable.tooltip'))
34
- self.window.ui.menu['video.capture'].triggered.connect(
35
- lambda: self.window.controller.camera.toggle(self.window.ui.menu['video.capture'].isChecked())
36
- )
37
-
38
- self.window.ui.menu['video.capture.auto'] = QAction(
39
- trans("menu.video.capture.auto"),
40
- self.window,
41
- checkable=True,
42
- )
43
- self.window.ui.menu['video.capture.auto'].setToolTip(trans('vision.capture.auto.tooltip'))
44
- self.window.ui.menu['video.capture.auto'].triggered.connect(
45
- lambda: self.window.controller.camera.toggle_auto(self.window.ui.menu['video.capture.auto'].isChecked())
46
- )
47
-
48
- self.window.ui.menu['menu.video'] = self.window.menuBar().addMenu(trans("menu.video"))
49
- self.window.ui.menu['menu.video'].addAction(self.window.ui.menu['video.capture'])
50
- self.window.ui.menu['menu.video'].addAction(self.window.ui.menu['video.capture.auto'])
51
- self.window.ui.menu['menu.video'].setToolTipsVisible(True)
28
+ w = self.window
29
+ ui_menu = w.ui.menu
30
+ cam = w.controller.camera
31
+
32
+ capture = QAction(trans("menu.video.capture"), w, checkable=True)
33
+ capture.setToolTip(trans('vision.capture.enable.tooltip'))
34
+ capture.triggered.connect(cam.toggle)
35
+
36
+ capture_auto = QAction(trans("menu.video.capture.auto"), w, checkable=True)
37
+ capture_auto.setToolTip(trans('vision.capture.auto.tooltip'))
38
+ capture_auto.triggered.connect(cam.toggle_auto)
39
+
40
+ menu_video = w.menuBar().addMenu(trans("menu.video"))
41
+ menu_video.addActions([capture, capture_auto])
42
+ menu_video.setToolTipsVisible(True)
43
+
44
+ ui_menu['video.capture'] = capture
45
+ ui_menu['video.capture.auto'] = capture_auto
46
+ ui_menu['menu.video'] = menu_video
pygpt_net/ui/tray.py CHANGED
@@ -6,14 +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: 2025.08.16 00:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtGui import QAction, QIcon
13
13
  from PySide6.QtWidgets import QSystemTrayIcon, QMenu
14
14
 
15
15
  from pygpt_net.utils import trans
16
- import pygpt_net.icons_rc
17
16
 
18
17
 
19
18
  class Tray:
@@ -6,15 +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: 2025.01.18 03:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import Qt
13
13
  from PySide6.QtGui import QPainter, QPalette
14
14
  from PySide6.QtWidgets import QWidget
15
15
 
16
- import pygpt_net.icons_rc
17
-
18
16
  class InputBar(QWidget):
19
17
  def __init__(self, parent=None):
20
18
  super().__init__(parent)
@@ -6,19 +6,18 @@
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.07.22 15:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import Qt
13
- from PySide6.QtGui import QPainter, QIcon
13
+ from PySide6.QtGui import QIcon
14
14
  from PySide6.QtWidgets import QLabel, QHBoxLayout, QWidget, QPushButton, QVBoxLayout
15
15
 
16
16
  from pygpt_net.core.events import Event, AppEvent
17
17
  from pygpt_net.ui.widget.option.toggle_label import ToggleLabel
18
18
  from pygpt_net.utils import trans
19
- from .bar import InputBar
20
19
 
21
- import pygpt_net.icons_rc
20
+ from .bar import InputBar
22
21
 
23
22
  class VoiceControlButton(QWidget):
24
23
  def __init__(self, window=None):
@@ -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.15 03:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Tuple
@@ -17,7 +17,6 @@ from PySide6.QtWidgets import QCalendarWidget, QMenu
17
17
 
18
18
  from pygpt_net.core.tabs.tab import Tab
19
19
  from pygpt_net.utils import trans
20
- import pygpt_net.icons_rc
21
20
 
22
21
 
23
22
  class CalendarSelect(QCalendarWidget):
@@ -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.01 03:00:00 #
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
- if not self.window.core.config.has("layout.dialog.geometry.store") \
62
- or not self.window.core.config.get("layout.dialog.geometry.store"):
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 = self.window.core.config.get("layout.dialog.geometry", {})
76
+ data = config.get("layout.dialog.geometry", {})
75
77
  else:
76
- data = self.window.core.config.get_session("layout.dialog.geometry", {})
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
- self.window.core.config.set("layout.dialog.geometry", data)
85
+ config.set("layout.dialog.geometry", data)
84
86
  else:
85
- self.window.core.config.set_session("layout.dialog.geometry", data)
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 = self.window.core.config.get("layout.dialog.geometry", {})
97
+ data = config.get("layout.dialog.geometry", {})
95
98
  else:
96
- data = self.window.core.config.get_session("layout.dialog.geometry", {})
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: 2024.04.14 18:00:00 #
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
- title = trans("untitled")
51
- if self.file:
52
- title = os.path.basename(self.file)
53
- if self.is_changed():
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 self.file and os.path.exists(self.file):
56
- file_size = self.window.core.filesystem.sizeof_fmt(os.path.getsize(self.file))
57
- title += " - {}".format(file_size)
58
- if self.is_changed() or force:
59
- time = datetime.datetime.now().strftime("%H:%M")
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 str(self.window.ui.editor[self.id].toPlainText()) != str(self.base_content)
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: 2024.04.10 23:00:00 #
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(FindDialog, self).__init__(window)
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.setMinimumWidth(70)
38
- self.counter.setMaximumWidth(70)
39
- self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) # always on top
40
-
41
- self.window.ui.nodes['dialog.find.input'] = self.input
42
- self.window.ui.nodes['dialog.find.counter'] = self.counter
43
- self.window.ui.nodes['dialog.find.btn.clear'] = QPushButton(trans('dialog.find.btn.clear'))
44
- self.window.ui.nodes['dialog.find.btn.clear'].clicked.connect(
45
- lambda: self.window.controller.finder.clear_input(),
46
- )
47
- self.window.ui.nodes['dialog.find.btn.find_prev'] = QPushButton(trans('dialog.find.btn.find_prev'))
48
- self.window.ui.nodes['dialog.find.btn.find_prev'].clicked.connect(
49
- lambda: self.window.controller.finder.prev(),
50
- )
51
- self.window.ui.nodes['dialog.find.btn.find_next'] = QPushButton(trans('dialog.find.btn.find_next'))
52
- self.window.ui.nodes['dialog.find.btn.find_next'].clicked.connect(
53
- lambda: self.window.controller.finder.next(),
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(self.window.ui.nodes['dialog.find.btn.clear'])
58
- bottom.addWidget(self.window.ui.nodes['dialog.find.btn.find_prev'])
59
- bottom.addWidget(self.window.ui.nodes['dialog.find.btn.find_next'])
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)