Commits

Rodrigo Bistolfi committed 360b31c

make render() optional

Comments (0)

Files changed (1)

vinstall/core/wizard.py

 
 import Queue
 import sys
+import unittest
 from inspect import isgeneratorfunction
+from concurrent import futures
 from .command import ProcessingFacade
 
 
         self.show()
 
     def show(self):
-        "Present the current controller to the user"
-        self.current_render = render = self.current_controller.render()
-        render.main_window.clear_callbacks()
-        render.update_main_window()
-        render.main_window.add_next_callback(self.next)
-        render.main_window.add_previous_callback(self.previous)
+        """Present the current controller to the user and setup callbacks for
+        running next. If optional render method is not present, call next()
+        ourselves.
+        
+        """
+        if hasattr(self.current_controller, "render"):
+            self.current_render = render = self.current_controller.render()
+            render.main_window.clear_callbacks()
+            render.update_main_window()
+            render.main_window.add_next_callback(self.next)
+            render.main_window.add_previous_callback(self.previous)
+        else:
+            self.next()
 
     def run_controller(self):
         "Execute tasks specified by the controller"
         process_method = getattr(self.current_controller, "process", None)
-        args = self.current_render.get_user_input()
+        if self.current_render is None:
+            args = tuple()
+        else:
+            args = self.current_render.get_user_input()
         if process_method:
             self.execute(process_method, args, {})
         command_method = getattr(self.current_controller, "command", None)
     def stop(self, *_):
         "Exit the wizard"
         self.current_render.main_window.stop()
+
+
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.