示例#1
0
def set_project_env_variables(proj = None, *args):
	"""
	sets two environment variables: MAYA_CURRENT_PROJECT and MAYA_PROJ_PATH, which we'll use in doing some pipeline stuff
	ARGS:
		proj (string) - the shortcut for the project we're using. Currently only "frog" and "fit", which stand for OutOfBoxExperience and FitAndSetup

	"""
	if not proj:
		return()

	currProj = None
	projPath = None

	if proj in pg.projects.keys():
		currProj = proj
		projPath = pg.projects[proj]

	os.environ["MAYA_CURRENT_PROJECT"] = currProj
	os.environ["MAYA_PROJECT_PATH"] = projPath

	print "{0} is now the current project (MAYA_CURRENT_PROJECT env var)\n{1} is now the current project path (MAYA_PROJECT_PATH env var)".format(currProj, projPath)

	if cmds.window("setProjectWin", exists=True):
		cmds.deleteUI(widgets["win"])

	fm.fileManager()
示例#2
0
def finish_up(versionUp=True, origScene=None, *args):
    """
    do final clean up stuff
    ARGS:
        pp (PathParser object)
    """
    pp = uf.PathParser(origScene)

    if versionUp:        
        verNum = int(pp.path[-7:-3])
        pp.get_version_info()
        nums = pp.versionNumbers
        newNum = nums[-1]

        verUpFile = "{0}{1}{2}".format(origScene[:-7], str(newNum).zfill(4),".mb")

        if os.path.isfile(verUpFile):
            print "multiRefAnimExport.finish_up: Opening version up file:", verUpFile
            cmds.file(verUpFile, open=True, force=True)
        else:
            print "multiRefAnimExport.finish_up: Couldn't find version up, opening original file: ",pp.path
            cmds.file(pp.path, open=True, force=True)
    else:
        print "multiRefAnimExport.finish_up: Opening original file: ",pp.path 
        cmds.file(pp.path, open=True, force=True)
    
    if cmds.window("gameExporterWindow", exists=True):
        cmds.deleteUI("gameExporterWindow")
    # reload file win
    fm.fileManager()

    cmds.confirmDialog(m="Animation published successfully!", t="Stage Publish")
示例#3
0
def main():

    # If not Python 3, bail
    if sys.version_info <= (3, 0):
        sys.stderr.write("Sorry, mob-boss requires Python 3\n")
        sys.exit(1)

    # Setup an argparse instance
    parser = argparse.ArgumentParser(description="Suricata Rule Management")

    # The path to the configuration file
    parser.add_argument('-c', '--config', required=True)

    # Parse the args from the command line input
    args = parser.parse_args()

    # Create a config parser instance
    cp = configParser.configParser(args.config)

    # Initialize Objects
    fm = fileManager.fileManager()
    gm = gitManager.gitManager()
    rp = reporter.reporter(cp)
    rm = ruleManager.ruleManager(fm, gm, cp, rp)

    # Call Rule Manager for Build Process
    rm.build()
示例#4
0
def CreateInfrastructure(nameProduct):
    fileNameInf = nameProduct + "Infrastructure"
    FMInfrastructure = fileManager(fileNameInf, nameProduct)
    FMInfrastructure.javaClassGen()
    jsonFile = open('scratch.json')
    dataStore = json.load(jsonFile)
    FMInfrastructure.addInfrastructure(dataStore)
示例#5
0
def main():

	# If not Python 3, bail
	if sys.version_info <= (3, 0):
		sys.stderr.write("Sorry, mob-boss requires Python 3\n")
		sys.exit(1)

	# Setup an argparse instance
	parser = argparse.ArgumentParser(
		description = "Suricata Rule Management"
	)

	# The path to the configuration file
	parser.add_argument('-c', '--config', required=True)

	# Parse the args from the command line input
	args = parser.parse_args()
	
	# Create a config parser instance
	cp = configParser.configParser(args.config)

	# Initialize Objects
	fm = fileManager.fileManager()
	gm = gitManager.gitManager()
	rp = reporter.reporter(cp)
	rm = ruleManager.ruleManager(fm, gm, cp, rp)
	
	# Call Rule Manager for Build Process
	rm.build()
def testlistAll():
    session=fm.session_factory()
    um=fm.userManager()    
    usr=um.getUser('rdi',session)
    fman=fm.fileManager(usr,session)
    fman.listAll('/')
    fman.showDirTable()
def testgetfile():
    session=fm.session_factory()
    um=fm.userManager()    
    usr=um.getUser('rdi',session)
    fman=fm.fileManager(usr,session)    
    record= fman.get_file('/dirtoto/testtoto34.txt',content=True)
    print record
    print record.content
def testsavefile():
    session=fm.session_factory()
    um=fm.userManager()    
    usr=um.getUser('rdi',session)
    fman=fm.fileManager(usr,session) 
    toto='435804395843095430584305048358034'
    fman.save_file('/dirtoto/testfile34.txt',toto)
    fman.save_file('/dirtoto/testfile1.txt',toto)
    fman.save_file('/dirtoto/dirtotot4/testfile3.txt',toto)
def testcreateDir():
    session=fm.session_factory()
    um=fm.userManager()    
    usr=um.getUser('rdi',session)
    fman=fm.fileManager(usr,session)   
    fman.create_directory('/dirtoto')    
    fman.create_directory('/dirtoto/dirtotot2')
    fman.create_directory('/dirtoto/dirtotot4')
    fman.create_directory('/dirtotot3')
示例#10
0
def fileManager(*args):
    reload(fileMgr)
    fileMgr.fileManager()
示例#11
0
def CreatemainFile(nameProduct):
    FMName = nameProduct + "Example"
    FMMain = fileManager(FMName, nameProduct)
    FMMain.javaClassGen()
    FMMain.addMainFile()
示例#12
0
def CreateAppFile(nameProduct):
    fileNameApp = nameProduct + "Application"
    FMApplication = fileManager(fileNameApp, nameProduct)
    FMApplication.javaClassGen()
    FMApplication.addAplication("ligth")
示例#13
0
# Manegador de los datos que se van a ejectutar
from cliManager import cliManager
# Se agrega fileManager este es el archivo que se encargará del manejo de la db (Sus archivos)
from fileManager import fileManager
# Estructura de como se imprimen los archivos los datos a utilizar y visualizacion de los mismos
from printerClass import printerClass

from sqlListener import sqlListener

if __name__ is not None and "." in __name__:
    from .sqlParser import sqlParser
else:
    from sqlParser import sqlParser

# Se inicializan las clases a utilizar
dbFile = fileManager()
dataCM = cliManager()
dbPrint = printerClass()


class tokenizationClass(sqlListener):
    def __init__(self):
        pass

    # Se ejecutan las clases de SQL LISTENER SQL PARSER
    def exitR(self, ctx):
        print("Bienvenido, el ingreso de cualquier valor SQL ha sido validado")

    def getTokenValue(self, name):
        return name.getText()
def testdeletefile():
    session=fm.session_factory()
    um=fm.userManager()    
    usr=um.getUser('rdi',session)
    fman=fm.fileManager(usr,session) 
    fman.delete_file('/dirtoto/testfile34.txt')
def testremovedir():
    session=fm.session_factory()
    um=fm.userManager()    
    usr=um.getUser('rdi',session)
    fman=fm.fileManager(usr,session) 
    fman.delete_directory('/dirtoto/dirtotot4/')
示例#16
0
    logList = [str(time.time()), str(status), str(peerId), str(peerData)]
    logger.log(str(logList))


# -------------------------------------------------------------------------
Communicator = communicator.communicator(controlRouter, PEER_IP, PEER_PORT)


# -------------------------------------------------------------------------
Discoverer = discoverer.discoverer(
    PEER_IP, PEER_PORT, PEER_ID, discoveryHandler, '192.168.10.255')


# --------------------------------------------------------------------------
FileManager = fileManager.fileManager(FOLDER_PATH, Discoverer)

#---------------------------------------------------------------------------
FolderReceiver = fileTransporter.folderReceiver(
    FOLDER_PATH, Communicator, FileManager)

