merge isy_dev with balloob/dev

This commit is contained in:
Ryan Kraus 2015-07-07 22:49:07 -04:00
commit d8d92e3ff7
13 changed files with 621 additions and 362 deletions

View File

@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """ """ DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "5fe3c81071fb3a771d93105eb9b911ed" VERSION = "1001fa37eccf171f7e364cf29a0d7fbb"

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,6 @@
"google-apis": "GoogleWebComponents/google-apis#0.8-preview", "google-apis": "GoogleWebComponents/google-apis#0.8-preview",
"moment": "^2.10.3", "moment": "^2.10.3",
"layout": "Polymer/layout", "layout": "Polymer/layout",
"color-picker-element": "~0.0.3",
"paper-styles": "polymerelements/paper-styles#^1.0.0", "paper-styles": "polymerelements/paper-styles#^1.0.0",
"lodash": "~3.9.3", "lodash": "~3.9.3",
"pikaday": "~1.3.2" "pikaday": "~1.3.2"

View File

@ -16,6 +16,10 @@
cursor: pointer; cursor: pointer;
overflow: hidden; overflow: hidden;
-ms-user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
} }
</style> </style>
@ -43,9 +47,8 @@
cardTapped: function(ev) { cardTapped: function(ev) {
ev.stopPropagation(); ev.stopPropagation();
this.debounce('show-more-info-dialog', function() { this.async(moreInfoActions.selectEntity.bind(
moreInfoActions.selectEntity(this.stateObj.entityId); this, this.stateObj.entityId), 100);
}.bind(this), 100);
}, },
}); });
})(); })();

View File

@ -0,0 +1,169 @@
<link rel='import' href='../bower_components/polymer/polymer.html'>
<dom-module id='ha-color-picker'>
<style>
canvas {
cursor: crosshair;
}
</style>
<template>
<canvas width='[[width]]' height='[[height]]'></canvas>
</template>
</dom-module>
<script>
/**
* Color-picker custom element
* Originally created by bbrewer97202 (Ben Brewer). MIT Licensed.
* https://github.com/bbrewer97202/color-picker-element
*
* Adapted to work with Polymer.
*/
(function() {
/**
* given red, green, blue values, return the equivalent hexidecimal value
* base source: http://stackoverflow.com/a/5624139
*/
var componentToHex = function(c) {
var hex = c.toString(16);
return hex.length === 1 ? "0" + hex : hex;
};
var rgbToHex = function(color) {
return "#" + componentToHex(color.r) + componentToHex(color.g) +
componentToHex(color.b);
};
Polymer({
is: 'ha-color-picker',
properties: {
width: {
type: Number,
value: 300,
},
height: {
type: Number,
value: 300,
},
color: {
type: Object,
},
},
listeners: {
'mousedown': 'onMouseDown',
'mouseup': 'onMouseUp',
'touchstart': 'onTouchStart',
'touchend': 'onTouchEnd',
'tap': 'onTap',
},
onMouseDown: function(e) {
this.onMouseMove(e);
this.addEventListener('mousemove', this.onMouseMove);
},
onMouseUp: function(e) {
this.removeEventListener('mousemove', this.onMouseMove);
},
onTouchStart: function(e) {
this.onTouchMove(e);
this.addEventListener('touchmove', this.onTouchMove);
},
onTouchEnd: function(e) {
this.removeEventListener('touchmove', this.onTouchMove);
},
onTap: function(e) {
e.stopPropagation();
},
onTouchMove: function(e) {
var touch = e.touches[0];
this.onColorSelect(e, {x: touch.clientX, y: touch.clientY});
},
onMouseMove: function(e) {
e.preventDefault();
if (this.mouseMoveIsThrottled) {
this.mouseMoveIsThrottled = false;
this.onColorSelect(e);
this.async(
function() { this.mouseMoveIsThrottled = true; }.bind(this), 100);
}
},
onColorSelect: function(e, coords) {
if (this.context) {
coords = coords || this.relativeMouseCoordinates(e);
var data = this.context.getImageData(coords.x, coords.y, 1, 1).data;
this.setColor({r: data[0], g: data[1], b: data[2]});
}
},
setColor: function(rgb) {
//save calculated color
this.color = {hex: rgbToHex(rgb), rgb: rgb};
this.fire('colorselected', {
rgb: this.color.rgb,
hex: this.color.hex
});
},
/**
* given a mouse click event, return x,y coordinates relative to the clicked target
* @returns object with x, y values
*/
relativeMouseCoordinates: function(e) {
var x = 0, y = 0;
if (this.canvas) {
var rect = this.canvas.getBoundingClientRect();
x = e.clientX - rect.left;
y = e.clientY - rect.top;
}
return {
x: x,
y: y
};
},
ready: function() {
this.setColor = this.setColor.bind(this);
this.mouseMoveIsThrottled = true;
this.canvas = this.children[0];
this.context = this.canvas.getContext('2d');
var colorGradient = this.context.createLinearGradient(0, 0, this.width, 0);
colorGradient.addColorStop(0, "rgb(255,0,0)");
colorGradient.addColorStop(0.16, "rgb(255,0,255)");
colorGradient.addColorStop(0.32, "rgb(0,0,255)");
colorGradient.addColorStop(0.48, "rgb(0,255,255)");
colorGradient.addColorStop(0.64, "rgb(0,255,0)");
colorGradient.addColorStop(0.80, "rgb(255,255,0)");
colorGradient.addColorStop(1, "rgb(255,0,0)");
this.context.fillStyle = colorGradient;
this.context.fillRect(0, 0, this.width, this.height);
var bwGradient = this.context.createLinearGradient(0, 0, 0, this.height);
bwGradient.addColorStop(0, "rgba(255,255,255,1)");
bwGradient.addColorStop(0.5, "rgba(255,255,255,0)");
bwGradient.addColorStop(0.5, "rgba(0,0,0,0)");
bwGradient.addColorStop(1, "rgba(0,0,0,1)");
this.context.fillStyle = bwGradient;
this.context.fillRect(0, 0, this.width, this.height);
},
});
})();
</script>

View File

@ -19,6 +19,12 @@ Too broken for now.
background: #fafafa; background: #fafafa;
box-shadow: 1px 0 1px rgba(0, 0, 0, 0.1); box-shadow: 1px 0 1px rgba(0, 0, 0, 0.1);
overflow: hidden; overflow: hidden;
white-space: nowrap;
-ms-user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
} }
/*.sidenav paper-menu { /*.sidenav paper-menu {

View File

@ -118,9 +118,11 @@
this.fetchHistoryData(); this.fetchHistoryData();
window.requestAnimationFrame(function() { // allow dialog to render content before showing it so it is
// positioned correctly.
this.async(function() {
this.dialogOpen = true; this.dialogOpen = true;
}.bind(this)); }.bind(this), 10);
}, },
dialogOpenChanged: function(newVal) { dialogOpenChanged: function(newVal) {

View File

@ -13,6 +13,10 @@
<dom-module id="login-form"> <dom-module id="login-form">
<style> <style>
:host {
white-space: nowrap;
}
#passwordDecorator { #passwordDecorator {
display: block; display: block;
height: 57px; height: 57px;
@ -128,9 +132,7 @@
isValidatingChanged: function(newVal) { isValidatingChanged: function(newVal) {
if (!newVal) { if (!newVal) {
this.debounce('focus-password', function() { this.async(function() { this.$.passwordInput.focus(); }.bind(this), 10);
this.$.passwordInput.focus();
}.bind(this), 1);
} }
}, },

View File

@ -6,6 +6,13 @@
<link rel='import' href='../bower_components/paper-icon-button/paper-icon-button.html'> <link rel='import' href='../bower_components/paper-icon-button/paper-icon-button.html'>
<dom-module id='partial-base'> <dom-module id='partial-base'>
<style>
:host {
-ms-user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
}
</style>
<template> <template>
<paper-scroll-header-panel class='fit'> <paper-scroll-header-panel class='fit'>
<paper-toolbar> <paper-toolbar>

View File

@ -89,10 +89,9 @@
isStaleChanged: function(newVal) { isStaleChanged: function(newVal) {
if (newVal) { if (newVal) {
// isLoading wouldn't update without debounce <_< // isLoading wouldn't update without async <_<
this.debounce('fetch-logbook-entries', function() { this.async(
logbookActions.fetchDate(this.selectedDate); function() { logbookActions.fetchDate(this.selectedDate); }, 10);
}, 0);
} }
}, },

View File

@ -1,7 +1,7 @@
<link rel='import' href='../bower_components/polymer/polymer.html'> <link rel='import' href='../bower_components/polymer/polymer.html'>
<link rel='import' href='../bower_components/paper-slider/paper-slider.html'> <link rel='import' href='../bower_components/paper-slider/paper-slider.html'>
<link rel='import' href='../bower_components/color-picker-element/dist/color-picker.html'> <link rel='import' href='../components/ha-color-picker.html'>
<dom-module id='more-info-light'> <dom-module id='more-info-light'>
<style> <style>
@ -13,7 +13,7 @@
transition: max-height .5s ease-in; transition: max-height .5s ease-in;
} }
color-picker { ha-color-picker {
display: block; display: block;
width: 350px; width: 350px;
margin: 0 auto; margin: 0 auto;
@ -27,7 +27,7 @@
max-height: 40px; max-height: 40px;
} }
.has-xy_color color-picker { .has-xy_color ha-color-picker {
max-height: 500px; max-height: 500px;
} }
</style> </style>
@ -41,7 +41,7 @@
</paper-slider> </paper-slider>
</div> </div>
<color-picker on-colorselected='colorPicked' width='350' height='200'> <ha-color-picker on-colorselected='colorPicked' width='350' height='200'>
</color-picker> </color-picker>
</div> </div>
</template> </template>
@ -73,7 +73,7 @@
this.brightnessSliderValue = newVal.attributes.brightness; this.brightnessSliderValue = newVal.attributes.brightness;
} }
this.debounce('more-info-light-animation-finish', function() { this.async(function() {
this.fire('iron-resize'); this.fire('iron-resize');
}.bind(this), 500); }.bind(this), 500);
}, },

View File

@ -127,7 +127,7 @@
}, },
stateObjChanged: function(newVal, oldVal) { stateObjChanged: function(newVal) {
if (newVal) { if (newVal) {
this.isOff = newVal.state == 'off'; this.isOff = newVal.state == 'off';
this.isPlaying = newVal.state == 'playing'; this.isPlaying = newVal.state == 'playing';
@ -142,9 +142,7 @@
this.supportsTurnOff = (newVal.attributes.supported_media_commands & 256) !== 0; this.supportsTurnOff = (newVal.attributes.supported_media_commands & 256) !== 0;
} }
this.debounce('more-info-volume-animation-finish', function() { this.async(function() { this.fire('iron-resize'); }.bind(this), 500);
this.fire('iron-resize');
}.bind(this), 500);
}, },
computeClassNames: function(stateObj) { computeClassNames: function(stateObj) {

View File

@ -153,8 +153,7 @@ class CastDevice(MediaPlayerDevice):
@property @property
def media_title(self): def media_title(self):
""" Title of current playing media. """ """ Title of current playing media. """
title = self.media_status.title if self.media_status else None return self.media_status.title if self.media_status else None
return title if title else self.cast.app_display_name
@property @property
def media_artist(self): def media_artist(self):