summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2011-05-21 00:16:39 +0200
committerKevin Chabowski <kevin@kch42.de>2011-05-21 00:16:39 +0200
commita5d315bcdcfcb8f2fca8266201d2738aa1943e42 (patch)
tree576d2721a96dc96fc3616ec124a82c97cd785b3b
parent948ccc48c33f2edb56dfabe7c59855c7adf589aa (diff)
downloaddotstr_edit-a5d315bcdcfcb8f2fca8266201d2738aa1943e42.tar.gz
dotstr_edit-a5d315bcdcfcb8f2fca8266201d2738aa1943e42.tar.bz2
dotstr_edit-a5d315bcdcfcb8f2fca8266201d2738aa1943e42.zip
Some Windows-related bugfixes and an "exefying" script.
Also added "LICENSE" and "installer.nsi", which builds an Installer for Windows.
-rw-r--r--BUILD_FOR_WINDOWS24
-rw-r--r--LICENSE18
-rw-r--r--[-rwxr-xr-x]dotstr_edit.py7
-rw-r--r--exefying.bat20
-rw-r--r--icon.icobin34494 -> 14846 bytes
-rw-r--r--icon/16x16.pngbin0 -> 923 bytes
-rw-r--r--icon/24x24.pngbin0 -> 1460 bytes
-rw-r--r--icon/32x32.pngbin0 -> 1560 bytes
-rw-r--r--icon/48x48.pngbin0 -> 3340 bytes
-rw-r--r--icon/64x64.pngbin0 -> 5242 bytes
-rw-r--r--installer.nsi178
-rwxr-xr-xmake_icon.sh3
-rw-r--r--mkexe.py30
13 files changed, 277 insertions, 3 deletions
diff --git a/BUILD_FOR_WINDOWS b/BUILD_FOR_WINDOWS
new file mode 100644
index 0000000..b670c5a
--- /dev/null
+++ b/BUILD_FOR_WINDOWS
@@ -0,0 +1,24 @@
+If you want to create a MS-Windows EXE file, just run the "exefying.bat" Batch-File.
+Additional stuff you need for this:
+* py2exe
+* 7-Zip (optional)
+* UPX (optional)
+7-Zip and UPX are only needed, if you want to compress the EXE (and its libbrary.zip).
+If you don't want compression, edit exefying.bat and find:
+
+REM Uncomment next line, if you do not want to compress...
+REM goto end
+
+and change to:
+
+REM Uncomment next line, if you do not want to compress...
+goto end
+
+The finished EXE file (and everything that this EXE needs) is now located in the directory "dist".
+
+You can also build an Installer using NSIS.
+Before compiling the setup.nsi file, you need to download vcredist_x86.exe and put it into the directory "redist".
+You can get "vcredist_x86.exe" here:
+http://www.microsoft.com/downloads/en/details.aspx?familyid=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en
+(It's not Open Source, but everyone is allowed to redistribute it)
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..ac88caa
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,18 @@
+Copyright (c) 2010-2011 "Die Voelker Mittelerdes" Modding Crew
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/dotstr_edit.py b/dotstr_edit.py
index 24265e8..f1cdb2c 100755..100644
--- a/dotstr_edit.py
+++ b/dotstr_edit.py
@@ -239,7 +239,7 @@ class editor_frame(wx.Frame):
def form_init(self):
"""
- IInitializes / clears all formulars
+ Initializes / clears all formulars
"""
self.populate_list()
self.input_filter.SetValue("")
@@ -366,12 +366,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."""
self.trans_text_ctrl.SetValue("")
def on_filter(self, event):
- if self.input_filter.GetValue() != "":
+ if event.GetString() != "":
self.populate_list()
- if len(self.transl_list.dict) == 0 and self.input_filter.GetValue() != "":
+ if len(self.transl_list.dict) == 0 and event.GetString() != "":
self.input_filter.SetBackgroundColour(wx.Colour(255,100,100))
else:
self.input_filter.SetBackgroundColour(wx.NullColour)
+ self.input_filter.Refresh()
def on_textedit(self, event):
key = self.transl_list.get_seclection()
diff --git a/exefying.bat b/exefying.bat
new file mode 100644
index 0000000..bce966d
--- /dev/null
+++ b/exefying.bat
@@ -0,0 +1,20 @@
+@echo off
+REM Exefying the script...
+
+python.exe -OO mkexe.py py2exe
+
+REM Uncomment next line, if you do not want to compress...
+REM goto end
+
+REM recompress the library
+cd dist\
+7z.exe -aoa x library.zip -olibrary\
+cd library\
+7z.exe a -tzip -mx9 ..\library.zip -r
+cd ..
+rd library /s /q
+
+REM UPX-Packing
+upx.exe --best *.*
+:end
+echo Done
diff --git a/icon.ico b/icon.ico
index 9ea4648..3a8b4cc 100644
--- a/icon.ico
+++ b/icon.ico
Binary files differ
diff --git a/icon/16x16.png b/icon/16x16.png
new file mode 100644
index 0000000..a0fccee
--- /dev/null
+++ b/icon/16x16.png
Binary files differ
diff --git a/icon/24x24.png b/icon/24x24.png
new file mode 100644
index 0000000..53bcc53
--- /dev/null
+++ b/icon/24x24.png
Binary files differ
diff --git a/icon/32x32.png b/icon/32x32.png
new file mode 100644
index 0000000..bff25c0
--- /dev/null
+++ b/icon/32x32.png
Binary files differ
diff --git a/icon/48x48.png b/icon/48x48.png
new file mode 100644
index 0000000..ec8bc70
--- /dev/null
+++ b/icon/48x48.png
Binary files differ
diff --git a/icon/64x64.png b/icon/64x64.png
new file mode 100644
index 0000000..7662bb4
--- /dev/null
+++ b/icon/64x64.png
Binary files differ
diff --git a/installer.nsi b/installer.nsi
new file mode 100644
index 0000000..5ad5c16
--- /dev/null
+++ b/installer.nsi
@@ -0,0 +1,178 @@
+; Script generated by the HM NIS Edit Script Wizard.
+
+; HM NIS Edit Wizard helper defines
+!define PRODUCT_NAME "str-Editor"
+!define PRODUCT_VERSION "0.1"
+!define PRODUCT_PUBLISHER "$\"Die Völker Mittelerdes$\" Modding Crew"
+!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\dotstr_edit.exe"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
+
+SetCompressor lzma
+
+; MUI 1.67 compatible ------
+!include "MUI.nsh"
+
+; MUI Settings
+!define MUI_ABORTWARNING
+!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
+!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
+
+; Language Selection Dialog Settings
+!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
+!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
+!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
+
+; Welcome page
+!insertmacro MUI_PAGE_WELCOME
+; License page
+!insertmacro MUI_PAGE_LICENSE "C:\Dokumente und Einstellungen\skadu42\Desktop\dotstr_edit\LICENSE"
+; Components page
+!insertmacro MUI_PAGE_COMPONENTS
+; Directory page
+!insertmacro MUI_PAGE_DIRECTORY
+; Start menu page
+var ICONS_GROUP
+!define MUI_STARTMENUPAGE_NODISABLE
+!define MUI_STARTMENUPAGE_DEFAULTFOLDER "dotstr-Editor"
+!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
+!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
+!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
+!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+; Finish page
+!define MUI_FINISHPAGE_RUN "$INSTDIR\dotstr_edit.exe"
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_INSTFILES
+
+; Language files
+!insertmacro MUI_LANGUAGE "English"
+!insertmacro MUI_LANGUAGE "German"
+
+; Reserve files
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+
+; MUI end ------
+
+
+!define SHCNE_ASSOCCHANGED 0x8000000
+!define SHCNF_IDLIST 0
+
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+OutFile "dotstr_edit_install.exe"
+InstallDir "$PROGRAMFILES\dotstr_edit"
+InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
+ShowInstDetails show
+ShowUnInstDetails show
+
+Function .onInit
+ !insertmacro MUI_LANGDLL_DISPLAY
+FunctionEnd
+
+Section ".str-Editor" SEC01
+ SectionIn RO
+ SetOutPath "$INSTDIR"
+ SetOverwrite ifnewer
+ File "dist\dotstr_edit.exe"
+ File "dist\icon.ico"
+ File "dist\icon.png"
+ File "dist\library.zip"
+ File "dist\LICENSE"
+ File "dist\python26.dll"
+ File "dist\README.markdown"
+ File "dist\w9xpopen.exe"
+ File "dist\wm-icon.ico"
+ SetOutPath "$INSTDIR\locale"
+ File /r "dist\locale\"
+
+; Shortcuts
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+ CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
+ CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\dotstr-Editor.lnk" "$INSTDIR\dotstr_edit.exe"
+ CreateShortCut "$DESKTOP\dotstr-Editor.lnk" "$INSTDIR\dotstr_edit.exe"
+ !insertmacro MUI_STARTMENU_WRITE_END
+SectionEnd
+
+Section "Visual C++ 2008 Redistributable" SEC02
+ SetOutPath "$TEMP"
+ File "redist\vcredist_x86.exe"
+ ExecWait '"$TEMP\vcredist_x86.exe" /q'
+ Delete "$TEMP\vcredist_x86.exe"
+SectionEnd
+
+Section "Associate .str files" SEC03
+ WriteRegStr HKCR ".str" "" "LOTR_BFME_STR.Text"
+ WriteRegStr HKCR "LOTR_BFME_STR.Text" "" "BFME .str File"
+ WriteRegStr HKCR "LOTR_BFME_STR.Text\DefaultIcon" "" "$INSTDIR\icon.ico,0"
+ WriteRegStr HKCR "LOTR_BFME_STR.Text\shell\open\command" "" '"$INSTDIR\dotstr_edit.exe" "%1"'
+ System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
+SectionEnd
+
+Section -AdditionalIcons
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+ CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
+ !insertmacro MUI_STARTMENU_WRITE_END
+SectionEnd
+
+Section -Post
+ WriteUninstaller "$INSTDIR\uninst.exe"
+ WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\AppMainExe.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\dotstr_edit.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
+SectionEnd
+
+; Section descriptions
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} ""
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+
+Function un.onUninstSuccess
+ HideWindow
+ MessageBox MB_ICONINFORMATION|MB_OK "Sucessfully uninstalled."
+FunctionEnd
+
+Function un.onInit
+!insertmacro MUI_UNGETLANGUAGE
+ MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to uninstall .str-Editor?" IDYES +2
+ Abort
+FunctionEnd
+
+Section Uninstall
+ !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
+ Delete "$INSTDIR\uninst.exe"
+ Delete "$INSTDIR\wm-icon.ico"
+ Delete "$INSTDIR\w9xpopen.exe"
+ Delete "$INSTDIR\README.markdown"
+ Delete "$INSTDIR\python26.dll"
+ Delete "$INSTDIR\LICENSE"
+ Delete "$INSTDIR\library.zip"
+ Delete "$INSTDIR\icon.png"
+ Delete "$INSTDIR\icon.ico"
+ Delete "$INSTDIR\dotstr_edit.exe"
+
+ Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
+ Delete "$DESKTOP\dotstr-Editor.lnk"
+ Delete "$SMPROGRAMS\$ICONS_GROUP\dotstr-Editor.lnk"
+
+ RMDir "$SMPROGRAMS\$ICONS_GROUP"
+ RMDir /r "$INSTDIR\locale"
+ RMDir /r "$INSTDIR"
+
+ DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+ DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
+
+ DeleteRegKey HKCR ".str"
+ DeleteRegKey HKCR "LOTR_BFME_STR.Text"
+ System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
+
+ SetAutoClose true
+SectionEnd
diff --git a/make_icon.sh b/make_icon.sh
new file mode 100755
index 0000000..f70c760
--- /dev/null
+++ b/make_icon.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+png2ico icon.ico icon/24x24.png icon/64x64.png icon/16x16.png icon/32x32.png icon/48x48.png
diff --git a/mkexe.py b/mkexe.py
new file mode 100644
index 0000000..f6da31a
--- /dev/null
+++ b/mkexe.py
@@ -0,0 +1,30 @@
+from distutils.core import setup
+import py2exe
+
+languages = ["de"]
+
+setup(
+ name="dotstr_edit",
+ version="0.1",
+ description="A tool for editing the .str files of EA's BFME2",
+ author="\"Die Voelker Mittelerdes\" Modding Crew",
+ windows=[
+ {
+ "script": "dotstr_edit.py",
+ "icon_resources": [(1, "icon.ico")]
+ }
+ ],
+ data_files=[("", ["icon.ico", "icon.png", "wm-icon.ico", "LICENSE", "README.markdown"])] + [(p, [p + "/dotstr_edit.mo"]) for p in ["locale/%s/LC_MESSAGES" % l for l in languages]],
+ options={
+ "py2exe": {
+ "optimize": 2,
+ "excludes": ["pywin", "pywin.debugger", "pywin.debugger.dbgcon",
+ "pywin.dialogs", "pywin.dialogs.list",
+ "Tkconstants","Tkinter","tcl", "_ssl", "doctest", "pdb", "unittest", "difflib", "inspect", "wave", "xml", "email", "urllib", "urllib2"
+ ],
+ "includes": ["zlib"], # So the resulting program is able tu unpack the library, even after recompressing.
+ "dll_excludes": ["MSVCP90.dll"],
+ "bundle_files": 2
+ }
+ }
+)