diff --git a/Electrify.nsi b/Electrify.nsi index 5fb14f0..ef64a0c 100644 --- a/Electrify.nsi +++ b/Electrify.nsi @@ -74,14 +74,14 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show ShowUnInstDetails show -Section "Electrify" SEC01 +Section "Electrifycutable" SEC01 SectionIn RO SetOutPath "$INSTDIR" SetOverwrite try File /r /x compressors "ElectrifyWin\" - CreateDirectory "$LocalAppData\Electrify\Electrify\files\compressors" - SetOutPath "$LocalAppData\Electrify\Electrify\files\compressors" + CreateDirectory "$LocalAppData\Electrifycutable\Electrifycutable\files\compressors" + SetOutPath "$LocalAppData\Electrifycutable\Electrifycutable\files\compressors" File "ElectrifyWin\files\compressors\upx-win.exe" ; Shortcuts diff --git a/README.md b/README.md index f994d32..b307a5d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,3 @@ -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 ============== @@ -12,7 +7,7 @@ Electrify What is it? ----------- -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. +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. 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 33daf35..7c0c98c 100755 --- a/build_command_line_linux.bash +++ b/build_command_line_linux.bash @@ -1,15 +1,16 @@ -rm -rf build ElectrifyLinux* +rm -rf ElectrifyLinux*.zip +rm -rf ElectrifyLinux-CMD VERSION=$(cat files/version.txt) -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 +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 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 --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 +pyinstaller -F --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 69f69ee..a786fcf 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 Electrify.app +rm -rf build dist Electrifycutable.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 Electrify 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 Electrifycutable main.py -#sudo chown -R joey dist/Electrify.app +#sudo chown -R joey dist/Electrifycutable.app #sudo chown -R joey dist/ build/ -#mv dist/Electrify.app Electrify.app +#mv dist/Electrifycutable.app Electrifycutable.app -mv ElectrifyMac/Electrify.app . +mv ElectrifyMac/Electrifycutable.app . -#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* +#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* -cp icon.icns Electrify.app/Contents/Resources/icon-windowed.icns -cp -rf files Electrify.app/Contents/MacOS/ +cp icon.icns Electrifycutable.app/Contents/Resources/icon-windowed.icns +cp -rf files Electrifycutable.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 Electrify.app +/Applications/Keka.app/Contents/Resources/keka7z a -r ElectrifyMac-${VERSION}.zip Electrifycutable.app -python3.4 upload_release.py +python upload_release.py diff --git a/command_line.py b/command_line.py index 872fa8a..ad64ca2 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 electron versions...' + self.progress_text = 'Updating nw 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.isfile(inject_start_file): + if os.path.exists(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.isfile(inject_end_file): + if os.path.exists(inject_end_file): inject_js_end = codecs.open(inject_end_file, encoding='utf-8').read() main_html = self.get_setting('main_html') @@ -1316,6 +1316,10 @@ 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 47f9eb2..93f2932 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 bb7da5a..fc091ea 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/icon.png" + inkscape:export-filename="/home/joey/Projects/Electrify/files/images/icon.png" inkscape:export-xdpi="1536.9606" inkscape:export-ydpi="1536.9606">> 8 & 0xff) s.append(type & 0xff) s.append(0) - return bytes(s) + return str(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 = int(icon_info.iconSize.height * icon_info.iconSize.width * icon_info.iconBitDepth/ICNS_BYTE_BITS) - icon_info.data = bytearray(int(icon_info.iconRawDataSize)) + icon_info.iconRawDataSize = icon_info.iconSize.height * icon_info.iconSize.width * icon_info.iconBitDepth/ICNS_BYTE_BITS + icon_info.data = bytearray(icon_info.iconRawDataSize) return icon_info @@ -999,12 +999,12 @@ class ICNSHeader(Structure): icns_info = ICNSInfo() icns_info.isImage = 1 - icns_info.iconSize.width = int(icon_size) - icns_info.iconSize.height = int(icon_size) + icns_info.iconSize.width = icon_size + icns_info.iconSize.height = icon_size icns_info.iconBitDepth = bpp icns_info.iconChannels = 4 if bpp == 32 else 1 - icns_info.iconPixelDepth = int(bpp / icns_info.iconChannels) - icns_info.iconRawDataSize = int(width * height * 4) + icns_info.iconPixelDepth = bpp / icns_info.iconChannels + icns_info.iconRawDataSize = width * height * 4 icns_info.data = bytearray(list(data)) icon_type = icns_info.get_image_type() @@ -1097,37 +1097,33 @@ 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 = int(width) - icns_info.iconSize.height = int(height) + icns_info.iconSize.width = width + icns_info.iconSize.height = height icns_info.iconBitDepth = bpp icns_info.iconChannels = 4 if bpp == 32 else 1 - icns_info.iconPixelDepth = int(bpp / icns_info.iconChannels) - icns_info.iconRawDataSize = int(width * height * 4) - icns_info.data = bytes(output.getvalue()) + icns_info.iconPixelDepth = bpp / icns_info.iconChannels + icns_info.iconRawDataSize = width * height * 4 + icns_info.data = bytearray(list(png_data)) 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 = bytes(output.getvalue()) + png_data = bytearray(output.getvalue()) icns_info = ICNSInfo() icns_info.isImage = 1 - icns_info.iconSize.width = int(image.size[0]) - icns_info.iconSize.height = int(image.size[1]) + icns_info.iconSize.width = image.size[0] + icns_info.iconSize.height = image.size[1] icns_info.iconBitDepth = bpp icns_info.iconChannels = 4 if bpp == 32 else 1 - icns_info.iconPixelDepth = int(bpp / icns_info.iconChannels) - icns_info.iconRawDataSize = int(image.size[0] * image.size[1] * 4) + icns_info.iconPixelDepth = bpp / icns_info.iconChannels + icns_info.iconRawDataSize = image.size[0] * image.size[1] * 4 icns_info.data = png_data else: @@ -1177,7 +1173,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): @@ -1189,7 +1185,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 = int(icns_info.iconSize.width * mask_bit_depth / ICNS_BYTE_BITS) + mask_data_row_size = icns_info.iconSize.width * mask_bit_depth / ICNS_BYTE_BITS if mask_type in [ICNS_128x128_8BIT_MASK, ICNS_48x48_8BIT_MASK, @@ -1197,7 +1193,7 @@ class ICNSElement(Structure): ICNS_16x16_8BIT_MASK]: data_count = 0 while data_count < icns_info.iconSize.height: - data_pos = int(data_count * mask_data_row_size) + data_pos = 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 @@ -1284,7 +1280,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(int(new_data_size)) + new_data = bytearray(new_data_size) data_count = 0 @@ -1333,7 +1329,7 @@ def get_image_with_mask(icns_data, element_type): icns_image.iconPixelDepth = 8 icns_image.iconChannels = 4 - icns_image.iconRawDataSize = int(new_data_size) + icns_image.iconRawDataSize = new_data_size icns_image.data = new_data if mask_type in [ICNS_128x128_8BIT_MASK, @@ -1360,11 +1356,10 @@ 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], bytes(icns_image.data)) - #print(icns_image.data) + im = Image.frombytes('RGBA', [icns_image.iconSize.width,icns_image.iconSize.height],str(icns_image.data)) output = BytesIO() im.save(output, format='PNG') - icns_image.data = bytes(output.getvalue()) + icns_image.data = bytearray(output.getvalue()) return icns_image @@ -1403,7 +1398,7 @@ def extract_icons(all_icns_data): image_count += 1 image_data = get_image_with_mask(icns_data, element.TypeID) - image_data.data = bytes(image_data.data) + image_data.data = str(image_data.data) data.append(image_data) offset += element.Size diff --git a/icon.icns b/icon.icns index 9b00c51..78072b4 100644 Binary files a/icon.icns and b/icon.icns differ diff --git a/icon.ico b/icon.ico index 38af64a..1bd2185 100644 Binary files a/icon.ico and b/icon.ico differ diff --git a/icon.png b/icon.png index 47f9eb2..93f2932 100644 Binary files a/icon.png and b/icon.png differ diff --git a/main.py b/main.py index 5a95446..5189c9d 100644 --- a/main.py +++ b/main.py @@ -863,8 +863,7 @@ class MainWindow(QtGui.QMainWindow, CommandBase): if icon_path.endswith('.icns'): pngs = pngs_from_icns(icon_path) if pngs: - ba = QtCore.QByteArray(pngs[-1].data) - image = QtGui.QImage.fromData(ba, 'PNG') + image = QtGui.QImage.fromData(QtCore.QByteArray(pngs[-1].data), 'PNG') else: return else: