def copyGraphicsToProject(root): log.printMessage("Copying graphics to project...") dummySmallLogo = "tile_30-30.png" dummyLogo = "tile_150-150.png" dummyWideLogo = "tile_310-150.png" storeLogo = "StoreLogo.scale-100.png" logo = "Logo.scale-100.png" smallLogo = "b_30x30.scale-100.png" wideLogo = "b_310x150.scale-100.png" splashScreen = "b_620x300.scale-100.png" graphicPath = graphics.getGraphicPath(rootdir,appName) if graphicPath == None: raise Exception("ERROR: Graphicpath not found.") destination = root+metadataPath+"/images" os.chdir(destination) source = os.listdir(destination) #Remove existing image in ../images folder graphicOperation(source, destination, "remove") os.chdir(graphicPath) source = os.listdir(graphicPath) #Copy graphics to ../images graphicOperation(source, destination, "copy") destination = root+metadataPath os.chdir(graphicPath) source = os.listdir(graphicPath) #Copy graphics to ../WindowsGenericReader/WindowsGenericReader graphicOperation(source, destination, "copy") os.chdir(root+metadataPath) #Rename all images to graphics added to project renamePng(graphics.wideLogo, wideLogo) renamePng(graphics.storeLogo, storeLogo) renamePng(graphics.smallLogo, smallLogo) renamePng(graphics.logo, logo) renamePng(graphics.splashScreen, splashScreen) os.chdir(graphicPath) #Copy graphics to ../WindowsGenericReader/WindowsGenericReader AGAIN for files in source: if files.endswith(".png") and ("image_30x30" in files or "image_150x150" in files or "image_310x150" in files): shutil.copy(files, destination) os.chdir(root+metadataPath) #Rename graphics to dummy tiles not used in project renamePng(graphics.smallLogo, dummySmallLogo) renamePng(graphics.logo, dummyLogo) renamePng(graphics.wideLogo, dummyWideLogo)
def copySplashScreenToProject(root): log.printMessage("Copying SplashScreenImage.jpg to to project...") splash = "SplashScreenImage.jpg" graphicPath = graphics.getGraphicPath(rootdir,appName) if graphicPath == None: raise Exception("ERROR: Graphicpath not found.") os.chdir(graphicPath) shutil.copy(graphics.splashScreenImage, root) os.chdir(root) if os.path.exists(splash): os.remove(splash) os.rename(graphics.splashScreenImage, splash)
def copyFromGraphicPath(root, prefix): graphicPath = graphics.getGraphicPath(rootdir, appName) screenshotPath = graphics.getScreenshotPath(root) screenshotPath += prefix if graphicPath is not None: os.chdir(root) if not os.path.exists(screenshotPath): log.printMessage("Creating empty screenshotfolder to contain the images...") os.makedirs(screenshotPath) shutil.copy(graphicPath+"/"+graphics.productImage, screenshotPath) shutil.copy(graphicPath+"/"+graphics.splashScreenImage, screenshotPath) addImages(screenshotPath) log.printMessage("Adding screenshots...") sleep(30) return True else: return False
from random import randint def renamePng(fromname, toname, appname): ran_num = randint(123456, 7891011) os.rename(fromname, str(ran_num)+"_"+toname) rootdir = os.path.dirname(os.path.realpath(__file__)) splashScreen = "b_620x300.scale-100.png" os.chdir(rootdir) appnames = file("appnames.txt") for appname in appnames: graphicPath = graphics.getGraphicPath(rootdir,appname) if graphicPath == None: raise Exception("ERROR: Graphicpath not found.") os.chdir(graphicPath) source = os.listdir(graphicPath) for files in source: if files.endswith(".png") and "620x300" in files: destination = r"C:\Users\dab_000.LENOVO-PC.000\Desktop\splashscreenW8" shutil.copy(files,destination) os.chdir(destination) renamePng(graphics.splashScreen, splashScreen, appname) """
def copyTilesToProject(root): log.printMessage("Copying tiles to project...") appIcon = "ApplicationIcon.png" smallTile = "FlipCycleTileSmall.png" medTile = "FlipCycleTileMedium.png" assetTilePath = root + "/Assets/Tiles" appIconPath = root + "/Assets" # OBS OBS - hurtige og dumme løsning - tilføjet d. 20/11-2014. forbiddenPath = root + "/Winnie/Assets/Tiles" graphicPath = graphics.getGraphicPath(rootdir,appName) if graphicPath == None: raise Exception("ERROR: Graphicpath not found.") os.chdir(graphicPath) source = os.listdir(graphicPath) for files in source: if files.endswith(".png") and not "99x99" in files: destination = assetTilePath shutil.copy(files,destination) if files.endswith(".png") and "99x99" in files: destination = appIconPath shutil.copy(files,destination) if files.endswith(".png") and "202x202" in files: destination = forbiddenPath shutil.copy(files,destination) os.chdir(appIconPath) if os.path.exists(appIcon): os.remove(appIcon) os.rename(graphics.appIcon, appIcon) else: os.rename(graphics.appIcon, appIcon) os.chdir(assetTilePath) if os.path.exists(smallTile): os.remove(smallTile) os.rename(graphics.smallTile, smallTile) else: os.rename(graphics.smallTile, smallTile) if os.path.exists(medTile): os.remove(medTile) os.rename(graphics.medTile, medTile) else: os.rename(graphics.medTile, medTile) # OBS OBS os.chdir(forbiddenPath) if os.path.exists(smallTile): os.remove(smallTile) os.rename(graphics.smallTile, smallTile) else: os.rename(graphics.smallTile, smallTile) os.chdir(graphicPath) source = os.listdir(graphicPath) for files in source: if files.endswith(".png"): destination = assetTilePath shutil.copy(files,destination)