QT-PyQt-PySide-Custom-Widgets 0.3.9__tar.gz → 0.4.0__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 (42) hide show
  1. usr/lib/python3.10/site-packages/Custom_Widgets/ProgressIndicator/__pycache__/__init__.cpython-310.pyc +0 -0
  2. usr/lib/python3.10/site-packages/Custom_Widgets/ProgressIndicator/__pycache__/test.cpython-310.pyc +0 -0
  3. usr/lib/python3.10/site-packages/Custom_Widgets/ProgressIndicator/__pycache__/ui_interface.cpython-310.pyc +0 -0
  4. usr/lib/python3.10/site-packages/Custom_Widgets/ProjectMaker.py +401 -0
  5. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/Qss/SassCompiler.py +10 -2
  6. usr/lib/python3.10/site-packages/Custom_Widgets/Qss/SvgToPngIcons.py +314 -0
  7. usr/lib/python3.10/site-packages/Custom_Widgets/Qss/__pycache__/SassCompiler.cpython-310.pyc +0 -0
  8. usr/lib/python3.10/site-packages/Custom_Widgets/Qss/__pycache__/SvgToPngIcons.cpython-310.pyc +0 -0
  9. usr/lib/python3.10/site-packages/Custom_Widgets/Qss/__pycache__/__init__.cpython-310.pyc +0 -0
  10. usr/lib/python3.10/site-packages/Custom_Widgets/Qss/__pycache__/colorsystem.cpython-310.pyc +0 -0
  11. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/Qss/colorsystem.py +2 -0
  12. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/Widgets.py +7 -2
  13. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/WidgetsWorker.py +1 -2
  14. usr/lib/python3.10/site-packages/Custom_Widgets/__pycache__/AnalogGaugeWidget.cpython-310.pyc +0 -0
  15. usr/lib/python3.10/site-packages/Custom_Widgets/__pycache__/ProjectMaker.cpython-310.pyc +0 -0
  16. usr/lib/python3.10/site-packages/Custom_Widgets/__pycache__/RoundProgressBar.cpython-310.pyc +0 -0
  17. usr/lib/python3.10/site-packages/Custom_Widgets/__pycache__/SpiralProgressBar.cpython-310.pyc +0 -0
  18. usr/lib/python3.10/site-packages/Custom_Widgets/__pycache__/Widgets.cpython-310.pyc +0 -0
  19. usr/lib/python3.10/site-packages/Custom_Widgets/__pycache__/WidgetsWorker.cpython-310.pyc +0 -0
  20. usr/lib/python3.10/site-packages/Custom_Widgets/__pycache__/__init__.cpython-310.pyc +0 -0
  21. usr/lib/python3.10/site-packages/Custom_Widgets/__pycache__/main.cpython-310.pyc +0 -0
  22. usr/lib/python3.10/site-packages/Custom_Widgets/main.py +64 -0
  23. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages/QT_PyQt_PySide_Custom_Widgets-0.4.0-py3.10.egg-info}/PKG-INFO +2 -2
  24. {QT-PyQt-PySide-Custom-Widgets-0.3.9/QT_PyQt_PySide_Custom_Widgets.egg-info → usr/lib/python3.10/site-packages/QT_PyQt_PySide_Custom_Widgets-0.4.0-py3.10.egg-info}/SOURCES.txt +2 -0
  25. {QT-PyQt-PySide-Custom-Widgets-0.3.9/QT_PyQt_PySide_Custom_Widgets.egg-info → usr/lib/python3.10/site-packages/QT_PyQt_PySide_Custom_Widgets-0.4.0-py3.10.egg-info}/requires.txt +4 -0
  26. QT-PyQt-PySide-Custom-Widgets-0.3.9/Custom_Widgets/Qss/SvgToPngIcons.py +0 -140
  27. QT-PyQt-PySide-Custom-Widgets-0.3.9/LICENSE +0 -674
  28. QT-PyQt-PySide-Custom-Widgets-0.3.9/MANIFEST.in +0 -0
  29. QT-PyQt-PySide-Custom-Widgets-0.3.9/QT_PyQt_PySide_Custom_Widgets.egg-info/PKG-INFO +0 -61
  30. QT-PyQt-PySide-Custom-Widgets-0.3.9/README.md +0 -39
  31. QT-PyQt-PySide-Custom-Widgets-0.3.9/setup.cfg +0 -4
  32. QT-PyQt-PySide-Custom-Widgets-0.3.9/setup.py +0 -50
  33. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/AnalogGaugeWidget.py +0 -0
  34. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/ProgressIndicator/__init__.py +0 -0
  35. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/ProgressIndicator/test.py +0 -0
  36. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/ProgressIndicator/ui_interface.py +0 -0
  37. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/Qss/__init__.py +0 -0
  38. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/RoundProgressBar.py +0 -0
  39. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/SpiralProgressBar.py +0 -0
  40. {QT-PyQt-PySide-Custom-Widgets-0.3.9 → usr/lib/python3.10/site-packages}/Custom_Widgets/__init__.py +0 -0
  41. {QT-PyQt-PySide-Custom-Widgets-0.3.9/QT_PyQt_PySide_Custom_Widgets.egg-info → usr/lib/python3.10/site-packages/QT_PyQt_PySide_Custom_Widgets-0.4.0-py3.10.egg-info}/dependency_links.txt +0 -0
  42. {QT-PyQt-PySide-Custom-Widgets-0.3.9/QT_PyQt_PySide_Custom_Widgets.egg-info → usr/lib/python3.10/site-packages/QT_PyQt_PySide_Custom_Widgets-0.4.0-py3.10.egg-info}/top_level.txt +0 -0
