def copy_system_gates(self):
     """Verify system ultrasonic gate plugins are copied to user's
     gates folder"""
     gate_plugins = ['predefined_gates.py', 'additional_gates.py', '__init__.py']
     self.remove_system_files(gate_plugins, pathfinder.gates_path())
     self.model.copy_system_gates()
     for gate in gate_plugins:
         installed_gate = os.path.join(pathfinder.gates_path(), gate)
         self.assertTrue(os.path.exists(installed_gate))
Beispiel #2
0
def load_gates():
    """Searches the plugins folder and imports all valid ultrasonic gate plugins,
    returning a list of the plugins successfully imported as tuples:
    first element is the plugin name (e.g. MyGate), second element is
    the class of the plugin."""
    return load_dynamic_modules(pathfinder.gates_path(),
                                abstractplugin.AbstractPlugin)
 def test_load_user_gate_functions(self):
     """Verify load_user_gate_functions returns the user's custom gate functions"""
     expected_gates = mainmodel.load_dynamic_modules(pathfinder.gates_path(), ultrasonicgate.UltrasonicGate)
     retrieved_gates = self.model.load_user_gate_functions()
     self.assertEqual(len(expected_gates), len(retrieved_gates))
     for idx in range(len(expected_gates)):
         self.assertEqual(expected_gates[idx][0], retrieved_gates[idx][0])
         self.assertTrue(issubclass(retrieved_gates[idx][1], ultrasonicgate.UltrasonicGate))
Beispiel #4
0
 def check_user_path(self):
     """Verify user data folders were created"""
     data_folders = [pathfinder.user_path(), pathfinder.data_path(),
                     pathfinder.thumbnails_path(), pathfinder.gates_path(),
                     pathfinder.plugins_path(), pathfinder.podmodels_path(),
                     pathfinder.colormaps_path(), pathfinder.batchoutput_path()]
     self.model.check_user_path()
     for folder in data_folders:
         self.assertTrue(os.path.exists(folder))
 def check_user_path(self):
     """Verify user data folders were created"""
     data_folders = [pathfinder.user_path(), pathfinder.data_path(),
                     pathfinder.thumbnails_path(), pathfinder.gates_path(),
                     pathfinder.plugins_path(), pathfinder.podmodels_path(),
                     pathfinder.adamodels_path(), pathfinder.colormaps_path(),
                     pathfinder.batchoutput_path()]
     self.model.check_user_path()
     for folder in data_folders:
         self.assertTrue(os.path.exists(folder))
Beispiel #6
0
 def test_load_user_gate_functions(self):
     """Verify load_user_gate_functions returns the user's custom gate functions"""
     expected_gates = mainmodel.load_dynamic_modules(
         pathfinder.gates_path(), ultrasonicgate.UltrasonicGate)
     retrieved_gates = self.model.load_user_gate_functions()
     self.assertEqual(len(expected_gates), len(retrieved_gates))
     for idx in range(len(expected_gates)):
         self.assertEqual(expected_gates[idx][0], retrieved_gates[idx][0])
         self.assertTrue(
             issubclass(retrieved_gates[idx][1],
                        ultrasonicgate.UltrasonicGate))
Beispiel #7
0
 def check_user_path(cls):
     """Verify that user data folders exist.  Creates
     any missing folders."""
     user_folder = pathfinder.user_path()
     data_folder = pathfinder.data_path()
     thumbnail_folder = pathfinder.thumbnails_path()
     plugins_folder = pathfinder.plugins_path()
     podmodels_folder = pathfinder.podmodels_path()
     adamodels_folder = pathfinder.adamodels_path()
     gates_folder = pathfinder.gates_path()
     colormaps_folder = pathfinder.colormaps_path()
     batch_folder = pathfinder.batchoutput_path()
     for fldr in (user_folder, data_folder, thumbnail_folder, plugins_folder, podmodels_folder, gates_folder,
         adamodels_folder, colormaps_folder, batch_folder):
         if not os.path.exists(fldr):
             os.makedirs(fldr)
Beispiel #8
0
 def check_user_path(cls):
     """Verify that user data folders exist.  Creates
     any missing folders."""
     user_folder = pathfinder.user_path()
     data_folder = pathfinder.data_path()
     thumbnail_folder = pathfinder.thumbnails_path()
     plugins_folder = pathfinder.plugins_path()
     podmodels_folder = pathfinder.podmodels_path()
     gates_folder = pathfinder.gates_path()
     colormaps_folder = pathfinder.colormaps_path()
     batch_folder = pathfinder.batchoutput_path()
     for fldr in (user_folder, data_folder, thumbnail_folder,
                  plugins_folder, podmodels_folder, gates_folder,
                  colormaps_folder, batch_folder):
         if not os.path.exists(fldr):
             os.makedirs(fldr)
 def load_user_gate_functions(self):
     """Retrieves the user-created ultrasonic gate functions and returns a list
     of tuples (gate_function_name, gate_function_class_instance)."""
     return mainmodel.load_dynamic_modules(pathfinder.gates_path(), ultrasonicgate.UltrasonicGate)
Beispiel #10
0
 def copy_system_gates(cls):
     """Copies ultrasonic gate plugins that ship with the application to the user's gates folder."""
     system_gates_folder = os.path.join(pathfinder.app_path(), 'gates')
     MainModel.copy_system_files(system_gates_folder, pathfinder.gates_path())
Beispiel #11
0
def load_gates():
    """Searches the plugins folder and imports all valid ultrasonic gate plugins,
    returning a list of the plugins successfully imported as tuples:
    first element is the plugin name (e.g. MyGate), second element is
    the class of the plugin."""
    return load_dynamic_modules(pathfinder.gates_path(), abstractplugin.AbstractPlugin)
Beispiel #12
0
 def test_gates_path(self):
     """Verify correct path to ultrasonic gates"""
     gates_path = os.path.join(self.user_path, "gates")
     self.assertEqual(gates_path, pathfinder.gates_path())
Beispiel #13
0
 def copy_system_gates(cls):
     """Copies ultrasonic gate plugins that ship with the application to the user's gates folder."""
     system_gates_folder = os.path.join(pathfinder.app_path(), 'gates')
     MainModel.copy_system_files(system_gates_folder,
                                 pathfinder.gates_path())
Beispiel #14
0
 def load_user_gate_functions(self):
     """Retrieves the user-created ultrasonic gate functions and returns a list
     of tuples (gate_function_name, gate_function_class_instance)."""
     return mainmodel.load_dynamic_modules(pathfinder.gates_path(),
                                           ultrasonicgate.UltrasonicGate)
 def test_gates_path(self):
     """Verify correct path to ultrasonic gates"""
     gates_path = os.path.join(self.user_path, "gates")
     self.assertEqual(gates_path, pathfinder.gates_path())