diff --git a/setup.py b/setup.py index 1b6ea082c0..c5dc750913 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ try: try: import Image except ImportError: - if sys.platform not in ['win32', 'darwin']: + if sys.platform.lower()[:5] not in ['win32', 'darwin']: print "Trying to install the Python Imaging Library" easy_install(["-f", "http://www.pythonware.com/products/pil/", "Imaging"]) else: @@ -48,10 +48,6 @@ if sys.hexversion < 0x2050000: sys.exit(1) -install_requires=[] -if sys.platform not in ['win32', 'darwin']: - install_requires = ["pyusb>=0.3.5", "pyxml>=0.8.4"] - setup( name='libprs500', packages = find_packages('src'), @@ -74,10 +70,6 @@ setup( 'gui_scripts' : [ 'prs500-gui = libprs500.gui.main:main'] }, zip_safe = True, - install_requires = install_requires, - dependency_links = ["http://sourceforge.net/project/showfiles.php?group_id=6473", - "http://easynews.dl.sourceforge.net/sourceforge/pyusb/pyusb-0.3.5.tar.gz", - ], description = """ Library to interface with the Sony Portable Reader 500 diff --git a/src/libprs500/__init__.py b/src/libprs500/__init__.py index 1d819c4cbd..eb82e683a5 100644 --- a/src/libprs500/__init__.py +++ b/src/libprs500/__init__.py @@ -37,6 +37,6 @@ the following rule in C{/etc/udev/rules.d/90-local.rules} :: You may have to adjust the GROUP and the location of the rules file to suit your distribution. """ -__version__ = "0.3.0b5" +__version__ = "0.3.0b6" __docformat__ = "epytext" __author__ = "Kovid Goyal " diff --git a/src/libprs500/books.py b/src/libprs500/books.py index a66ed92d19..d3c0e26298 100644 --- a/src/libprs500/books.py +++ b/src/libprs500/books.py @@ -16,7 +16,6 @@ This module contains the logic for dealing with XML book lists found in the reader cache. """ -from xml.dom.ext import PrettyPrint import xml.dom.minidom as dom from base64 import b64decode as decode from base64 import b64encode as encode @@ -94,8 +93,8 @@ class Book(object): self.prefix = prefix self.root = root - def __repr__(self): - return self.title + " by " + self.author+ " at " + self.path + def __repr__(self): + return self.title + u" by " + self.author + u" at " + self.path def __str__(self): return self.__repr__() @@ -208,4 +207,4 @@ class BookList(list): def write(self, stream): """ Write XML representation of DOM tree to C{stream} """ - PrettyPrint(self.document, stream) + stream.write(self.document.toxml('utf-8')) diff --git a/src/libprs500/cli/main.py b/src/libprs500/cli/main.py index bec7e894bc..4027778a3d 100755 --- a/src/libprs500/cli/main.py +++ b/src/libprs500/cli/main.py @@ -207,7 +207,8 @@ def main(): str(0 if total[i]==0 else int(100*(total[i]-free[i])/(total[i]*1.)))+"%") elif command == "books": print "Books in main memory:" - for book in dev.books(): print book + for book in dev.books(): + print unicode(book) print "\nBooks on storage card:" for book in dev.books(oncard=True): print book elif command == "mkdir": diff --git a/src/libprs500/communicate.py b/src/libprs500/communicate.py index ef399bfb58..7d94f89661 100755 --- a/src/libprs500/communicate.py +++ b/src/libprs500/communicate.py @@ -480,9 +480,9 @@ class PRS500Device(Device): command_number=FileIO.RNUMBER, packet_size=4096) try: # The first 16 bytes are meta information on the packet stream - array('B', packets[0][16:]).tofile(outfile) - for i in range(1, len(packets)): - array('B', packets[i]).tofile(outfile) + outfile.write("".join(map(chr, packets[0][16:]))) + for i in range(1, len(packets)): + outfile.write("".join(map(chr, packets[i]))) except IOError, err: self.send_validated_command(FileClose(_id)) raise ArgumentError("File get operation failed. " + \ diff --git a/src/libprs500/gui/main.py b/src/libprs500/gui/main.py index 752d6c4649..4d331a8831 100644 --- a/src/libprs500/gui/main.py +++ b/src/libprs500/gui/main.py @@ -522,6 +522,8 @@ class Main(QObject, Ui_MainWindow): except DeviceBusy, err: Error("Device is in use by another application", None) self.status("Device busy") + self.window.setCursor(Qt.ArrowCursor) + return except DeviceError, err: self.dev.reconnect() self.thread().msleep(100) @@ -550,26 +552,17 @@ class Main(QObject, Ui_MainWindow): sc = space[1] if int(space[1])>0 else space[2] self.device_tree.model().update_free_space(space[0], sc) -class LockFile(object): - def __init__(self, path): - self.path = path - f = open(path, "w") - f.close() - - def __del__(self): - if os.access(self.path, os.F_OK): os.remove(self.path) - class DeviceConnectDetector(QObject): def timerEvent(self, e): if e.timerId() == self.device_detector: is_connected = self.dev.is_connected() if is_connected and not self.is_connected: - self.emit(SIGNAL("device_connected()")) self.is_connected = True + self.emit(SIGNAL("device_connected()")) elif not is_connected and self.is_connected: - self.emit(SIGNAL("device_removed()")) self.is_connected = False + self.emit(SIGNAL("device_removed()")) def udi_is_device(self, udi): ans = False @@ -638,7 +631,6 @@ def main(): QCoreApplication.setOrganizationName("KovidsBrain") QCoreApplication.setApplicationName(APP_TITLE) Main(window, options.log_packets) - lock = LockFile(lock) return app.exec_() if __name__ == "__main__": diff --git a/src/libprs500/gui/main.ui b/src/libprs500/gui/main.ui index ee77b0aac9..9e7bf4e0e2 100644 --- a/src/libprs500/gui/main.ui +++ b/src/libprs500/gui/main.ui @@ -53,7 +53,7 @@ 10000 - 95 + 90 @@ -81,11 +81,17 @@ 5 - 0 + 5 0 0 + + + 16777215 + 90 + + For help visit <a href="https://libprs500.kovidgoyal.net/wiki/GuiUsage">http://libprs500.kovidgoyal.net</a><br><br><b>libprs500</b> was created by <b>Kovid Goyal</b> &copy; 2006<br>%1 %2 %3 @@ -281,8 +287,8 @@ - 163 - 58 + 124 + 50