# ---------------------------------------------------------------------------
Controller = controller.controller(Communicator, Discoverer, FileManager, FolderReceiver)

# --------------------------------------------------------------------------
FileTransporter = fileTransporter.fileTransporter(
    Controller, FOLDER_PATH, Communicator, FileManager)


Communicator.run()
Discoverer.startDiscovery()
示例#17
0
def assetPublish(versionUp=True, *args):
    """
    checks the current scene if it's compatible, if not kick out
    ARGS:
        versionUp (bool): whether to version up the work file on publish
    """
    origScene = cmds.file(q=True, sn=True)
    print "-------ORIG SCENE line 414", origScene
    pp = uf.PathParser(origScene)

    # bail if current scene is not compatible
    if not pp.compatible:
        cmds.warning(
            "assetPublish.assetPublish: You're not in a project compatible scene! Sorry. See a TD"
        )
        return ()

    # if it's not a stage file or a publish file and it's either modeling or rigging phase
    if pp.assetType != "Stages" and pp.phase in [
            "Rigging", "Modeling", "Texturing", "Lighting"
    ] and pp.stage == "Work":
        mayapub = publish_maya_scene(versionUp, origScene)
        if not mayapub:  # i.e. we've failed somewhere in the func
            return ()
    else:
        print "===== not doing standard maya asset publish, since you're in {0} phase and {1} stage of the pipeline".format(
            pp.phase, pp.stage)

    # lets check if the fbx plugin is loaded
    uf.plugin_load("fbxmaya")

    # if it's modeling or texturing phase - fbx export
    if pp.assetType != "Stages" and pp.phase in ["Modeling", "Texturing"
                                                 ] and pp.stage == "Work":
        fbxPub = publish_fbx_model_file(versionUp, origScene)
        if not fbxPub:
            return ()

    # if it's a rig work file
    if pp.assetType != "Stages" and pp.phase in ["Rigging"
                                                 ] and pp.stage == "Work":
        fbxPub = publish_fbx_rig_file(versionUp, origScene)
        if not fbxPub:
            return ()

    # if it's an anm work file
    if pp.assetType != "Stages" and pp.phase in ["Animation"
                                                 ] and pp.stage == "Work":
        fbxPub = publish_fbx_anim_file(versionUp, origScene)
        if not fbxPub:
            return ()

    if versionUp:
        verNum = int(pp.path[-7:-3])
        pp.get_version_info()
        nums = pp.versionNumbers
        newNum = nums[-1]

        verUpFile = "{0}{1}{2}".format(origScene[:-7],
                                       str(newNum).zfill(4), ".mb")

        if os.path.isfile(verUpFile):
            print "assetPublish.assetPublish: Opening version up file:", verUpFile
            cmds.file(verUpFile, open=True, force=True)
        else:
            print "assetPublish.assetPublish: Couldn't find version up, opening original file: ", pp.path
            cmds.file(pp.path, open=True, force=True)
    else:
        print "assetPublish.assetPublish: Opening original file: ", pp.path
        cmds.file(pp.path, open=True, force=True)

    # close the game export window
    if cmds.window("gameExporterWindow", exists=True):
        cmds.deleteUI("gameExporterWindow")
    # reload file win
    fm.fileManager()

    cmds.confirmDialog(m="Asset Publish Sucessful!", t="AssetPublish")
    def save_file(self, *args):
        # assemble file name
        sel = []
        if self.selBased:
            sel = cmds.ls(sl=True)
            if not sel:
                cmds.warning(
                    "fileManager.save_as_new: You haven't selected anything! Make a selection and try again!"
                )
                return ()

        currscene = cmds.file(q=True, sn=True)
        if currscene:
            saveScene = cmds.confirmDialog(
                t="Save?",
                m="Should I save the current scene before writing new file?",
                button=["Yes", "No", "Cancel"],
                defaultButton="Yes",
                cancelButton="Cancel",
                dismissString="Cancel")
            if saveScene == "Yes":
                print "Saving current scene: {0}".format(currscene)
                cmds.file(s=True, f=True)
            elif saveScene == "No":
                pass
            elif saveScene == "Cancel":
                cmds.warning("Cancelling Save As New!")
                return ()
        else:
            pass
            # cmds.warning("You must be in a named scene to continue!")
            # return()

        filepath = None
        assettype = cmds.optionMenu(self.assetTypeOM, q=True, value=True)
        if assettype == "Stages":
            basepath = "{0}/Stages".format(self.projEnvPath)
        else:
            basepath = "{0}/Assets/3D/{1}".format(self.projEnvPath, assettype)

        asset = cmds.optionMenu(self.assetOM, q=True, value=True)
        variant = cmds.textFieldGrp(self.variant, q=True, tx=True)
        if not uf.check_for_good_name(variant):
            cmds.warning("No underscores allowed in variant names!")
            return ()
        phase = cmds.optionMenu(self.phaseOM, q=True, value=True)

        if assettype == "Stages":
            filepath = "{0}/{1}/{2}/Production/Maya/scenes/{3}_{4}_{5}_Work_v0001.mb".format(
                basepath, asset, phase, asset, variant, phase)
        else:
            filepath = "{0}/{1}/{2}/Work/Maya/scenes/{3}_{4}_{5}_Work_v0001.mb".format(
                basepath, asset, phase, asset, variant, phase)

        # confirm and save
        # export to temp, open that
        tempScene = None
        if self.selBased:
            tempScene = create_temp_scene(filepath)
            if tempScene:
                cmds.file(tempScene, open=True, f=True)
            else:
                return ()

        write = "Cancel"
        confirm = cmds.confirmDialog(
            title="Save Confirmation",
            message="You are about to 'version up':\n{0}\n\nShould we continue?"
            .format(filepath[:-9]),
            button=("Create", "Cancel"),
            defaultButton="Save",
            cancelButton="Cancel",
            dismissString="Cancel",
            bgc=(.6, .5, .5))
        if confirm == "Create":
            write == "Save"
            print "Saving. . .: ", filepath
        else:
            write == "Cancel"
            print "Canceling. . ."
            cmds.deleteUI(self.win)

        if write:
            ver = vf.versionClass()
            ver.versionUp(filepath)
            cmds.deleteUI(self.win)
            if tempScene and os.path.isfile(tempScene):
                print "saveNewWindows.save_file: Cleaning up temp scene {0}".format(
                    tempScene)
                os.remove(tempScene)
            cmds.confirmDialog(
                m="Save successful! You're now in file:\n{0}".format(
                    cmds.file(q=True, sn=True)))

        # Try to refresh the file manager window
        if cmds.window("fileWin", exists=True):
            fm.fileManager()
