[Clippy-commits] SF.net SVN: clippy:[14] clippy
Status: Pre-Alpha
Brought to you by:
edheldil
|
From: <edh...@us...> - 2010-06-11 21:40:20
|
Revision: 14
http://clippy.svn.sourceforge.net/clippy/?rev=14&view=rev
Author: edheldil
Date: 2010-06-11 21:40:13 +0000 (Fri, 11 Jun 2010)
Log Message:
-----------
Threads
Modified Paths:
--------------
clippy/config.py
clippy/ui/assistant/app.py
clippy/ui/assistant/win_main.py
Modified: clippy/config.py
===================================================================
--- clippy/config.py 2010-06-11 21:39:52 UTC (rev 13)
+++ clippy/config.py 2010-06-11 21:40:13 UTC (rev 14)
@@ -9,7 +9,7 @@
class Config (object):
SYS_CONFIG_FILE = '/etc/clippy.cfg'
CONFIG_DIR = os.path.expanduser ('~/.clippy')
- CONFIG_FILE = os.path.join (CONFIG_DIR, 'clippy.cfg')
+ CONFIG_FILE = os.path.join (CONFIG_DIR, 'config')
USER_REPO_DIR = os.path.join (CONFIG_DIR, 'repositories')
Modified: clippy/ui/assistant/app.py
===================================================================
--- clippy/ui/assistant/app.py 2010-06-11 21:39:52 UTC (rev 13)
+++ clippy/ui/assistant/app.py 2010-06-11 21:40:13 UTC (rev 14)
@@ -48,6 +48,8 @@
self.skip_targets = False
self.skip_sources = False
self.skip_confirm = False
+
+ self.use_threads = True
# FIXME: option for swapping order of source and target pages
self.item_list_mode = 'both' # one of: src, tgt, both
@@ -108,6 +110,13 @@
default = False,
help = "skip download confirmation page")
+ oparser.add_option ("-u",
+ "--no-threads",
+ dest = "use_threads",
+ action = "store_false",
+ default = self.use_threads,
+ help = "don't thread networking")
+
# oparser.add_option ("-o",
# "--option",
# dest = "options",
@@ -130,6 +139,7 @@
self.item_list_mode = opts.item_list_mode
self.skip_confirm = opts.skip_confirm
+ self.use_threads = opts.use_threads
def read_config (self):
self.config.read_file (self.config.CONFIG_FILE, True)
Modified: clippy/ui/assistant/win_main.py
===================================================================
--- clippy/ui/assistant/win_main.py 2010-06-11 21:39:52 UTC (rev 13)
+++ clippy/ui/assistant/win_main.py 2010-06-11 21:40:13 UTC (rev 14)
@@ -6,6 +6,7 @@
import gtk
import pango
import string
+import sys
import thread
import time
@@ -284,7 +285,7 @@
def run_async (self, job_fns, idle_fn, end_fn):
- if True:
+ if app.use_threads:
jobs = [ worker.Job (job_fn) for job_fn in job_fns ]
[ worker.input.put (job) for job in jobs ]
gtk.idle_add (idle_fn, (jobs, end_fn))
@@ -325,9 +326,12 @@
print "Can't get source items:", e
+ self.throbber_phase = 0
+ self.throbber_time = 0
self.run_async ((lambda: app.repo_target.getItems (qry), lambda: app.repo_source.getItems (qry)), self.update_item_list_idle, self.update_item_list_end)
def update_item_list_end (self, results):
+ print
tree = self['tree_items']
items = []
model = self.model_items
@@ -378,7 +382,13 @@
tree.thaw_child_notify ()
def update_item_list_idle (self, data):
- print 'x',
+ pics = "|/-\\"
+ if time.time () - self.throbber_time >0.3:
+ print 3*pics[self.throbber_phase] + "\r",
+ self.throbber_phase = (self.throbber_phase + 1) % len (pics)
+ sys.stdout.flush()
+ self.throbber_time = time.time ()
+
jobs, end_fn = data
if jobs[0].is_done () and jobs[1].is_done ():
end_fn ([ job.result for job in jobs ])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|