pygpt-net 2.6.19__py3-none-any.whl → 2.6.20__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.
@@ -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.22 10:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import Qt
@@ -91,6 +91,20 @@ class BaseConfigDialog:
91
91
 
92
92
  return widgets
93
93
 
94
+ def trans_or_not(self, label: str):
95
+ """
96
+ Translate label or return it as is if translation is not available
97
+
98
+ :param label: Label to translate
99
+ :return: Translated label or original if not found
100
+ """
101
+ txt = trans(label)
102
+ if txt == label:
103
+ if txt.startswith("dictionary."):
104
+ # get only last part after the dot
105
+ txt = txt.split('.')[-1].capitalize()
106
+ return txt
107
+
94
108
  def add_option(self, widget: QWidget, option: dict) -> QHBoxLayout:
95
109
  """
96
110
  Add option
@@ -105,7 +119,7 @@ class BaseConfigDialog:
105
119
  label_key = f'{label}.label'
106
120
  nodes = self.window.ui.nodes
107
121
 
108
- txt = trans(label)
122
+ txt = self.trans_or_not(label)
109
123
  if extra.get('bold'):
110
124
  nodes[label_key] = TitleLabel(txt)
111
125
  else:
@@ -151,7 +165,7 @@ class BaseConfigDialog:
151
165
  extra = option.get('extra') or {}
152
166
  nodes = self.window.ui.nodes
153
167
 
154
- txt = trans(label)
168
+ txt = self.trans_or_not(label)
155
169
  if extra.get('bold'):
156
170
  nodes[label_key] = TitleLabel(txt)
157
171
  else:
@@ -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 15:00:00 #
9
+ # Updated Date: 2025.08.22 10:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtGui import QIcon
@@ -50,7 +50,7 @@ class OptionCheckbox(QWidget):
50
50
  if self.option is not None:
51
51
  if "label" in self.option and self.option["label"] is not None \
52
52
  and self.option["label"] != "":
53
- self.title = trans(self.option["label"])
53
+ self.title = self.trans_or_not(self.option["label"])
54
54
  if "value" in self.option:
55
55
  self.value = self.option["value"]
56
56
  if "real_time" in self.option:
@@ -90,6 +90,20 @@ class OptionCheckbox(QWidget):
90
90
 
91
91
  #self.setLayout(self.layout)
92
92
 
93
+ def trans_or_not(self, label: str):
94
+ """
95
+ Translate label or return it as is if translation is not available
96
+
97
+ :param label: Label to translate
98
+ :return: Translated label or original if not found
99
+ """
100
+ txt = trans(label)
101
+ if txt == label:
102
+ if txt.startswith("dictionary."):
103
+ # get only last part after the dot
104
+ txt = txt.split('.')[-1].capitalize()
105
+ return txt
106
+
93
107
  def setIcon(self, icon: str):
94
108
  """
95
109
  Set icon