My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

makeIco.py 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python3
  2. #
  3. # Make a DWIN .ico file from a directory of JPEG icon files.
  4. #
  5. # Copyright (c) 2020 Brent Burton
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. #----------------------------------------------------------------
  20. import os
  21. import os.path
  22. import argparse
  23. import DWIN_ICO
  24. version = '2.0.7'
  25. #----------------
  26. if __name__ == '__main__':
  27. try:
  28. parser = argparse.ArgumentParser(description='Make .ico from JPEG files')
  29. parser.add_argument('iconDir', type=str, nargs=1,
  30. help='name of directory containing icon JPGs')
  31. parser.add_argument('filename', type=str, nargs=1,
  32. help='name of new .ico file to create')
  33. args = parser.parse_args()
  34. filename = args.filename[0]
  35. iconDir = args.iconDir[0]
  36. if os.path.isfile(filename):
  37. raise RuntimeError("ICO file '%s' already exists." % (filename))
  38. if not os.path.exists(iconDir):
  39. raise RuntimeError("Icon directory '%s' doesn't exist." % (iconDir))
  40. print("Making .ico file '%s' from contents of '%s'" % (filename, iconDir))
  41. ico = DWIN_ICO.DWIN_ICO_File()
  42. ico.createFile(iconDir, filename)
  43. except Exception as e:
  44. print('Error: ', e)