clapp-pm 1.0.21__tar.gz → 1.0.22__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.
Files changed (100) hide show
  1. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/PKG-INFO +1 -1
  2. clapp_pm-1.0.22/progress_utils.py +173 -0
  3. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/requirements.txt +3 -1
  4. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/setup.py +1 -0
  5. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/version.json +1 -1
  6. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/version.py +1 -1
  7. clapp_pm-1.0.21/progress_utils.py +0 -274
  8. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/CHANGELOG.md +0 -0
  9. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/GITHUB_SETUP.md +0 -0
  10. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/LICENSE +0 -0
  11. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/MANIFEST.in +0 -0
  12. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/PYPI_UPLOAD.md +0 -0
  13. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/README.md +0 -0
  14. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/advanced_test.py +0 -0
  15. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/apps/test-app/README.md +0 -0
  16. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/apps/test-app/main.py +0 -0
  17. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/apps/test-app/manifest.json +0 -0
  18. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/build_index.py +0 -0
  19. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/check_env.py +0 -0
  20. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/clapp_core.py +0 -0
  21. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/clean_command.py +0 -0
  22. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/cli_commands.py +0 -0
  23. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/dependency_resolver.py +0 -0
  24. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/doctor_command.py +0 -0
  25. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/info_command.py +0 -0
  26. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/install_command.py +0 -0
  27. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/installer.py +0 -0
  28. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/list_command.py +0 -0
  29. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/main.py +0 -0
  30. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/manifest_schema.py +0 -0
  31. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/manifest_validator.py +0 -0
  32. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/package_registry.py +0 -0
  33. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/package_runner.py +0 -0
  34. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/post_install_hint.py +0 -0
  35. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/publish_command.py +0 -0
  36. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/remote_registry.py +0 -0
  37. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/setup.py +0 -0
  38. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/system_test.py +0 -0
  39. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/uninstall_command.py +0 -0
  40. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/validate_command.py +0 -0
  41. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/version.py +0 -0
  42. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/version_command.py +0 -0
  43. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/backup_current/where_command.py +0 -0
  44. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/build_index.py +0 -0
  45. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/cache_manager.py +0 -0
  46. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/check_env.py +0 -0
  47. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/README.md +0 -0
  48. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/index.json +0 -0
  49. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/packages/hello-python/main.py +0 -0
  50. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/packages/hello-python/manifest.json +0 -0
  51. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/packages/test-app/main.py +0 -0
  52. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/packages/test-app/manifest.json +0 -0
  53. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/packages/test-app2/main.py +0 -0
  54. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/packages/test-app2/manifest.json +0 -0
  55. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp-packages-repo/packages.json +0 -0
  56. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp_app_structure.md +0 -0
  57. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp_core.py +0 -0
  58. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp_pm.egg-info/SOURCES.txt +0 -0
  59. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp_pm.egg-info/dependency_links.txt +0 -0
  60. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp_pm.egg-info/entry_points.txt +0 -0
  61. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp_pm.egg-info/requires.txt +0 -0
  62. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clapp_pm.egg-info/top_level.txt +0 -0
  63. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/clean_command.py +0 -0
  64. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/cli_commands.py +0 -0
  65. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/dependency_resolver.py +0 -0
  66. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/deploy.py +0 -0
  67. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/docs/developer_guide.md +0 -0
  68. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/doctor_command.py +0 -0
  69. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/index.json +0 -0
  70. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/info_command.py +0 -0
  71. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/install_command.py +0 -0
  72. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/installer.py +0 -0
  73. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/list_command.py +0 -0
  74. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/main.py +0 -0
  75. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/manifest_schema.py +0 -0
  76. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/manifest_validator.py +0 -0
  77. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/new_command.py +0 -0
  78. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/package_registry.py +0 -0
  79. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/package_runner.py +0 -0
  80. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/package_signing.py +0 -0
  81. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/post_install_hint.py +0 -0
  82. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/publish_command.py +0 -0
  83. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/pyproject.toml +0 -0
  84. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/remote_registry.py +0 -0
  85. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/setup.cfg +0 -0
  86. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/smart_search.py +0 -0
  87. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/system_test.py +0 -0
  88. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/templates/dart/manifest.json +0 -0
  89. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/templates/lua/manifest.json +0 -0
  90. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/templates/python/README.md +0 -0
  91. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/templates/python/main.py +0 -0
  92. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/templates/python/manifest.json +0 -0
  93. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/test-app/README.md +0 -0
  94. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/test-app/main.py +0 -0
  95. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/test-app/manifest.json +0 -0
  96. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/uninstall_command.py +0 -0
  97. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/validate_command.py +0 -0
  98. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/version_command.py +0 -0
  99. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/version_manager.py +0 -0
  100. {clapp_pm-1.0.21 → clapp_pm-1.0.22}/where_command.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clapp-pm
