From fb2a358c7323466b6b57de0f913b5aa69c1948c1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 5 Aug 2007 02:44:20 +0000 Subject: [PATCH] Add beta launcher --- setup.py | 1 + src/libprs500/__init__.py | 2 +- src/libprs500/gui2/Makefile | 2 +- src/libprs500/gui2/main.py | 28 +++++++--------------------- upload.py | 14 ++++++++------ windows_installer.py | 2 +- 6 files changed, 19 insertions(+), 30 deletions(-) diff --git a/setup.py b/setup.py index cb988b5146..386ce97789 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ entry_points = { 'web2disk = libprs500.web.fetch.simple:main',\ 'web2lrf = libprs500.ebooks.lrf.web.convert_from:main',\ 'pdf2lrf = libprs500.ebooks.lrf.pdf.convert_from:main',\ + 'libprs500-beta = libprs500.gui2.main:main',\ ], 'gui_scripts' : [ APPNAME+' = libprs500.gui.main:main'] } diff --git a/src/libprs500/__init__.py b/src/libprs500/__init__.py index a225eee7cd..462faed504 100644 --- a/src/libprs500/__init__.py +++ b/src/libprs500/__init__.py @@ -13,7 +13,7 @@ ## with this program; if not, write to the Free Software Foundation, Inc., ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ''' E-book management software''' -__version__ = "0.3.84" +__version__ = "0.3.86" __docformat__ = "epytext" __author__ = "Kovid Goyal " __appname__ = 'libprs500' diff --git a/src/libprs500/gui2/Makefile b/src/libprs500/gui2/Makefile index ed8e636bb4..9575097fc9 100644 --- a/src/libprs500/gui2/Makefile +++ b/src/libprs500/gui2/Makefile @@ -2,7 +2,7 @@ UI = main_ui.py dialogs/metadata_single_ui.py dialogs/metadata_bulk_ui.py dialog RC = images_rc.pyc %_ui.py : %.ui - pyuic4 $< > $@ + pyuic4 $< | sed "s/import images_rc/from libprs500.gui2 import images_rc/" > $@ %_rc.pyc : %.qrc % pyrcc4 $< > $*_rc.py diff --git a/src/libprs500/gui2/main.py b/src/libprs500/gui2/main.py index f9c880de63..1cab2f2ed4 100644 --- a/src/libprs500/gui2/main.py +++ b/src/libprs500/gui2/main.py @@ -12,6 +12,7 @@ ## You should have received a copy of the GNU General Public License along ## with this program; if not, write to the Free Software Foundation, Inc., ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.Warning +from libprs500.ptempfile import PersistentTemporaryFile import os, tempfile, sys, traceback from PyQt4.QtCore import Qt, SIGNAL, QObject, QCoreApplication, \ @@ -485,40 +486,25 @@ class Main(QObject, Ui_MainWindow): def unhandled_exception(self, type, value, tb): traceback.print_exception(type, value, tb, file=sys.stderr) + if type == KeyboardInterrupt: + self.window.close() + self.window.thread().exit(0) fe = '\n'.join(traceback.format_exception(type, value, tb)) msg = '

' + str(value) + '

' msg += '

Detailed traceback:

'+fe+'
' d = error_dialog(self.window, 'ERROR: Unhandled exception', msg) d.exec_() -def main(): - lock = os.path.join(tempfile.gettempdir(),"libprs500_gui_lock") - if os.access(lock, os.F_OK): - print >>sys.stderr, "Another instance of", APP_TITLE, "is running" - print >>sys.stderr, "If you are sure this is not the case then "+\ - "manually delete the file", lock - sys.exit(1) +def main(): from PyQt4.Qt import QApplication, QMainWindow app = QApplication(sys.argv) - #from IPython.Shell import IPShellEmbed - #ipshell = IPShellEmbed([], - # banner = 'Dropping into IPython', - # exit_msg = 'Leaving Interpreter, back to program.') - #ipshell() - #return 0 window = QMainWindow() window.setWindowTitle(APP_TITLE) QCoreApplication.setOrganizationName("KovidsBrain") QCoreApplication.setApplicationName(APP_TITLE) initialize_file_icon_provider() - main = Main(window) - def unhandled_exception(type, value, tb): - import traceback - traceback.print_exception(type, value, tb, file=sys.stderr) - if type == KeyboardInterrupt: - main.window.close() - sys.excepthook = main.unhandled_exception - + main = Main(window) + sys.excepthook = main.unhandled_exception return app.exec_() diff --git a/upload.py b/upload.py index 0220864c6c..8779eed959 100644 --- a/upload.py +++ b/upload.py @@ -89,6 +89,7 @@ def upload_docs(): def main(): + upload = len(sys.argv) < 2 shutil.rmtree('build') os.mkdir('build') shutil.rmtree('docs') @@ -99,12 +100,13 @@ def main(): dmg = build_osx() print 'Building Windows installer...' exe = build_windows() - print 'Uploading installers...' - upload_installers(exe, dmg) - print 'Uploading to PyPI' - check_call('''python setup.py register bdist_egg --exclude-source-files upload''') - upload_docs() - check_call('''rm -rf dist/* build/*''') + if upload: + print 'Uploading installers...' + upload_installers(exe, dmg) + print 'Uploading to PyPI' + check_call('''python setup.py register bdist_egg --exclude-source-files upload''') + upload_docs() + check_call('''rm -rf dist/* build/*''') if __name__ == '__main__': main() diff --git a/windows_installer.py b/windows_installer.py index ba30a1c8c6..a85c26591e 100644 --- a/windows_installer.py +++ b/windows_installer.py @@ -190,7 +190,7 @@ Section "Device Drivers" "secdd" IfErrors 0 +3 MessageBox MB_OK|MB_ICONINFORMATION|MB_TOPMOST "Failed to install USB driver. devcon exit code: $0" Goto +2 - MessageBox MB_OK 'If you have the SONY Connect Reader software installed: $\nGoto Add Remove Programs and uninstall the entry "Windows Driver Package - Sony Corporation (PRSUSB)". $\n$\nIf your reader is connected to the computer, disconnect and reconnect it now.' + MessageBox MB_OK '1. If you have the SONY Connect Reader software installed: $\nGoto Add Remove Programs and uninstall the entry "Windows Driver Package - Sony Corporation (PRSUSB)". $\n$\n2. If your reader is connected to the computer, disconnect and reconnect it now.' DetailPrint " "