Skip to content

Commit df46b00

Browse files
committed
Change package name
1 parent abccff6 commit df46b00

21 files changed

Lines changed: 126 additions & 65 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ color.add_color(0xFF00)
3939
data = AnimationData()
4040
data.add_color(color)
4141

42-
sender.send_animation(data)
42+
sender.send_data(data)
4343
```
4444

4545
#### `AnimationData` type notes

animatedledstrip/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from .animation_data import AnimationData
2+
from .animation_sender import AnimationSender
3+
from .color_container import ColorContainer
4+
from .direction import Direction
5+
from .end_animation import EndAnimation
6+
from .global_vars import ANIMATION_DATA_PREFIX, ANIMATION_INFO_PREFIX, DELIMITER, \
7+
END_ANIMATION_PREFIX, SECTION_PREFIX, STRICT_TYPE_CHECKING, STRIP_INFO_PREFIX
8+
from .param_usage import ParamUsage
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# THE SOFTWARE.
2020

2121
import json
22-
from typing import List, Optional, AnyStr
22+
from typing import AnyStr, List, Optional
2323

2424
from .color_container import ColorContainer
2525
from .direction import *
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919
# THE SOFTWARE.
20+
2021
import logging
2122
import socket
2223
from threading import Thread
23-
from typing import Optional, Dict, AnyStr, Callable, Any, List
24+
from typing import Any, AnyStr, Callable, Dict, List, Optional
2425

2526
from .animation_data import AnimationData
2627
from .animation_info import AnimationInfo
@@ -78,7 +79,7 @@ def end(self) -> 'AnimationSender':
7879

7980
return self
8081

81-
def send_animation(self, animation_json: AnyStr) -> 'AnimationSender':
82+
def send_data(self, animation_json: AnyStr) -> 'AnimationSender':
8283
"""Send a new animation to the server"""
8384
json_bytes = bytearray(animation_json, 'utf-8')
8485
self.connection.sendall(json_bytes)
@@ -98,6 +99,9 @@ def parse_data(self):
9899
# they are split up with triple semicolons)
99100
# TODO: Support partial data
100101
for split_input in all_input.split(DELIMITER):
102+
if len(split_input) == 0:
103+
continue
104+
101105
if self.receiveCallback:
102106
self.receiveCallback(split_input)
103107

@@ -141,7 +145,7 @@ def parse_data(self):
141145
pass # TODO
142146

143147
else:
144-
logging.warning('Unrecognized data type: {}'.format(split_input[:4]))
148+
logging.warning('Unrecognized data type: {} ({})'.format(split_input[:4], split_input))
145149

146150
except socket.timeout:
147151
pass
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919
# THE SOFTWARE.
2020

21-
from led_client.utils import check_data_type
21+
from .utils import check_data_type
2222

2323

2424
class ColorContainer(object):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919
# THE SOFTWARE.
2020

21-
from enum import Enum, auto
21+
from enum import auto, Enum
2222

2323

2424
class Direction(Enum):
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import json
2222
from typing import AnyStr
2323

24-
from .global_vars import END_ANIMATION_PREFIX
2524
from .utils import check_data_type
2625

2726

animatedledstrip/param_usage.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2019-2020 AnimatedLEDStrip
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in
11+
# all copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
# THE SOFTWARE.
20+
21+
from enum import auto, Enum
22+
23+
24+
class ParamUsage(Enum):
25+
NOTUSED = auto()
26+
USED = auto()

0 commit comments

Comments
 (0)