Updates for py2exe linking

Relative paths weren't relative enough
This commit is contained in:
Jan 2013-10-11 00:08:26 +11:00
parent 4f67ca3c34
commit bb66815f4f
9 changed files with 40 additions and 25 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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

View File

@ -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>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;Manga processor by Alex Yatskov for the Kindle e-book reader. Please see &lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-style:italic;&quot;&gt;license.txt&lt;/span&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt; for licensing information. Visit the homepage at &lt;/span&gt;&lt;a href=&quot;http://foosoft.net/mangle&quot;&gt;&lt;span style=&quot; font-family:'Sans'; text-decoration: underline; color:#0000ff;&quot;&gt;http://foosoft.net/mangle&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;Manga processor for the Kindle e-book reader. Please see &lt;/span&gt;&lt;span style=&quot; font-family:'Sans'; font-style:italic;&quot;&gt;license.txt&lt;/span&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt; for licensing information. Visit the homepage at &lt;/span&gt;&lt;a href=&quot;https://github.com/catmanjan/mangle&quot;&gt;&lt;span style=&quot; font-family:'Sans'; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/catmanjan/mangle&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>

View File

@ -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)

10
nodist
View File

@ -1,10 +0,0 @@
.git
.gitignore
ref
build
dist
nodist
README
*.pyw
*.pyc
*.py

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
# Copyright (C) 2010 Alex Yatskov
# Copyright (C) 2013 Jan Martin
#
# 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
@ -23,7 +23,27 @@ import py2exe
sys.argv.append('py2exe')
setup(
name = 'Mangle',
windows = [{'script': 'mangle.pyw'}],
options={'py2exe': {'bundle_files': 1, 'includes': ['sip']}},
data_files = [('', ['LICENSE']),
('mangle/ui', ['mangle/ui/book.ui',
'mangle/ui/about.ui',
'mangle/ui/options.ui']),
('mangle/img', ['mangle/img/add_directory.png',
'mangle/img/add_file.png',
'mangle/img/banner_about.png',
'mangle/img/export_book.png',
'mangle/img/file_new.png',
'mangle/img/file_open.png',
'mangle/img/remove_files.png',
'mangle/img/save_file.png',
'mangle/img/shift_down.png',
'mangle/img/shift_up.png'])],
options = {'py2exe': {
'bundle_files': 1,
'includes': ['sip'],
'packages': ['reportlab.pdfbase'],
'dll_excludes': ['w9xpopen.exe']
}},
zipfile = None
)