Commits

Anonymous committed 983cf08

Using progress in (open|close)_project()

Comments (0)

Files changed (2)

ropemacs/__init__.py

         root = lisputils.ask_directory('Rope project root folder: ')
         if self.project is not None:
             self.close_project()
-        base = 'Opening "%s" project ... ' % root
-        lisputils.message(base)
+        progress = lisputils.create_progress('Opening "%s" project' % root)
         self.project = project.Project(root)
-        lisputils.message(base + 'done')
+        progress.done()
 
     @interactive
     def close_project(self):
         if self.project is not None:
-            base = 'Closing "%s" project ... ' % self.project.address
-            lisputils.message(base)
+            progress = lisputils.create_progress('Closing "%s" project' %
+                                                 self.project.address)
             self.project.close()
             self.project = None
-            lisp.message(base + 'done')
+            progress.done()
 
     @interactive
     def undo_refactoring(self):

ropemacs/lisputils.py

 
     def __call__(self):
         handle = taskhandle.TaskHandle(name=self.name)
-        if _emacs_version() < 22:
-            progress = _OldProgress(self.name)
-        else:
-            progress = _LispProgress(self.name)
+        progress = create_progress(self.name)
         def update_progress():
             jobset = handle.current_jobset()
             if jobset:
         return calculate.result
 
 
+def create_progress(name):
+    if _emacs_version() < 22:
+        progress = _OldProgress(name)
+    else:
+        progress = _LispProgress(name)
+    return progress
+
+
 class _LispProgress(object):
 
     def __init__(self, name):
         self.update(0)
 
     def update(self, percent):
-        message('%s ... %s%%%%' % (self.name, percent))
+        if percent != 0:
+            message('%s ... %s%%%%' % (self.name, percent))
+        else:
+            message('%s ... ' % self.name)
 
     def done(self):
         message('%s ... done' % self.name)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.