diff --git a/Electrify.nsi b/Electrify.nsi index ef64a0c..5fb14f0 100644 --- a/Electrify.nsi +++ b/Electrify.nsi @@ -74,14 +74,14 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show ShowUnInstDetails show -Section "Electrifycutable" SEC01 +Section "Electrify" SEC01 SectionIn RO SetOutPath "$INSTDIR" SetOverwrite try File /r /x compressors "ElectrifyWin\" - CreateDirectory "$LocalAppData\Electrifycutable\Electrifycutable\files\compressors" - SetOutPath "$LocalAppData\Electrifycutable\Electrifycutable\files\compressors" + CreateDirectory "$LocalAppData\Electrify\Electrify\files\compressors" + SetOutPath "$LocalAppData\Electrify\Electrify\files\compressors" File "ElectrifyWin\files\compressors\upx-win.exe" ; Shortcuts diff --git a/README.md b/README.md index b307a5d..f994d32 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +NOTICE +====== + +This app is unmaintained. I do not have the resources to work on it any longer and haven't for a long time. If anyone would like to sponsor this project or take up ownership from me, I'd be glad to do either. + Electrify ============== @@ -7,7 +12,7 @@ Electrify What is it? ----------- -From the creator of [Web2Executable](https://github.com/jyapayne/Electrifycutable) comes Electrify, another friendly command line and GUI application that can transform your Nodejs (or any other JS/HTML) app into a standalone executable. The difference is that it is now powered by [Electron](https://github.com/atom/electron) instead of NW.js. It can export to Mac OS X, Windows and Linux all from one platform, so no need to go out and buy expensive hardware. +From the creator of [Web2Executable](https://github.com/jyapayne/Web2Executable) comes Electrify, another friendly command line and GUI application that can transform your Nodejs (or any other JS/HTML) app into a standalone executable. The difference is that it is now powered by [Electron](https://github.com/atom/electron) instead of NW.js. It can export to Mac OS X, Windows and Linux all from one platform, so no need to go out and buy expensive hardware. It's powered by the very awesome project [Electron](https://github.com/atom/electron) and PySide, is open source, and is just dang awesome and easy to use. diff --git a/build_command_line_linux.bash b/build_command_line_linux.bash index 7c0c98c..33daf35 100755 --- a/build_command_line_linux.bash +++ b/build_command_line_linux.bash @@ -1,16 +1,15 @@ -rm -rf ElectrifyLinux*.zip -rm -rf ElectrifyLinux-CMD +rm -rf build ElectrifyLinux* VERSION=$(cat files/version.txt) -pyinstaller --onefile --hidden-import PIL.Jpeg2KImagePlugin --hidden-import pkg_resources --hidden-import PIL._imaging --hidden-import configobj --distpath ElectrifyLinux-CMD -n electrify-linux command_line.py +pyinstaller --onefile --exclude-module PyQt5 --exclude-module PyQt4 --hidden-import PIL._imaging --hidden-import PIL.Jpeg2KImagePlugin --hidden-import pkg_resources --hidden-import PIL._imaging --hidden-import configobj --distpath ElectrifyLinux-CMD -n electrify-linux command_line.py cp -rf files ElectrifyLinux-CMD/files rm -rf ElectrifyLinux-CMD/files/downloads/* rm ElectrifyLinux-CMD/files/error.log ElectrifyLinux-CMD/files/last_project_path.txt ElectrifyLinux-CMD/files/recent_files.txt ElectrifyLinux-CMD/files/compressors/upx-mac ElectrifyLinux-CMD/files/compressors/upx-win.exe rm -rf ElectrifyLinux -pyinstaller -F --hidden-import PIL.Jpeg2KImagePlugin --hidden-import configobj --hidden-import PIL._imaging --hidden-import pkg_resources -n electrify --distpath ElectrifyLinux main.py +pyinstaller -F --exclude-module PyQt5 --exclude-module PyQt4 --hidden-import PIL._imaging --hidden-import PIL.Jpeg2KImagePlugin --hidden-import configobj --hidden-import PIL._imaging --hidden-import pkg_resources -n electrify --distpath ElectrifyLinux main.py cp -rf files ElectrifyLinux/files rm -rf ElectrifyLinux/files/downloads/* rm ElectrifyLinux/files/error.log ElectrifyLinux/files/last_project_path.txt ElectrifyLinux/files/recent_files.txt ElectrifyLinux/files/compressors/upx-mac ElectrifyLinux/files/compressors/upx-win.exe diff --git a/build_mac.bash b/build_mac.bash index a786fcf..69f69ee 100755 --- a/build_mac.bash +++ b/build_mac.bash @@ -7,28 +7,28 @@ rm -rf ElectrifyMac-CMD/files pyinstaller --hidden-import PIL.Jpeg2KImagePlugin --hidden-import configobj --hidden-import pkg_resources --distpath ElectrifyMac-CMD --onefile -n electrify-mac command_line.py cp -rf files ElectrifyMac-CMD/files/ -rm -rf build dist Electrifycutable.app +rm -rf build dist Electrify.app #sudo python build_mac_setup.py py2app --iconfile icon.icns -pyinstaller -w --hidden-import PIL.Jpeg2KImagePlugin --hidden-import PyQt4 --hidden-import PIL --hidden-import configobj --hidden-import pkg_resources --distpath ElectrifyMac --onefile -n Electrifycutable main.py +pyinstaller -w --hidden-import PIL.Jpeg2KImagePlugin --hidden-import PyQt4 --hidden-import PIL --hidden-import configobj --hidden-import pkg_resources --distpath ElectrifyMac --onefile -n Electrify main.py -#sudo chown -R joey dist/Electrifycutable.app +#sudo chown -R joey dist/Electrify.app #sudo chown -R joey dist/ build/ -#mv dist/Electrifycutable.app Electrifycutable.app +#mv dist/Electrify.app Electrify.app -mv ElectrifyMac/Electrifycutable.app . +mv ElectrifyMac/Electrify.app . -#rm -rf Electrifycutable.app/Contents/Frameworks/QtDesigner* -#rm -rf Electrifycutable.app/Contents/Frameworks/QtXml* -#rm -rf Electrifycutable.app/Contents/Frameworks/QtWebKit* -#rm -rf Electrifycutable.app/Contents/Frameworks/QtScript* +#rm -rf Electrify.app/Contents/Frameworks/QtDesigner* +#rm -rf Electrify.app/Contents/Frameworks/QtXml* +#rm -rf Electrify.app/Contents/Frameworks/QtWebKit* +#rm -rf Electrify.app/Contents/Frameworks/QtScript* -cp icon.icns Electrifycutable.app/Contents/Resources/icon-windowed.icns -cp -rf files Electrifycutable.app/Contents/MacOS/ +cp icon.icns Electrify.app/Contents/Resources/icon-windowed.icns +cp -rf files Electrify.app/Contents/MacOS/ rm -rf build dist /Applications/Keka.app/Contents/Resources/keka7z a -r ElectrifyMac-CMD.zip ElectrifyMac-CMD -/Applications/Keka.app/Contents/Resources/keka7z a -r ElectrifyMac-${VERSION}.zip Electrifycutable.app +/Applications/Keka.app/Contents/Resources/keka7z a -r ElectrifyMac-${VERSION}.zip Electrify.app -python upload_release.py +python3.4 upload_release.py diff --git a/command_line.py b/command_line.py index ad64ca2..872fa8a 100644 --- a/command_line.py +++ b/command_line.py @@ -275,7 +275,7 @@ class CommandBase(object): self.setup_electron_versions() def update_electron_versions(self, button): - self.progress_text = 'Updating nw versions...' + self.progress_text = 'Updating electron versions...' self.get_versions() self.progress_text = '\nDone.\n' @@ -685,14 +685,14 @@ class CommandBase(object): inject_start_file = utils.path_join(self.project_dir(), inject_start_file) - if os.path.exists(inject_start_file): + if os.path.isfile(inject_start_file): inject_js_start = codecs.open(inject_start_file, encoding='utf-8').read() inject_end_file = self.get_setting('inject_js_end').value inject_end_file = utils.path_join(self.project_dir(), inject_end_file) - if os.path.exists(inject_end_file): + if os.path.isfile(inject_end_file): inject_js_end = codecs.open(inject_end_file, encoding='utf-8').read() main_html = self.get_setting('main_html') @@ -1316,10 +1316,6 @@ def main(): if args.app_name is None: args.app_name = command_base.project_name() - if args.name is not None: - setting = command_base.get_setting('name') - args.name = setting.filter_name(args.name if not callable(args.name) else args.name()) - command_base._project_name = args.app_name if not callable(args.app_name) else args.app_name() if not args.title: diff --git a/files/images/icon.png b/files/images/icon.png index 93f2932..47f9eb2 100644 Binary files a/files/images/icon.png and b/files/images/icon.png differ diff --git a/files/images/icon.svg b/files/images/icon.svg index fc091ea..bb7da5a 100644 --- a/files/images/icon.svg +++ b/files/images/icon.svg @@ -19,7 +19,7 @@ xml:space="preserve" inkscape:version="0.91+devel r" sodipodi:docname="icon.svg" - inkscape:export-filename="/home/joey/Projects/Electrify/files/images/icon.png" + inkscape:export-filename="/home/joey/Projects/Electrify/icon.png" inkscape:export-xdpi="1536.9606" inkscape:export-ydpi="1536.9606">> 8 & 0xff) s.append(type & 0xff) s.append(0) - return str(s) + return bytes(s) class Printable(object): def _attrs(self): @@ -953,8 +953,8 @@ class ICNSInfo(Printable): print('Unable to parse icon type {}'.format(type_to_str(type))) icon_info.iconType = ICNS_NULL_TYPE - icon_info.iconRawDataSize = icon_info.iconSize.height * icon_info.iconSize.width * icon_info.iconBitDepth/ICNS_BYTE_BITS - icon_info.data = bytearray(icon_info.iconRawDataSize) + icon_info.iconRawDataSize = int(icon_info.iconSize.height * icon_info.iconSize.width * icon_info.iconBitDepth/ICNS_BYTE_BITS) + icon_info.data = bytearray(int(icon_info.iconRawDataSize)) return icon_info @@ -999,12 +999,12 @@ class ICNSHeader(Structure): icns_info = ICNSInfo() icns_info.isImage = 1 - icns_info.iconSize.width = icon_size - icns_info.iconSize.height = icon_size + icns_info.iconSize.width = int(icon_size) + icns_info.iconSize.height = int(icon_size) icns_info.iconBitDepth = bpp icns_info.iconChannels = 4 if bpp == 32 else 1 - icns_info.iconPixelDepth = bpp / icns_info.iconChannels - icns_info.iconRawDataSize = width * height * 4 + icns_info.iconPixelDepth = int(bpp / icns_info.iconChannels) + icns_info.iconRawDataSize = int(width * height * 4) icns_info.data = bytearray(list(data)) icon_type = icns_info.get_image_type() @@ -1097,33 +1097,37 @@ class ICNSElement(Structure): width, height, png_data, stats_dict = png_file.read_flat() + im = Image.frombytes('RGBA', [width, height], bytes(png_data)) + output = BytesIO() + im.save(output, format='PNG') + bpp = stats_dict['bitdepth'] * 4 icns_info = ICNSInfo() icns_info.isImage = 1 - icns_info.iconSize.width = width - icns_info.iconSize.height = height + icns_info.iconSize.width = int(width) + icns_info.iconSize.height = int(height) icns_info.iconBitDepth = bpp icns_info.iconChannels = 4 if bpp == 32 else 1 - icns_info.iconPixelDepth = bpp / icns_info.iconChannels - icns_info.iconRawDataSize = width * height * 4 - icns_info.data = bytearray(list(png_data)) + icns_info.iconPixelDepth = int(bpp / icns_info.iconChannels) + icns_info.iconRawDataSize = int(width * height * 4) + icns_info.data = bytes(output.getvalue()) else: image = Image.open(BytesIO(data)) mode_to_bpp = {'1':1, 'L':8, 'P':8, 'RGB':24, 'RGBA':32, 'CMYK':32, 'YCbCr':24, 'I':32, 'F':32} output = BytesIO() image.save(output, format='PNG') bpp = mode_to_bpp[image.mode] - png_data = bytearray(output.getvalue()) + png_data = bytes(output.getvalue()) icns_info = ICNSInfo() icns_info.isImage = 1 - icns_info.iconSize.width = image.size[0] - icns_info.iconSize.height = image.size[1] + icns_info.iconSize.width = int(image.size[0]) + icns_info.iconSize.height = int(image.size[1]) icns_info.iconBitDepth = bpp icns_info.iconChannels = 4 if bpp == 32 else 1 - icns_info.iconPixelDepth = bpp / icns_info.iconChannels - icns_info.iconRawDataSize = image.size[0] * image.size[1] * 4 + icns_info.iconPixelDepth = int(bpp / icns_info.iconChannels) + icns_info.iconRawDataSize = int(image.size[0] * image.size[1] * 4) icns_info.data = png_data else: @@ -1173,7 +1177,7 @@ class ICNSElement(Structure): data_pos = data_count * icon_data_row_size icns_info.data[data_pos:data_pos+icon_data_row_size] = data[data_pos:data_pos+icon_data_row_size] data_count += 1 - + return icns_info def get_mask(self): @@ -1185,7 +1189,7 @@ class ICNSElement(Structure): icns_info = ICNSInfo.from_type(mask_type) mask_bit_depth = icns_info.iconSize.width * icns_info.iconSize.height mask_data_size = icns_info.iconRawDataSize - mask_data_row_size = icns_info.iconSize.width * mask_bit_depth / ICNS_BYTE_BITS + mask_data_row_size = int(icns_info.iconSize.width * mask_bit_depth / ICNS_BYTE_BITS) if mask_type in [ICNS_128x128_8BIT_MASK, ICNS_48x48_8BIT_MASK, @@ -1193,7 +1197,7 @@ class ICNSElement(Structure): ICNS_16x16_8BIT_MASK]: data_count = 0 while data_count < icns_info.iconSize.height: - data_pos = data_count * mask_data_row_size + data_pos = int(data_count * mask_data_row_size) icns_info.data[data_pos:data_pos+mask_data_row_size] = data[data_pos:data_pos+mask_data_row_size] data_count += 1 @@ -1280,7 +1284,7 @@ def get_image_with_mask(icns_data, element_type): new_data_size = new_block_size * icns_image.iconSize.height old_data = icns_image.data - new_data = bytearray(new_data_size) + new_data = bytearray(int(new_data_size)) data_count = 0 @@ -1329,7 +1333,7 @@ def get_image_with_mask(icns_data, element_type): icns_image.iconPixelDepth = 8 icns_image.iconChannels = 4 - icns_image.iconRawDataSize = new_data_size + icns_image.iconRawDataSize = int(new_data_size) icns_image.data = new_data if mask_type in [ICNS_128x128_8BIT_MASK, @@ -1356,10 +1360,11 @@ def get_image_with_mask(icns_data, element_type): color_index = 0xFF if (data_value & 0x80) else 0x00 data_value = data_value << 1 icns_image.data[pixel_id*4+3] = color_index - im = Image.frombytes('RGBA', [icns_image.iconSize.width,icns_image.iconSize.height],str(icns_image.data)) + im = Image.frombytes('RGBA', [icns_image.iconSize.width,icns_image.iconSize.height], bytes(icns_image.data)) + #print(icns_image.data) output = BytesIO() im.save(output, format='PNG') - icns_image.data = bytearray(output.getvalue()) + icns_image.data = bytes(output.getvalue()) return icns_image @@ -1398,7 +1403,7 @@ def extract_icons(all_icns_data): image_count += 1 image_data = get_image_with_mask(icns_data, element.TypeID) - image_data.data = str(image_data.data) + image_data.data = bytes(image_data.data) data.append(image_data) offset += element.Size diff --git a/icon.icns b/icon.icns index 78072b4..9b00c51 100644 Binary files a/icon.icns and b/icon.icns differ diff --git a/icon.ico b/icon.ico index 1bd2185..38af64a 100644 Binary files a/icon.ico and b/icon.ico differ diff --git a/icon.png b/icon.png index 93f2932..47f9eb2 100644 Binary files a/icon.png and b/icon.png differ diff --git a/main.py b/main.py index 5189c9d..5a95446 100644 --- a/main.py +++ b/main.py @@ -863,7 +863,8 @@ class MainWindow(QtGui.QMainWindow, CommandBase): if icon_path.endswith('.icns'): pngs = pngs_from_icns(icon_path) if pngs: - image = QtGui.QImage.fromData(QtCore.QByteArray(pngs[-1].data), 'PNG') + ba = QtCore.QByteArray(pngs[-1].data) + image = QtGui.QImage.fromData(ba, 'PNG') else: return else: