pygpt-net 2.6.3__py3-none-any.whl → 2.6.4__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 (66) hide show
  1. pygpt_net/CHANGELOG.txt +5 -0
  2. pygpt_net/__init__.py +1 -1
  3. pygpt_net/config.py +55 -65
  4. pygpt_net/controller/chat/chat.py +38 -35
  5. pygpt_net/controller/chat/render.py +144 -217
  6. pygpt_net/controller/chat/stream.py +51 -25
  7. pygpt_net/controller/config/config.py +39 -42
  8. pygpt_net/controller/config/field/checkbox.py +16 -12
  9. pygpt_net/controller/config/field/checkbox_list.py +36 -31
  10. pygpt_net/controller/config/field/cmd.py +51 -57
  11. pygpt_net/controller/config/field/combo.py +33 -16
  12. pygpt_net/controller/config/field/dictionary.py +48 -55
  13. pygpt_net/controller/config/field/input.py +50 -32
  14. pygpt_net/controller/config/field/slider.py +40 -45
  15. pygpt_net/controller/config/field/textarea.py +20 -6
  16. pygpt_net/controller/config/placeholder.py +110 -231
  17. pygpt_net/controller/lang/mapping.py +57 -95
  18. pygpt_net/controller/lang/plugins.py +64 -55
  19. pygpt_net/controller/lang/settings.py +39 -38
  20. pygpt_net/controller/layout/layout.py +11 -2
  21. pygpt_net/controller/plugins/plugins.py +19 -1
  22. pygpt_net/controller/ui/mode.py +107 -125
  23. pygpt_net/core/bridge/bridge.py +5 -5
  24. pygpt_net/core/command/command.py +149 -219
  25. pygpt_net/core/ctx/ctx.py +94 -146
  26. pygpt_net/core/debug/debug.py +48 -58
  27. pygpt_net/core/models/models.py +74 -112
  28. pygpt_net/core/modes/modes.py +13 -21
  29. pygpt_net/core/plugins/plugins.py +154 -177
  30. pygpt_net/core/presets/presets.py +103 -176
  31. pygpt_net/core/render/web/body.py +2 -3
  32. pygpt_net/core/render/web/renderer.py +109 -180
  33. pygpt_net/core/text/utils.py +28 -44
  34. pygpt_net/core/tokens/tokens.py +104 -203
  35. pygpt_net/data/config/config.json +2 -2
  36. pygpt_net/data/config/models.json +2 -2
  37. pygpt_net/item/ctx.py +141 -139
  38. pygpt_net/plugin/agent/plugin.py +2 -1
  39. pygpt_net/plugin/audio_output/plugin.py +5 -2
  40. pygpt_net/plugin/base/plugin.py +77 -93
  41. pygpt_net/plugin/bitbucket/plugin.py +3 -2
  42. pygpt_net/plugin/cmd_code_interpreter/plugin.py +3 -2
  43. pygpt_net/plugin/cmd_custom/plugin.py +3 -2
  44. pygpt_net/plugin/cmd_files/plugin.py +3 -2
  45. pygpt_net/plugin/cmd_history/plugin.py +3 -2
  46. pygpt_net/plugin/cmd_mouse_control/plugin.py +5 -2
  47. pygpt_net/plugin/cmd_serial/plugin.py +3 -2
  48. pygpt_net/plugin/cmd_system/plugin.py +3 -6
  49. pygpt_net/plugin/cmd_web/plugin.py +3 -2
  50. pygpt_net/plugin/experts/plugin.py +2 -2
  51. pygpt_net/plugin/facebook/plugin.py +3 -4
  52. pygpt_net/plugin/github/plugin.py +4 -2
  53. pygpt_net/plugin/google/plugin.py +3 -3
  54. pygpt_net/plugin/idx_llama_index/plugin.py +3 -2
  55. pygpt_net/plugin/mailer/plugin.py +3 -5
  56. pygpt_net/plugin/openai_vision/plugin.py +3 -2
  57. pygpt_net/plugin/real_time/plugin.py +52 -60
  58. pygpt_net/plugin/slack/plugin.py +3 -4
  59. pygpt_net/plugin/telegram/plugin.py +3 -4
  60. pygpt_net/plugin/twitter/plugin.py +3 -4
  61. pygpt_net/ui/widget/textarea/web.py +18 -14
  62. {pygpt_net-2.6.3.dist-info → pygpt_net-2.6.4.dist-info}/METADATA +7 -2
  63. {pygpt_net-2.6.3.dist-info → pygpt_net-2.6.4.dist-info}/RECORD +66 -66
  64. {pygpt_net-2.6.3.dist-info → pygpt_net-2.6.4.dist-info}/LICENSE +0 -0
  65. {pygpt_net-2.6.3.dist-info → pygpt_net-2.6.4.dist-info}/WHEEL +0 -0
  66. {pygpt_net-2.6.3.dist-info → pygpt_net-2.6.4.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.02 20:00:00 #
9
+ # Updated Date: 2025.08.15 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Dict
@@ -24,76 +24,61 @@ class Mapping:
24
24
  self.window = window
25
25
  self.mapping = {}
26
26
 
27
+ def _apply_map(self, items, targets, getter_name: str, setter_name: str):
28
+ t = trans
29
+ get = getattr
30
+ for k, key in items.items():
31
+ w = targets.get(k)
32
+ if w is None:
33
+ continue
34
+ try:
35
+ v = t(key)
36
+ getter = get(w, getter_name, None)
37
+ setter = get(w, setter_name, None)
38
+ if setter is None:
39
+ continue
40
+ if getter:
41
+ try:
42
+ if getter() == v:
43
+ continue
44
+ except Exception:
45
+ pass
46
+ setter(v)
47
+ except Exception:
48
+ pass
49
+
27
50
  def apply(self):
28
51
  """Apply mapped keys"""
29
-
30
- # load locale mapping
31
- if len(self.mapping) == 0:
52
+ if not self.mapping:
32
53
  self.mapping = self.get_mapping()
33
54
 
34
- # nodes labels
35
- for k in self.mapping['nodes']:
36
- if k in self.window.ui.nodes:
55
+ ui = self.window.ui
56
+ m = self.mapping
57
+
58
+ self._apply_map(m['nodes'], ui.nodes, 'text', 'setText')
59
+ self._apply_map(m['menu.title'], ui.menu, 'title', 'setTitle')
60
+ self._apply_map(m['menu.text'], ui.menu, 'text', 'setText')
61
+ self._apply_map(m['menu.tooltip'], ui.menu, 'toolTip', 'setToolTip')
62
+ self._apply_map(m['dialog.title'], ui.dialog, 'windowTitle', 'setWindowTitle')
63
+ self._apply_map(m['tooltip'], ui.nodes, 'toolTip', 'setToolTip')
64
+ self._apply_map(m['placeholder'], ui.nodes, 'placeholderText', 'setPlaceholderText')
65
+
66
+ tab_tools = self.window.controller.tools.get_tab_tools()
67
+ t = trans
68
+ for k, v in tab_tools.items():
69
+ w = ui.menu.get(k)
70
+ if w is None:
71
+ continue
72
+ try:
73
+ val = t("output.tab." + v[0])
37
74
  try:
38
- self.window.ui.nodes[k].setText(trans(self.mapping['nodes'][k]))
39
- except:
40
- pass
41
-
42
- # menu title
43
- for k in self.mapping['menu.title']:
44
- if k in self.window.ui.menu:
45
- try:
46
- self.window.ui.menu[k].setTitle(trans(self.mapping['menu.title'][k]))
47
- except:
48
- pass
49
-
50
- # menu text
51
- for k in self.mapping['menu.text']:
52
- if k in self.window.ui.menu:
53
- try:
54
- self.window.ui.menu[k].setText(trans(self.mapping['menu.text'][k]))
55
- except:
56
- pass
57
-
58
- # menu tooltip
59
- for k in self.mapping['menu.tooltip']:
60
- if k in self.window.ui.menu:
61
- try:
62
- self.window.ui.menu[k].setToolTip(trans(self.mapping['menu.tooltip'][k]))
63
- except:
64
- pass
65
-
66
- # dialog title
67
- for k in self.mapping['dialog.title']:
68
- if k in self.window.ui.dialog:
69
- try:
70
- self.window.ui.dialog[k].setWindowTitle(trans(self.mapping['dialog.title'][k]))
71
- except:
72
- pass
73
-
74
- # tooltip
75
- for k in self.mapping['tooltip']:
76
- if k in self.window.ui.nodes:
77
- try:
78
- self.window.ui.nodes[k].setToolTip(trans(self.mapping['tooltip'][k]))
79
- except:
80
- pass
81
-
82
- # placeholder
83
- for k in self.mapping['placeholder']:
84
- if k in self.window.ui.nodes:
85
- try:
86
- self.window.ui.nodes[k].setPlaceholderText(trans(self.mapping['placeholder'][k]))
87
- except:
88
- pass
89
-
90
- # menu tab tools
91
- for k in self.window.controller.tools.get_tab_tools():
92
- if k in self.window.ui.menu:
93
- try:
94
- self.window.ui.menu[k].setText(trans("output.tab." + self.window.controller.tools.get_tab_tools()[k][0]))
95
- except:
75
+ if hasattr(w, 'text') and w.text() == val:
76
+ continue
77
+ except Exception:
96
78
  pass
79
+ w.setText(val)
80
+ except Exception:
81
+ pass
97
82
 
98
83
  def get_mapping(self) -> Dict[str, Dict[str, str]]:
99
84
  """
@@ -132,8 +117,6 @@ class Mapping:
132
117
  nodes['preset.presets.label'] = 'toolbox.presets.label'
133
118
  nodes['preset.agents.label'] = 'toolbox.agents.label'
134
119
  nodes['preset.experts.label'] = 'toolbox.experts.label'
135
- # nodes['preset.presets.new'] = 'preset.new'
136
- # nodes['preset.clear'] = 'preset.clear'
137
120
  nodes['preset.use'] = 'preset.use'
138
121
  nodes['cmd.enabled'] = 'cmd.enabled'
139
122
  nodes['toolbox.prompt.label'] = 'toolbox.prompt'
@@ -146,7 +129,6 @@ class Mapping:
146
129
  nodes["agent.auto_stop"] = "toolbox.agent.auto_stop.label"
147
130
  nodes["agent.continue"] = "toolbox.agent.continue.label"
148
131
  nodes['layout.split'] = "layout.split"
149
- # nodes["indexes.new"] = "idx.new"
150
132
 
151
133
  # input
152
134
  nodes['input.label'] = 'input.label'
@@ -171,7 +153,6 @@ class Mapping:
171
153
 
172
154
  # assistants
173
155
  nodes['assistants.label'] = 'toolbox.assistants.label'
174
- # nodes['assistants.new'] = 'assistant.new'
175
156
  nodes['assistants.import'] = 'assistant.import'
176
157
  nodes['assistant.btn.save'] = 'dialog.assistant.btn.save'
177
158
  nodes['assistant.btn.close'] = 'dialog.assistant.btn.close'
@@ -190,13 +171,7 @@ class Mapping:
190
171
  nodes['assistant.store.btn.close'] = 'dialog.assistant.store.btn.close'
191
172
  nodes['assistant.store.hide_thread'] = 'assistant.store.hide_threads'
192
173
 
193
- # nodes['assistant.id_tip'] = 'assistant.new.id_tip'
194
- # nodes['assistant.api.tip'] = 'assistant.api.tip'
195
-
196
174
  # vision
197
- # nodes['vision.capture.enable'] = 'vision.capture.enable'
198
- # nodes['vision.capture.auto'] = 'vision.capture.auto'
199
- # nodes['vision.capture.label'] = 'vision.capture.options.title'
200
175
  nodes['inline.vision'] = 'inline.vision'
201
176
 
202
177
  # dialog: plugin settings
@@ -241,7 +216,7 @@ class Mapping:
241
216
 
242
217
  # extra settings
243
218
  nodes["idx.api.warning"] = "settings.llama.extra.api.warning"
244
- nodes["idx.db.settings.legend"] = "settings.llama.extra.btn.idx_head"
219
+ nodes["idx.db.settings.legend.head"] = "settings.llama.extra.btn.idx_head"
245
220
 
246
221
  # start
247
222
  nodes['start.title'] = 'dialog.start.title.text'
@@ -290,7 +265,6 @@ class Mapping:
290
265
  nodes['dialog.find.btn.clear'] = 'dialog.find.btn.clear'
291
266
  nodes['dialog.find.btn.find_prev'] = 'dialog.find.btn.find_prev'
292
267
  nodes['dialog.find.btn.find_next'] = 'dialog.find.btn.find_next'
293
- nodes['dialog.find.btn.find_prev'] = 'dialog.find.btn.find_prev'
294
268
 
295
269
  # dialog: profile
296
270
  nodes['dialog.profile.item.btn.dismiss'] = 'dialog.profile.item.btn.dismiss'
@@ -316,10 +290,9 @@ class Mapping:
316
290
  nodes['tip.toolbox.presets'] = 'tip.toolbox.presets'
317
291
  nodes['tip.toolbox.prompt'] = 'tip.toolbox.prompt'
318
292
  nodes['tip.toolbox.assistants'] = 'tip.toolbox.assistants'
319
- # nodes['tip.toolbox.indexes'] = 'tip.toolbox.indexes'
320
293
  nodes['tip.toolbox.ctx'] = 'tip.toolbox.ctx'
321
294
  nodes['tip.toolbox.mode'] = 'tip.toolbox.mode'
322
- nodes['plugin.settings.cmd.footer'] = 'cmd.tip' # plugin settings cmd footer
295
+ nodes['plugin.settings.cmd.footer'] = 'cmd.tip'
323
296
 
324
297
  # tool: indexer
325
298
  nodes['tool.indexer.idx.label'] = 'tool.indexer.idx'
@@ -344,7 +317,6 @@ class Mapping:
344
317
  nodes['tool.indexer.ctx.header.tip'] = 'tool.indexer.tab.ctx.tip'
345
318
  nodes['tool.indexer.browse.header.tip'] = 'tool.indexer.tab.browse.tip'
346
319
 
347
- # menu title
348
320
  menu_title = {}
349
321
  menu_title['menu.app'] = 'menu.file'
350
322
  menu_title['menu.config'] = 'menu.config'
@@ -368,7 +340,6 @@ class Mapping:
368
340
  menu_title['menu.tools'] = 'menu.tools'
369
341
  menu_title['menu.donate'] = 'menu.info.donate'
370
342
 
371
- # menu text
372
343
  menu_text = {}
373
344
  menu_text['app.ctx.new'] = 'menu.file.new'
374
345
  menu_text['app.ctx.group.new'] = 'menu.file.group.new'
@@ -408,8 +379,8 @@ class Mapping:
408
379
  menu_text['video.capture'] = 'menu.video.capture'
409
380
  menu_text['video.capture.auto'] = 'menu.video.capture.auto'
410
381
 
411
- # debug menu
412
- if 'menu.debug' in self.window.ui.menu:
382
+ ui_menu = self.window.ui.menu
383
+ if 'menu.debug' in ui_menu:
413
384
  menu_text['debug.config'] = 'menu.debug.config'
414
385
  menu_text['debug.context'] = 'menu.debug.context'
415
386
  menu_text['debug.presets'] = 'menu.debug.presets'
@@ -424,7 +395,6 @@ class Mapping:
424
395
  menu_text['debug.logger'] = 'menu.debug.logger'
425
396
  menu_text['debug.app.log'] = 'menu.debug.app.log'
426
397
 
427
- # dialog titles
428
398
  dialog_title = {}
429
399
  dialog_title['info.about'] = 'dialog.about.title'
430
400
  dialog_title['info.changelog'] = 'dialog.changelog.title'
@@ -445,13 +415,10 @@ class Mapping:
445
415
  dialog_title['profile.item'] = 'dialog.profile.item.editor'
446
416
  dialog_title['tool.indexer'] = 'tool.indexer.title'
447
417
 
448
- # tooltips
449
418
  tooltips = {}
450
419
  tooltips['prompt.context'] = 'tip.tokens.ctx'
451
420
  tooltips['input.counter'] = 'tip.tokens.input'
452
421
  tooltips['inline.vision'] = 'vision.checkbox.tooltip'
453
- # tooltips['vision.capture.enable'] = 'vision.capture.enable.tooltip'
454
- # tooltips['vision.capture.auto'] = 'vision.capture.auto.tooltip'
455
422
  tooltips['cmd.enabled'] = 'cmd.tip'
456
423
  tooltips['icon.video.capture'] = 'icon.video.capture'
457
424
  tooltips['icon.audio.output'] = 'icon.audio.output'
@@ -459,17 +426,14 @@ class Mapping:
459
426
  tooltips['assistant.store.btn.refresh_status'] = 'dialog.assistant.store.btn.refresh_status'
460
427
  tooltips['agent.llama.loop.score'] = 'toolbox.agent.llama.loop.score.tooltip'
461
428
 
462
- # menu tooltips
463
429
  menu_tooltips = {}
464
430
  menu_tooltips['video.capture'] = 'vision.capture.enable.tooltip'
465
431
  menu_tooltips['video.capture.auto'] = 'vision.capture.auto.tooltip'
466
432
 
467
- # placeholders
468
433
  placeholders = {}
469
434
  placeholders['ctx.search'] = 'ctx.list.search.placeholder'
470
435
  placeholders['interpreter.input'] = 'interpreter.input.placeholder'
471
436
 
472
- # mapping
473
437
  mapping = {}
474
438
  mapping['nodes'] = nodes
475
439
  mapping['menu.title'] = menu_title
@@ -479,10 +443,8 @@ class Mapping:
479
443
  mapping['tooltip'] = tooltips
480
444
  mapping['placeholder'] = placeholders
481
445
 
482
- # tools
483
446
  tool_mappings = self.window.tools.get_lang_mappings()
484
- for type in tool_mappings:
485
- for k in tool_mappings[type]:
486
- mapping[type][k] = tool_mappings[type][k]
447
+ for t, d in tool_mappings.items():
448
+ mapping.setdefault(t, {}).update(d)
487
449
 
488
- return mapping
450
+ return mapping
@@ -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.07.22 00:00:00 #
9
+ # Updated Date: 2025.08.15 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.utils import trans
@@ -27,71 +27,80 @@ class Plugins:
27
27
  # plugins: info
28
28
  self.window.controller.plugins.update_info()
29
29
 
30
- # reload all domains (plugin locale files)
31
- ids = self.window.core.plugins.plugins.keys()
32
- for id in ids:
33
- plugin = self.window.core.plugins.plugins[id]
30
+ plugins_dict = self.window.core.plugins.plugins
31
+ plugin_ids = tuple(plugins_dict.keys())
32
+ win = self.window
33
+ ui = win.ui
34
+ ui_nodes = ui.nodes
35
+ ui_tabs = ui.tabs
36
+ settings_tab = ui_tabs['plugin.settings']
37
+ ui_menu_plugins = ui.menu.get('plugins', {})
38
+ ui_config = ui.config
39
+ ctrl_plugins = win.controller.plugins
40
+
41
+ for plugin_id in plugin_ids:
42
+ plugin = plugins_dict[plugin_id]
34
43
  if not plugin.use_locale:
35
44
  continue
36
- domain = 'plugin.{}'.format(id)
45
+ domain = f'plugin.{plugin_id}'
37
46
  trans('', True, domain)
38
47
 
39
- # apply to plugin settings
40
- for id in ids:
41
- plugin = self.window.core.plugins.plugins[id]
48
+ for plugin_id in plugin_ids:
49
+ plugin = plugins_dict[plugin_id]
42
50
  if not plugin.use_locale:
43
51
  continue
44
- domain = 'plugin.{}'.format(id)
52
+ domain = f'plugin.{plugin_id}'
45
53
 
46
- # set name, translate if localization is enabled
47
54
  name_txt = trans('plugin.name', False, domain)
48
55
 
49
- # set description, translate if localization is enabled
50
- desc_key = 'plugin.settings.' + id + '.desc'
51
- desc_txt = trans('plugin.description', False, domain)
52
- if desc_key in self.window.ui.nodes:
53
- self.window.ui.nodes[desc_key].setText(desc_txt)
56
+ plugin_settings_desc_key = f'plugin.settings.{plugin_id}.desc'
57
+ if plugin_settings_desc_key in ui_nodes:
58
+ desc_txt = trans('plugin.description', False, domain)
59
+ ui_nodes[plugin_settings_desc_key].setText(desc_txt)
54
60
 
55
- # update tab name
56
- tab_idx = self.window.controller.plugins.get_tab_idx(id)
57
- # update tab name
61
+ tab_idx = ctrl_plugins.get_tab_idx(plugin_id)
58
62
  if tab_idx is not None:
59
- self.window.ui.tabs['plugin.settings'].setTabText(tab_idx, name_txt)
63
+ settings_tab.setTabText(tab_idx, name_txt)
60
64
 
61
- if id in self.window.ui.menu['plugins']:
62
- self.window.ui.menu['plugins'][id].setText(name_txt)
65
+ if plugin_id in ui_menu_plugins:
66
+ ui_menu_plugins[plugin_id].setText(name_txt)
63
67
 
64
68
  options = plugin.setup()
65
- option_ids = options.keys()
66
- for option_id in option_ids:
67
- # prepare element nodes keys
68
- label_key = 'plugin.' + id + '.' + option_id + '.label'
69
- desc_key = 'plugin.' + id + '.' + option_id + '.desc'
70
-
71
- # update options label, description and tooltip
72
- label_str = trans(option_id + '.label', False, domain)
73
- desc_str = trans(option_id + '.description', False, domain)
74
- tooltip_str = trans(option_id + '.tooltip', False, domain)
75
-
76
- if tooltip_str == option_id + '.tooltip':
77
- tooltip_str = desc_str
78
- if label_key in self.window.ui.nodes:
79
- self.window.ui.nodes[label_key].setText(label_str)
80
- if desc_key in self.window.ui.nodes:
81
- self.window.ui.nodes[desc_key].setText(desc_str)
82
- self.window.ui.nodes[desc_key].setToolTip(tooltip_str)
83
-
84
- if options[option_id]['type'] == 'bool':
85
- # update checkbox label
86
- if domain in self.window.ui.config and option_id in self.window.ui.config[domain]:
87
- try:
88
- if hasattr(self.window.ui.config[domain][option_id], 'setText'):
89
- self.window.ui.config[domain][option_id].setText(label_str)
90
- self.window.ui.config[domain][option_id].box.setText(label_str)
91
- except Exception as e:
92
- pass
93
-
94
- # update settings dialog list
95
- idx = self.window.ui.tabs['plugin.settings'].currentIndex()
96
- self.window.plugin_settings.update_list('plugin.list', self.window.core.plugins.plugins)
97
- self.window.controller.plugins.set_by_tab(idx)
69
+ if not options:
70
+ continue
71
+
72
+ cfg_domain = ui_config.get(domain)
73
+ for option_id, option in options.items():
74
+ label_key = f'plugin.{plugin_id}.{option_id}.label'
75
+ desc_key = f'plugin.{plugin_id}.{option_id}.desc'
76
+
77
+ is_bool = option.get('type') == 'bool'
78
+ need_label = (label_key in ui_nodes) or (is_bool and cfg_domain and option_id in cfg_domain)
79
+ need_desc = desc_key in ui_nodes
80
+
81
+ label_str = None
82
+ if need_label:
83
+ label_str = trans(f'{option_id}.label', False, domain)
84
+
85
+ if need_desc:
86
+ desc_str = trans(f'{option_id}.description', False, domain)
87
+ tooltip_str = trans(f'{option_id}.tooltip', False, domain)
88
+ if tooltip_str == f'{option_id}.tooltip':
89
+ tooltip_str = desc_str
90
+ ui_nodes[desc_key].setText(desc_str)
91
+ ui_nodes[desc_key].setToolTip(tooltip_str)
92
+
93
+ if label_key in ui_nodes and label_str is not None:
94
+ ui_nodes[label_key].setText(label_str)
95
+
96
+ if is_bool and cfg_domain and option_id in cfg_domain and label_str is not None:
97
+ widget = cfg_domain[option_id]
98
+ if hasattr(widget, 'setText'):
99
+ widget.setText(label_str)
100
+ box = getattr(widget, 'box', None)
101
+ if box and hasattr(box, 'setText'):
102
+ box.setText(label_str)
103
+
104
+ idx = settings_tab.currentIndex()
105
+ win.plugin_settings.update_list('plugin.list', plugins_dict)
106
+ ctrl_plugins.set_by_tab(idx)
@@ -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.07.22 00:00:00 #
9
+ # Updated Date: 2025.08.15 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.utils import trans
@@ -23,48 +23,49 @@ class Settings:
23
23
 
24
24
  def apply(self):
25
25
  """Apply locale to settings dialog"""
26
- # load settings options if not loaded yet
27
26
  if not self.window.controller.settings.editor.initialized:
28
27
  self.window.controller.settings.editor.load_config_options(False)
29
28
 
30
- # update settings options labels
31
- for id in self.window.controller.settings.editor.options:
32
- option = self.window.controller.settings.editor.options[id]
33
- option_label = 'settings.{}.label'.format(id) # TODO: check
34
- trans_key = '{}'.format(option['label'])
29
+ w = self.window
30
+ tr = trans
31
+ ctrl_settings = w.controller.settings
32
+ editor = ctrl_settings.editor
33
+ options = editor.options
34
+ ui = w.ui
35
+ ui_nodes = ui.nodes
36
+ ui_tabs = ui.tabs
37
+ ui_config = ui.config['config']
35
38
 
36
- # label
37
- if option['type'] == 'bool':
38
- if id in self.window.ui.config['config']:
39
- if hasattr(self.window.ui.config['config'][id], 'setText'):
40
- self.window.ui.config['config'][id].setText(trans(trans_key))
41
- self.window.ui.config['config'][id].box.setText(trans(trans_key))
39
+ for opt_id, option in options.items():
40
+ t_label = tr(option['label'])
41
+ if option.get('type') == 'bool':
42
+ if opt_id in ui_config:
43
+ widget = ui_config[opt_id]
44
+ if hasattr(widget, 'setText'):
45
+ widget.setText(t_label)
46
+ widget.box.setText(t_label)
42
47
  else:
43
- if option_label in self.window.ui.nodes:
44
- self.window.ui.nodes[option_label].setText(trans(trans_key))
48
+ node_key = f'settings.{opt_id}.label'
49
+ node = ui_nodes.get(node_key)
50
+ if node is not None:
51
+ node.setText(t_label)
45
52
 
46
- # description
47
- if 'description' in option \
48
- and option['description'] is not None \
49
- and option['description'].strip() != "":
50
- option_desc = 'settings.{}.desc'.format(id)
51
- if option_desc in self.window.ui.nodes:
52
- trans_desc_key = '{}'.format(option['description'])
53
- self.window.ui.nodes[option_desc].setText(trans(trans_desc_key))
54
- option_desc = option["description"]
55
- if option_desc in self.window.ui.nodes:
56
- trans_desc_key = '{}'.format(option['description'])
57
- self.window.ui.nodes[option_desc].setText(trans(trans_desc_key))
53
+ if 'description' in option and option['description'] is not None and option['description'].strip() != "":
54
+ desc = option['description']
55
+ t_desc = tr(desc)
56
+ node_key1 = f'settings.{opt_id}.desc'
57
+ node1 = ui_nodes.get(node_key1)
58
+ if node1 is not None:
59
+ node1.setText(t_desc)
60
+ node2 = ui_nodes.get(desc)
61
+ if node2 is not None:
62
+ node2.setText(t_desc)
58
63
 
59
- # update sections tabs
60
- sections = self.window.core.settings.get_sections()
61
- i = 0
62
- for section_id in sections.keys():
63
- key = 'settings.section.' + section_id
64
- self.window.ui.tabs['settings.section'].setTabText(i, trans(key))
65
- i += 1
64
+ sections = w.core.settings.get_sections()
65
+ tabs = ui_tabs['settings.section']
66
+ for i, section_id in enumerate(sections.keys()):
67
+ tabs.setTabText(i, tr(f'settings.section.{section_id}'))
66
68
 
67
- # update sections list
68
- idx = self.window.ui.tabs['settings.section'].currentIndex()
69
- self.window.settings.refresh_list()
70
- self.window.controller.settings.set_by_tab(idx)
69
+ idx = tabs.currentIndex()
70
+ w.settings.refresh_list()
71
+ ctrl_settings.set_by_tab(idx)
@@ -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.15 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtWidgets import QApplication
@@ -24,7 +24,16 @@ class Layout:
24
24
  """
25
25
  self.window = window
26
26
  # self.splitters = ["main", "main.output", "toolbox", "toolbox.mode", "toolbox.presets"]
27
- self.splitters = ["main", "main.output", "toolbox", "toolbox.mode", "calendar", "interpreter", "interpreter.columns", "columns"]
27
+ self.splitters = [
28
+ "main",
29
+ "main.output",
30
+ "toolbox",
31
+ "toolbox.mode",
32
+ "calendar",
33
+ "interpreter",
34
+ "interpreter.columns",
35
+ "columns",
36
+ ]
28
37
  self.text_nodes = ["input"]
29
38
 
30
39
  def setup(self):
@@ -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.15 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import List, Dict, Any
@@ -386,6 +386,24 @@ class Plugins:
386
386
  """
387
387
  return self._apply_cmds_common(Event.CMD_EXECUTE, ctx, cmds, all=all, execute_only=execute_only)
388
388
 
389
+ def apply_cmds_all(
390
+ self,
391
+ ctx: CtxItem,
392
+ cmds: List[Dict[str, Any]]
393
+ ):
394
+ """
395
+ Apply all commands (inline or not)
396
+
397
+ :param ctx: context
398
+ :param cmds: commands
399
+ :return: results
400
+ """
401
+ if self.window.core.config.get("cmd"):
402
+ return self.apply_cmds(ctx, cmds)
403
+ else:
404
+ return self.apply_cmds_inline(ctx, cmds)
405
+
406
+
389
407
  def apply_cmds_inline(
390
408
  self,
391
409
  ctx: CtxItem,