Browse code

Make the load package list method static

Anish Swaminathan authored on 2015/07/14 05:57:04
Showing 2 changed files
... ...
@@ -30,13 +30,14 @@ class PackageSelector(object):
30 30
 
31 31
         self.window = Window(self.win_height, self.win_width, self.maxy, self.maxx, 'Select Installation', True, self.package_menu)
32 32
 
33
-    def get_packages_to_install(self, options, base_path, config_type):
33
+    @staticmethod
34
+    def get_packages_to_install(options, base_path, config_type):
34 35
         package_list = []
35 36
         for install_option in options:
36 37
             if install_option[0] == config_type:
37 38
                 if install_option[1]["include"] != "none":
38 39
                     for include_type in install_option[1]["include"].split(','):
39
-                        package_list = package_list + self.get_packages_to_install(options, base_path, include_type)
40
+                        package_list = package_list + PackageSelector.get_packages_to_install(options, base_path, include_type)
40 41
                 json_wrapper_package_list = JsonWrapper(os.path.join(base_path, install_option[1]["file"]))
41 42
                 package_list_json = json_wrapper_package_list.read()
42 43
                 package_list = package_list + package_list_json["packages"]
... ...
@@ -54,7 +55,7 @@ class PackageSelector(object):
54 54
 
55 55
         for install_option in options_sorted:
56 56
             if install_option[1]["visible"] == True:
57
-                package_list = self.get_packages_to_install(options_sorted, base_path, install_option[0])
57
+                package_list = PackageSelector.get_packages_to_install(options_sorted, base_path, install_option[0])
58 58
                 self.package_menu_items.append((install_option[1]["title"], self.exit_function, [install_option[0], package_list] ))
59 59
 
60 60
         self.package_menu = Menu(self.menu_starty,  self.maxx, self.package_menu_items)
... ...
@@ -161,7 +161,7 @@ if __name__ == '__main__':
161 161
                 package_list_json = json_wrapper_package_list.read()
162 162
                 packages = package_list_json["packages"]
163 163
     else:
164
-        packages = get_packages_to_install(options_sorted, base_path, config['type'])
164
+        packages = PackageSelector.get_packages_to_install(options_sorted, base_path, config['type'])
165 165
 
166 166
     config['packages'] = packages
167 167