3
- Version: 1.0.21
3
+ Version: 1.0.22
4
4
  Summary: Lightweight cross-language app manager for Python and Lua
5
5
  Home-page: https://github.com/mburakmmm/clapp
6
6
  Author: Melih Burak Memiş
@@ -0,0 +1,173 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ progress_utils.py - Progress Bar ve İndirme Hızı Göstergesi
4
+
5
+ Bu modül indirme ve yükleme işlemleri için progress bar ve hız göstergesi sağlar.
6
+ """
7
+
8
+ import sys
9
+ import time
10
+ import threading
11
+ from typing import Optional, Callable
12
+ from urllib.request import urlopen
13
+ from urllib.error import URLError
14
+ from tqdm import tqdm
15
+
16
+
17
+ class ProgressBar:
18
+ """Progress bar sınıfı"""
19
+
20
+ def __init__(self, total: int, description: str = "İndiriliyor", width: int = 50):
21
+ self.total = total
22
+ self.description = description
23
+ self.width = width
24
+ self.current = 0
25
+ self.start_time = time.time()
26
+ self.last_update = 0
27
+ self.speed = 0
28
+ self.lock = threading.Lock()
29
+ self.last_line_length = 0 # Son satır uzunluğunu takip et
30
+
31
+ def update(self, current: int, speed: Optional[float] = None):
32
+ """Progress bar'ı günceller"""
33
+ with self.lock:
34
+ self.current = current
35
+ if speed is not None:
36
+ self.speed = speed
37
+
38
+ # Hız hesaplama
39
+ if self.current > 0:
40
+ elapsed = time.time() - self.start_time
41
+ if elapsed > 0:
42
+ self.speed = self.current / elapsed
43
+
44
+ def display(self):
45
+ if self.total <= 0:
46
+ return
47
+
48
+ percentage = (self.current / self.total) * 100
49
+ filled_width = int(self.width * self.current // self.total)
50
+ bar = '█' * filled_width + '░' * (self.width - filled_width)
51
+ speed_str = self._format_speed(self.speed)
52
+ current_str = self._format_size(self.current)
53
+ total_str = self._format_size(self.total)
54
+ progress_line = f"{self.description}: [{bar}] {percentage:5.1f}% | {current_str}/{total_str} | {speed_str}"
55
+
56
+ # Satır başına dön, progress barı yaz, kalan karakterleri temizle
57
+ pad = getattr(self, 'last_line_length', 0) - len(progress_line)
58
+ sys.stdout.write('\r' + progress_line + (' ' * pad if pad > 0 else ''))
59
+ sys.stdout.flush()
60
+ self.last_line_length = len(progress_line)
61
+
62
+ def finish(self, success: bool = True):
63
+ # Satırı temizle
64
+ sys.stdout.write('\r' + ' ' * getattr(self, 'last_line_length', 80) + '\r')
65
+ if success:
66
+ print(f"✅ {self.description} tamamlandı!")
67
+ else:
68
+ print(f"❌ {self.description} başarısız!")
69
+ sys.stdout.flush()
70
+
71
+ def _format_speed(self, speed: float) -> str:
72
+ """Hızı formatlar (B/s, KB/s, MB/s)"""
73
+ if speed < 1024:
74
+ return f"{speed:.1f} B/s"
75
+ elif speed < 1024 * 1024:
76
+ return f"{speed/1024:.1f} KB/s"
77
+ else:
78
+ return f"{speed/(1024*1024):.1f} MB/s"
79
+
80
+ def _format_size(self, size: int) -> str:
81
+ """Boyutu formatlar (B, KB, MB, GB)"""
82
+ if size < 1024:
83
+ return f"{size} B"
84
+ elif size < 1024 * 1024:
85
+ return f"{size/1024:.1f} KB"
86
+ elif size < 1024 * 1024 * 1024:
87
+ return f"{size/(1024*1024):.1f} MB"
88
+ else:
89
+ return f"{size/(1024*1024*1024):.1f} GB"
90
+
91
+
92
+ def download_with_progress(url: str, filename: str, description: str = "İndiriliyor") -> bool:
93
+ """
94
+ tqdm ile dosya indirir
95
+ """
96
+ try:
97
+ response = urlopen(url)
98
+ total_size = int(response.headers.get('content-length', 0))
99
+ response.close()
100
+ with urlopen(url) as response, open(filename, 'wb') as file, tqdm(
101
+ total=total_size, unit='B', unit_scale=True, desc=description, ncols=80
102
+ ) as bar:
103
+ downloaded = 0
104
+ chunk_size = 8192
105
+ while True:
106
+ chunk = response.read(chunk_size)
107
+ if not chunk:
108
+ break
109
+ file.write(chunk)
110
+ downloaded += len(chunk)
111
+ bar.update(len(chunk))
112
+ print(f"✅ {description} tamamlandı!")
113
+ return True
114
+ except Exception as e:
115
+ print(f"❌ İndirme hatası: {e}")
116
+ return False
117
+
118
+ def copy_with_progress(src: str, dst: str, description: str = "Kopyalanıyor") -> bool:
119
+ import os
120
+ try:
121
+ total_size = os.path.getsize(src)
122
+ with open(src, 'rb') as src_file, open(dst, 'wb') as dst_file, tqdm(
123
+ total=total_size, unit='B', unit_scale=True, desc=description, ncols=80
124
+ ) as bar:
125
+ copied = 0
126
+ chunk_size = 8192
127
+ while True:
128
+ chunk = src_file.read(chunk_size)
129
+ if not chunk:
130
+ break
131
+ dst_file.write(chunk)
132
+ copied += len(chunk)
133
+ bar.update(len(chunk))
134
+ print(f"✅ {description} tamamlandı!")
135
+ return True
136
+ except Exception as e:
137
+ print(f"❌ Kopyalama hatası: {e}")
138
+ return False
139
+
140
+ def extract_with_progress(zip_path: str, extract_path: str, description: str = "Çıkarılıyor") -> bool:
141
+ """
142
+ tqdm ile ZIP dosyası çıkarır
143
+ """
144
+ import zipfile
145
+ import os
146
+ try:
147
+ with zipfile.ZipFile(zip_path, 'r') as zip_ref:
148
+ file_list = zip_ref.filelist
149
+ total_files = len(file_list)
150
+ if total_files == 0:
151
+ print(f"❌ ZIP dosyası boş: {zip_path}")
152
+ return False
153
+ with tqdm(total=total_files, desc=description, ncols=80, unit='dosya') as bar:
154
+ for file_info in file_list:
155
+ zip_ref.extract(file_info, extract_path)
156
+ bar.update(1)
157
+ print(f"✅ {description} tamamlandı!")
158
+ return True
159
+ except Exception as e:
160
+ print(f"❌ Çıkarma hatası: {e}")
161
+ return False
162
+
163
+ def show_success_message(message: str):
164
+ print(f"✅ {message}")
165
+
166
+ def show_error_message(message: str):
167
+ print(f"❌ {message}")
168
+
169
+ def show_info_message(message: str):
170
+ print(f"ℹ️ {message}")
171
+
172
+ def show_warning_message(message: str):
173
+ print(f"⚠️ {message}")
@@ -10,4 +10,6 @@ typing-extensions>=4.0.0
10
10
  cryptography>=41.0.0
11
11
 
12
12
  # Versiyon yönetimi için
13
- packaging>=23.0
13
+ packaging>=23.0
14
+
15
+ tqdm>=4.0.0
@@ -90,6 +90,7 @@ setup(
90
90
  install_requires=[
91
91
  "requests>=2.31.0",
92
92
  "typing-extensions>=4.0.0; python_version<'3.10'",
93
+ "tqdm>=4.0.0",
93
94
  ],
94
95
 
95
96
  # Ek gereksinimler
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "app_name": "clapp",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "author": "Melih Burak Memiş",
5
5
  "description": "Basit ve güçlü paket yöneticisi",
6
6
  "source": "https://github.com/melihburak/clapp",
@@ -2,7 +2,7 @@
2
2
  Version information for clapp-pm package.
3
3
  """
4
4
 
5
- __version__ = "1.0.21"
5
+ __version__ = "1.0.22"
6
6
  __author__ = "Melih Burak Memiş"
7
7
  __email__ = "mburakmemiscy@gmail.com"
8
8
  __description__ = "Lightweight cross-language app manager for Python and Lua"
@@ -1,274 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- progress_utils.py - Progress Bar ve İndirme Hızı Göstergesi
4
-
5
- Bu modül indirme ve yükleme işlemleri için progress bar ve hız göstergesi sağlar.
6
- """
7
-
8
- import sys
9
- import time
10
- import threading
11
- from typing import Optional, Callable
12
- from urllib.request import urlopen
13
- from urllib.error import URLError
14
-
15
- class ProgressBar:
16
- """Progress bar sınıfı"""
17
-
18
- def __init__(self, total: int, description: str = "İndiriliyor", width: int = 50):
19
- self.total = total
20
- self.description = description
21
- self.width = width
22
- self.current = 0
23
- self.start_time = time.time()
24
- self.last_update = 0
25
- self.speed = 0
26
- self.lock = threading.Lock()
27
-
28
- def update(self, current: int, speed: Optional[float] = None):
29
- """Progress bar'ı günceller"""
30
- with self.lock:
31
- self.current = current
32
- if speed is not None:
33
- self.speed = speed
34
-
35
- # Hız hesaplama
36
- if self.current > 0:
37
- elapsed = time.time() - self.start_time
38
- if elapsed > 0:
39
- self.speed = self.current / elapsed
40
-
41
- def display(self):
42
- """Progress bar'ı ekranda gösterir"""
43
- if self.total <= 0:
44
- return
45
-
46
- percentage = (self.current / self.total) * 100
47
- filled_width = int(self.width * self.current // self.total)
48
-
49
- # Progress bar oluştur
50
- bar = '█' * filled_width + '░' * (self.width - filled_width)
51
-
52
- # Hız formatı
53
- speed_str = self._format_speed(self.speed)
54
-
55
- # Yüzde ve boyut bilgisi
56
- current_str = self._format_size(self.current)
57
- total_str = self._format_size(self.total)
58
-
59
- # Progress bar çıktısı
60
- progress_line = f"\r{self.description}: [{bar}] {percentage:5.1f}% | {current_str}/{total_str} | {speed_str}"
61
-
62
- # Satırı temizle ve yaz
63
- sys.stdout.write('\r' + ' ' * (len(progress_line) + 10)) # Temizle
64
- sys.stdout.write(progress_line)
65
- sys.stdout.flush()
66
-
67
- def finish(self, success: bool = True):
68
- """Progress bar'ı tamamlar"""
69
- if success:
70
- # Tamamlandı mesajı
71
- sys.stdout.write('\r' + ' ' * (self.width + 50)) # Temizle
72
- sys.stdout.write(f"\r✅ {self.description} tamamlandı!\n")
73
- else:
74
- # Hata mesajı
75
- sys.stdout.write('\r' + ' ' * (self.width + 50)) # Temizle
76
- sys.stdout.write(f"\r❌ {self.description} başarısız!\n")
77
- sys.stdout.flush()
78
-
79
- def _format_speed(self, speed: float) -> str:
80
- """Hızı formatlar (B/s, KB/s, MB/s)"""
81
- if speed < 1024:
82
- return f"{speed:.1f} B/s"
83
- elif speed < 1024 * 1024:
84
- return f"{speed/1024:.1f} KB/s"
85
- else:
86
- return f"{speed/(1024*1024):.1f} MB/s"
87
-
88
- def _format_size(self, size: int) -> str:
89
- """Boyutu formatlar (B, KB, MB, GB)"""
90
- if size < 1024:
91
- return f"{size} B"
92
- elif size < 1024 * 1024:
93
- return f"{size/1024:.1f} KB"
94
- elif size < 1024 * 1024 * 1024:
95
- return f"{size/(1024*1024):.1f} MB"
96
- else:
97
- return f"{size/(1024*1024*1024):.1f} GB"
98
-
99
-
100
- def download_with_progress(url: str, filename: str, description: str = "İndiriliyor") -> bool:
101
- """
102
- Progress bar ile dosya indirir
103
-
104
- Args:
105
- url: İndirilecek URL
106
- filename: Kaydedilecek dosya adı
107
- description: Progress bar açıklaması
108
-
109
- Returns:
110
- Başarılı ise True
111
- """
112
- try:
113
- # URL'den dosya boyutunu al
114
- response = urlopen(url)
115
- total_size = int(response.headers.get('content-length', 0))
116
- response.close()
117
-
118
- # Progress bar oluştur
119
- progress = ProgressBar(total_size, description)
120
-
121
- # İndirme işlemi
122
- with urlopen(url) as response:
123
- with open(filename, 'wb') as file:
124
- downloaded = 0
125
- chunk_size = 8192
126
-
127
- while True:
128
- chunk = response.read(chunk_size)
129
- if not chunk:
130
- break
131
-
132
- file.write(chunk)
133
- downloaded += len(chunk)
134
-
135
- # Progress bar güncelle
136
- progress.update(downloaded)
137
- progress.display()
138
-
139
- # Kısa bekleme (çok sık güncelleme önlemek için)
140
- time.sleep(0.01)
141
-
142
- # Tamamlandı
143
- progress.finish(True)
144
- return True
145
-
146
- except Exception as e:
147
- if 'progress' in locals():
148
- progress.finish(False)
149
- print(f"❌ İndirme hatası: {e}")
150
- return False
151
-
152
-
153
- def copy_with_progress(src: str, dst: str, description: str = "Kopyalanıyor") -> bool:
154
- """
155
- Progress bar ile dosya kopyalar
156
-
157
- Args:
158
- src: Kaynak dosya
159
- dst: Hedef dosya
160
- description: Progress bar açıklaması
161
-
162
- Returns:
163
- Başarılı ise True
164
- """
165
- import os
166
- import shutil
167
-
168
- try:
169
- # Dosya boyutunu al
170
- total_size = os.path.getsize(src)
171
-
172
- # Progress bar oluştur
173
- progress = ProgressBar(total_size, description)
174
-
175
- # Kopyalama işlemi
176
- with open(src, 'rb') as src_file:
177
- with open(dst, 'wb') as dst_file:
178
- copied = 0
179
- chunk_size = 8192
180
-
181
- while True:
182
- chunk = src_file.read(chunk_size)
183
- if not chunk:
184
- break
185
-
186
- dst_file.write(chunk)
187
- copied += len(chunk)
188
-
189
- # Progress bar güncelle
190
- progress.update(copied)
191
- progress.display()
192
-
193
- # Kısa bekleme
194
- time.sleep(0.001)
195
-
196
- # Tamamlandı
197
- progress.finish(True)
198
- return True
199
-
200
- except Exception as e:
201
- if 'progress' in locals():
202
- progress.finish(False)
203
- print(f"❌ Kopyalama hatası: {e}")
204
- return False
205
-
206
-
207
- def extract_with_progress(zip_path: str, extract_path: str, description: str = "Çıkarılıyor") -> bool:
208
- """
209
- Progress bar ile ZIP dosyası çıkarır
210
-
211
- Args:
212
- zip_path: ZIP dosyası yolu
213
- extract_path: Çıkarılacak dizin
214
- description: Progress bar açıklaması
215
-
216
- Returns:
217
- Başarılı ise True
218
- """
219
- import zipfile
220
- import os
221
-
222
- try:
223
- with zipfile.ZipFile(zip_path, 'r') as zip_ref:
224
- # Toplam dosya sayısı
225
- file_list = zip_ref.filelist
226
- total_files = len(file_list)
227
-
228
- if total_files == 0:
229
- print(f"❌ ZIP dosyası boş: {zip_path}")
230
- return False
231
-
232
- # Progress bar oluştur
233
- progress = ProgressBar(total_files, description)
234
-
235
- # Çıkarma işlemi
236
- for i, file_info in enumerate(file_list):
237
- zip_ref.extract(file_info, extract_path)
238
-
239
- # Progress bar güncelle
240
- progress.update(i + 1)
241
- progress.display()
242
-
243
- # Kısa bekleme
244
- time.sleep(0.01)
245
-
246
- # Tamamlandı
247
- progress.finish(True)
248
- return True
249
-
250
- except Exception as e:
251
- if 'progress' in locals():
252
- progress.finish(False)
253
- print(f"❌ Çıkarma hatası: {e}")
254
- return False
255
-
256
-
257
- def show_success_message(message: str):
258
- """Başarı mesajı gösterir"""
259
- print(f"✅ {message}")
260
-
261
-
262
- def show_error_message(message: str):
263
- """Hata mesajı gösterir"""
264
- print(f"❌ {message}")
265
-
266
-
267
- def show_info_message(message: str):
268
- """Bilgi mesajı gösterir"""
269
- print(f"ℹ️ {message}")
270
-
271
-
272
- def show_warning_message(message: str):
273
- """Uyarı mesajı gösterir"""
274
- print(f"⚠️ {message}")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes