def main(): output = '../src/util/images.py' doc = ''' ''' # get the list of PNG files files = glob.glob('*.png') # get the list of ICON files files.extend(glob.glob('*.bmp')) files.extend(glob.glob('*.ico')) files.extend(glob.glob('*.gif')) files.extend(glob.glob('*.jpg')) files.extend(glob.glob('*.jpeg')) files.sort() # Truncate the inages module handle = open(output, 'w') #handle.write(doc) # call img2py on each file for file in files: # extract the basename to be used as the image name name = os.path.splitext(os.path.basename(file))[0] # encode it if file == files[0]: cmd = "-u -i -n %s %s %s" % (name, file, output) else: cmd = "-a -u -i -n %s %s %s" % (name, file, output) img2py.main(cmd.split())
def addIcon(pngName, pngFilename, iconPyFile, first): options = [ '-F', '-i', '-c', '-a', '-n%s' % pngName, pngFilename, iconPyFile ] if first: options.remove('-a') img2py.main(options)
def makeSplashScreen(iconPyFile): options = ['-F', '-c', '-a', '-nsplash', 'splash.png', iconPyFile] img2py.main(options)
import wx if __name__ == "__main__": app = wx.App() files = glob.glob('*.png') first = 1 for x in files: # This converts filenames in the form of file_name.png # into names of the form FileName suitable for method # names in the gamera_icons module base_name = x.split('.')[0] names = base_name.split('_') name = '' for j in names: name += j[0].upper() + j[1:] args = [] # -a means append the image - only done after the first image if first == 0: args.append('-a') else: first = 0 # -n sets the name pattern for the methods to access # this particular image args.append('-n') args.append(name) args.append(x) args.append('../gui/gamera_icons.py') # run the script img2py.main(args)
def addIcon(pngName, pngFilename, iconPyFile, first): options = ['-F', '-i', '-c', '-a', '-n%s'%pngName, pngFilename, iconPyFile] if first: options.remove('-a') img2py.main(options)