Skip to content

Commit d6bd9e7

Browse files
committed
Flake8 cleanup
1 parent 2571735 commit d6bd9e7

20 files changed

+169
-262
lines changed

printrun/calibrateextruder.py calibrateextruder.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
1616

17-
#Interactive RepRap e axis calibration program
18-
#(C) Nathan Zadoks 2011
17+
# Interactive RepRap e axis calibration program
18+
# (C) Nathan Zadoks 2011
1919

2020
s = 300 # Extrusion speed (mm/min)
2121
n = 100 # Default length to extrude
@@ -95,7 +95,7 @@ def gettemp(p):
9595
if not os.path.exists(port):
9696
port = 0
9797

98-
#Parse options
98+
# Parse options
9999
help = u"""
100100
%s [ -l DISTANCE ] [ -s STEPS ] [ -t TEMP ] [ -p PORT ]
101101
-l --length Length of filament to extrude for each calibration step (default: %d mm)
@@ -126,7 +126,7 @@ def gettemp(p):
126126
elif o in ('-p', '--port'):
127127
port = a
128128

129-
#Show initial parameters
129+
# Show initial parameters
130130
print "Initial parameters"
131131
print "Steps per mm: %3d steps" % k
132132
print "Length extruded: %3d mm" % n
@@ -135,7 +135,7 @@ def gettemp(p):
135135

136136
p = None
137137
try:
138-
#Connect to printer
138+
# Connect to printer
139139
w("Connecting to printer..")
140140
try:
141141
p = printcore(port, 115200)
@@ -149,7 +149,7 @@ def gettemp(p):
149149

150150
heatup(p, temp)
151151

152-
#Calibration loop
152+
# Calibration loop
153153
while n != m:
154154
heatup(p, temp, True)
155155
p.send_now("G92 E0") # Reset e axis

printrun/bmpDisplay.py

-91
This file was deleted.

printrun/gcoder.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def _preprocess(self, lines = None, build_layers = False,
271271
cur_layer_has_extrusion = False
272272

273273
for line in lines:
274-
## Parse line
274+
# # Parse line
275275
split_raw = split(line)
276276
if line.command:
277277
# Update properties
@@ -342,7 +342,7 @@ def _preprocess(self, lines = None, build_layers = False,
342342
line.current_y = current_y
343343
line.current_z = current_z
344344

345-
## Process extrusion
345+
# # Process extrusion
346346
if line.e is not None:
347347
if line.is_move:
348348
if line.relative_e:
@@ -358,7 +358,7 @@ def _preprocess(self, lines = None, build_layers = False,
358358
elif line.command == "G92":
359359
offset_e = current_e - line.e
360360

361-
## Create layers
361+
# # Create layers
362362
if not build_layers:
363363
continue
364364
# FIXME : looks like this needs to be tested with "lift Z on move"
@@ -413,7 +413,7 @@ def _preprocess(self, lines = None, build_layers = False,
413413
line_idxs.append(layer_line)
414414
layer_line += 1
415415
prev_z = cur_z
416-
### Loop done
416+
# ## Loop done
417417

418418
# Store current status
419419
self.imperial = imperial
@@ -494,7 +494,7 @@ def estimate_duration(self):
494494
totalduration = 0.0
495495
acceleration = 2000.0 # mm/s^2
496496
layerbeginduration = 0.0
497-
#TODO:
497+
# TODO:
498498
# get device caps from firmware: max speed, acceleration/axis
499499
# (including extruder)
500500
# calculate the maximum move duration accounting for above ;)

printrun/gcview.py

-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222
from .gl.panel import wxGLPanel
2323
from .gl.trackball import build_rotmatrix
2424
from .gl.libtatlin import actors
25-
from .gl.libtatlin.actors import vec
2625

2726
from pyglet.gl import glPushMatrix, glPopMatrix, \
2827
glTranslatef, glRotatef, glScalef, glMultMatrixd
29-
from pyglet.gl import *
3028

3129
from .gviz import GvizBaseFrame
3230

printrun/gui/bufferedcanvas.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def disable_event(*pargs, **kwargs):
7373
pass # the sauce, please
7474
self.Bind(wx.EVT_ERASE_BACKGROUND, disable_event)
7575

76-
##
77-
## General methods
78-
##
76+
#
77+
# General methods
78+
#
7979

8080
def draw(self, dc, w, h):
8181
"""
@@ -97,9 +97,9 @@ def getWidthHeight(self):
9797
height = 1
9898
return (width, height)
9999

100-
##
101-
## Event handlers
102-
##
100+
#
101+
# Event handlers
102+
#
103103

104104
def onPaint(self, event):
105105
# Blit the front buffer to the screen

printrun/gui/controls.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def add(name, widget, *args, **kwargs):
123123
container = self
124124
container.Add(widget, *args, **kwargs)
125125

126-
## Hotend & bed temperatures
126+
# Hotend & bed temperatures #
127127

128128
# Hotend temp
129129
add("htemp_label", wx.StaticText(parentpanel, -1, _("Heat:")), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
@@ -168,8 +168,8 @@ def add(name, widget, *args, **kwargs):
168168
root.btemp.SetValue(str(root.settings.last_bed_temperature))
169169
root.htemp.SetValue(str(root.settings.last_temperature))
170170

171-
## added for an error where only the bed would get (pla) or (abs).
172-
#This ensures, if last temp is a default pla or abs, it will be marked so.
171+
# added for an error where only the bed would get (pla) or (abs).
172+
# This ensures, if last temp is a default pla or abs, it will be marked so.
173173
# if it is not, then a (user) remark is added. This denotes a manual entry
174174

175175
for i in btemp_choices:
@@ -184,7 +184,7 @@ def add(name, widget, *args, **kwargs):
184184
if '(' not in root.htemp.Value:
185185
root.htemp.SetValue(root.htemp.Value + ' (user)')
186186

187-
## Speed control
187+
# Speed control #
188188
speedpanel = root.newPanel(parentpanel)
189189
speedsizer = wx.BoxSizer(wx.HORIZONTAL)
190190
speedsizer.Add(wx.StaticText(speedpanel, -1, _("Print speed:")), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
@@ -210,7 +210,7 @@ def speedslider_scroll(event):
210210
root.speed_label.SetLabel(_("%d%%") % value)
211211
root.speed_slider.Bind(wx.EVT_SCROLL, speedslider_scroll)
212212

213-
## Temperature gauges
213+
# Temperature gauges #
214214

215215
if root.display_gauges:
216216
root.hottgauge = TempGauge(parentpanel, size = (-1, 24), title = _("Heater:"), maxval = 300, bgcolor = root.bgcolor)
@@ -234,7 +234,7 @@ def bedgauge_scroll_setpoint(e):
234234
root.hottgauge.Bind(wx.EVT_MOUSEWHEEL, hotendgauge_scroll_setpoint)
235235
root.bedtgauge.Bind(wx.EVT_MOUSEWHEEL, bedgauge_scroll_setpoint)
236236

237-
## Temperature (M105) feedback display
237+
# Temperature (M105) feedback display #
238238
root.tempdisp = wx.StaticText(parentpanel, -1, "", style = wx.ST_NO_AUTORESIZE)
239239

240240
def on_tempdisp_size(evt):
@@ -248,14 +248,14 @@ def tempdisp_setlabel(label):
248248
root.tempdisp.SetLabel = tempdisp_setlabel
249249
add("tempdisp", root.tempdisp, flag = wx.EXPAND)
250250

251-
## Temperature graph
251+
# Temperature graph #
252252

253253
if root.display_graph:
254254
root.graph = Graph(parentpanel, wx.ID_ANY, root)
255255
add("tempgraph", root.graph, flag = wx.EXPAND | wx.ALL, border = 5)
256256
root.graph.Bind(wx.EVT_LEFT_DOWN, root.graph.show_graph_window)
257257

258-
## Extrusion controls
258+
# Extrusion controls #
259259

260260
# Extrusion settings
261261
esettingspanel = root.newPanel(parentpanel)

printrun/gui/graph.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def __init__(self, parent, id, root, pos = wx.DefaultPosition,
6767
if self.rescaley:
6868
self._ybounds = Graph._YBounds(self)
6969

70-
#If rescaley is set then ybars gives merely an estimate
71-
#Note that "bars" actually indicate the number of internal+external gridlines.
70+
# If rescaley is set then ybars gives merely an estimate
71+
# Note that "bars" actually indicate the number of internal+external gridlines.
7272
self.ybars = 5
7373
self.xbars = 7 # One bar per 10 second
7474
self.xsteps = 60 # Covering 1 minute in the graph
@@ -99,22 +99,22 @@ def updateTemperatures(self, event):
9999
self.Refresh()
100100

101101
def drawgrid(self, dc, gc):
102-
#cold, medium, hot = wx.Colour(0, 167, 223),\
103-
# wx.Colour(239, 233, 119),\
104-
# wx.Colour(210, 50.100)
105-
#col1 = wx.Colour(255, 0, 0, 255)
106-
#col2 = wx.Colour(255, 255, 255, 128)
102+
# cold, medium, hot = wx.Colour(0, 167, 223),\
103+
# wx.Colour(239, 233, 119),\
104+
# wx.Colour(210, 50.100)
105+
# col1 = wx.Colour(255, 0, 0, 255)
106+
# col2 = wx.Colour(255, 255, 255, 128)
107107

108-
#b = gc.CreateLinearGradientBrush(0, 0, w, h, col1, col2)
108+
# b = gc.CreateLinearGradientBrush(0, 0, w, h, col1, col2)
109109

110110
gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
111111

112-
#gc.SetBrush(wx.Brush(wx.Colour(245, 245, 255, 52)))
112+
# gc.SetBrush(wx.Brush(wx.Colour(245, 245, 255, 52)))
113113

114-
#gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(0, 0, 0, 255))))
114+
# gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(0, 0, 0, 255))))
115115
gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 255), 1))
116116

