Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-org-sugar-git@silbe.org>2009-04-05 13:41:27 (GMT)
committer Sascha Silbe <sascha-org-sugar-git@silbe.org>2009-04-05 13:41:27 (GMT)
commiteac20ac371e0e3842f01e709c217834f58e2af1f (patch)
treebde0e2beddce77ad85c9ca9319c0c550ff374946
parent69325573020da9473261736ba88c9464cc6c0f46 (diff)
ask whether to use single-device or parallel mode
-rwxr-xr-xsoas-assimilator.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/soas-assimilator.py b/soas-assimilator.py
index 48ddeca..6a8a74e 100755
--- a/soas-assimilator.py
+++ b/soas-assimilator.py
@@ -269,14 +269,14 @@ class WriteQThread (threading.Thread) :
class tDeviceListener (object) :
- def __init__(self, image_dir, status_cb) :
+ def __init__(self, image_dir, status_cb, use_parallel) :
self.mode = 'read'
self.image_dir = image_dir
self.status_cb = status_cb
self._images_dict = {}
self._images_flat = []
self._images_lastupdate = 0
- self._use_write_q = True
+ self._use_write_q = not use_parallel
self._write_q = []
self._write_q_cond = threading.Condition()
self.bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
@@ -396,7 +396,8 @@ class tApp (object) :
def __init__(self) :
self._imageDir = self._chooseImageDir()
self._devStatus = {}
- self._deviceListener = tDeviceListener(self._imageDir, self._updateStatus)
+ parallel = self._askParallel()
+ self._deviceListener = tDeviceListener(self._imageDir, self._updateStatus, parallel)
if self._askReadImage() :
self._win = tReadWindow()
self._win.writeButton.connect("clicked", self._showWriteWindow)
@@ -472,6 +473,24 @@ class tApp (object) :
askDialog.destroy()
return (res == gtk.RESPONSE_OK)
+ def _askParallel(self) :
+ """
+ Ask the user whether to restrict writing to a single device at a time or
+ write in parallel. Returns True for the latter, False otherwise.
+ """
+ askDialog = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION,
+ buttons=gtk.BUTTONS_NONE,
+ message_format="\n".join([x.strip() for x in """
+ If you are using a slow (i.e. 12Mbps / FullSpeed) hub or your system is having trouble with USB, it might make
+ sense to write access a single device at a time. Usually parallel mode is much faster and thus recommended, though.
+ """.split("\n")]))
+
+ askDialog.add_buttons("Parallel mode", gtk.RESPONSE_OK, "Single device mode", gtk.RESPONSE_CANCEL)
+ askDialog.set_title("Read images first?")
+ res = askDialog.run()
+ askDialog.destroy()
+ return (res == gtk.RESPONSE_OK)
+
def run(self) :
gtk.main()