コード例 #1
0
ファイル: compile_images.py プロジェクト: PyTis/NSIS-Walker
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())
コード例 #2
0
def addIcon(pngName, pngFilename, iconPyFile, first):
    options = [
        '-F', '-i', '-c', '-a',
        '-n%s' % pngName, pngFilename, iconPyFile
    ]
    if first:
        options.remove('-a')
    img2py.main(options)
コード例 #3
0
def makeSplashScreen(iconPyFile):
    options = ['-F', '-c', '-a', '-nsplash', 'splash.png', iconPyFile]
    img2py.main(options)
コード例 #4
0
ファイル: convert_images.py プロジェクト: DDMAL/Gamera
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)
コード例 #5
0
def makeSplashScreen(iconPyFile):
    options = ['-F', '-c', '-a', '-nsplash', 'splash.png', iconPyFile]
    img2py.main(options)
コード例 #6
0
def addIcon(pngName, pngFilename, iconPyFile, first):
    options = ['-F', '-i', '-c', '-a', '-n%s'%pngName, pngFilename, iconPyFile]
    if first:
        options.remove('-a')
    img2py.main(options)
コード例 #7
0
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)