diff --git a/mangle/about.py b/mangle/about.py index 4d54903..c255e66 100644 --- a/mangle/about.py +++ b/mangle/about.py @@ -15,10 +15,11 @@ import os.path +import util from PyQt4 import QtGui, uic class DialogAbout(QtGui.QDialog): def __init__(self, parent): QtGui.QDialog.__init__(self, parent) - uic.loadUi('mangle/resource/ui/about.ui', self) + uic.loadUi(util.buildResPath('mangle/resource/ui/about.ui'), self) diff --git a/mangle/book.py b/mangle/book.py index 6c89ebc..18cd30c 100644 --- a/mangle/book.py +++ b/mangle/book.py @@ -16,6 +16,7 @@ import os import os.path +import util from PyQt4 import QtGui, QtCore, QtXml, uic from image import ImageFlags from about import DialogAbout @@ -111,7 +112,7 @@ class MainWindowBook(QtGui.QMainWindow): def __init__(self, filename=None): QtGui.QMainWindow.__init__(self) - uic.loadUi('mangle/resource/ui/book.ui', self) + uic.loadUi(util.buildResPath('mangle/resource/ui/book.ui'), self) self.listWidgetFiles.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.actionFileNew.triggered.connect(self.onFileNew) self.actionFileOpen.triggered.connect(self.onFileOpen) diff --git a/mangle/options.py b/mangle/options.py index 443b0b5..b791098 100644 --- a/mangle/options.py +++ b/mangle/options.py @@ -15,6 +15,7 @@ import os.path +import util from PyQt4 import QtGui, QtCore, uic from image import ImageFlags @@ -23,7 +24,7 @@ class DialogOptions(QtGui.QDialog): def __init__(self, parent, book): QtGui.QDialog.__init__(self, parent) - uic.loadUi('mangle/resource/ui/options.ui', self) + uic.loadUi(util.buildResPath('mangle/resource/ui/options.ui'), self) self.accepted.connect(self.onAccept) self.book = book diff --git a/mangle/util.py b/mangle/util.py new file mode 100644 index 0000000..b4eb6ba --- /dev/null +++ b/mangle/util.py @@ -0,0 +1,23 @@ +# Copyright (C) 2010 Alex Yatskov +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +import sys +import os.path + + +def buildResPath(relative): + directory = os.path.split(sys.argv[0])[0] + return os.path.join(directory, relative)