예제 #1
0
def aToolsOfflineInstall(offlineFilePath):

    mayaAppDir      = mel.eval('getenv MAYA_APP_DIR')    
    aToolsPath      = mayaAppDir + os.sep + 'scripts'
    aToolsFolder    = aToolsPath + os.sep + 'aTools' + os.sep
    tmpZipFile      = '%s%stmp.zip'%(aToolsPath, os.sep)
    offlineFileUrl  = r'file:///%s'%offlineFilePath
        
    if os.path.isfile(tmpZipFile):     os.remove(tmpZipFile)   
    if os.path.isdir(aToolsFolder): shutil.rmtree(aToolsFolder)      
    
    output = download(offlineFileUrl, tmpZipFile)    
    
    zfobj = zipfile.ZipFile(tmpZipFile)
    for name in zfobj.namelist():
        uncompressed = zfobj.read(name)
    
        filename  = formatPath('%s%s%s'%(aToolsPath, os.sep, name))        
        d         = os.path.dirname(filename)
        
        if not os.path.exists(d): os.makedirs(d)
        if filename.endswith(os.sep): continue
        
        output = open(filename,'wb')
        output.write(uncompressed)
        output.close()
        
    zfobj.close()
    if os.path.isfile(tmpZipFile):     os.remove(tmpZipFile)
    from aTools import setup; reload(setup); setup.install([offlineFilePath, False]) 
    cmds.evalDeferred(\"from aTools.animTools.animBar import animBarUI; reload(animBarUI); animBarUI.show(\'refresh\')\")     
예제 #2
0
    def uninstall(self, *args):
        message = "Are you sure you want to uninstall aTools?"
        confirm = cmds.confirmDialog(title='Confirm',
                                     message=message,
                                     button=['Yes', 'No'],
                                     defaultButton='No',
                                     cancelButton='No',
                                     dismissString='No')

        if confirm == 'Yes':

            from aTools.animTools.animBar import animBarUI
            reload(animBarUI)
            #aToolsPath          = aToolsMod.getaToolsPath(2)
            aToolsFolder = aToolsMod.getaToolsPath()

            #if aToolsPath in sys.path: sys.path.remove(aToolsPath)

            G.deferredManager.sendToQueue(G.aToolsBar.delWindows, 1,
                                          "uninstall_delWindows")
            G.deferredManager.sendToQueue(
                lambda *args: setup.install('', True), 1, "uninstall_install")

            #delete files
            if os.path.isdir(aToolsFolder): shutil.rmtree(aToolsFolder)

            cmds.warning(
                "Uninstall complete! If you want to install aTools in the future, go to %s."
                % SITE_URL)
예제 #3
0
    def updateaTools(self, downloadUrl, offline=None, *args):

        aToolsPath = aToolsMod.getaToolsPath(2)
        aToolsFolder = aToolsMod.getaToolsPath()
        oldaToolsFolder = "%saTools.old" % aToolsPath
        tmpZipFile = "%stmp.zip" % aToolsPath

        #delete temp
        if os.path.isfile(tmpZipFile): os.remove(tmpZipFile)
        if os.path.isdir(oldaToolsFolder): shutil.rmtree(oldaToolsFolder)

        output = utilMod.download("aToolsProgressBar", downloadUrl, tmpZipFile)

        if not output:
            cmds.warning("Atools - Update failed.")
            return

        #rename aTools to old
        if os.path.isdir(aToolsFolder):
            os.rename(aToolsFolder, oldaToolsFolder)
        #uncompress file
        zfobj = zipfile.ZipFile(tmpZipFile)
        for name in zfobj.namelist():
            uncompressed = zfobj.read(name)
            # save uncompressed data to disk
            filename = utilMod.formatPath("%s%s" % (aToolsPath, name))

            d = os.path.dirname(filename)

            if not os.path.exists(d): os.makedirs(d)
            if filename.endswith(os.sep): continue

            output = open(filename, 'wb')
            output.write(uncompressed)
            output.close()

        #delete temp
        zfobj.close()
        if os.path.isfile(tmpZipFile): os.remove(tmpZipFile)
        if os.path.isdir(oldaToolsFolder): shutil.rmtree(oldaToolsFolder)

        setup.install(offline=offline)

        #refresh
        G.GT_wasUpdated = True
        refreshATools()
예제 #4
0
    def updateaTools(self, downloadUrl, offline=None, *args):
        
        aToolsPath      = aToolsMod.getaToolsPath(2)
        aToolsFolder    = aToolsMod.getaToolsPath()
        oldaToolsFolder = "%saTools.old"%aToolsPath
        tmpZipFile      = "%stmp.zip"%aToolsPath    
            
        #delete temp
        if os.path.isfile(tmpZipFile):     os.remove(tmpZipFile)
        if os.path.isdir(oldaToolsFolder): shutil.rmtree(oldaToolsFolder)  
        
        output = utilMod.download("aToolsProgressBar", downloadUrl, tmpZipFile)
        
        if not output:
            cmds.warning("Atools - Update failed.")
            return
        
        #rename aTools to old
        if os.path.isdir(aToolsFolder): os.rename(aToolsFolder, oldaToolsFolder)
        #uncompress file
        zfobj = zipfile.ZipFile(tmpZipFile)
        for name in zfobj.namelist():
            uncompressed = zfobj.read(name)        
            # save uncompressed data to disk
            filename  = utilMod.formatPath("%s%s"%(aToolsPath, name))
            
            d         = os.path.dirname(filename)
            
            if not os.path.exists(d): os.makedirs(d)
            if filename.endswith(os.sep): continue
            
            output = open(filename,'wb')
            output.write(uncompressed)
            output.close()
            
        #delete temp
        zfobj.close()
        if os.path.isfile(tmpZipFile):     os.remove(tmpZipFile)
        if os.path.isdir(oldaToolsFolder): shutil.rmtree(oldaToolsFolder)
        
        setup.install(offline=offline)

        #refresh
        G.GT_wasUpdated = True
        refreshATools()
예제 #5
0
 def uninstall(self, *args):
     message = "Are you sure you want to uninstall aTools?"
     confirm = cmds.confirmDialog( title='Confirm', message=message, button=['Yes','No'], defaultButton='No', cancelButton='No', dismissString='No' )
 
     if confirm == 'Yes':      
     
         from aTools.animTools.animBar import animBarUI; reload(animBarUI)
         #aToolsPath          = aToolsMod.getaToolsPath(2) 
         aToolsFolder        = aToolsMod.getaToolsPath() 
          
         #if aToolsPath in sys.path: sys.path.remove(aToolsPath)
         
         G.deferredManager.sendToQueue(G.aToolsBar.delWindows, 1, "uninstall_delWindows") 
         G.deferredManager.sendToQueue(lambda *args:setup.install('', True), 1, "uninstall_install") 
          
         #delete files
         if os.path.isdir(aToolsFolder): shutil.rmtree(aToolsFolder)
         
         cmds.warning("Uninstall complete! If you want to install aTools in the future, go to %s."%SITE_URL)