117-
#gc.DrawLines(wx.Point(0, 0), wx.Point(50, 10))
117+
# gc.DrawLines(wx.Point(0, 0), wx.Point(50, 10))
118118

119119
font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
120120
gc.SetFont(font, wx.Colour(23, 44, 44))
@@ -134,7 +134,7 @@ def drawgrid(self, dc, gc):
134134
firstbar = int(ceil(self.minyvalue / spacing)) # in degrees
135135
dc.SetPen(wx.Pen(wx.Colour(225, 225, 225), 1))
136136
for y in range(firstbar, firstbar + ybars + 1):
137-
#y_pos = y*(float(self.height)/self.ybars)
137+
# y_pos = y*(float(self.height)/self.ybars)
138138
degrees = y * spacing
139139
y_pos = self._y_pos(degrees)
140140
dc.DrawLine(0, y_pos, self.width, y_pos)
@@ -148,15 +148,15 @@ def drawgrid(self, dc, gc):
148148
self.width / 2 - (font.GetPointSize() * 3),
149149
self.height / 2 - (font.GetPointSize() * 1))
150150

151-
#dc.DrawCircle(50, 50, 1)
151+
# dc.DrawCircle(50, 50, 1)
152152

153-
#gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
154-
#gc.DrawLines([[20, 30], [10, 53]])
155-
#dc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
153+
# gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
154+
# gc.DrawLines([[20, 30], [10, 53]])
155+
# dc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
156156

157157
def _y_pos(self, temperature):
158158
"""Converts a temperature, in degrees, to a pixel position"""
159-
#fraction of the screen from the bottom
159+
# fraction of the screen from the bottom
160160
frac = (float(temperature - self.minyvalue)
161161
/ (self.maxyvalue - self.minyvalue))
162162
return int((1.0 - frac) * (self.height - 1))
@@ -168,7 +168,7 @@ def _calculate_spacing(self):
168168
log_yspan = log10(yspan / self.ybars)
169169
exponent = int(floor(log_yspan))
170170

171-
#calculate boundary points between allowed spacings
171+
# calculate boundary points between allowed spacings
172172
log1_25 = log10(2) + log10(1) + log10(2.5) - log10(1 + 2.5)
173173
log25_5 = log10(2) + log10(2.5) + log10(5) - log10(2.5 + 5)
174174
log5_10 = log10(2) + log10(5) + log10(10) - log10(5 + 10)
@@ -205,7 +205,7 @@ def drawtemperature(self, dc, gc, temperature_list,
205205

206206
if len(text) > 0:
207207
font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD)
208-
#font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
208+
# font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
209209
if self.timer.IsRunning() is False:
210210
gc.SetFont(font, wx.Colour(128, 128, 128))
211211
else:
@@ -337,7 +337,7 @@ def __init__(self, graph, minimum_scale=5.0, buffer=0.10):
337337

338338
# Frequency to rescale the graph
339339
self.update_freq = 10
340-
#number of updates since last full refresh
340+
# number of updates since last full refresh
341341
self._last_update = self.update_freq
342342

343343
def update(self, forceUpdate=False):
@@ -418,7 +418,7 @@ def getBoundsQuick(self):
418418
miny = min(miny, bed_min, bed_target)
419419
maxy = max(maxy, bed_max, bed_target)
420420

421-
#We have to rescale, so add padding
421+
# We have to rescale, so add padding
422422
bufratio = self.buffer / (1.0 - self.buffer)
423423
if miny < self.graph.minyvalue:
424424
padding = (self.graph.maxyvalue - miny) * bufratio

0 commit comments

Comments
 (0)