|
19 | 19 | xbmcgui.Dialog().ok(addonname, line1, line2 + line3) |
20 | 20 |
|
21 | 21 | try: |
22 | | - if "spidev" not in subprocess.check_output(['ls','/dev']): |
23 | | - xbmcgui.Dialog().ok(addonname, "We have detected that your system does not have spi enabled. You can still continue, but leds may not work if you're using GPIO/SPI connection."+ |
24 | | - " For USB connection you are safe to proceed") |
| 22 | + |
| 23 | + device_versions = [ HyperPyCon.HyperPyCon.ws2801 , HyperPyCon.HyperPyCon.adalight ] |
| 24 | + selected_device = xbmcgui.Dialog().select("Select your led device:",device_versions) |
| 25 | + if selected_device == 0: |
| 26 | + if "spidev" not in subprocess.check_output(['ls','/dev']): |
| 27 | + xbmcgui.Dialog().ok(addonname, "We have detected that your system does not have spi enabled. You can still continue, but leds may not work if you're using GPIO/SPI connection") |
25 | 28 |
|
26 | 29 | xbmcgui.Dialog().ok(addonname, "In next two steps please provovide number of leds at the top edge of tv (horizontally)" + |
27 | 30 | " and number of leds at the side of your tv (count leds at single side only) - horizontally") |
28 | 31 |
|
29 | | - nol_horizontal = xbmcgui.Dialog().input("Select number of leds horizontally","16",xbmcgui.INPUT_NUMERIC) |
30 | | - nol_vertical = xbmcgui.Dialog().input("Select number of leds vertically","9",xbmcgui.INPUT_NUMERIC) |
| 32 | + nol_horizontal = xbmcgui.Dialog().input("Select number of leds horizontally","29",xbmcgui.INPUT_NUMERIC) |
| 33 | + nol_vertical = xbmcgui.Dialog().input("Select number of leds vertically","16",xbmcgui.INPUT_NUMERIC) |
31 | 34 |
|
32 | 35 | hyperion_configuration = HyperPyCon.HyperPyCon(int(nol_horizontal), int(nol_vertical)) |
| 36 | + hyperion_configuration.set_device_type(device_versions[selected_device]) |
33 | 37 |
|
34 | | - options = ["Right bottom corner and goes up","Left bottom corner and goes up"] |
| 38 | + options = ["Right/bottom corner and goes up","Left/bottom corner and goes up","Center/bottom and goes right","Center/bottom and goes left"] |
35 | 39 | selected_index = xbmcgui.Dialog().select("Select where the led chain starts:",options) |
36 | 40 |
|
37 | | - if options[selected_index] == "Left bottom corner and goes up": |
| 41 | + if selected_index == 1: |
38 | 42 | hyperion_configuration.led_chain.reverse_direction() |
39 | 43 | hyperion_configuration.led_chain.set_offset(int(nol_horizontal)) |
| 44 | + elif selected_index == 2 or selected_index == 3: |
| 45 | + offset = xbmcgui.Dialog().input("How many leds from the center to the corner or the screen?","15",xbmcgui.INPUT_NUMERIC) |
| 46 | + if selected_index == 2: |
| 47 | + hyperion_configuration.led_chain.set_offset((-1)*int(offset)) |
| 48 | + else: |
| 49 | + hyperion_configuration.led_chain.reverse_direction() |
| 50 | + hyperion_configuration.led_chain.set_offset(int(offset)) |
40 | 51 |
|
41 | 52 | grabber = "" |
42 | 53 | lsusb_output = subprocess.check_output('lsusb') |
|
64 | 75 | else: |
65 | 76 | xbmcgui.Dialog().ok(addonname, "For the next 10 seconds you will see leds in 3 corners marked with different colors. Check if they are exactly in the corners."+ |
66 | 77 | " If not, start this wizard again and provide correct numbers of leds horizontally and vertically.") |
67 | | - hyperion_configuration.test_corners(10) |
| 78 | + #hyperion_configuration.test_corners(10) |
| 79 | + okno = xbmcgui.WindowDialog(xbmcgui.getCurrentWindowId()) |
| 80 | + #obrazek = xbmcgui.ControlImage(0,0,okno.getWidth(),okno.getHeight(),addon_dir+"/test_picture.png") |
| 81 | + obrazek = xbmcgui.ControlImage(0,0,1280,720,addon_dir+"/test_picture.png") |
| 82 | + okno.addControl(obrazek) |
| 83 | + okno.show() |
| 84 | + obrazek.setVisible(True) |
| 85 | + hyperion_configuration.show_test_image(addon_dir+"/test_picture.png") |
| 86 | + time.sleep(10) |
| 87 | + okno.close() |
| 88 | + hyperion_configuration.clear_leds() |
68 | 89 |
|
69 | 90 | if xbmcgui.Dialog().yesno(addonname, "Do you want us to save this config as your default one?","(if No, changes will be lost after hyperion/system restart)"): |
70 | 91 | hyperion_configuration.overwrite_default_config() |
|
0 commit comments