mktheme.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/python3
  2. # vcc/scripts/mktheme.py
  3. #
  4. # This file is part of vcc.
  5. #
  6. # vcc is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # vcc is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with vcc. If not, see <https://www.gnu.org/licenses/>
  18. import os
  19. import sys
  20. from random import choice
  21. random = False
  22. modes = {'def': 0, 'high': 1, 'under': 4, 'blink': 5}
  23. fgs = {'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, \
  24. 'magenta': 35, 'lightblue': 36, 'white': 37, 'gray': 90}
  25. bgs = {'black': 40, 'red': '41', 'green': 42, 'yellow': 43, 'blue': 44, \
  26. 'magenta': 45, 'lightblue': 46, 'white': 47, 'gray': 100}
  27. fd = open("{}/.vcc-theme".format(os.getenv("HOME")), "w")
  28. if len(sys.argv) == 2 and sys.argv[1] == '--random':
  29. random = True
  30. else:
  31. print("modes: ", modes)
  32. print("fgs: ", fgs)
  33. print("bgs: ", bgs)
  34. def put(s, n, d):
  35. fd.write("seti {s}_{n} = {d}\n".format(s=s, n=n, d=d))
  36. def get(s):
  37. l = {'mode': modes, 'fg': fgs, 'bg': bgs}
  38. for k, v in l.items():
  39. if random:
  40. put(s, k, choice(list(v.values())))
  41. continue
  42. while True:
  43. print("[%s] %s: " % (s, k), end='')
  44. try:
  45. n = input()
  46. put(s, k, v[n])
  47. break
  48. except KeyboardInterrupt:
  49. print('')
  50. continue
  51. except KeyError:
  52. if n == 'quit':
  53. exit(1)
  54. print("Invalid input. ")
  55. continue
  56. entries = ['usrname', 'sysusername', 'msg', 'sysmsg', 'sid', 'lvl', 'time', \
  57. 'relay', 'errmsg', 'helpcmd', 'helpmsg', 'cqd']
  58. for i in entries:
  59. get(i)