Compare commits

1 Commits
Author SHA1 Message Date
Niels Ørgaard e6eb46966e small fixes
Due to GIT missing basic features I’m used to from SVN, there were (and
are) issues with the lifx-python integration.
2014-10-23 18:30:06 +02:00
3 changed files with 23 additions and 25 deletions

No files matched your search

+6 -9
View File
@@ -32,10 +32,6 @@ OTHER_FILES += qml/LightFish.qml \
qml/pages/lifx3/lifxconstants.py \
qml/pages/lifx3/lifx3.py \
lightfish_test_3.png \
qml/lifx3/lifxconstants.py \
qml/lifx3/packetcodec.py \
qml/lifx3/network.py \
qml/lifx3/listen.py \
qml/lightfish.py \
qml/pages/BulbDetails.qml \
qml/pages/storage.js \
@@ -46,11 +42,12 @@ OTHER_FILES += qml/LightFish.qml \
qml/images/logo_lifx_grey.png \
qml/perl/iwpriv_helper.pl \
qml/lifx3/lifx.py \
../lifx-python/lifx/packetcodec.py \
../lifx-python/lifx/network.py \
../lifx-python/lifx/listen.py \
../lifx-python/lifx/lifxconstants.py \
../lifx-python/lifx/lifx.py
qml/lifx/packetcodec.py \
qml/lifx/network.py \
qml/lifx/listen.py \
qml/lifx/lifxconstants.py \
qml/lifx/lifx.py \
qml/lifx/__init__.py
# to disable building translations every time, comment out the
# following CONFIG line
+2 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 2.8.2, 2014-10-23T15:53:29. -->
<!-- Written by QtCreator 2.8.2, 2014-10-23T17:31:38. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -55,7 +55,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">MerSDK-SailfishOS-armv7hl</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{3abb43b3-4d4a-433f-8714-aa5574cd8f40}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">2</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+15 -14
View File
@@ -9,8 +9,8 @@ import colorsys
import random
import lifx3
import lifx3.lifx
import lifx
#import lifx.lifx
BulbList = dict()
@@ -18,7 +18,7 @@ BulbListSelected = dict()
# Example how to fill a list model with data from Python.
def get_data():
lights = lifx3.lifx.get_lights()
lights = lifx.get_lights()
data = []
for bulb in lights:
data.append({'bulb_name': bulb.get_addr(), 'bulb_addr': bulb.get_addr()})
@@ -34,7 +34,7 @@ def get_data():
def get_bulbs(discovery = False):
if( (len(BulbList) < 1) or (discovery) ):
print("Getting bulbs from network")
lights = lifx3.lifx.get_lights()
lights = lifx.get_lights()
else:
print("Getting bulbs from memory")
lights = BulbList.values()
@@ -92,18 +92,18 @@ def get_selected_count():
def turn_on_all():
for addr in BulbListSelected:
#BulbListSelected[addr].set_power(1)
lifx3.lifx.set_power(addr, 1)
lifx3.lifx.pause(0.2)
lifx.set_power(addr, 1)
lifx.pause(0.2)
def turn_off_all():
for addr in BulbListSelected:
#BulbListSelected[addr].set_power(0)
lifx3.lifx.set_power(addr, 0)
lifx3.lifx.pause(0.2)
lifx.set_power(addr, 0)
lifx.pause(0.2)
def set_power(addr, power):
lifx3.lifx.set_power(addr, power)
lifx3.lifx.pause(0.2)
lifx.set_power(addr, power)
lifx.pause(0.2)
return 1
def set_color_rgbhex(colorstring):
@@ -149,8 +149,8 @@ def set_kelvin(kelvin):
def set_color():
for addr in BulbListSelected:
#BulbListSelected[addr].set_color( BulbListSelected[addr].hue, BulbListSelected[addr].saturation, BulbListSelected[addr].brightness, BulbListSelected[addr].kelvin, 300)
lifx3.lifx.set_color(addr, BulbListSelected[addr].hue, BulbListSelected[addr].saturation, BulbListSelected[addr].brightness, BulbListSelected[addr].kelvin, 500)
lifx3.lifx.pause(0.01) #0.2
lifx.set_color(addr, BulbListSelected[addr].hue, BulbListSelected[addr].saturation, BulbListSelected[addr].brightness, BulbListSelected[addr].kelvin, 500)
lifx.pause(0.01) #0.2
#def set_color_rgb(red, green, blue):
# hue = 0
@@ -230,14 +230,15 @@ class PartyThread(Thread):
brightness = (random.randint(0, 1)) * 65534 #Randomize brightness
#set_color(self, hue, saturation, brightness, kelvin, fade_time):
#BulbListSelected[addr].set_color( hue, 65535, brightness, 3500, 400)
lifx3.lifx.set_color(addr, hue, 65535, brightness, 3500, 400)
lifx.set_color(addr, hue, 65535, brightness, 3500, 400)
usleep(100) #sleep during 100ms
lifx3.lifx.pause(0.01)
lifx.pause(0.01)
#sys.stderr.write('party thread stopping')
partythread = PartyThread()
def party_start():
partythread.daemon = True #Need to run as daemonic thread, to ensure exit of program.
partythread.threadPartyRun = True #This is by no means proper - use semaphores
#print( "G:partythread.threadPartyRun: "+str(partythread.threadPartyRun))
#print( "G:killThreads: "+str(killThreads))