Browse code

Adding the minimal flavor is the default selection during the installation

Mahmoud Bassiouny authored on 2015/08/15 09:12:17
Showing 2 changed files
... ...
@@ -10,11 +10,11 @@ from action import Action
10 10
 from sets import Set
11 11
 
12 12
 class Menu(Action):
13
-    def __init__(self, starty, maxx, items, height = 0, selector_menu = False, can_navigate_outside = True, horizontal = False):
13
+    def __init__(self, starty, maxx, items, height = 0, selector_menu = False, can_navigate_outside = True, horizontal = False, default_selected = 0):
14 14
         self.can_navigate_outside = can_navigate_outside
15 15
         self.horizontal = horizontal
16 16
         self.horizontal_padding = 10
17
-        self.position = 0
17
+        self.position = default_selected
18 18
         self.head_position = 0  #This is the start of showing
19 19
         self.items = items
20 20
         self.items_strings = []
... ...
@@ -62,13 +62,19 @@ class PackageSelector(object):
62 62
         base_path = os.path.dirname(options_file)
63 63
         package_list = []
64 64
 
65
+        default_selected = 0
66
+        visible_options_cnt = 0
65 67
         for install_option in options_sorted:
66 68
             if install_option[1]["visible"] == True:
67 69
                 package_list = PackageSelector.get_packages_to_install(options_sorted, install_option[0], base_path)
68 70
                 additional_files = PackageSelector.get_additional_files_to_copy_in_iso(options_sorted, base_path, install_option[0])
69 71
                 self.package_menu_items.append((install_option[1]["title"], self.exit_function, [install_option[0], package_list, additional_files] ))
72
+                if install_option[0] == 'minimal':
73
+                    default_selected = visible_options_cnt
74
+                visible_options_cnt = visible_options_cnt + 1
70 75
 
71
-        self.package_menu = Menu(self.menu_starty,  self.maxx, self.package_menu_items)
76
+
77
+        self.package_menu = Menu(self.menu_starty,  self.maxx, self.package_menu_items, default_selected = default_selected)
72 78
 
73 79
     def exit_function(self,  selected_item_params):
74 80
         self.install_config['type'] = selected_item_params[0];