Skip to content

Commit d7dcab7

Browse files
author
Margaret Matocha
committed
updated examples camelCase to snake_case to match pylint requirements
1 parent ab90cc1 commit d7dcab7

File tree

3 files changed

+131
-125
lines changed

3 files changed

+131
-125
lines changed

examples/display_shapes_sparkline_simpletest.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,29 @@
9292
##########################################
9393

9494
# Baseline size of the sparkline chart, in pixels.
95-
chartWidth = display.width
96-
chartHeight = display.height
95+
chart_width = display.width
96+
chart_height = display.height
9797

98-
# mySparkline1 uses a vertical y range between 0 to 10 and will contain a
98+
# sparkline1 uses a vertical y range between 0 to 10 and will contain a
9999
# maximum of 40 items
100-
mySparkline1 = Sparkline(
101-
width=chartWidth, height=chartHeight, max_items=40, y_min=0, y_max=10, x=0, y=0
100+
sparkline1 = Sparkline(
101+
width=chart_width, height=chart_height, max_items=40, y_min=0, y_max=10, x=0, y=0
102102
)
103103

104104
# Create a group to hold the sparkline and append the sparkline into the
105-
# group (myGroup)
105+
# group (my_group)
106106
#
107107
# Note: In cases where display elements will overlap, then the order the elements
108108
# are added to the group will set which is on top. Latter elements are displayed
109109
# on top of former elemtns.
110-
myGroup = displayio.Group(max_size=1)
110+
my_group = displayio.Group(max_size=1)
111111

112-
# add the sparkline into myGroup
113-
myGroup.append(mySparkline1)
112+
# add the sparkline into my_group
113+
my_group.append(sparkline1)
114114

115115

116-
# Add myGroup (containing the sparkline) to the display
117-
display.show(myGroup)
116+
# Add my_group (containing the sparkline) to the display
117+
display.show(my_group)
118118

119119
# Start the main loop
120120
while True:
@@ -125,7 +125,7 @@
125125
# add_value: add a new value to a sparkline
126126
# Note: The y-range for mySparkline1 is set to 0 to 10, so all these random
127127
# values (between 0 and 10) will fit within the visible range of this sparkline
128-
mySparkline1.add_value(random.uniform(0, 10))
128+
sparkline1.add_value(random.uniform(0, 10))
129129

130130
# turn the display auto_refresh back on
131131
display.auto_refresh = True

examples/display_shapes_sparkline_ticks.py

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -92,88 +92,88 @@
9292
##########################################
9393

9494
# Baseline size of the sparkline chart, in pixels.
95-
chartWidth = display.width - 50
96-
chartHeight = display.height - 50
95+
chart_width = display.width - 50
96+
chart_height = display.height - 50
9797

9898
font = terminalio.FONT
9999

100-
lineColor = 0xFFFFFF
100+
line_color = 0xFFFFFF
101101

102102
# Setup the first bitmap and sparkline
103103
# This sparkline has no background bitmap
104104
# mySparkline1 uses a vertical y range between 0 to 10 and will contain a
105105
# maximum of 40 items
106-
mySparkline1 = Sparkline(
107-
width=chartWidth,
108-
height=chartHeight,
106+
sparkline1 = Sparkline(
107+
width=chart_width,
108+
height=chart_height,
109109
max_items=40,
110-
yMin=0,
111-
yMax=10,
110+
y_min=0,
111+
y_max=10,
112112
x=40,
113113
y=30,
114-
color=lineColor,
114+
color=line_color,
115115
)
116116

117117
# Label the y-axis range
118118

119-
textXOffset = -10
120-
textLabel1a = label.Label(
121-
font=font, text=str(mySparkline1.yTop), color=lineColor
119+
text_xoffset = -10
120+
text_label1a = label.Label(
121+
font=font, text=str(sparkline1.y_top), color=line_color
122122
) # yTop label
123-
textLabel1a.anchor_point = (1, 0.5) # set the anchorpoint at right-center
124-
textLabel1a.anchored_position = (
125-
mySparkline1.x + textXOffset,
126-
mySparkline1.y,
123+
text_label1a.anchor_point = (1, 0.5) # set the anchorpoint at right-center
124+
text_label1a.anchored_position = (
125+
sparkline1.x + text_xoffset,
126+
sparkline1.y,
127127
) # set the text anchored position to the upper right of the graph
128128

129-
textLabel1b = label.Label(
130-
font=font, text=str(mySparkline1.yBottom), color=lineColor
129+
text_label1b = label.Label(
130+
font=font, text=str(sparkline1.y_bottom), color=line_color
131131
) # yTop label
132-
textLabel1b.anchor_point = (1, 0.5) # set the anchorpoint at right-center
133-
textLabel1b.anchored_position = (
134-
mySparkline1.x + textXOffset,
135-
mySparkline1.y + chartHeight,
132+
text_label1b.anchor_point = (1, 0.5) # set the anchorpoint at right-center
133+
text_label1b.anchored_position = (
134+
sparkline1.x + text_xoffset,
135+
sparkline1.y + chart_height,
136136
) # set the text anchored position to the upper right of the graph
137137

138138

139-
boundingRectangle = Rect(
140-
mySparkline1.x, mySparkline1.y, chartWidth + 1, chartHeight + 1, outline=lineColor
139+
bounding_rectangle = Rect(
140+
sparkline1.x, sparkline1.y, chart_width + 1, chart_height + 1, outline=line_color
141141
)
142142

143143

144144
# Create a group to hold the sparkline, text, rectangle and tickmarks
145-
# append them into the group (myGroup)
145+
# append them into the group (my_group)
146146
#
147147
# Note: In cases where display elements will overlap, then the order the
148148
# elements are added to the group will set which is on top. Latter elements
149149
# are displayed on top of former elemtns.
150150

151-
myGroup = displayio.Group(max_size=20)
151+
my_group = displayio.Group(max_size=20)
152152

153-
myGroup.append(mySparkline1)
154-
myGroup.append(textLabel1a)
155-
myGroup.append(textLabel1b)
156-
myGroup.append(boundingRectangle)
153+
my_group.append(sparkline1)
154+
my_group.append(text_label1a)
155+
my_group.append(text_label1b)
156+
my_group.append(bounding_rectangle)
157157

158-
totalTicks = 10
158+
total_ticks = 10
159159

160-
for i in range(totalTicks + 1):
161-
xStart = mySparkline1.x - 5
162-
xEnd = mySparkline1.x
163-
yBoth = mySparkline1.y + i * int(round(chartHeight / (totalTicks)))
164-
myGroup.append(Line(xStart, yBoth, xEnd, yBoth, color=lineColor))
165-
myGroup.append(
160+
for i in range(total_ticks + 1):
161+
x_start = sparkline1.x - 5
162+
x_end = sparkline1.x
163+
y_both = sparkline1.y + i * int(round(chart_height / (total_ticks)))
164+
my_group.append(Line(x_start, y_both, x_end, y_both, color=line_color))
165+
my_group.append(
166166
Line(
167-
xStart,
168-
mySparkline1.y + chartHeight,
169-
xEnd,
170-
mySparkline1.y + chartHeight,
171-
color=lineColor,
167+
x_start,
168+
sparkline1.y + chart_height,
169+
x_end,
170+
sparkline1.y + chart_height,
171+
color=line_color,
172172
)
173173
)
174174

175-
# Set the display to show myGroup that contains the sparkline and other graphics
176-
display.show(myGroup)
175+
# Set the display to show my_group that contains the sparkline and other graphics
176+
display.show(my_group)
177177

178178
# Start the main loop
179179
while True:
@@ -185,7 +185,7 @@
185185
# add_value: add a new value to a sparkline
186186
# Note: The y-range for mySparkline1 is set to 0 to 10, so all these random
187187
# values (between 0 and 10) will fit within the visible range of this sparkline
188-
mySparkline1.add_value(random.uniform(0, 10))
188+
sparkline1.add_value(random.uniform(0, 10))
189189

190190
# Turn on auto_refresh for the display
191191
display.auto_refresh = True

0 commit comments

Comments
 (0)