config.py 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # -*- coding: utf-8 -*-
  2. import os
  3. import platform
  4. from UI.util_funcs import FileExists,ArmSystem,ReadTheFileContent
  5. from pyaria2_rpc.pyaria2 import Xmlrpc
  6. CurKeySet = "GameShell" ## >>> PC or GameShell <<<
  7. DontLeave = False
  8. BackLight = "/proc/driver/backlight"
  9. Battery = "/sys/class/power_supply/axp20x-battery/uevent"
  10. FB_Modes = "/sys/class/graphics/fb0/modes"
  11. MPD_socket = "/tmp/mpd.socket"
  12. #UPDATE_URL="https://raw.githubusercontent.com/clockworkpi/CPI_DEOT/master/version.json"
  13. UPDATE_URL="https://raw.githubusercontent.com/hi80482/launcher_deot/master/version.json"
  14. VERSION="D.E.O.T. v2+ 200903"
  15. SKIN=None
  16. ButtonsLayout="snes"
  17. RPC = None
  18. ## three timer values in seconds: dim screen, close screen,PowerOff
  19. ## zero means no action
  20. PowerLevels = {}
  21. PowerLevels["supersaving"] = [10,30,120]
  22. PowerLevels["powersaving"] = [40,120,300]
  23. PowerLevels["server"] = [40,120,0]
  24. PowerLevels["balance_saving"] = [40,0,0]
  25. PowerLevel = "balance_saving"
  26. GlobalCanvas=None
  27. GlobalScale = 1
  28. def PreparationInAdv():
  29. global SKIN,ButtonsLayout,FB_Modes,GlobalScale
  30. global PowerLevel
  31. global RPC
  32. if SKIN != None:
  33. return
  34. SKIN= "../skin/DEOT"
  35. if FileExists("%s/.gameshell_skin" % os.path.expanduser('~')) == True:
  36. with open("%s/.gameshell_skin" % os.path.expanduser('~'),"r") as f:
  37. gameshell_skin = f.read()
  38. gameshell_skin = gameshell_skin.strip()
  39. SKIN= gameshell_skin
  40. if FileExists(".buttonslayout") == True:
  41. with open(".buttonslayout") as f:
  42. btnlayout = f.read()
  43. btnlayout = btnlayout.strip()
  44. ButtonsLayout = btnlayout
  45. if ButtonsLayout != "xbox" and ButtonsLayout != "snes":
  46. #ButtonsLayout = "xbox"
  47. ButtonsLayout = "snes"
  48. if FileExists(".powerlevel") == False:
  49. os.system("touch .powerlevel")
  50. with open(".powerlevel","r") as f:
  51. powerlevel = f.read()
  52. powerlevel = powerlevel.strip()
  53. if powerlevel != "":
  54. PowerLevel = powerlevel
  55. if powerlevel != "supersaving":
  56. ArmSystem("sudo iw wlan0 set power_save off >/dev/null")
  57. else:
  58. ArmSystem("sudo iw wlan0 set power_save on > /dev/null")
  59. else:
  60. ArmSystem("sudo iw wlan0 set power_save off >/dev/null")
  61. if FileExists(FB_Modes):
  62. modes = ReadTheFileContent(FB_Modes)
  63. if "320x240" in modes:
  64. GlobalScale = 1
  65. if "640x480" in modes:
  66. GlobalScale = 2
  67. if "480x640" in modes:
  68. GlobalScale = 2
  69. else:
  70. GlobalScale = 1
  71. RPC = Xmlrpc('localhost', 6800)
  72. PreparationInAdv()
  73. ##sys.py/.powerlevel