Exemplo n.º 1
0
def reload_scripts():
    remove_all_scripts()
    if "CLTools" == identifiers.name:
        # this is the original package
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location):
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except:
                debug.critical("""Could not create CLTools directory. Make
 sure '%s' does not exist and parent directory is writable""" % location)
                sys.exit(1)
    else:
        # this is a standalone package so modules are placed in this directory
        location = os.path.dirname(__file__)
    
    for path in os.listdir(location):
        if path.endswith(SUFFIX):
            try:
                add_tool(os.path.join(location, path))
            except Exception as exc:
                import traceback
                debug.critical("Package CLTools failed to create module "
                   "from '%s': %s" % (os.path.join(location, path), exc),
                   traceback.format_exc())

    from vistrails.core.interpreter.cached import CachedInterpreter
    CachedInterpreter.clear_package(identifiers.identifier)

    from vistrails.gui.vistrails_window import _app
    _app.invalidate_pipelines()
Exemplo n.º 2
0
def reload_scripts(initial=False, name=None):
    reg = vistrails.core.modules.module_registry.get_module_registry()
    if not initial:
        from vistrails.core.interpreter.cached import CachedInterpreter
        CachedInterpreter.clear_package(identifiers.identifier)

        if name is None:
            remove_all_scripts()
        else:
            del cl_tools[name]
            reg.delete_module(identifiers.identifier, name)

    if "CLTools" == identifiers.name:
        # this is the original package
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location): # pragma: no cover # pragma: no branch
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except Exception, e:
                debug.critical("Could not create CLTools directory. Make "
                               "sure '%s' does not exist and parent directory "
                               "is writable" % location,
                               e)
                sys.exit(1)
Exemplo n.º 3
0
def reload_scripts(initial=False, name=None):
    reg = vistrails.core.modules.module_registry.get_module_registry()
    if not initial:
        from vistrails.core.interpreter.cached import CachedInterpreter
        CachedInterpreter.clear_package(identifiers.identifier)

        if name is None:
            remove_all_scripts()
        else:
            del cl_tools[name]
            reg.delete_module(identifiers.identifier, name)

    if "CLTools" == identifiers.name:
        # this is the original package
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location):  # pragma: no cover # pragma: no branch
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except Exception, e:
                debug.critical(
                    "Could not create CLTools directory. Make "
                    "sure '%s' does not exist and parent directory "
                    "is writable" % location, e)
                sys.exit(1)
Exemplo n.º 4
0
    def remove_package(self, codepath):
        """remove_package(name): Removes a package from the system."""
        pkg = self._package_list[codepath]

        from vistrails.core.interpreter.cached import CachedInterpreter
        CachedInterpreter.clear_package(pkg.identifier)

        self._dependency_graph.delete_vertex(pkg.identifier)
        del self._package_versions[pkg.identifier][pkg.version]
        if len(self._package_versions[pkg.identifier]) == 0:
            del self._package_versions[pkg.identifier]
        self.remove_old_identifiers(pkg.identifier)
        self.remove_menu_items(pkg)
        pkg.finalize()
        del self._package_list[codepath]
        self._registry.remove_package(pkg)
        app = get_vistrails_application()
        app.send_notification("package_removed", codepath)
Exemplo n.º 5
0
    def remove_package(self, codepath):
        """remove_package(name): Removes a package from the system."""
        pkg = self._package_list[codepath]

        from vistrails.core.interpreter.cached import CachedInterpreter
        CachedInterpreter.clear_package(pkg.identifier)

        self._dependency_graph.delete_vertex(pkg.identifier)
        del self._package_versions[pkg.identifier][pkg.version]
        if len(self._package_versions[pkg.identifier]) == 0:
            del self._package_versions[pkg.identifier]
        self.remove_old_identifiers(pkg.identifier)
        self.remove_menu_items(pkg)
        pkg.finalize()
        del self._package_list[codepath]
        self._registry.remove_package(pkg)
        app = get_vistrails_application()
        app.send_notification("package_removed", codepath)
Exemplo n.º 6
0
    if initial:
        reg = vistrails.core.modules.module_registry.get_module_registry()
        reg.add_module(CLTools, abstract=True)
    for path in os.listdir(location):
        if path.endswith(SUFFIX): # pragma: no branch
            try:
                add_tool(os.path.join(location, path))
            except Exception as exc: # pragma: no cover
                import traceback
                debug.critical("Package CLTools failed to create module "
                   "from '%s': %s" % (os.path.join(location, path), exc),
                   traceback.format_exc())

    if not initial:
        from vistrails.core.interpreter.cached import CachedInterpreter
        CachedInterpreter.clear_package(identifiers.identifier)

        from vistrails.gui.vistrails_window import _app
        _app.invalidate_pipelines()


wizards_list = []

def menu_items():
    """menu_items() -> tuple of (str,function)
    It returns a list of pairs containing text for the menu and a
    callback function that will be executed when that menu item is selected.
    
    """
    try:
        from wizard import QCLToolsWizardWindow
Exemplo n.º 7
0
        location = os.path.dirname(__file__)

    if initial:
        reg.add_module(CLTools, abstract=True)
    if name is None:
        for path in os.listdir(location):
            if path.endswith(SUFFIX):  # pragma: no branch
                add_tool(os.path.join(location, path))
    else:
        path = os.path.join(location, name + SUFFIX)
        if os.path.exists(path):
            add_tool(path)

    if not initial:
        from vistrails.core.interpreter.cached import CachedInterpreter
        CachedInterpreter.clear_package(identifiers.identifier)

        from vistrails.gui.vistrails_window import _app
        _app.invalidate_pipelines()


wizards_list = []


def menu_items():
    """menu_items() -> tuple of (str,function)
    It returns a list of pairs containing text for the menu and a
    callback function that will be executed when that menu item is selected.
    
    """
    try: