Ejemplo n.º 1
0
Archivo: menu.py Proyecto: Mikfr83/Luna
 def _delete_old(cls):
     if pm.menu(cls.MAIN_MENU_ID,
                label=cls.MAIN_MENU_ID,
                exists=1,
                parent=cls.MAIN_WINDOW):
         pm.deleteUI(pm.menu(cls.MAIN_MENU_ID, e=1, deleteAllItems=1))
         Logger.debug("Deleted existing {} object".format(cls.MAIN_MENU_ID))
Ejemplo n.º 2
0
    def get_config_path(cls):
        """Get path to config file. Copy a default one if one doesn't exist.

        Returns:
            str: Path to config file
        """
        if not os.path.isfile(cls.FILE_PATH):
            shutil.copy2(cls.DEFAULT_CONFIG_PATH, cls.FILE_PATH)
            Logger.debug("Default config copied to: {0}".format(cls.FILE_PATH))

        return cls.FILE_PATH
Ejemplo n.º 3
0
def copy_empty_scene(new_path):
    """Copy empty scenes from Luna's resource directory ot a given path. Scene version is based on current Maya version.

    Args:
        new_path (str): Full path to a new scene file location.

    Raises:
        IOError: If scene for selected maya version doesn't exist.
    """
    if os.path.isfile(new_path):
        return

    source_path = os.path.join(directories.EMPTY_SCENES_PATH,
                               "EmptyScene_Maya{0}.ma".format(pm.about(v=1)))
    Logger.debug("Copying file {0} to {1}".format(source_path, new_path))
    if not os.path.isfile(source_path):
        raise IOError
    try:
        shutil.copy2(source_path, new_path)
    except Exception:
        Logger.exception("Failed to copy scene {0}".format(source_path))
Ejemplo n.º 4
0
Archivo: menu.py Proyecto: Mikfr83/Luna
    from Luna import Config
    from Luna.static import directories
    from Luna.interface.commands import tool_cmds
    from Luna.interface.commands import help_cmds
    from Luna.utils import devFn
    from Luna.utils import fileFn
    from Luna import TestVars
except Exception as e:
    Logger.exception("Failed to import modules", exc_info=e)

if DEBUG_MODE:
    try:
        reload(tool_cmds)
        reload(help_cmds)
        reload(devFn)
        Logger.debug("Menu - reloaded command modules")
    except ImportError:
        Logger.exception("Failed to reload command modules")


def _null_command(*args):
    pass


class MenuUtil:
    @staticmethod
    def addMenuItem(parent=None,
                    label="",
                    command=_null_command,
                    icon="",
                    divider=False,
Ejemplo n.º 5
0
def set_project_var(value):
    environ.data["LUNA_PROJECT"] = value
    Logger.debug("LUNA_PROJECT: {0}".format(value))
Ejemplo n.º 6
0
def set_character_var(value):
    environ.data["LUNA_CHARACTER"] = value
    Logger.debug("LUNA_CHARACTER : {0}".format(value))
Ejemplo n.º 7
0
def set_asset_var(value):
    environ.data["LUNA_ASSET"] = value
    Logger.debug("LUNA_ASSET: {0}".format(value))
Ejemplo n.º 8
0
def open_docs(*args):
    Logger.debug("TODO: open Luna docs")
Ejemplo n.º 9
0
 def is_project(cls, path):
     search_file = os.path.join(path, cls.TAG_FILE)
     Logger.debug("isProject check ({0}) - {1}".format(
         os.path.isfile(search_file), path))
     return os.path.isfile(search_file)