diff --git a/crediteditorwindow.py b/crediteditorwindow.py index 11615ac..b8083a3 100644 --- a/crediteditorwindow.py +++ b/crediteditorwindow.py @@ -20,7 +20,8 @@ limitations under the License. from PyQt4 import QtCore, QtGui, uic - +from settings import ComicTaggerSettings +import os class CreditEditorWindow(QtGui.QDialog): @@ -32,7 +33,7 @@ class CreditEditorWindow(QtGui.QDialog): def __init__(self, parent, mode, role, name ): super(CreditEditorWindow, self).__init__(parent) - uic.loadUi('crediteditorwindow.ui', self) + uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'crediteditorwindow.ui' ), self) self.mode = mode diff --git a/issueselectionwindow.py b/issueselectionwindow.py index 91a4fa2..946dbc5 100644 --- a/issueselectionwindow.py +++ b/issueselectionwindow.py @@ -27,6 +27,7 @@ from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest from comicvinetalker import ComicVineTalker from imagefetcher import ImageFetcher +from settings import ComicTaggerSettings class IssueSelectionWindow(QtGui.QDialog): @@ -35,7 +36,7 @@ class IssueSelectionWindow(QtGui.QDialog): def __init__(self, parent, settings, series_id, issue_number): super(IssueSelectionWindow, self).__init__(parent) - uic.loadUi('issueselectionwindow.ui', self) + uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'issueselectionwindow.ui' ), self) self.series_id = series_id self.settings = settings @@ -125,7 +126,7 @@ class IssueSelectionWindow(QtGui.QDialog): self.issue_number = record['issue_number'] - self.labelThumbnail.setPixmap(QtGui.QPixmap(os.getcwd() + "/nocover.png")) + self.labelThumbnail.setPixmap(QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'nocover.png' ))) self.cv = ComicVineTalker( self.settings.cv_api_key ) self.cv.urlFetchComplete.connect( self.urlFetchComplete ) diff --git a/mac/Makefile b/mac/Makefile new file mode 100644 index 0000000..b73e0d4 --- /dev/null +++ b/mac/Makefile @@ -0,0 +1,56 @@ +PY2INSTALLER_CMD := python $(HOME)/pyinstaller-2.0/pyinstaller.py +TAGGER_BASE := $(HOME)/Dropbox/tagger/comictagger + +APP_NAME := ComicTagger +VERSION_STR := 1.0 + +MAC_BASE := $(TAGGER_BASE)/mac +DIST_DIR := $(MAC_BASE)/dist +STAGING := $(MAC_BASE)/$(APP_NAME) +APP_BUNDLE := $(DIST_DIR)/$(APP_NAME).app +VOLUME_NAME := $(APP_NAME)-$(VERSION_STR) +DMG_FILE := $(VOLUME_NAME).dmg + +all: clean dist + +dist: + $(PY2INSTALLER_CMD) tagger.py -o $(MAC_BASE) -w -n $(APP_NAME) -s + cp $(TAGGER_BASE)/*.ui $(TAGGER_BASE)/*.png $(APP_BUNDLE)/Contents/MacOS + cp $(MAC_BASE)/app.icns $(APP_BUNDLE)/Contents/Resources/icon-windowed.icns +clean: + rm -rf $(DIST_DIR) $(MAC_BASE)/build + rm -f $(MAC_BASE)/*.spec + rm -f "*~" *.pyc *.pyo + +diskimage: + + + #Set up disk image staging folder + rm -rf $(STAGING) + mkdir $(STAGING) + #cp $(TAGGER_BASE)/README.txt $(STAGING) + cp -a $(APP_BUNDLE) $(STAGING) + cp $(MAC_BASE)/volume.icns $(STAGING)/.VolumeIcon.icns + SetFile -c icnC $(STAGING)/.VolumeIcon.icns + + ##generate raw disk image + rm -f $(DMG_FILE) + hdiutil create -srcfolder $(STAGING) -volname $(VOLUME_NAME) -format UDRW -ov raw-$(DMG_FILE) + + #remove working files and folders + rm -rf $(STAGING) + + # we now have a raw DMG file. + + # remount it so we can set the volume icon properly + mkdir -p $(STAGING) + hdiutil attach raw-$(DMG_FILE) -mountpoint $(STAGING) + SetFile -a C $(STAGING) + hdiutil detach $(STAGING) + rm -rf $(STAGING) + + # convert the raw image + rm -f $(DMG_FILE) + hdiutil convert raw-$(DMG_FILE) -format UDZO -o $(DMG_FILE) + rm -f raw-$(DMG_FILE) + \ No newline at end of file diff --git a/mac/app.icns b/mac/app.icns new file mode 100644 index 0000000..b11ce3f Binary files /dev/null and b/mac/app.icns differ diff --git a/mac/volume.icns b/mac/volume.icns new file mode 100644 index 0000000..d90d154 Binary files /dev/null and b/mac/volume.icns differ diff --git a/options.py b/options.py index 4498197..97803aa 100644 --- a/options.py +++ b/options.py @@ -36,7 +36,7 @@ class MetaDataStyle: class Options: def __init__(self): - self.data_style = MetaDataStyle.CBI + self.data_style = MetaDataStyle.CIX self.no_gui = False self.series_name = '' @@ -44,7 +44,11 @@ class Options: self.filename = '' self.image_hasher = 1 - def parseCmdLineArgs(self): + def parseCmdLineArgs(self): + + # mac no likey this from .app bundle + if getattr(sys, 'frozen', None): + return # parse command line options try: diff --git a/progresswindow.py b/progresswindow.py index ca255f5..7296788 100644 --- a/progresswindow.py +++ b/progresswindow.py @@ -20,7 +20,8 @@ limitations under the License. import sys from PyQt4 import QtCore, QtGui, uic - +import os +from settings import ComicTaggerSettings class IDProgressWindow(QtGui.QDialog): @@ -29,7 +30,7 @@ class IDProgressWindow(QtGui.QDialog): def __init__(self, parent): super(IDProgressWindow, self).__init__(parent) - uic.loadUi('progresswindow.ui', self) + uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'progresswindow.ui' ), self) diff --git a/progresswindow.ui b/progresswindow.ui index 21d117b..3ffcb05 100644 --- a/progresswindow.ui +++ b/progresswindow.ui @@ -11,7 +11,7 @@ - Image Identification Progress + Issue Identification Progress diff --git a/settings.py b/settings.py index f5507d3..87de3c3 100644 --- a/settings.py +++ b/settings.py @@ -20,6 +20,7 @@ limitations under the License. #import sys import os +import sys import ConfigParser import platform @@ -40,6 +41,14 @@ class ComicTaggerSettings: return os.path.join( os.environ['APPDATA'], 'ComicTagger' ) else: return os.path.join( os.path.expanduser('~') , '.ComicTagger') + + @staticmethod + def baseDir(): + if getattr(sys, 'frozen', None): + return sys._MEIPASS + else: + return os.path.dirname(__file__) + def __init__(self): diff --git a/settingswindow.py b/settingswindow.py index 975df0f..2cf60ba 100644 --- a/settingswindow.py +++ b/settingswindow.py @@ -55,7 +55,8 @@ class SettingsWindow(QtGui.QDialog): def __init__(self, parent, settings ): super(SettingsWindow, self).__init__(parent) - uic.loadUi('settingswindow.ui', self) + uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'settingswindow.ui' ), self) + self.settings = settings if platform.system() == "Windows": diff --git a/taggerwindow.py b/taggerwindow.py index 790fa10..e1f1970 100644 --- a/taggerwindow.py +++ b/taggerwindow.py @@ -45,11 +45,12 @@ class TaggerWindow( QtGui.QMainWindow): def __init__(self, opts, settings, parent = None): super(TaggerWindow, self).__init__(parent) - uic.loadUi('taggerwindow.ui', self) - self.setWindowIcon(QtGui.QIcon('app.png')) + uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'taggerwindow.ui' ), self) + self.setWindowIcon(QtGui.QIcon(os.path.join(ComicTaggerSettings.baseDir(), 'app.png' ))) - self.lblCover.setPixmap(QtGui.QPixmap(os.getcwd() + "/nocover.png")) + self.lblCover.setPixmap(QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'nocover.png' ))) self.center() + self.show() self.raise_() #print platform.system(), platform.release() diff --git a/todo.txt b/todo.txt index c0524d9..74cb356 100644 --- a/todo.txt +++ b/todo.txt @@ -5,11 +5,13 @@ Features Toolbar icons +Infobox needs fixing up + Page Browser, mode-less dialog Multi-match dialog -More auto-select logic using +More auto-select logic using metadata Stand-alone CLI Info dump @@ -37,6 +39,8 @@ Version 2 - GUI to handle mutliple files or folders ----------------- Bugs ---------------- +SERIOUS BUG: rebuilding zips! +http://stackoverflow.com/questions/11578443/trigger-io-errno-18-cross-device-link Be more tolerant of mis-labled extensions i.e. cbr when it's a cbz @@ -111,3 +115,9 @@ Some that seem library only: Proposed Values Community Rating +Mac Notes: + +python ~/pyinstaller-2.0/pyinstaller.py tagger.py -w -i windows/nsis/app.ico + + + diff --git a/volumeselectionwindow.py b/volumeselectionwindow.py index ddbd453..ac55722 100644 --- a/volumeselectionwindow.py +++ b/volumeselectionwindow.py @@ -32,6 +32,7 @@ from issueidentifier import IssueIdentifier from genericmetadata import GenericMetadata from imagefetcher import ImageFetcher from progresswindow import IDProgressWindow +from settings import ComicTaggerSettings class SearchThread( QtCore.QThread): @@ -84,7 +85,7 @@ class VolumeSelectionWindow(QtGui.QDialog): def __init__(self, parent, cv_api_key, series_name, issue_number, comic_archive, settings): super(VolumeSelectionWindow, self).__init__(parent) - uic.loadUi('volumeselectionwindow.ui', self) + uic.loadUi(os.path.join(ComicTaggerSettings.baseDir(), 'volumeselectionwindow.ui' ), self) self.settings = settings self.series_name = series_name @@ -271,8 +272,8 @@ class VolumeSelectionWindow(QtGui.QDialog): self.teDetails.setText ( record['description'] ) - self.labelThumbnail.setPixmap(QtGui.QPixmap(os.getcwd() + "/nocover.png")) - + self.labelThumbnail.setPixmap(QtGui.QPixmap(os.path.join(ComicTaggerSettings.baseDir(), 'nocover.png' ))) + url = record['image']['super_url'] self.fetcher = ImageFetcher( ) self.fetcher.fetchComplete.connect(self.finishRequest)