From bb66815f4fddd6b01ae8376d215a56ebdba6b41b Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 11 Oct 2013 00:08:26 +1100 Subject: [PATCH] Updates for py2exe linking Relative paths weren't relative enough --- README.md | 2 +- mangle/about.py | 2 +- mangle/book.py | 14 +++++++++----- mangle/options.py | 2 +- mangle/ui/about.ui | 4 ++-- mangle/util.py | 3 ++- nodist | 10 ---------- ref/testpattern.png | Bin 3780 -> 0 bytes setup.py | 28 ++++++++++++++++++++++++---- 9 files changed, 40 insertions(+), 25 deletions(-) delete mode 100644 nodist delete mode 100644 ref/testpattern.png diff --git a/README.md b/README.md index 848fee2..f1d1d17 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Mangle 3 Mangle exports comics, manga and other image files into a format that all Kindles can read. Mangle can also resize your images to render faster on your Kindle. -## Requirements +## For Developers - [Python 2.7](http://www.python.org/download/releases/2.7/) - [Python Image Library (PIL)](http://www.pythonware.com/products/pil/) - [PyQT4](http://www.riverbankcomputing.com/software/pyqt/download) diff --git a/mangle/about.py b/mangle/about.py index 39c37a9..c2af64b 100644 --- a/mangle/about.py +++ b/mangle/about.py @@ -22,4 +22,4 @@ from PyQt4 import QtGui, uic class DialogAbout(QtGui.QDialog): def __init__(self, parent): QtGui.QDialog.__init__(self, parent) - uic.loadUi(util.buildResPath('ui/about.ui'), self) + uic.loadUi(util.buildResPath('mangle/ui/about.ui'), self) diff --git a/mangle/book.py b/mangle/book.py index 5ad7638..1ec5ccf 100644 --- a/mangle/book.py +++ b/mangle/book.py @@ -29,7 +29,7 @@ from natsort import natsorted class Book(object): - DefaultDevice = 'Kindle 4' + DefaultDevice = 'Kindle Paperwhite' DefaultOutputFormat = 'PDF only' DefaultOverwrite = True DefaultImageFlags = ImageFlags.Orient | ImageFlags.Resize | ImageFlags.Quantize @@ -40,6 +40,7 @@ class Book(object): self.filename = None self.modified = False self.title = None + self.titleSet = False self.device = Book.DefaultDevice self.overwrite = Book.DefaultOverwrite self.imageFlags = Book.DefaultImageFlags @@ -116,7 +117,7 @@ class MainWindowBook(QtGui.QMainWindow): def __init__(self, filename=None): QtGui.QMainWindow.__init__(self) - uic.loadUi(util.buildResPath('ui/book.ui'), self) + uic.loadUi(util.buildResPath('mangle/ui/book.ui'), self) self.listWidgetFiles.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.actionFileNew.triggered.connect(self.onFileNew) self.actionFileOpen.triggered.connect(self.onFileOpen) @@ -240,7 +241,8 @@ class MainWindowBook(QtGui.QMainWindow): def onBookOptions(self): dialog = DialogOptions(self, self.book) - dialog.exec_() + if dialog.exec_() == QtGui.QDialog.Accepted: + self.book.titleSet = True def onBookExport(self): @@ -248,10 +250,12 @@ class MainWindowBook(QtGui.QMainWindow): QtGui.QMessageBox.warning(self, 'Mangle', 'This book has no images to export') return - if self.book.title is None: + if not self.book.titleSet: # if self.book.title is None: dialog = DialogOptions(self, self.book) if dialog.exec_() == QtGui.QDialog.Rejected: return + else: + self.book.titleSet = True directory = QtGui.QFileDialog.getExistingDirectory(self, 'Select a directory to export book to') if not directory.isNull(): @@ -261,7 +265,7 @@ class MainWindowBook(QtGui.QMainWindow): def onHelpHomepage(self): services = QtGui.QDesktopServices() - services.openUrl(QtCore.QUrl('http://foosoft.net/mangle')) + services.openUrl(QtCore.QUrl('https://github.com/catmanjan/mangle')) def onHelpAbout(self): diff --git a/mangle/options.py b/mangle/options.py index 364dece..cf4b021 100644 --- a/mangle/options.py +++ b/mangle/options.py @@ -24,7 +24,7 @@ class DialogOptions(QtGui.QDialog): def __init__(self, parent, book): QtGui.QDialog.__init__(self, parent) - uic.loadUi(util.buildResPath('ui/options.ui'), self) + uic.loadUi(util.buildResPath('mangle/ui/options.ui'), self) self.accepted.connect(self.onAccept) self.book = book diff --git a/mangle/ui/about.ui b/mangle/ui/about.ui index b7544e0..f89c313 100644 --- a/mangle/ui/about.ui +++ b/mangle/ui/about.ui @@ -49,9 +49,9 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:14pt;">Mangle</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans';">Version 2.3</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans';">Version 3</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans';">Manga processor by Alex Yatskov for the Kindle e-book reader. Please see </span><span style=" font-family:'Sans'; font-style:italic;">license.txt</span><span style=" font-family:'Sans';"> for licensing information. Visit the homepage at </span><a href="http://foosoft.net/mangle"><span style=" font-family:'Sans'; text-decoration: underline; color:#0000ff;">http://foosoft.net/mangle</span></a><span style=" font-family:'Sans';">.</span></p></body></html> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans';">Manga processor for the Kindle e-book reader. Please see </span><span style=" font-family:'Sans'; font-style:italic;">license.txt</span><span style=" font-family:'Sans';"> for licensing information. Visit the homepage at </span><a href="https://github.com/catmanjan/mangle"><span style=" font-family:'Sans'; text-decoration: underline; color:#0000ff;">https://github.com/catmanjan/mangle</span></a><span style=" font-family:'Sans';">.</span></p></body></html> true diff --git a/mangle/util.py b/mangle/util.py index ff749d2..e23c7f4 100644 --- a/mangle/util.py +++ b/mangle/util.py @@ -16,8 +16,9 @@ import os.path import re +import sys def buildResPath(relative): - directory = os.path.dirname(__file__) + directory = os.path.dirname(os.path.realpath(sys.argv[0])) return os.path.join(directory, relative) diff --git a/nodist b/nodist deleted file mode 100644 index 92ec6a9..0000000 --- a/nodist +++ /dev/null @@ -1,10 +0,0 @@ -.git -.gitignore -ref -build -dist -nodist -README -*.pyw -*.pyc -*.py diff --git a/ref/testpattern.png b/ref/testpattern.png deleted file mode 100644 index 4f7c51d818ad2434c531f48c9da2aab6718d67e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3780 zcmZu!2{=^W8=g`W5vCMnU(;x(jLN=DlbJ$eQYvH3kQS4Yv|1)fMHER9sTt}PEkfIs zHWe}?Bt_X%wkZA2y?5?3^LzfD$7AN+bH4L^@B4o5cW~Fx9OY%zWC;Xh+k-!*G^x8wND7kSBnzt*cd|$8+E1UC#4Z(v|xXlQ6;WHe{a9AjhSxpU`|NF);zlX>&z&7VJi!GZ+~ z7cN}1Xwl-uiC$D(mYJKIlgVTY3ybB;m#ebH9&NLd0PN%O~vu5quwJt6$ zuCA_bZf@(=tz$44?(XhPCUgDz^&TD`8#Zj%xN)PWr{|_kn>KIWyk*N4FE1|^i{+9?1=jZS59}p0*b?er^z(6*e9TXH492~rD+qRI9knP*I@7S?p=gytGcI^rc z4drk+yLayn3k%z`XV2cfd&9%S_wCyk5fQO}|Nh9x$O8us96WgN(4j+z4<9~q3Kr%AP)b zT3%lM?Af#D&!4||@#5vnm#<#Es;H=V{rdHrH*em)eOp;sSyfe4U0wa|-MgBa8i7Di zTU%RKSNHz?`}+F&4<9}>G&D3eHa0aief;>bxw-k%r%x>{EuTMs{_^EZYiny;Tie&K zU%!3(*52OU(b3V_+1b_A)!p6Q)6>)2+xz|d_rAWqA3uKl{Q0xLzkgt0U~q77XlQ77 zc=*?^Un3(Uqobq0fB*jT=g-*K*x$c@TW)ynClKU3D0bFvd+NKYqHgV8rz-Q-`%Ycn zmas70+&Yj+<2d8Gx^(ar{pnox`H*&aD4`SErCNo)F{bXh= z_yr$S&@Xa*bd~^nVj9l3U0Y>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