示例#19
0
import os
import subprocess
import fileManager
import time
import fileTransfer
import admin

FM = fileManager.fileManager()
FT = fileTransfer.fileTransfer()
AD = admin.admin()


class runner:
    def welcome():
        """Functions that automatically desplays hello that is generated in ASCii
		"""
        os.system('clear')
        print("            _________                               _____     ")
        print("|        | |            |           |             /       \   ")
        print("|        | |            |           |            /         \  ")
        print("|--------| | --------   |           |           |           | ")
        print("|        | |            |           |            \         / ")
        print("|        | |_________   |_________  |_________    \ _____ /  ")
        print("")
        print("-------------------------------------------------------------")
        print("")

    def mainMenu():
        """This is the function that creates deals with interaction with the user, It uses the functions from the other utilities file. (FileTransfer.py and FileManager.py)
		"""
        option = input(
def testrenamefile():
    session=fm.session_factory()
    um=fm.userManager()    
    usr=um.getUser('rdi',session)
    fman=fm.fileManager(usr,session)    
    fman.rename_file('/dirtoto/testfile3.txt','/dirtoto/testtoto34.txt')
def testrenamedirectory():
    session=fm.session_factory()
    um=fm.userManager()    
    usr=um.getUser('rdi',session)
    fman=fm.fileManager(usr,session)    
    fman.rename_directory('/dirtoto/','/dirtoto0/')
def reload_file_manager(*args):
    import fileManager as fm

    fm.fileManager()