pygame-widget-kit 0.0.4__tar.gz → 0.0.6__tar.gz
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.
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/PKG-INFO +26 -2
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/README.md +25 -1
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/pyproject.toml +1 -1
- pygame_widget_kit-0.0.6/src/pygame_widget_kit/Animation.py +293 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/Button.py +49 -9
- pygame_widget_kit-0.0.6/src/pygame_widget_kit/CodeEditor.py +256 -0
- pygame_widget_kit-0.0.6/src/pygame_widget_kit/Layout.py +713 -0
- pygame_widget_kit-0.0.6/src/pygame_widget_kit/Loading.py +732 -0
- pygame_widget_kit-0.0.6/src/pygame_widget_kit/ProgressBar.py +585 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/Radio.py +12 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/Select.py +2 -1
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/Text.py +2 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/TextArea.py +17 -0
- pygame_widget_kit-0.0.6/src/pygame_widget_kit/TextInput.py +2327 -0
- pygame_widget_kit-0.0.6/src/pygame_widget_kit/ToggleButton.py +167 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/UIComponent.py +39 -4
- pygame_widget_kit-0.0.6/src/pygame_widget_kit/UIManager.py +215 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/Widget.py +2 -2
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/__init__.py +6 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit.egg-info/PKG-INFO +26 -2
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit.egg-info/SOURCES.txt +6 -1
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit.egg-info/top_level.txt +0 -1
- pygame_widget_kit-0.0.4/src/main.py +0 -127
- pygame_widget_kit-0.0.4/src/pygame_widget_kit/TextInput.py +0 -587
- pygame_widget_kit-0.0.4/src/pygame_widget_kit/UIManager.py +0 -125
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/LICENSE +0 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/setup.cfg +0 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit/Slider.py +0 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit.egg-info/dependency_links.txt +0 -0
- {pygame_widget_kit-0.0.4 → pygame_widget_kit-0.0.6}/src/pygame_widget_kit.egg-info/requires.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pygame-widget-kit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: A GUI framework built on Pygame. Designed as a retained-mode UI system with a component tree, extensible widgets, and focus management.
|
|
5
5
|
Author-email: Sinan Orgu <sinanorguuu@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -33,7 +33,7 @@ PyPI: https://pypi.org/project/pygame-widget-kit/
|
|
|
33
33
|
- Retained-mode component tree with nested children
|
|
34
34
|
- Event routing with hover, focus, and active state handling
|
|
35
35
|
- Modal/dropdown support via `UIManager`
|
|
36
|
-
- Built-in widgets: `Button`, `Text`, `Select`, `Radio`, `TextInput`, `Slider`,`TextArea
|
|
36
|
+
- Built-in widgets: `Button`, `Text`, `Select`, `Radio`, `TextInput`, `Slider`,`TextArea`, `CodeEditor`
|
|
37
37
|
- Text input filtering modes (text, number, hex, binary, octal)
|
|
38
38
|
|
|
39
39
|
|
|
@@ -180,6 +180,30 @@ if __name__ == "__main__":
|
|
|
180
180
|
- `Select` expects `options` as a list of strings and exposes `selected_value`.
|
|
181
181
|
- `Radio` expects `options` as a list of `(label, value)` tuples and exposes `get_value()`.
|
|
182
182
|
|
|
183
|
+
## CodeEditor (syntax highlight)
|
|
184
|
+
|
|
185
|
+
`CodeEditor`, `TextInput` sinifini inherit eder ve anahtar kelimeleri renk/bold/italic ile cizer.
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
editor = CodeEditor(
|
|
189
|
+
rect=(24, 520, 620, 170),
|
|
190
|
+
initial_text="for i in range(3):\n print(i)",
|
|
191
|
+
keyword_styles={
|
|
192
|
+
"for": {"color": (0, 120, 255), "bold": True},
|
|
193
|
+
"in": {"color": (0, 120, 255), "bold": True},
|
|
194
|
+
"range": {"color": (200, 120, 30), "italic": True},
|
|
195
|
+
},
|
|
196
|
+
)
|
|
197
|
+
root.add_child(editor)
|
|
198
|
+
|
|
199
|
+
# Autocomplete altyapisi (UI'siz provider hook)
|
|
200
|
+
def my_provider(full_text, cursor_pos, prefix):
|
|
201
|
+
return ["for", "format", "from"] if prefix.startswith("f") else []
|
|
202
|
+
|
|
203
|
+
editor.set_autocomplete_provider(my_provider)
|
|
204
|
+
suggestions = editor.request_completions()
|
|
205
|
+
```
|
|
206
|
+
|
|
183
207
|
## TextInput allowed_char_mode
|
|
184
208
|
|
|
185
209
|
- `ALLOW_ALL_CHARS`
|
|
@@ -11,7 +11,7 @@ PyPI: https://pypi.org/project/pygame-widget-kit/
|
|
|
11
11
|
- Retained-mode component tree with nested children
|
|
12
12
|
- Event routing with hover, focus, and active state handling
|
|
13
13
|
- Modal/dropdown support via `UIManager`
|
|
14
|
-
- Built-in widgets: `Button`, `Text`, `Select`, `Radio`, `TextInput`, `Slider`,`TextArea
|
|
14
|
+
- Built-in widgets: `Button`, `Text`, `Select`, `Radio`, `TextInput`, `Slider`,`TextArea`, `CodeEditor`
|
|
15
15
|
- Text input filtering modes (text, number, hex, binary, octal)
|
|
16
16
|
|
|
17
17
|
|
|
@@ -158,6 +158,30 @@ if __name__ == "__main__":
|
|
|
158
158
|
- `Select` expects `options` as a list of strings and exposes `selected_value`.
|
|
159
159
|
- `Radio` expects `options` as a list of `(label, value)` tuples and exposes `get_value()`.
|
|
160
160
|
|
|
161
|
+
## CodeEditor (syntax highlight)
|
|
162
|
+
|
|
163
|
+
`CodeEditor`, `TextInput` sinifini inherit eder ve anahtar kelimeleri renk/bold/italic ile cizer.
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
editor = CodeEditor(
|
|
167
|
+
rect=(24, 520, 620, 170),
|
|
168
|
+
initial_text="for i in range(3):\n print(i)",
|
|
169
|
+
keyword_styles={
|
|
170
|
+
"for": {"color": (0, 120, 255), "bold": True},
|
|
171
|
+
"in": {"color": (0, 120, 255), "bold": True},
|
|
172
|
+
"range": {"color": (200, 120, 30), "italic": True},
|
|
173
|
+
},
|
|
174
|
+
)
|
|
175
|
+
root.add_child(editor)
|
|
176
|
+
|
|
177
|
+
# Autocomplete altyapisi (UI'siz provider hook)
|
|
178
|
+
def my_provider(full_text, cursor_pos, prefix):
|
|
179
|
+
return ["for", "format", "from"] if prefix.startswith("f") else []
|
|
180
|
+
|
|
181
|
+
editor.set_autocomplete_provider(my_provider)
|
|
182
|
+
suggestions = editor.request_completions()
|
|
183
|
+
```
|
|
184
|
+
|
|
161
185
|
## TextInput allowed_char_mode
|
|
162
186
|
|
|
163
187
|
- `ALLOW_ALL_CHARS`
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Callable
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Easing:
|
|
7
|
+
@staticmethod
|
|
8
|
+
def linear(t: float) -> float:
|
|
9
|
+
return t
|
|
10
|
+
|
|
11
|
+
@staticmethod
|
|
12
|
+
def ease_in_out_quad(t: float) -> float:
|
|
13
|
+
if t < 0.5:
|
|
14
|
+
return 2 * t * t
|
|
15
|
+
return 1 - ((-2 * t + 2) ** 2) / 2
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def ease_out_cubic(t: float) -> float:
|
|
19
|
+
return 1 - (1 - t) ** 3
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Animation:
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
duration: float,
|
|
26
|
+
easing: Callable[[float], float] | None = None,
|
|
27
|
+
delay: float = 0.0,
|
|
28
|
+
on_start: Callable[[], None] | None = None,
|
|
29
|
+
on_update: Callable[[float], None] | None = None,
|
|
30
|
+
on_complete: Callable[[], None] | None = None,
|
|
31
|
+
key: Any = None,
|
|
32
|
+
):
|
|
33
|
+
self.duration = max(0.000001, float(duration))
|
|
34
|
+
self.easing = easing or Easing.linear
|
|
35
|
+
self.delay = max(0.0, float(delay))
|
|
36
|
+
|
|
37
|
+
self.on_start = on_start
|
|
38
|
+
self.on_update = on_update
|
|
39
|
+
self.on_complete = on_complete
|
|
40
|
+
|
|
41
|
+
self.key = key
|
|
42
|
+
|
|
43
|
+
self.elapsed = 0.0
|
|
44
|
+
self.started = False
|
|
45
|
+
self.finished = False
|
|
46
|
+
self.paused = False
|
|
47
|
+
|
|
48
|
+
def start(self):
|
|
49
|
+
if self.started:
|
|
50
|
+
return
|
|
51
|
+
self.started = True
|
|
52
|
+
if self.on_start is not None:
|
|
53
|
+
self.on_start()
|
|
54
|
+
|
|
55
|
+
def pause(self):
|
|
56
|
+
self.paused = True
|
|
57
|
+
|
|
58
|
+
def resume(self):
|
|
59
|
+
self.paused = False
|
|
60
|
+
|
|
61
|
+
def cancel(self):
|
|
62
|
+
self.finished = True
|
|
63
|
+
|
|
64
|
+
def update(self, dt: float):
|
|
65
|
+
if self.finished or self.paused:
|
|
66
|
+
return
|
|
67
|
+
|
|
68
|
+
self.elapsed += max(0.0, dt)
|
|
69
|
+
|
|
70
|
+
if self.elapsed < self.delay:
|
|
71
|
+
return
|
|
72
|
+
|
|
73
|
+
if not self.started:
|
|
74
|
+
self.start()
|
|
75
|
+
|
|
76
|
+
local_elapsed = self.elapsed - self.delay
|
|
77
|
+
raw_t = min(1.0, local_elapsed / self.duration)
|
|
78
|
+
eased_t = max(0.0, min(1.0, self.easing(raw_t)))
|
|
79
|
+
|
|
80
|
+
self._apply(eased_t)
|
|
81
|
+
|
|
82
|
+
if self.on_update is not None:
|
|
83
|
+
self.on_update(eased_t)
|
|
84
|
+
|
|
85
|
+
if raw_t >= 1.0:
|
|
86
|
+
self.finished = True
|
|
87
|
+
if self.on_complete is not None:
|
|
88
|
+
self.on_complete()
|
|
89
|
+
|
|
90
|
+
def _apply(self, eased_t: float):
|
|
91
|
+
raise NotImplementedError
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class PropertyAnimation(Animation):
|
|
95
|
+
def __init__(
|
|
96
|
+
self,
|
|
97
|
+
getter: Callable[[], Any],
|
|
98
|
+
setter: Callable[[Any], None],
|
|
99
|
+
to_value: Any,
|
|
100
|
+
duration: float,
|
|
101
|
+
from_value: Any = None,
|
|
102
|
+
easing: Callable[[float], float] | None = None,
|
|
103
|
+
delay: float = 0.0,
|
|
104
|
+
on_start: Callable[[], None] | None = None,
|
|
105
|
+
on_update: Callable[[float], None] | None = None,
|
|
106
|
+
on_complete: Callable[[], None] | None = None,
|
|
107
|
+
interpolator: Callable[[Any, Any, float], Any] | None = None,
|
|
108
|
+
key: Any = None,
|
|
109
|
+
):
|
|
110
|
+
super().__init__(
|
|
111
|
+
duration=duration,
|
|
112
|
+
easing=easing,
|
|
113
|
+
delay=delay,
|
|
114
|
+
on_start=on_start,
|
|
115
|
+
on_update=on_update,
|
|
116
|
+
on_complete=on_complete,
|
|
117
|
+
key=key,
|
|
118
|
+
)
|
|
119
|
+
self.getter = getter
|
|
120
|
+
self.setter = setter
|
|
121
|
+
self.to_value = to_value
|
|
122
|
+
self.from_value = from_value
|
|
123
|
+
self.interpolator = interpolator or interpolate_value
|
|
124
|
+
|
|
125
|
+
def start(self):
|
|
126
|
+
if self.from_value is None:
|
|
127
|
+
self.from_value = self.getter()
|
|
128
|
+
super().start()
|
|
129
|
+
|
|
130
|
+
def _apply(self, eased_t: float):
|
|
131
|
+
value = self.interpolator(self.from_value, self.to_value, eased_t)
|
|
132
|
+
self.setter(value)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class AngleAnimation(PropertyAnimation):
|
|
136
|
+
def __init__(
|
|
137
|
+
self,
|
|
138
|
+
getter: Callable[[], float],
|
|
139
|
+
setter: Callable[[float], None],
|
|
140
|
+
to_angle: float,
|
|
141
|
+
duration: float,
|
|
142
|
+
from_angle: float = None,
|
|
143
|
+
easing: Callable[[float], float] | None = None,
|
|
144
|
+
delay: float = 0.0,
|
|
145
|
+
on_start: Callable[[], None] | None = None,
|
|
146
|
+
on_update: Callable[[float], None] | None = None,
|
|
147
|
+
on_complete: Callable[[], None] | None = None,
|
|
148
|
+
key: Any = None,
|
|
149
|
+
shortest_path: bool = True,
|
|
150
|
+
):
|
|
151
|
+
self.shortest_path = shortest_path
|
|
152
|
+
super().__init__(
|
|
153
|
+
getter=getter,
|
|
154
|
+
setter=setter,
|
|
155
|
+
to_value=to_angle,
|
|
156
|
+
duration=duration,
|
|
157
|
+
from_value=from_angle,
|
|
158
|
+
easing=easing,
|
|
159
|
+
delay=delay,
|
|
160
|
+
on_start=on_start,
|
|
161
|
+
on_update=on_update,
|
|
162
|
+
on_complete=on_complete,
|
|
163
|
+
interpolator=self._interpolate_angle,
|
|
164
|
+
key=key,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
def _interpolate_angle(self, a: float, b: float, t: float):
|
|
168
|
+
return interpolate_angle_degrees(a, b, t, self.shortest_path)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class AnimationManager:
|
|
172
|
+
def __init__(self):
|
|
173
|
+
self.animations: list[Animation] = []
|
|
174
|
+
|
|
175
|
+
def add(self, animation: Animation):
|
|
176
|
+
if animation.key is not None:
|
|
177
|
+
self.animations = [a for a in self.animations if a.key != animation.key]
|
|
178
|
+
self.animations.append(animation)
|
|
179
|
+
return animation
|
|
180
|
+
|
|
181
|
+
def update(self, dt: float):
|
|
182
|
+
if not self.animations:
|
|
183
|
+
return
|
|
184
|
+
|
|
185
|
+
for animation in list(self.animations):
|
|
186
|
+
animation.update(dt)
|
|
187
|
+
|
|
188
|
+
self.animations = [a for a in self.animations if not a.finished]
|
|
189
|
+
|
|
190
|
+
def clear(self):
|
|
191
|
+
self.animations.clear()
|
|
192
|
+
|
|
193
|
+
def clear_key(self, key: Any):
|
|
194
|
+
self.animations = [a for a in self.animations if a.key != key]
|
|
195
|
+
|
|
196
|
+
def animate(
|
|
197
|
+
self,
|
|
198
|
+
getter: Callable[[], Any],
|
|
199
|
+
setter: Callable[[Any], None],
|
|
200
|
+
to_value: Any,
|
|
201
|
+
duration: float,
|
|
202
|
+
from_value: Any = None,
|
|
203
|
+
easing: Callable[[float], float] | None = None,
|
|
204
|
+
delay: float = 0.0,
|
|
205
|
+
on_start: Callable[[], None] | None = None,
|
|
206
|
+
on_update: Callable[[float], None] | None = None,
|
|
207
|
+
on_complete: Callable[[], None] | None = None,
|
|
208
|
+
interpolator: Callable[[Any, Any, float], Any] | None = None,
|
|
209
|
+
key: Any = None,
|
|
210
|
+
):
|
|
211
|
+
animation = PropertyAnimation(
|
|
212
|
+
getter=getter,
|
|
213
|
+
setter=setter,
|
|
214
|
+
to_value=to_value,
|
|
215
|
+
duration=duration,
|
|
216
|
+
from_value=from_value,
|
|
217
|
+
easing=easing,
|
|
218
|
+
delay=delay,
|
|
219
|
+
on_start=on_start,
|
|
220
|
+
on_update=on_update,
|
|
221
|
+
on_complete=on_complete,
|
|
222
|
+
interpolator=interpolator,
|
|
223
|
+
key=key,
|
|
224
|
+
)
|
|
225
|
+
return self.add(animation)
|
|
226
|
+
|
|
227
|
+
def animate_attr(
|
|
228
|
+
self,
|
|
229
|
+
target: Any,
|
|
230
|
+
attr_name: str,
|
|
231
|
+
to_value: Any,
|
|
232
|
+
duration: float,
|
|
233
|
+
from_value: Any = None,
|
|
234
|
+
easing: Callable[[float], float] | None = None,
|
|
235
|
+
delay: float = 0.0,
|
|
236
|
+
on_start: Callable[[], None] | None = None,
|
|
237
|
+
on_update: Callable[[float], None] | None = None,
|
|
238
|
+
on_complete: Callable[[], None] | None = None,
|
|
239
|
+
interpolator: Callable[[Any, Any, float], Any] | None = None,
|
|
240
|
+
key: Any = None,
|
|
241
|
+
):
|
|
242
|
+
animation_key = key if key is not None else (id(target), attr_name)
|
|
243
|
+
|
|
244
|
+
def getter():
|
|
245
|
+
return getattr(target, attr_name)
|
|
246
|
+
|
|
247
|
+
def setter(value):
|
|
248
|
+
setattr(target, attr_name, value)
|
|
249
|
+
|
|
250
|
+
return self.animate(
|
|
251
|
+
getter=getter,
|
|
252
|
+
setter=setter,
|
|
253
|
+
to_value=to_value,
|
|
254
|
+
duration=duration,
|
|
255
|
+
from_value=from_value,
|
|
256
|
+
easing=easing,
|
|
257
|
+
delay=delay,
|
|
258
|
+
on_start=on_start,
|
|
259
|
+
on_update=on_update,
|
|
260
|
+
on_complete=on_complete,
|
|
261
|
+
interpolator=interpolator,
|
|
262
|
+
key=animation_key,
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def interpolate_value(a: Any, b: Any, t: float):
|
|
267
|
+
if isinstance(a, (int, float)) and isinstance(b, (int, float)):
|
|
268
|
+
return a + (b - a) * t
|
|
269
|
+
|
|
270
|
+
if isinstance(a, (tuple, list)) and isinstance(b, (tuple, list)) and len(a) == len(b):
|
|
271
|
+
values = [interpolate_value(x, y, t) for x, y in zip(a, b)]
|
|
272
|
+
if isinstance(a, tuple):
|
|
273
|
+
return tuple(values)
|
|
274
|
+
return values
|
|
275
|
+
|
|
276
|
+
try:
|
|
277
|
+
return a.lerp(b, t)
|
|
278
|
+
except Exception:
|
|
279
|
+
pass
|
|
280
|
+
|
|
281
|
+
return b if t >= 1.0 else a
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def interpolate_angle_degrees(a: float, b: float, t: float, shortest_path: bool = True):
|
|
285
|
+
start = float(a)
|
|
286
|
+
end = float(b)
|
|
287
|
+
|
|
288
|
+
if shortest_path:
|
|
289
|
+
delta = ((end - start + 180.0) % 360.0) - 180.0
|
|
290
|
+
else:
|
|
291
|
+
delta = end - start
|
|
292
|
+
|
|
293
|
+
return start + delta * t
|
|
@@ -75,22 +75,61 @@ class Button(UIComponent):
|
|
|
75
75
|
if self.border_color:
|
|
76
76
|
pygame.draw.rect(surface,self.border_color,self.absolute_rect,2)
|
|
77
77
|
|
|
78
|
+
content_rect = pygame.Rect(
|
|
79
|
+
self.absolute_rect[0],
|
|
80
|
+
self.absolute_rect[1],
|
|
81
|
+
self.absolute_rect[2],
|
|
82
|
+
self.absolute_rect[3],
|
|
83
|
+
)
|
|
84
|
+
old_clip = surface.get_clip()
|
|
85
|
+
effective_clip = content_rect.clip(old_clip)
|
|
86
|
+
surface.set_clip(effective_clip)
|
|
87
|
+
|
|
88
|
+
if effective_clip.width > 0 and effective_clip.height > 0:
|
|
89
|
+
self.text.draw(surface)
|
|
78
90
|
|
|
79
|
-
|
|
91
|
+
surface.set_clip(old_clip)
|
|
80
92
|
|
|
81
93
|
|
|
82
94
|
def handle_event(self, event):
|
|
83
95
|
if event.type == pygame.MOUSEBUTTONDOWN:
|
|
84
|
-
|
|
96
|
+
button = getattr(event, "button", None)
|
|
97
|
+
|
|
98
|
+
if button == 1:
|
|
99
|
+
# Sol tik: butonu active yap
|
|
100
|
+
self.active = True
|
|
101
|
+
elif button == 2:
|
|
102
|
+
# Orta tik: ileride davranis eklenebilir
|
|
103
|
+
pass
|
|
104
|
+
elif button == 3:
|
|
105
|
+
# Sag tik: ileride davranis eklenebilir
|
|
106
|
+
pass
|
|
107
|
+
else:
|
|
108
|
+
# Diger butonlar: simdilik islenmiyor
|
|
109
|
+
pass
|
|
85
110
|
|
|
86
111
|
elif event.type == pygame.MOUSEBUTTONUP:
|
|
87
|
-
|
|
112
|
+
button = getattr(event, "button", None)
|
|
113
|
+
|
|
114
|
+
if button == 1:
|
|
115
|
+
# Sol tik birakma: active'i kapat
|
|
116
|
+
self.active = False
|
|
117
|
+
elif button == 2:
|
|
118
|
+
# Orta tik birakma: ileride davranis eklenebilir
|
|
119
|
+
pass
|
|
120
|
+
elif button == 3:
|
|
121
|
+
# Sag tik birakma: ileride davranis eklenebilir
|
|
122
|
+
pass
|
|
123
|
+
else:
|
|
124
|
+
# Diger butonlar: simdilik islenmiyor
|
|
125
|
+
pass
|
|
88
126
|
|
|
89
127
|
def on_click(self, event):
|
|
90
128
|
if self.click_function is not None:
|
|
91
129
|
self.click_function()
|
|
92
130
|
else:
|
|
93
|
-
print("Button clicked")
|
|
131
|
+
#print("Button clicked")
|
|
132
|
+
pass
|
|
94
133
|
|
|
95
134
|
|
|
96
135
|
|
|
@@ -102,7 +141,7 @@ class ChooseFileButton(Button):
|
|
|
102
141
|
self.chosen_file_path = None
|
|
103
142
|
|
|
104
143
|
def on_click(self, event):
|
|
105
|
-
print("Dosya seçici ayrı işlemde başlatılıyor...")
|
|
144
|
+
#print("Dosya seçici ayrı işlemde başlatılıyor...")
|
|
106
145
|
|
|
107
146
|
q = multiprocessing.Queue()
|
|
108
147
|
|
|
@@ -114,16 +153,17 @@ class ChooseFileButton(Button):
|
|
|
114
153
|
sonuc = q.get()
|
|
115
154
|
if sonuc:
|
|
116
155
|
secilen_dosya = sonuc
|
|
117
|
-
print(f"Gelen dosya: {secilen_dosya}")
|
|
156
|
+
#print(f"Gelen dosya: {secilen_dosya}")
|
|
118
157
|
self.chosen_file_path = secilen_dosya
|
|
119
158
|
self.text.set_text(secilen_dosya)
|
|
120
159
|
if self.click_function is not None:
|
|
121
160
|
self.click_function()
|
|
122
161
|
else:
|
|
123
|
-
print("islem iptal")
|
|
162
|
+
#print("islem iptal")
|
|
163
|
+
pass
|
|
124
164
|
else:
|
|
125
|
-
print("İşlem iptal edildi veya hata oluştu.")
|
|
126
|
-
|
|
165
|
+
#print("İşlem iptal edildi veya hata oluştu.")
|
|
166
|
+
pass
|
|
127
167
|
|
|
128
168
|
|
|
129
169
|
|