def main(): parsed_args, workflow_cmdline_args = app.parse_known_args() hShell = app.main(parsed_args, workflow_cmdline_args) # in headless mode the headless shell is returned and its project manager still has an open project file hShell.closeCurrentProject()
def start_workflow_create_project_headless(self, workflow_class_tuple, temp_dir): """Tests project file creation via the command line Args: workflow_class_tuple (tuple): tuple returned from getAvailableWorkflows with (workflow_class, workflow_name, workflow_class.workflowDisplayName) """ workflow_class, workflow_name, display_name = workflow_class_tuple logger.debug(f"starting {workflow_name}") project_file = generate_project_file_name(temp_dir, workflow_name) args = [ "--headless", f"--new_project={project_file}", f"--workflow={workflow_name}" ] # Clear the existing commandline args so it looks like we're starting fresh. sys.argv = ["ilastik.py"] sys.argv.extend(args) # Start up the ilastik.py entry script as if we had launched it from the command line parsed_args, workflow_cmdline_args = app.parse_known_args() shell = app.main(parsed_args=parsed_args, workflow_cmdline_args=workflow_cmdline_args, init_logging=False) shell.closeCurrentProject() # now check if the project file has been created: assert os.path.exists( project_file ), f"Project File {project_file} creation not successful"
def test_133_pc_oc_loading(project_path: pathlib.Path): args = ["--headless", f"--project={project_path}"] # Clear the existing commandline args so it looks like we're starting fresh. sys.argv = ["ilastik.py"] sys.argv.extend(args) # Start up the ilastik.py entry script as if we had launched it from the command line parsed_args, workflow_cmdline_args = app.parse_known_args() shell = app.main(parsed_args=parsed_args, workflow_cmdline_args=workflow_cmdline_args, init_logging=False) shell.closeCurrentProject()
def main(): if "--clean_paths" in sys.argv: script_dir = pathlib.Path(__file__).parent ilastik_root = script_dir.parent.parent _clean_paths(ilastik_root) # Allow to start-up by double-clicking a project file. if len(sys.argv) == 2 and sys.argv[1].endswith(".ilp"): sys.argv.insert(1, "--project") arg_opts, env_vars = _parse_internal_config("internal-startup-options.cfg") sys.argv[1:1] = arg_opts os.environ.update(env_vars) from ilastik import app parsed_args, workflow_cmdline_args = app.parse_known_args() hShell = app.main(parsed_args, workflow_cmdline_args) # in headless mode the headless shell is returned and its project manager still has an open project file hShell.closeCurrentProject()