def __init__(self, maxkey): super().__init__("Hue", maxkey) folder_lights = Folder("Lights", maxkey) folder_rooms = Folder("Rooms", maxkey) self.set_key(0, "Lights", "light.png", folder_lights) self.set_key(1, "Rooms", "room.png", folder_rooms) #parse json resonse to get ip #try: if True: ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE with urllib.request.urlopen("https://discovery.meethue.com/", context=ctx) as url: data = json.loads(url.read()) ip = "192.168.0.160" #data[0]['internalipaddress'] #TODO self.bridge = Bridge(ip) self.bridge.connect() i = 0 for light in self.bridge.lights: f = Hue_Light_Folder(light.name, maxkey, self.bridge, light) folder_lights.set_key(i, light.name, "light.png", f) i += 1 i = 0 for group in self.bridge.groups: f = Hue_Light_Folder(group.name, maxkey, self.bridge, group) folder_rooms.set_key(i, group.name, "room.png", f) i += 1
from Hue import Hue_Folder from Xournal import Xournal_Folder from OBS import OBS_Folder ICON_PATH = os.path.join(os.path.dirname(__file__), "icons") root = Folder("root", 32) folder_latex = LaTeX_Folder(32) folder_xournal = Xournal_Folder(32) folder_obs = OBS_Folder(32) folder_epson = Folder("Epson", 32) #folder_hue = Hue_Folder(32) root.set_key(0, "LaTeX", "latex.png", folder_latex) root.set_key(1, "Xournal", "xournal/xournal.png", folder_xournal) root.set_key(2, "OBS", "obs.png", folder_obs) root.set_key(3, "Epson", "epson.jpg", folder_epson) #root.set_key(4, "Hue", "hue.png", folder_hue) '''root.current_dir() root.key_pressed_callback(5) root.key_pressed_callback(6) root.key_pressed_callback(2) root.current_dir() root.key_pressed_callback(2) root.current_dir() root.key_pressed_callback(0) root.key_pressed_callback(1) root.key_pressed_callback(31) root.current_dir()