forked from badabing2005/PixelFlasher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencode-bitmaps.py
246 lines (234 loc) · 13 KB
/
encode-bitmaps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#!/usr/bin/env python
# This file is part of PixelFlasher https://github.com/badabing2005/PixelFlasher
#
# Copyright (C) 2024 Badabing2005
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Also add information on how to contact you by electronic and paper mail.
#
# If your software can interact with users remotely through a computer network,
# you should also make sure that it provides a way for users to get its source.
# For example, if your program is a web application, its interface could
# display a "Source" link that leads users to an archive of the code. There are
# many ways you could offer source, and different solutions will be better for
# different programs; see section 13 for the specific requirements.
#
# You should also get your employer (if you work as a programmer) or school, if
# any, to sign a "copyright disclaimer" for the program, if necessary. For more
# information on this, and how to apply and follow the GNU AGPL, see
# <https://www.gnu.org/licenses/>.
"""
This is a way to save the startup time when running img2py on lots of
files...
"""
import os
from wx.tools import img2py
command_lines = [
"-a -F -i -n about-24 images/about-24.png images.py",
"-a -F -i -n about-64 images/about-64.png images.py",
"-a -F -i -n add-24 images/add-24.png images.py",
"-a -F -i -n settings-24 images/settings-24.png images.py",
"-a -F -i -n settings-64 images/settings-64.png images.py",
"-a -F -i -n backup-24 images/backup-24.png images.py",
"-a -F -i -n backup-64 images/backup-64.png images.py",
"-a -F -i -n blank images/blank.png images.py",
"-a -F -i -n boot-24 images/boot-24.png images.py",
"-a -F -i -n bottom-24 images/bottom-24.png images.py",
"-a -F -i -n bug-24 images/bug-24.png images.py",
"-a -F -i -n custom-patch-24 images/custom-patch-24.png images.py",
"-a -F -i -n delete-24 images/delete-24.png images.py",
"-a -F -i -n exit-24 images/exit-24.png images.py",
"-a -F -i -n feature-24 images/feature-24.png images.py",
"-a -F -i -n flash-24 images/flash-24.png images.py",
"-a -F -i -n flash-32 images/flash-32.png images.py",
"-a -F -i -n folder-24 images/folder-24.png images.py",
"-a -F -i -n forum-24 images/forum-24.png images.py",
"-a -F -i -n github-24 images/github-24.png images.py",
"-a -F -i -n guide-24 images/guide-24.png images.py",
"-a -F -i -n Icon-256 images/icon-256.png images.py",
"-a -F -i -n Icon-dark-256 images/icon-dark-256.png images.py",
"-a -F -i -n install-apk-24 images/install-apk-24.png images.py",
"-a -F -i -n install-apk-64 images/install-apk-64.png images.py",
"-a -F -i -n install-magisk-24 images/install-magisk-24.png images.py",
"-a -F -i -n install-magisk-64 images/install-magisk-64.png images.py",
"-a -F -i -n left-24 images/left-24.png images.py",
"-a -F -i -n lock-24 images/lock-24.png images.py",
"-a -F -i -n lock-64 images/lock-64.png images.py",
"-a -F -i -n magisk-24 images/magisk-24.png images.py",
"-a -F -i -n magisk-64 images/magisk-64.png images.py",
"-a -F -i -n official-16 images/official-16.png images.py",
"-a -F -i -n official-24 images/official-24.png images.py",
"-a -F -i -n open-link-24 images/open-link-24.png images.py",
"-a -F -i -n open-link-red-24 images/open-link-red-24.png images.py",
"-a -F -i -n packages-24 images/packages-24.png images.py",
"-a -F -i -n packages-64 images/packages-64.png images.py",
"-a -F -i -n partition-24 images/partition-24.png images.py",
"-a -F -i -n partition-64 images/partition-64.png images.py",
"-a -F -i -n paste-24 images/paste-24.png images.py",
"-a -F -i -n paste-up-24 images/paste-up-24.png images.py",
"-a -F -i -n smart-paste-up-24 images/smart-paste-up-24.png images.py",
"-a -F -i -n paste-down-24 images/paste-down-24.png images.py",
"-a -F -i -n patch-24 images/patch-24.png images.py",
"-a -F -i -n patched-16 images/patched-16.png images.py",
"-a -F -i -n patched-24 images/patched-24.png images.py",
"-a -F -i -n process_file-24 images/process_file-24.png images.py",
"-a -F -i -n reboot-24 images/reboot-24.png images.py",
"-a -F -i -n reboot-64 images/reboot-64.png images.py",
"-a -F -i -n reboot-System-24 images/reboot-system-24.png images.py",
"-a -F -i -n reboot-system-64 images/reboot-system-64.png images.py",
"-a -F -i -n reboot-bootloader-24 images/reboot-bootloader-24.png images.py",
"-a -F -i -n reboot-bootloader-64 images/reboot-bootloader-64.png images.py",
"-a -F -i -n reboot-fastbootd-24 images/reboot-fastbootd-24.png images.py",
"-a -F -i -n reboot-fastbootd-64 images/reboot-fastbootd-64.png images.py",
"-a -F -i -n reboot-download-24 images/reboot-download-24.png images.py",
"-a -F -i -n reboot-download-64 images/reboot-download-64.png images.py",
"-a -F -i -n reboot-recovery-24 images/reboot-recovery-24.png images.py",
"-a -F -i -n reboot-recovery-64 images/reboot-recovery-64.png images.py",
"-a -F -i -n reboot-safe-mode-24 images/reboot-safe-mode-24.png images.py",
"-a -F -i -n reboot-safe-mode-64 images/reboot-safe-mode-64.png images.py",
"-a -F -i -n reboot-sideload-24 images/reboot-sideload-24.png images.py",
"-a -F -i -n reboot-sideload-64 images/reboot-sideload-64.png images.py",
"-a -F -i -n right-24 images/right-24.png images.py",
"-a -F -i -n scan-24 images/scan-24.png images.py",
"-a -F -i -n shell-24 images/shell-24.png images.py",
"-a -F -i -n shell-64 images/shell-64.png images.py",
"-a -F -i -n shell-64-disabled images/shell-64-disabled.png images.py",
"-a -F -i -n scrcpy-24 images/scrcpy-24.png images.py",
"-a -F -i -n scrcpy-64 images/scrcpy-64.png images.py",
"-a -F -i -n shield-24 images/shield-24.png images.py",
"-a -F -i -n shield-64 images/shield-64.png images.py",
"-a -F -i -n sos-24 images/sos-24.png images.py",
"-a -F -i -n sos-64 images/sos-64.png images.py",
"-a -F -i -n Splash images/splash.png images.py",
"-a -F -i -n Splash-dark images/splash-dark.png images.py",
"-a -F -i -n support-24 images/support-24.png images.py",
"-a -F -i -n switch-slot-24 images/switch-slot-24.png images.py",
"-a -F -i -n switch-slot-64 images/switch-slot-64.png images.py",
"-a -F -i -n top-24 images/top-24.png images.py",
"-a -F -i -n unlock-24 images/unlock-24.png images.py",
"-a -F -i -n unlock-64 images/unlock-64.png images.py",
"-a -F -i -n update-check-24 images/update-check-24.png images.py",
"-a -F -i -n wifi-adb-24 images/wifi-adb-24.png images.py",
"-a -F -i -n slot-a-48 images/slot-a-48.png images.py",
"-a -F -i -n slot-b-48 images/slot-b-48.png images.py",
"-a -F -i -n rooted images/rooted.png images.py",
"-a -F -i -n watch-green-24 images/watch-green-24.png images.py",
"-a -F -i -n watch-blue-24 images/watch-blue-24.png images.py",
"-a -F -i -n phone-green-24 images/phone-green-24.png images.py",
"-a -F -i -n phone-blue-24 images/phone-blue-24.png images.py",
"-a -F -i -n disable-24 images/disable-24.png images.py",
"-a -F -i -n enable-24 images/enable-24.png images.py",
"-a -F -i -n download-16 images/download-16.png images.py",
"-a -F -i -n download-24 images/download-24.png images.py",
"-a -F -i -n uninstall-24 images/uninstall-24.png images.py",
"-a -F -i -n launch-24 images/launch-24.png images.py",
"-a -F -i -n kill-24 images/kill-24.png images.py",
"-a -F -i -n clear-24 images/clear-24.png images.py",
"-a -F -i -n check-24 images/check-24.png images.py",
"-a -F -i -n uncheck-24 images/uncheck-24.png images.py",
"-a -F -i -n clipboard-24 images/clipboard-24.png images.py",
"-a -F -i -n push-24 images/push-24.png images.py",
"-a -F -i -n push-cart-24 images/push-cart-24.png images.py",
"-a -F -i -n json-24 images/json-24.png images.py",
"-a -F -i -n xml-24 images/xml-24.png images.py",
"-a -F -i -n alert-red-24 images/alert-red-24.png images.py",
"-a -F -i -n alert-gray-24 images/alert-gray-24.png images.py",
"-a -F -i -n pif-24 images/pif-24.png images.py",
"-a -F -i -n pif-64 images/pif-64.png images.py",
"-a -F -i -n heart-red-24 images/heart-red-24.png images.py",
"-a -F -i -n heart-gray-24 images/heart-gray-24.png images.py",
"-a -F -i -n import-24 images/import-24.png images.py",
"-a -F -i -n cancel-ota-24 images/cancel-ota-24.png images.py",
"-a -F -i -n factory-24 images/factory-24.png images.py",
"-a -F -i -n cloud-24 images/cloud-24.png images.py",
"-a -F -i -n star-green-24 images/star-green-24.png images.py",
"-a -F -i -n e2j-24 images/e2j-24.png images.py",
"-a -F -i -n j2e-24 images/j2e-24.png images.py",
"-a -F -i -n save-24 images/save-24.png images.py",
"-a -F -i -n kernelsu-24 images/kernelsu-24.png images.py",
"-a -F -i -n apatch-24 images/apatch-24.png images.py",
"-a -F -i -n cert-24 images/cert-24.png images.py",
"-a -F -i -n downgrade-24 images/downgrade-24.png images.py",
"-a -F -i -n check-otacerts-24 images/check-otacerts-24.png images.py",
"-a -F -i -n wrench-24 images/wrench-24.png images.py",
"-a -F -i -n java-24 images/java-24.png images.py",
"-a -F -i -n folder-zip-24 images/folder-zip-24.png images.py",
"-a -F -i -n restore-24 images/restore-24.png images.py",
"-a -F -i -n analyze-24 images/analyze-24.png images.py",
"-a -F -i -n analyze-64 images/analyze-64.png images.py",
]
if __name__ == "__main__":
# first delete the existing images.py
if os.path.exists("images.py"):
os.remove("images.py")
# create images.py with proper header
with open('images.py', "w", encoding="ISO-8859-1", errors="replace") as f:
header = """
# This file is part of PixelFlasher https://github.com/badabing2005/PixelFlasher
#
# Copyright (C) 2024 Badabing2005
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
# for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Also add information on how to contact you by electronic and paper mail.
#
# If your software can interact with users remotely through a computer network,
# you should also make sure that it provides a way for users to get its source.
# For example, if your program is a web application, its interface could
# display a "Source" link that leads users to an archive of the code. There are
# many ways you could offer source, and different solutions will be better for
# different programs; see section 13 for the specific requirements.
#
# You should also get your employer (if you work as a programmer) or school, if
# any, to sign a "copyright disclaimer" for the program, if necessary. For more
# information on this, and how to apply and follow the GNU AGPL, see
# <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------
# This file was generated by encode-bitmaps.py
#
from wx.lib.embeddedimage import PyEmbeddedImage
#----------------------------------------------------------------------
SmallUpArrow = PyEmbeddedImage(
b"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAADxJ"
b"REFUOI1jZGRiZqAEMFGke2gY8P/f3/9kGwDTjM8QnAaga8JlCG3CAJdt2MQxDCAUaOjyjKMp"
b"cRAYAABS2CPsss3BWQAAAABJRU5ErkJggg==")
#----------------------------------------------------------------------
SmallDnArrow = PyEmbeddedImage(
b"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAEhJ"
b"REFUOI1jZGRiZqAEMFGke9QABgYGBgYWdIH///7+J6SJkYmZEacLkCUJacZqAD5DsInTLhDR"
b"bcPlKrwugGnCFy6Mo3mBAQChDgRlP4RC7wAAAABJRU5ErkJggg==")
"""
# header = "#----------------------------------------------------------------------\n"
# header += "# This file was generated by encode-bitmaps.py\n"
# header += "#\n"
# header += "from wx.lib.embeddedimage import PyEmbeddedImage\n\n"
f.write(header)
# add all the images
for line in command_lines:
args = line.split()
img2py.main(args)