diff --git a/autotagmatchwindow.py b/autotagmatchwindow.py
index 2a0cab8..dae5ba1 100644
--- a/autotagmatchwindow.py
+++ b/autotagmatchwindow.py
@@ -38,7 +38,7 @@ class AutoTagMatchWindow(QtGui.QDialog):
def __init__(self, parent, match_set_list, style, fetch_func):
super(AutoTagMatchWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'autotagmatchwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('autotagmatchwindow.ui' ), self)
self.altCoverWidget = CoverImageWidget( self.altCoverContainer, CoverImageWidget.AltCoverMode )
gridlayout = QtGui.QGridLayout( self.altCoverContainer )
diff --git a/autotagprogresswindow.py b/autotagprogresswindow.py
index eeee9e2..8940e85 100644
--- a/autotagprogresswindow.py
+++ b/autotagprogresswindow.py
@@ -30,9 +30,9 @@ class AutoTagProgressWindow(QtGui.QDialog):
def __init__(self, parent):
super(AutoTagProgressWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'autotagprogresswindow.ui' ), self)
- self.lblTest.setPixmap(QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/nocover.png' )))
- self.lblArchive.setPixmap(QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/nocover.png' )))
+ uic.loadUi(ComicTaggerSettings.getUIFile('autotagprogresswindow.ui' ), self)
+ self.lblTest.setPixmap(QtGui.QPixmap(ComicTaggerSettings.getGraphic('nocover.png')))
+ self.lblArchive.setPixmap(QtGui.QPixmap(ComicTaggerSettings.getGraphic('nocover.png')))
self.isdone = False
self.setWindowFlags(self.windowFlags() |
@@ -54,7 +54,7 @@ class AutoTagProgressWindow(QtGui.QDialog):
label.setPixmap(QtGui.QPixmap(img))
label.setScaledContents(True)
else:
- label.setPixmap(QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/nocover.png' )))
+ label.setPixmap(QtGui.QPixmap(ComicTaggerSettings.getGraphic('nocover.png')))
label.setScaledContents(True)
QtCore.QCoreApplication.processEvents()
QtCore.QCoreApplication.processEvents()
diff --git a/autotagstartwindow.py b/autotagstartwindow.py
index 84683e4..283fe68 100644
--- a/autotagstartwindow.py
+++ b/autotagstartwindow.py
@@ -32,7 +32,7 @@ class AutoTagStartWindow(QtGui.QDialog):
def __init__( self, parent, settings, msg ):
super(AutoTagStartWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'autotagstartwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('autotagstartwindow.ui' ), self)
self.label.setText( msg )
self.setWindowFlags(self.windowFlags() &
diff --git a/comicarchive.py b/comicarchive.py
index 6a6a51f..f319c93 100644
--- a/comicarchive.py
+++ b/comicarchive.py
@@ -525,7 +525,7 @@ class ComicArchive:
self.archiver = UnknownArchiver( self.path )
if ComicArchive.logo_data is None:
- fname = os.path.join(ComicTaggerSettings.baseDir(), 'graphics','nocover.png' )
+ fname = ComicTaggerSettings.getGraphic('nocover.png')
with open(fname, 'rb') as fd:
ComicArchive.logo_data = fd.read()
diff --git a/comictagger.py b/comictagger.py
index f94f0c8..e4a0845 100755
--- a/comictagger.py
+++ b/comictagger.py
@@ -575,7 +575,8 @@ def main():
app = QtGui.QApplication(sys.argv)
if platform.system() != "Linux":
- img = QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/tags.png' ))
+ img = QtGui.QPixmap(ComicTaggerSettings.getGraphic('tags.png'))
+
splash = QtGui.QSplashScreen(img)
splash.show()
splash.raise_()
diff --git a/coverimagewidget.py b/coverimagewidget.py
index efb760d..8137e70 100644
--- a/coverimagewidget.py
+++ b/coverimagewidget.py
@@ -63,7 +63,7 @@ class CoverImageWidget(QWidget):
def __init__(self, parent, mode ):
super(CoverImageWidget, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'coverimagewidget.ui' ), self )
+ uic.loadUi(ComicTaggerSettings.getUIFile('coverimagewidget.ui' ), self)
utils.reduceWidgetFontSize( self.label )
@@ -72,8 +72,8 @@ class CoverImageWidget(QWidget):
self.page_loader = None
self.showControls = True
- self.btnLeft.setIcon(QIcon(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/left.png' )))
- self.btnRight.setIcon(QIcon(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/right.png' )))
+ self.btnLeft.setIcon(QIcon(ComicTaggerSettings.getGraphic('left.png')))
+ self.btnRight.setIcon(QIcon(ComicTaggerSettings.getGraphic('right.png')))
self.btnLeft.clicked.connect( self.decrementImage )
self.btnRight.clicked.connect( self.incrementImage )
@@ -236,7 +236,7 @@ class CoverImageWidget(QWidget):
self.page_loader = None
def loadDefault( self ):
- self.current_pixmap = QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/nocover.png' ))
+ self.current_pixmap = QPixmap(ComicTaggerSettings.getGraphic('nocover.png'))
#print "loadDefault called"
self.setDisplayPixmap( 0, 0)
diff --git a/crediteditorwindow.py b/crediteditorwindow.py
index e65f90a..d78e76c 100644
--- a/crediteditorwindow.py
+++ b/crediteditorwindow.py
@@ -33,7 +33,7 @@ class CreditEditorWindow(QtGui.QDialog):
def __init__(self, parent, mode, role, name, primary ):
super(CreditEditorWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'crediteditorwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('crediteditorwindow.ui' ), self)
self.mode = mode
diff --git a/exportwindow.py b/exportwindow.py
index ba62ba8..cc3a463 100644
--- a/exportwindow.py
+++ b/exportwindow.py
@@ -36,7 +36,7 @@ class ExportWindow(QtGui.QDialog):
def __init__( self, parent, settings, msg ):
super(ExportWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'exportwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('exportwindow.ui' ), self)
self.label.setText( msg )
self.setWindowFlags(self.windowFlags() &
diff --git a/fileselectionlist.py b/fileselectionlist.py
index 71bc800..5a2ad59 100644
--- a/fileselectionlist.py
+++ b/fileselectionlist.py
@@ -71,7 +71,7 @@ class FileSelectionList(QWidget):
def __init__(self, parent , settings ):
super(FileSelectionList, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'fileselectionlist.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('fileselectionlist.ui' ), self)
self.settings = settings
diff --git a/imagepopup.py b/imagepopup.py
index 20b7e08..9df1df9 100644
--- a/imagepopup.py
+++ b/imagepopup.py
@@ -29,7 +29,7 @@ class ImagePopup(QtGui.QDialog):
def __init__(self, parent, image_pixmap):
super(ImagePopup, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'imagepopup.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('imagepopup.ui' ), self)
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
@@ -48,7 +48,7 @@ class ImagePopup(QtGui.QDialog):
# widget
self.desktopBg = QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop ().winId(),
0,0, screen_size.width(), screen_size.height())
- bg = QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/popup_bg.png' ))
+ bg = QtGui.QPixmap(ComicTaggerSettings.getGraphic('popup_bg.png'))
self.clientBgPixmap = bg.scaled(screen_size.width(), screen_size.height())
self.setMask(self.clientBgPixmap.mask())
diff --git a/issueselectionwindow.py b/issueselectionwindow.py
index 02a06b1..90f7f32 100644
--- a/issueselectionwindow.py
+++ b/issueselectionwindow.py
@@ -39,7 +39,7 @@ class IssueSelectionWindow(QtGui.QDialog):
def __init__(self, parent, settings, series_id, issue_number):
super(IssueSelectionWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'issueselectionwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('issueselectionwindow.ui' ), self)
self.coverWidget = CoverImageWidget( self.coverImageContainer, CoverImageWidget.AltCoverMode )
gridlayout = QtGui.QGridLayout( self.coverImageContainer )
diff --git a/logwindow.py b/logwindow.py
index fba98b5..5632a4a 100644
--- a/logwindow.py
+++ b/logwindow.py
@@ -30,7 +30,7 @@ class LogWindow(QtGui.QDialog):
def __init__(self, parent):
super(LogWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'logwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('logwindow.ui' ), self)
self.setWindowFlags(self.windowFlags() |
QtCore.Qt.WindowSystemMenuHint |
diff --git a/matchselectionwindow.py b/matchselectionwindow.py
index 109b73e..de0be42 100644
--- a/matchselectionwindow.py
+++ b/matchselectionwindow.py
@@ -38,7 +38,7 @@ class MatchSelectionWindow(QtGui.QDialog):
def __init__(self, parent, matches, comic_archive):
super(MatchSelectionWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'matchselectionwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('matchselectionwindow.ui' ), self)
self.altCoverWidget = CoverImageWidget( self.altCoverContainer, CoverImageWidget.AltCoverMode )
gridlayout = QtGui.QGridLayout( self.altCoverContainer )
diff --git a/pagebrowser.py b/pagebrowser.py
index 5ce727c..720a973 100644
--- a/pagebrowser.py
+++ b/pagebrowser.py
@@ -30,7 +30,7 @@ class PageBrowserWindow(QtGui.QDialog):
def __init__(self, parent, metadata):
super(PageBrowserWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'pagebrowser.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('pagebrowser.ui' ), self)
self.pageWidget = CoverImageWidget( self.pageContainer, CoverImageWidget.ArchiveMode )
gridlayout = QtGui.QGridLayout( self.pageContainer )
@@ -52,8 +52,8 @@ class PageBrowserWindow(QtGui.QDialog):
self.btnPrev.setText("<<")
self.btnNext.setText(">>")
else:
- self.btnPrev.setIcon(QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/left.png' )))
- self.btnNext.setIcon(QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/right.png' )))
+ self.btnPrev.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('left.png' )))
+ self.btnNext.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('right.png')))
self.btnNext.clicked.connect( self.nextPage )
self.btnPrev.clicked.connect( self.prevPage )
diff --git a/pagelisteditor.py b/pagelisteditor.py
index ce40a99..6360c7d 100644
--- a/pagelisteditor.py
+++ b/pagelisteditor.py
@@ -78,7 +78,7 @@ class PageListEditor(QWidget):
def __init__(self, parent ):
super(PageListEditor, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'pagelisteditor.ui' ), self )
+ uic.loadUi(ComicTaggerSettings.getUIFile('pagelisteditor.ui' ), self)
self.pageWidget = CoverImageWidget( self.pageContainer, CoverImageWidget.ArchiveMode )
gridlayout = QGridLayout( self.pageContainer )
diff --git a/progresswindow.py b/progresswindow.py
index b6aa847..e1f69fc 100644
--- a/progresswindow.py
+++ b/progresswindow.py
@@ -30,7 +30,7 @@ class IDProgressWindow(QtGui.QDialog):
def __init__(self, parent):
super(IDProgressWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'progresswindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('progresswindow.ui' ), self)
self.setWindowFlags(self.windowFlags() |
QtCore.Qt.WindowSystemMenuHint |
diff --git a/renamewindow.py b/renamewindow.py
index ebe593d..fb416a0 100644
--- a/renamewindow.py
+++ b/renamewindow.py
@@ -33,7 +33,7 @@ class RenameWindow(QtGui.QDialog):
def __init__( self, parent, comic_archive_list, data_style, settings ):
super(RenameWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'renamewindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('renamewindow.ui' ), self)
self.label.setText("Preview (based on {0} tags):".format(MetaDataStyle.name[data_style]))
self.setWindowFlags(self.windowFlags() |
diff --git a/settings.py b/settings.py
index 8c08bc1..1bdceea 100644
--- a/settings.py
+++ b/settings.py
@@ -40,9 +40,17 @@ class ComicTaggerSettings:
if platform.system() == "Darwin" and getattr(sys, 'frozen', None):
return sys._MEIPASS
else:
- #print "ATB basename", os.path.dirname( os.path.abspath( sys.argv[0] ) )
- return os.path.dirname( os.path.abspath( sys.argv[0] ) )
+ #return os.path.dirname( os.path.abspath( sys.argv[0] ) )
+ return os.path.dirname( os.path.realpath(sys.argv[0] ) )
+
+ @staticmethod
+ def getGraphic( filename ):
+ return os.path.join(ComicTaggerSettings.baseDir(), '..', 'graphics', filename )
+ @staticmethod
+ def getUIFile( filename ):
+ return os.path.join(ComicTaggerSettings.baseDir(), '..', 'ui', filename )
+
def setDefaultValues( self ):
# General Settings
diff --git a/settingswindow.py b/settingswindow.py
index 3e1b8e8..2d5b65c 100644
--- a/settingswindow.py
+++ b/settingswindow.py
@@ -54,7 +54,7 @@ class SettingsWindow(QtGui.QDialog):
def __init__(self, parent, settings ):
super(SettingsWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'settingswindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('settingswindow.ui' ), self)
self.setWindowFlags(self.windowFlags() &
~QtCore.Qt.WindowContextHelpButtonHint )
diff --git a/taggerwindow.py b/taggerwindow.py
index cfa8c24..6b11def 100644
--- a/taggerwindow.py
+++ b/taggerwindow.py
@@ -84,7 +84,7 @@ class TaggerWindow( QtGui.QMainWindow):
def __init__(self, file_list, settings, parent = None):
super(TaggerWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'taggerwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('taggerwindow.ui' ), self)
self.settings = settings
self.archiveCoverWidget = CoverImageWidget( self.coverImageContainer, CoverImageWidget.ArchiveMode )
@@ -122,8 +122,8 @@ class TaggerWindow( QtGui.QMainWindow):
self.scrollAreaWidgetContents.adjustSize()
- self.setWindowIcon(QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/app.png' )))
-
+ self.setWindowIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('app.png')))
+
self.save_data_style = settings.last_selected_save_data_style
self.load_data_style = settings.last_selected_load_data_style
@@ -329,16 +329,16 @@ class TaggerWindow( QtGui.QMainWindow):
self.actionComicTaggerForum.triggered.connect( self.showForum )
# ToolBar
-
- self.actionLoad.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/open.png')) )
- self.actionLoadFolder.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/longbox.png')) )
- self.actionWrite_Tags.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/save.png')) )
- self.actionParse_Filename.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/parse.png')) )
- self.actionSearchOnline.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/search.png')) )
- self.actionAutoIdentify.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/auto.png')) )
- self.actionAutoTag.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/autotag.png')) )
- self.actionClearEntryForm.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/clear.png')) )
- self.actionPageBrowser.setIcon( QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(),'graphics/browse.png') ))
+
+ self.actionLoad.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('open.png')))
+ self.actionLoadFolder.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('longbox.png')))
+ self.actionWrite_Tags.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('save.png')))
+ self.actionParse_Filename.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('parse.png')))
+ self.actionSearchOnline.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('search.png')))
+ self.actionAutoIdentify.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('auto.png')))
+ self.actionAutoTag.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('autotag.png')))
+ self.actionClearEntryForm.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('clear.png')))
+ self.actionPageBrowser.setIcon(QtGui.QIcon( ComicTaggerSettings.getGraphic('browse.png')))
self.toolBar.addAction( self.actionLoad )
self.toolBar.addAction( self.actionLoadFolder )
@@ -451,7 +451,7 @@ class TaggerWindow( QtGui.QMainWindow):
msgBox = QtGui.QMessageBox()
msgBox.setWindowTitle( self.tr("About " + self.appName ) )
msgBox.setTextFormat( QtCore.Qt.RichText )
- msgBox.setIconPixmap( QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'graphics/about.png' )) )
+ msgBox.setIconPixmap( QtGui.QPixmap(ComicTaggerSettings.getGraphic('about.png')) )
msgBox.setText( "
"
+ self.appName + " v" + self.version + "
"
+ "(c)2012 Anthony Beville
"
diff --git a/volumeselectionwindow.py b/volumeselectionwindow.py
index df0e877..584a388 100644
--- a/volumeselectionwindow.py
+++ b/volumeselectionwindow.py
@@ -90,7 +90,7 @@ class VolumeSelectionWindow(QtGui.QDialog):
def __init__(self, parent, series_name, issue_number, year, cover_index_list, comic_archive, settings, autoselect=False):
super(VolumeSelectionWindow, self).__init__(parent)
- uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'volumeselectionwindow.ui' ), self)
+ uic.loadUi(ComicTaggerSettings.getUIFile('volumeselectionwindow.ui' ), self)
self.imageWidget = CoverImageWidget( self.imageContainer, CoverImageWidget.URLMode )
gridlayout = QtGui.QGridLayout( self.imageContainer )