Added ability to replace windows icons on export if the Window Icon field is filled in.
This commit is contained in:
parent
e0c5d23723
commit
293725d427
2 changed files with 18 additions and 3 deletions
19
main.py
19
main.py
|
|
@ -1,4 +1,5 @@
|
|||
from utils import zip_files, join_files, log, get_temp_dir, open_folder_in_explorer
|
||||
from pepy.pe import PEFile
|
||||
|
||||
import urllib2, re
|
||||
import sys, os, glob, json, re, shutil, stat, tarfile
|
||||
|
|
@ -191,7 +192,7 @@ class MainWindow(QtGui.QWidget):
|
|||
win_32_dir_prefix+'/icudtl.dat',
|
||||
win_32_dir_prefix+'/libEGL.dll',
|
||||
win_32_dir_prefix+'/libGLESv2.dll'],
|
||||
dest_files=['nw.exe',
|
||||
dest_files=['nw.exe', #must be the first entry
|
||||
'nw.pak',
|
||||
'icudtl.dat',
|
||||
'libEGL.dll',
|
||||
|
|
@ -1181,16 +1182,22 @@ class MainWindow(QtGui.QWidget):
|
|||
self.progress_text += '.'
|
||||
else:
|
||||
ext = ''
|
||||
windows = False
|
||||
if ex_setting.name == 'windows':
|
||||
ext = '.exe'
|
||||
windows=True
|
||||
|
||||
nw_path = os.path.join(export_dest, ex_setting.dest_files[0])
|
||||
dest_binary_path = os.path.join(export_dest, self.projectName()+ext)
|
||||
join_files(os.path.join(export_dest, self.projectName()+ext), nw_path, zip_file)
|
||||
|
||||
join_files(dest_binary_path, nw_path, zip_file)
|
||||
|
||||
sevenfivefive = stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH
|
||||
os.chmod(dest_binary_path, sevenfivefive)
|
||||
|
||||
if windows:
|
||||
self.replace_icon_in_exe(dest_binary_path)
|
||||
|
||||
self.progress_text += '.'
|
||||
|
||||
if os.path.exists(nw_path):
|
||||
|
|
@ -1201,6 +1208,14 @@ class MainWindow(QtGui.QWidget):
|
|||
finally:
|
||||
shutil.rmtree(tempDir)
|
||||
|
||||
def replace_icon_in_exe(self, exe_path):
|
||||
icon_setting = self.getSetting('icon')
|
||||
if icon_setting.value:
|
||||
p = PEFile(exe_path)
|
||||
p.replace_icon(os.path.join(self.projectDir(), icon_setting.value))
|
||||
p.write(exe_path)
|
||||
p = None
|
||||
|
||||
def show_and_raise(self):
|
||||
self.show()
|
||||
self.raise_()
|
||||
|
|
|
|||
2
pepy
2
pepy
|
|
@ -1 +1 @@
|
|||
Subproject commit 6eb2006269318abb7eadd03178cf3f2fa7df7a5f
|
||||
Subproject commit 51525eddff3ed50d4879366f2ba1ae4ed30a678f
|
||||
Loading…
Add table
Add a link
Reference in a new issue