@@ -0,0 +1,401 @@
1
+ ########################################################################
2
+ ## SPINN DESIGN CODE
3
+ # YOUTUBE: (SPINN TV) https://www.youtube.com/spinnTv
4
+ # WEBSITE: spinntv.com
5
+ # EMAIL: info@spinntv.com
6
+ ########################################################################
7
+
8
+ ########################################################################
9
+ ## IMPORTS
10
+ ########################################################################
11
+ import os
12
+ import sys
13
+ from subprocess import call
14
+ import cairosvg
15
+ import codecs
16
+ import shutil
17
+ import json
18
+ from urllib.parse import urlparse
19
+
20
+ from PySide2.QtCore import QUrl
21
+ from PySide2.QtGui import QColor
22
+
23
+ from . Qss.colorsystem import *
24
+
25
+
26
+ def progress(count, total, status=''):
27
+ bar_len = 60
28
+ filled_len = int(round(bar_len * count / float(total)))
29
+
30
+ percents = round(100.0 * count / float(total), 1)
31
+ bar = '=' * filled_len + '-' * (bar_len - filled_len)
32
+
33
+ sys.stdout.write('[%s] %s%s ...%s\r' % (bar, percents, '%', status))
34
+ sys.stdout.flush()
35
+
36
+
37
+ def query_yes_no(question, default="yes"):
38
+ valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
39
+ if default is None:
40
+ prompt = " [y/n] "
41
+ elif default == "yes":
42
+ prompt = " [Y/n] "
43
+ elif default == "no":
44
+ prompt = " [y/N] "
45
+ else:
46
+ raise ValueError("invalid default answer: '%s'" % default)
47
+
48
+ while True:
49
+ sys.stdout.write(question + prompt)
50
+ choice = input().lower()
51
+ if default is not None and choice == "":
52
+ return valid[default]
53
+ elif choice in valid:
54
+ return valid[choice]
55
+ else:
56
+ sys.stdout.write("Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n")
57
+
58
+ def generateIcons(iconsColor = "#fff"):
59
+ # Files folder
60
+ dirname = os.path.dirname(__file__)
61
+ filename = os.path.join(dirname, 'Qss/icons/original_svg')
62
+ list_of_files = []
63
+
64
+ svg_color = "#fff"
65
+ normal_color = iconsColor
66
+
67
+ focused_color = adjust_lightness(normal_color, 1.5)
68
+ disabled_color = adjust_lightness(normal_color, .5)
69
+
70
+
71
+ iconsFolder = os.path.abspath(os.path.join(os.getcwd(), 'QSS/Icons'))
72
+
73
+
74
+ print("Generating icons for your theme, please wait. This may take long\n")
75
+
76
+ for root, dirs, files in os.walk(filename):
77
+ for file in files:
78
+ list_of_files.append(os.path.join(root,file))
79
+
80
+ totalIcons = len(list_of_files)
81
+
82
+ for name in list_of_files:
83
+ # Create normal icons
84
+ with codecs.open(name, encoding='utf-8', errors='ignore') as f:
85
+ content = f.read()
86
+
87
+ newSVG = content.replace(svg_color, normal_color)
88
+ newBytes = str.encode(newSVG)
89
+
90
+ name_2 = os.path.basename(urlparse(name).path).replace(".svg", ".png")
91
+ filename = os.path.abspath(os.path.join(iconsFolder, name_2))
92
+
93
+ if not os.path.exists(iconsFolder):
94
+ os.makedirs(iconsFolder)
95
+
96
+ if not os.path.exists(filename):
97
+ try:
98
+ cairosvg.svg2png(bytestring=newBytes, write_to=filename)
99
+ except Exception as e:
100
+ print(e)
101
+
102
+
103
+ # Create focus icons
104
+ with codecs.open(name, encoding='utf-8', errors='ignore') as f:
105
+ content = f.read()
106
+
107
+ newSVG = content.replace(svg_color, focused_color)
108
+ newBytes = str.encode(newSVG)
109
+
110
+ name_2 = os.path.basename(urlparse(name).path).replace(".svg", "_focus.png")
111
+ filename = os.path.abspath(os.path.join(iconsFolder, name_2))
112
+
113
+ if not os.path.exists(iconsFolder):
114
+ os.makedirs(iconsFolder)
115
+
116
+ if not os.path.exists(filename):
117
+ try:
118
+ cairosvg.svg2png(bytestring=newBytes, write_to=filename)
119
+ except Exception as e:
120
+ print(e)
121
+
122
+
123
+ # Create disabled icons
124
+ with codecs.open(name, encoding='utf-8', errors='ignore') as f:
125
+ content = f.read()
126
+
127
+ newSVG = content.replace(svg_color, disabled_color)
128
+ newBytes = str.encode(newSVG)
129
+
130
+ name_2 = os.path.basename(urlparse(name).path).replace(".svg", "_disabled.png")
131
+ filename = os.path.abspath(os.path.join(iconsFolder, name_2))
132
+
133
+ if not os.path.exists(iconsFolder):
134
+ os.makedirs(iconsFolder)
135
+
136
+ if not os.path.exists(filename):
137
+ try:
138
+ cairosvg.svg2png(bytestring=newBytes, write_to=filename)
139
+ except Exception as e:
140
+ print(e)
141
+
142
+ progress(int((list_of_files.index(name)/totalIcons) * 100), 100)
143
+
144
+ print("\nCreating the resources (py) file")
145
+ # Check resource file
146
+ resource_path = os.path.abspath(os.path.join(os.getcwd(), 'QSS/QSS_Resources.qrc'))
147
+ if not os.path.exists(resource_path):
148
+ shutil.copy(os.path.abspath(os.path.join(os.path.dirname(__file__), 'QSS_Resources.qrc')), os.path.abspath(os.path.join(os.getcwd(), 'QSS')))
149
+ py_resource_path = resource_path.replace(".qrc", ".py")
150
+ py_resource_path = py_resource_path.replace("QSS/", "")
151
+ py_resource_path = py_resource_path.replace("QSS_Resources", "QSS_Resources_rc")
152
+ # Convert qrc to py
153
+ try:
154
+ os.system("pyrcc5 '"+resource_path+"' -o '"+py_resource_path+"'")
155
+ except Exception as e:
156
+ raise e
157
+
158
+ print("Resources (py) file created")
159
+
160
+
161
+
162
+
163
+
164
+ # Current Directory
165
+ currentDir = os.getcwd()
166
+ print("""
167
+ ########################################################################
168
+ ## SPINN DESIGN CODE
169
+ # THE CUSTOM WIDGETS MODULE FOR QT
170
+ # PROJECT MAKER
171
+ # YOUTUBE: (SPINN TV) https://www.youtube.com/spinnTv
172
+ # WEBSITE: spinntv.com
173
+ # EMAIL: info@spinntv.com
174
+ ########################################################################
175
+
176
+ ########################################################################
177
+ ## INITIALIZING A NEW PROJECT TO:
178
+ ########################################################################
179
+ """)
180
+ print(currentDir)
181
+
182
+ # Check if the folder is empty
183
+ if any(os.scandir(currentDir)):
184
+ print("""
185
+ ########################################################################
186
+ ## EXITING BECAUSE THE FOLDER IS NOT EMPTY
187
+ ########################################################################
188
+ Please select an empty folder
189
+ """)
190
+ exit()
191
+
192
+ print("""
193
+
194
+ ########################################################################
195
+
196
+ """)
197
+ print("Creating resources folder")
198
+
199
+ qcss_folder = os.path.abspath(os.path.join(os.getcwd(), 'QSS'))
200
+ if not os.path.exists(qcss_folder):
201
+ os.makedirs(qcss_folder)
202
+
203
+ print("Resources folder created")
204
+
205
+ print("Creating (qrc) resource file")
206
+ # Check resource file
207
+ resource_path = os.path.abspath(os.path.join(os.getcwd(), 'QSS/QSS_Resources.qrc'))
208
+ if not os.path.exists(resource_path):
209
+ shutil.copy(os.path.abspath(os.path.join(os.path.dirname(__file__), 'Qss/QSS_Resources.qrc')), os.path.abspath(os.path.join(os.getcwd(), 'QSS')))
210
+
211
+ print("Resource (qrc) file created")
212
+
213
+ print("Creating the main (UI) interface file")
214
+ # Check ui file
215
+ resource_path = os.path.abspath(os.path.join(os.getcwd(), 'interface.ui'))
216
+ if not os.path.exists(resource_path):
217
+ shutil.copy(os.path.abspath(os.path.join(os.path.dirname(__file__), 'components/uis/interface.ui')), os.getcwd())
218
+
219
+
220
+ print("Main (UI) interface file created")
221
+
222
+ print("Creating the main (py) python file")
223
+ # Check main file
224
+ resource_path = os.path.abspath(os.path.join(os.getcwd(), 'main.py'))
225
+ if not os.path.exists(resource_path):
226
+ shutil.copy(os.path.abspath(os.path.join(os.path.dirname(__file__), 'components/python/main.py')), os.getcwd())
227
+
228
+ print("Main (py) python file created")
229
+
230
+ print("Creating the icons (png) files")
231
+
232
+ print("""
233
+
234
+ ########################################################################
235
+ PLEASE ENTER YOUR ICONS COLOR BELOW:
236
+ ########################################################################
237
+ You can pass the color HEX value such as #fff
238
+ or the color string value like white
239
+
240
+ """)
241
+
242
+ while True:
243
+ iconsColor = input("Enter icons color: ")
244
+ if iconsColor.isspace() or iconsColor == "":
245
+ print("Icons color can not be empty")
246
+ print("!!!!!!")
247
+ continue
248
+ if not QColor().isValidColor(iconsColor):
249
+ print(iconsColor, "is not a valid color")
250
+ print("!!!!!!")
251
+ continue
252
+ if query_yes_no("Your icons color is " + str(iconsColor) + ". Save the color and continue?"):
253
+ break
254
+
255
+ generateIcons(iconsColor)
256
+
257
+ print("Icons have been created")
258
+
259
+ print("Creating UI (py) file")
260
+ # Check ui(py) file
261
+ resource_path = os.path.abspath(os.path.join(os.getcwd(), 'ui_interface.py'))
262
+ if not os.path.exists(resource_path):
263
+ shutil.copy(os.path.abspath(os.path.join(os.path.dirname(__file__), 'components/python/ui_interface.py')), os.getcwd())
264
+
265
+ print("UI (py) file has been created")
266
+
267
+
268
+ print("Creating the JSON stylesheet file")
269
+
270
+ print("""
271
+
272
+ ########################################################################
273
+ PLEASE FILL IN THE REQUIRED DATA BELOW:
274
+ ########################################################################
275
+
276
+ """)
277
+
278
+ while True:
279
+ appName = input("Enter your app name: ")
280
+ if appName.isspace() or appName == "":
281
+ print("App name can not be empty")
282
+ print("!!!!!!")
283
+ continue
284
+ if query_yes_no("Your app name is " + appName + ". Save the name and continue?"):
285
+ break
286
+
287
+ print("""
288
+
289
+ ########################################################################
290
+ THE FOLLOWING VALUES WILL BE USED TO SAVE YOUR APP CONFIGURATIONS SUCH AS
291
+ APP APP THEME USING THE QSETTINGS CLASS
292
+
293
+ The required value are application name, organisation name and domain name.
294
+ If left empty, your app name will be used, you can change this later
295
+ from the JSON stylesheet file inside your project
296
+ ########################################################################
297
+
298
+ """)
299
+
300
+ while True:
301
+ organizationName = input("Please enter the your organization name (Optional): ")
302
+ if organizationName.isspace() or organizationName == "":
303
+ organizationName = appName+" Company"
304
+ break
305
+ if query_yes_no("Your organization name is " + organizationName + ". Save the organization name and continue?"):
306
+ break
307
+
308
+ while True:
309
+ domainName = input("Please enter the your domain name. Please enter a URL i.e domain.org (Optional): ")
310
+ if domainName.isspace() or domainName == "":
311
+ domainName = appName+".org"
312
+ break
313
+ # if not QUrl(domainName).isValid():
314
+ # print("Invalid URL: %s", domainName, " Domain name must be a URL like domain.org")
315
+ # continue
316
+ if query_yes_no("Your domain name is " + domainName + ". Save the domain name and continue?"):
317
+ break
318
+
319
+
320
+ # Check json file
321
+ json_path = os.path.abspath(os.path.join(os.getcwd(), 'style.json'))
322
+ if not os.path.exists(json_path):
323
+ shutil.copy(os.path.abspath(os.path.join(os.path.dirname(__file__), 'components/json/style.json')), os.getcwd())
324
+
325
+ with open(json_path, 'r+') as f:
326
+ data = json.load(f)
327
+ print(data)
328
+ if "QMainWindow" in data:
329
+ for QMainWindow in data["QMainWindow"]:
330
+ # Set window tittle
331
+ QMainWindow["tittle"] = appName
332
+
333
+ ########################################################################
334
+ ## QSETTINGS
335
+ ########################################################################
336
+ if "QSettings" in data:
337
+ for settings in data["QSettings"]:
338
+ if "AppSettings" in settings:
339
+ appSettings = settings['AppSettings']
340
+
341
+ appSettings["OrginizationName"] = str(appName)
342
+
343
+ appSettings["ApplicationName"] = str(organizationName)
344
+
345
+ appSettings["OrginizationDormain"] = str(domainName)
346
+
347
+ f.seek(0)
348
+ json.dump(data, f, indent=4)
349
+ f.truncate()
350
+
351
+
352
+ print("JSON stylesheet file created")
353
+
354
+ print("""
355
+
356
+ ########################################################################
357
+ CONGRATULATIONS! YOUR PROJECT HAS BEEN CREATED.
358
+
359
+ WHAT NEXT??
360
+
361
+ 1. Open the interface.ui file inside your project folder using QT designer.
362
+ This is your main inteface file.
363
+
364
+ 2. Put your app customization/style inside the JSON style.json file.
365
+ Read more here on how to use the custom widgets module
366
+ https://github.com/KhamisiKibet/QT-PyQt-PySide-Custom-Widgets
367
+
368
+ 3. Run the main.py file to view your app. Get more tutorials
369
+ here on how to create awsome QT Apps with python
370
+ https://www.youtube.com/spinnTv
371
+
372
+ 4. Your default app icons are located inside the QSS/Icons folder.
373
+
374
+ [The following is important only if you decide to use the theme maker]
375
+
376
+ 5. The default QSASS and QSS stylesheet are also inside the QSS folder.
377
+
378
+ 6. Put you own style (CSS or SCSS) inside the QSS/defaultStyle.scss file.
379
+ This style will override the default theme style.
380
+
381
+ 7. The QSS/_variables.scss contains your theme variables
382
+
383
+ ########################################################################
384
+
385
+ """)
386
+
387
+
388
+ while True:
389
+ if not query_yes_no("Run the created project or exit the project wizard? Type yes to run the app or no to exit the wizard"):
390
+ break
391
+ else:
392
+ print("""
393
+
394
+ ########################################################################
395
+ RUNNING YOUR PROJECT
396
+ ########################################################################
397
+ """)
398
+ call(["python", "main.py"])
399
+
400
+
401
+ exit()
@@ -84,18 +84,26 @@ class CompileStyleSheet():
84
84
  ########################################################################
85
85
  ## GENERATE NEW ICONS
86
86
  # START WORKER
87
+ # CURRENT THEME ICONS
87
88
  iconsWorker = Worker(self.compileSassTheme)
88
89
  iconsWorker.signals.result.connect(WorkerResponse.print_output)
89
90
  iconsWorker.signals.finished.connect(self.restart)
90
91
  iconsWorker.signals.progress.connect(self.sassCompilationProgress)
91
92
 
93
+ # ALL THEME ICONS
94
+ allIconsWorker = Worker(self.makeAllIcons)
95
+ allIconsWorker.signals.result.connect(WorkerResponse.print_output)
96
+ allIconsWorker.signals.finished.connect(lambda: print("all icons have been checked and missing icons generated!"))
97
+ allIconsWorker.signals.progress.connect(self.sassCompilationProgress)
98
+
92
99
  color = CreateColorVariable.getCurrentThemeInfo(self)
93
100
  normal_color = str(color["icons-color"])
94
101
  # print(settings.value("ICONS-COLOR"), normal_color)
95
- if not settings.value("ICONS-COLOR") == normal_color and color["icons-color"] is not None:
102
+ if not settings.value("ICONS-COLOR") == normal_color and color["icons-color"] is not None:
96
103
  # Execute
97
104
  self.customWidgetsThreadpool.start(iconsWorker)
98
- print("test")
105
+ else:
106
+ self.customWidgetsThreadpool.start(allIconsWorker)
99
107
 
100
108
 
101
109
  ########################################################################