Exemplo n.º 1
0
def base(context, backup, massbackup, hash, rename, massrename, convert):
    '''Method to backup files from the baseflow project

    Args:
        context (object): Global context object
        backup (object): Make a copy of a picture in the backup flow
        massbackup (object): Make a copy of all pictures within the base flow and copy them to the backup flow
        rename (object): Rename a picture within the baseflow accordingly to it's shootname
        massrename (object): Rename all pictures within the baseflow accordingly to it's shootname
        convert (object): Convert a raw picture within the base flow to a jpg format and store it within the preview flow
    '''

    ctx = helper.Context(context)

    if backup:
        bs = baseflow.Base(ctx, backup[0])
        bs.Backup(backup[1])
    elif massbackup:
        bs = baseflow.Base(ctx, massbackup[0])
        bs.MassBackup()
    elif hash:
        bs = baseflow.Base(ctx, hash[0])
        bs.HashRename()
    elif rename:
        bs = baseflow.Base(ctx, rename[0])
        bs.Rename(rename[1], rename[2])
    elif massrename:
        bs = baseflow.Base(ctx, massrename[0])
        bs.MassRename()
    elif convert:
        bs = baseflow.Base(ctx, convert[0])
        bs.Convert(convert[1], convert[2])
Exemplo n.º 2
0
    def ShowConfig(self):
        '''Open the config location within an editor'''

        ctx = helper.Context(self.context)

        grd.Filesystem.PathExist(ctx.WorkspaceObj.location)
        os.system(f"start {ctx.WorkspaceObj.location}")
Exemplo n.º 3
0
def flow(context, completed, edited):
    ctx = helper.Context(context)

    fw = otherflow.Flow(ctx)
    if completed:
        fw.Completed()
    elif edited:
        fw.Edited()
Exemplo n.º 4
0
    def Create(self, index):
        '''Create a new workspace an initialize it with flows'''
        
        index = int(index)

        ctx = helper.Context(self.context)

        if not grd.Filesystem.IsPath(ctx.Config[index].Workspace):
            directory.CreateFolder(ctx.Config[index].Workspace)
        
        else:
            click.echo(f"Workspace {ctx.Config.Workspace} already exists")
Exemplo n.º 5
0
def shoot(context, new):
    '''Shoot option allows modification of a shoot within the workspace

    Args:
        context (object): Global context object
        new (object): Option to create a new shoot (<name> <date>) 
    '''

    ctx = helper.Context(context)

    if new:
        newShoot = f'{new[1]} {new[2]}'
        # Create a shoot object
        s = sht.Shoot(ctx, new[0], newShoot)
        # Creates the shoot
        s.Create()
Exemplo n.º 6
0
def workspace(context, create):
    '''Create a new workspace
    
    Args:
        context (object): Global context object
        create (object): Create a new workspace
    '''

    ctx = helper.Context(context)
    # Get the current working directory of where the script is executed
    cwd = os.getcwd()

    #Check whether the current working directory exists
    grd.Filesystem.PathExist(cwd)

    if create:
        ctx.WorkspaceObj.Create(create[0])
Exemplo n.º 7
0
def config(context, show, location, version):
    '''CLI command that handles the configuration file operations
    
    Args:
        context (object): Global context object
        view (object): Option that opens the configuration file
        location (object): Option that prints the configuration file location within the filesystem
    '''

    ctx = helper.Context(context)

    if show:
        ctx.WorkspaceObj.ShowConfig()
    elif location:
        ctx.WorkspaceObj.PrintConfig()
    elif version:
        ctx.WorkspaceObj.Version()
Exemplo n.º 8
0
    def PrintConfig(self):
        '''Print the configuration path location'''
        
        ctx = helper.Context(self.context)

        click.echo(ctx.WorkspaceObj.location)