From e9b35cd84f6722eae69c36b52172e85a0764644c Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Thu, 19 May 2011 22:28:38 +0200 Subject: Added artwork and replaced progdir() with scriptdir. scriptdir will also point to the correct directory, if the script is "exefied". --- dotstr_edit.py | 15 ++++++++++----- icon.ico | Bin 0 -> 34494 bytes icon.png | Bin 0 -> 16482 bytes icon.xcf | Bin 0 -> 40773 bytes wm-icon.ico | Bin 0 -> 1150 bytes 5 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 icon.ico create mode 100644 icon.png create mode 100644 icon.xcf create mode 100644 wm-icon.ico diff --git a/dotstr_edit.py b/dotstr_edit.py index 25a333e..38b5c7b 100755 --- a/dotstr_edit.py +++ b/dotstr_edit.py @@ -8,10 +8,6 @@ import locale, gettext from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin -def progdir(): - """Get the path to the directory of this file""" - return os.path.abspath(os.path.dirname(sys.argv[0])) - class TransDictListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin): """ListCtrl for a translation dictionary""" def __init__(self, parent): @@ -187,6 +183,9 @@ class editor_frame(wx.Frame): self.mainpanel.SetSizer(vbox) + cool_icon = wx.Icon(os.path.join(scriptdir, "wm-icon.ico"), wx.BITMAP_TYPE_ICO) + self.SetIcon(cool_icon) + # Binding events self.Bind(wx.EVT_MENU, self.on_new, id=wx.ID_NEW) self.Bind(wx.EVT_MENU, self.on_open, id=wx.ID_OPEN) @@ -353,6 +352,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.""" info.SetCopyright(u'(C) 2010-2011 \"Die Völker Mittelerdes\" Modding Crew') info.SetLicence(licence) info.AddDeveloper('Kevin Chabowski') + info.SetIcon(wx.Icon(os.path.join(scriptdir, 'icon.png'), wx.BITMAP_TYPE_PNG)) wx.AboutBox(info) @@ -423,6 +423,11 @@ class dotstr_edit_app(wx.App): return True if __name__ == '__main__': + # get directory of script / executable + scriptdir = os.path.dirname(unicode( + sys.executable if hasattr(sys,"frozen") and sys.frozen in ("windows_exe", "console_exe") else __file__, + sys.getfilesystemencoding())) + # init localisation if os.name == 'nt': # windows hack for locale setting @@ -434,7 +439,7 @@ if __name__ == '__main__': if lang: os.environ['LANG'] = lang locale.setlocale(locale.LC_ALL, '') - translator = gettext.translation('dotstr_edit', os.path.join(progdir(), 'locale'), fallback=True) + translator = gettext.translation('dotstr_edit', os.path.join(scriptdir, 'locale'), fallback=True) translator.install(True) fd_wildcard = _("str File")+"|*.str|*.*|*.*" diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..9ea4648 Binary files /dev/null and b/icon.ico differ diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..e45a46d Binary files /dev/null and b/icon.png differ diff --git a/icon.xcf b/icon.xcf new file mode 100644 index 0000000..e91345b Binary files /dev/null and b/icon.xcf differ diff --git a/wm-icon.ico b/wm-icon.ico new file mode 100644 index 0000000..0fa4145 Binary files /dev/null and b/wm-icon.ico differ -- cgit v1.2.3-54-g00ecf