@@ -138,7 +138,7 @@ def __setitem__(self, index, val):
138
138
else :
139
139
self ._set_pixels (index , val )
140
140
141
- if self ._pixels .auto_write :
141
+ if hasattr ( self . _pixels , "auto_write" ) and self ._pixels .auto_write :
142
142
self .show ()
143
143
144
144
def __getitem__ (self , index ):
@@ -161,12 +161,13 @@ def brightness(self):
161
161
"""
162
162
brightness from the underlying strip.
163
163
"""
164
- return self ._pixels .brightness
164
+ return self ._pixels .brightness if hasattr ( self . _pixels , "brightness" ) else 1.0
165
165
166
166
@brightness .setter
167
167
def brightness (self , brightness ):
168
- # pylint: disable=attribute-defined-outside-init
169
- self ._pixels .brightness = min (max (brightness , 0.0 ), 1.0 )
168
+ if hasattr (self ._pixels , "brightness" ):
169
+ # pylint: disable=attribute-defined-outside-init
170
+ self ._pixels .brightness = min (max (brightness , 0.0 ), 1.0 )
170
171
171
172
def fill (self , color ):
172
173
"""
@@ -182,18 +183,22 @@ def show(self):
182
183
"""
183
184
Shows the pixels on the underlying strip.
184
185
"""
185
- self ._pixels .show ()
186
+ if hasattr (self ._pixels , "show" ):
187
+ self ._pixels .show ()
188
+ elif hasattr (self ._pixels , "write" ):
189
+ self ._pixels .write ()
186
190
187
191
@property
188
192
def auto_write (self ):
189
193
"""
190
194
auto_write from the underlying strip.
191
195
"""
192
- return self ._pixels .auto_write
196
+ return hasattr ( self . _pixels , "auto_write" ) and self ._pixels .auto_write
193
197
194
198
@auto_write .setter
195
199
def auto_write (self , value ):
196
- self ._pixels .auto_write = value
200
+ if hasattr (self ._pixels , "auto_write" ):
201
+ self ._pixels .auto_write = value
197
202
198
203
@classmethod
199
204
def vertical_lines (cls , pixel_object , width , height , gridmap ):
0 commit comments