From 50811803d0f276e32e7d5abb4d8b9b936e1b95e1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 26 Apr 2007 18:53:40 +0000 Subject: [PATCH] Fix #31 --- src/libprs500/__init__.py | 2 +- src/libprs500/gui/main.py | 6 +----- src/libprs500/gui/widgets.py | 5 ++++- src/libprs500/prs500.py | 7 ++++++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/libprs500/__init__.py b/src/libprs500/__init__.py index bf265bde36..d448824b69 100644 --- a/src/libprs500/__init__.py +++ b/src/libprs500/__init__.py @@ -33,7 +33,7 @@ You may have to adjust the GROUP and the location of the rules file to suit your distribution. """ -__version__ = "0.3.14" +__version__ = "0.3.15" __docformat__ = "epytext" __author__ = "Kovid Goyal " diff --git a/src/libprs500/gui/main.py b/src/libprs500/gui/main.py index 9f7366bc2e..e01d3c38c3 100644 --- a/src/libprs500/gui/main.py +++ b/src/libprs500/gui/main.py @@ -13,11 +13,7 @@ ## with this program; if not, write to the Free Software Foundation, Inc., ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.Warning """ Create and launch the GUI """ -import sys -import re -import os -import traceback -import tempfile +import sys, re, os, traceback, tempfile from PyQt4.QtCore import Qt, SIGNAL, QObject, QCoreApplication, \ QSettings, QVariant, QSize, QEventLoop, QString, \ diff --git a/src/libprs500/gui/widgets.py b/src/libprs500/gui/widgets.py index 760a0f7071..a23d47eb9c 100644 --- a/src/libprs500/gui/widgets.py +++ b/src/libprs500/gui/widgets.py @@ -25,6 +25,7 @@ from math import sin, cos, pi from libprs500.gui import Error, _Warning from libprs500.ptempfile import PersistentTemporaryFile +from libprs500 import iswindows from PyQt4.QtCore import Qt, SIGNAL from PyQt4.Qt import QApplication, QString, QFont, QAbstractListModel, \ @@ -66,7 +67,9 @@ class FileDragAndDrop(object): if o.scheme and o.scheme != 'file': _Warning(o.scheme + " not supported in drop events", None) continue - path = unquote(o.path) + path = unquote(o.path) + if iswindows and path.startswith('/'): + path = path[1:] if not os.access(path, os.R_OK): _Warning("You do not have read permission for: " + path, None) continue diff --git a/src/libprs500/prs500.py b/src/libprs500/prs500.py index 5ee89d1aa4..f5e6ec678b 100755 --- a/src/libprs500/prs500.py +++ b/src/libprs500/prs500.py @@ -680,7 +680,12 @@ class PRS500(Device): while data_left: data = array('B') try: - data.fromfile(infile, chunk_size) + # Cannot use data.fromfile(infile, chunk_size) as it + # doesn't work in windows w/ python 2.5.1 + ind = infile.read(chunk_size) + data.fromstring(ind) + if len(ind) < chunk_size: + raise EOFError except EOFError: data_left = False res = self.send_validated_command(FileIO(_id, pos, len(data), \