Run reindent.py on the whole repository

master
Guillaume Seguin 2012-08-08 08:39:50 +02:00
parent ec596c5ab6
commit 8cc134955f
31 changed files with 667 additions and 677 deletions

View File

@ -336,25 +336,25 @@ class stlwin(wx.Frame):
def center(self, event): def center(self, event):
i = self.l.GetSelection() i = self.l.GetSelection()
if i != -1: if i != -1:
m = self.models[self.l.GetString(i)] m = self.models[self.l.GetString(i)]
m.offsets = [100, 100, m.offsets[2]] m.offsets = [100, 100, m.offsets[2]]
self.Refresh() self.Refresh()
def snap(self, event): def snap(self, event):
i = self.l.GetSelection() i = self.l.GetSelection()
if i != -1: if i != -1:
m = self.models[self.l.GetString(i)] m = self.models[self.l.GetString(i)]
m.offsets[2] = -1.0 * min(m.facetsminz)[0] m.offsets[2] = -1.0 * min(m.facetsminz)[0]
#print m.offsets[2] #print m.offsets[2]
self.Refresh() self.Refresh()
def delete(self, event): def delete(self, event):
i = self.l.GetSelection() i = self.l.GetSelection()
if i != -1: if i != -1:
del self.models[self.l.GetString(i)] del self.models[self.l.GetString(i)]
self.l.Delete(i) self.l.Delete(i)
self.l.Select(self.l.GetCount() - 1) self.l.Select(self.l.GetCount() - 1)
self.Refresh() self.Refresh()
def done(self, event, cb): def done(self, event, cb):
try: try:

View File

@ -164,11 +164,11 @@ class printcore():
self.clear = True self.clear = True
if line.startswith('ok') and "T:" in line and self.tempcb: if line.startswith('ok') and "T:" in line and self.tempcb:
#callback for temp, status, whatever #callback for temp, status, whatever
try: self.tempcb(line) try: self.tempcb(line)
except: pass except: pass
elif line.startswith('Error'): elif line.startswith('Error'):
if self.errorcb: if self.errorcb:
#callback for errors #callback for errors
try: self.errorcb(line) try: self.errorcb(line)
except: pass except: pass
if line.lower().startswith("resend") or line.startswith("rs"): if line.lower().startswith("resend") or line.startswith("rs"):

View File

@ -2,112 +2,112 @@
#Interactive RepRap e axis calibration program #Interactive RepRap e axis calibration program
#(C) Nathan Zadoks 2011 #(C) Nathan Zadoks 2011
#Licensed under CC-BY-SA or GPLv2 and higher - Pick your poison. #Licensed under CC-BY-SA or GPLv2 and higher - Pick your poison.
s=300 #Extrusion speed (mm/min) s=300 #Extrusion speed (mm/min)
n=100 #Default length to extrude n=100 #Default length to extrude
m= 0 #User-entered measured extrusion length m= 0 #User-entered measured extrusion length
k=300 #Default amount of steps per mm k=300 #Default amount of steps per mm
port='/dev/ttyUSB0' #Default serial port to connect to printer port='/dev/ttyUSB0' #Default serial port to connect to printer
temp=210 #Default extrusion temperature temp=210 #Default extrusion temperature
tempmax=250 #Maximum extrusion temperature tempmax=250 #Maximum extrusion temperature
t=int(n*60)/s #Time to wait for extrusion t=int(n*60)/s #Time to wait for extrusion
try: try:
from printdummy import printcore from printdummy import printcore
except ImportError: except ImportError:
from printcore import printcore from printcore import printcore
import time,getopt,sys,os import time,getopt,sys,os
def float_input(prompt=''): def float_input(prompt=''):
import sys import sys
f=None f=None
while f==None: while f==None:
s=raw_input(prompt) s=raw_input(prompt)
try: try:
f=float(s) f=float(s)
except ValueError: except ValueError:
sys.stderr.write("Not a valid floating-point number.\n") sys.stderr.write("Not a valid floating-point number.\n")
sys.stderr.flush() sys.stderr.flush()
return f return f
def wait(t,m=''): def wait(t,m=''):
import time,sys import time,sys
sys.stdout.write(m+'['+(' '*t)+']\r'+m+'[') sys.stdout.write(m+'['+(' '*t)+']\r'+m+'[')
sys.stdout.flush() sys.stdout.flush()
for i in range(t): for i in range(t):
for s in ['|\b','/\b','-\b','\\\b','|']: for s in ['|\b','/\b','-\b','\\\b','|']:
sys.stdout.write(s) sys.stdout.write(s)
sys.stdout.flush() sys.stdout.flush()
time.sleep(1.0/5) time.sleep(1.0/5)
print print
def w(s): def w(s):
sys.stdout.write(s) sys.stdout.write(s)
sys.stdout.flush() sys.stdout.flush()
def heatup(p,temp,s=0): def heatup(p,temp,s=0):
curtemp=gettemp(p) curtemp=gettemp(p)
p.send_now('M109 S%03d'%temp) p.send_now('M109 S%03d'%temp)
p.temp=0 p.temp=0
if not s: w("Heating extruder up..") if not s: w("Heating extruder up..")
f=False f=False
while curtemp<=(temp-1): while curtemp<=(temp-1):
p.send_now('M105') p.send_now('M105')
time.sleep(0.5) time.sleep(0.5)
if not f: if not f:
time.sleep(1.5) time.sleep(1.5)
f=True f=True
curtemp=gettemp(p) curtemp=gettemp(p)
if curtemp: w(u"\rHeating extruder up.. %3d \xb0C"%curtemp) if curtemp: w(u"\rHeating extruder up.. %3d \xb0C"%curtemp)
if s: print if s: print
else: print "\nReady." else: print "\nReady."
def gettemp(p): def gettemp(p):
try: p.logl try: p.logl
except: setattr(p,'logl',0) except: setattr(p,'logl',0)
try: p.temp try: p.temp
except: setattr(p,'temp',0) except: setattr(p,'temp',0)
for n in range(p.logl,len(p.log)): for n in range(p.logl,len(p.log)):
line=p.log[n] line=p.log[n]
if 'T:' in line: if 'T:' in line:
try: try:
setattr(p,'temp',int(line.split('T:')[1].split()[0])) setattr(p,'temp',int(line.split('T:')[1].split()[0]))
except: print line except: print line
p.logl=len(p.log) p.logl=len(p.log)
return p.temp return p.temp
if not os.path.exists(port): if not os.path.exists(port):
port=0 port=0
#Parse options #Parse options
help=u""" help=u"""
%s [ -l DISTANCE ] [ -s STEPS ] [ -t TEMP ] [ -p PORT ] %s [ -l DISTANCE ] [ -s STEPS ] [ -t TEMP ] [ -p PORT ]
-l --length Length of filament to extrude for each calibration step (default: %d mm) -l --length Length of filament to extrude for each calibration step (default: %d mm)
-s --steps Initial amount of steps to use (default: %d steps) -s --steps Initial amount of steps to use (default: %d steps)
-t --temp Extrusion temperature in degrees Celsius (default: %d \xb0C, max %d \xb0C) -t --temp Extrusion temperature in degrees Celsius (default: %d \xb0C, max %d \xb0C)
-p --port Serial port the printer is connected to (default: %s) -p --port Serial port the printer is connected to (default: %s)
-h --help This cruft. -h --help This cruft.
"""[1:-1].encode('utf-8')%(sys.argv[0],n,k,temp,tempmax,port if port else 'auto') """[1:-1].encode('utf-8')%(sys.argv[0],n,k,temp,tempmax,port if port else 'auto')
try: try:
opts,args=getopt.getopt(sys.argv[1:],"hl:s:t:p:",["help","length=","steps=","temp=","port="]) opts,args=getopt.getopt(sys.argv[1:],"hl:s:t:p:",["help","length=","steps=","temp=","port="])
except getopt.GetoptError,err: except getopt.GetoptError,err:
print str(err) print str(err)
print help print help
sys.exit(2) sys.exit(2)
for o,a in opts: for o,a in opts:
if o in ('-h','--help'): if o in ('-h','--help'):
print help print help
sys.exit() sys.exit()
elif o in ('-l','--length'): elif o in ('-l','--length'):
n=float(a) n=float(a)
elif o in ('-s','--steps'): elif o in ('-s','--steps'):
k=int(a) k=int(a)
elif o in ('-t','--temp'): elif o in ('-t','--temp'):
temp=int(a) temp=int(a)
if temp>=tempmax: if temp>=tempmax:
print (u'%d \xb0C? Are you insane?'.encode('utf-8')%temp)+(" That's over nine thousand!" if temp>9000 else '') print (u'%d \xb0C? Are you insane?'.encode('utf-8')%temp)+(" That's over nine thousand!" if temp>9000 else '')
sys.exit(255) sys.exit(255)
elif o in ('-p','--port'): elif o in ('-p','--port'):
port=a port=a
#Show initial parameters #Show initial parameters
print "Initial parameters" print "Initial parameters"
@ -118,34 +118,34 @@ print "Serial port: %s"%(port if port else 'auto')
p=None p=None
try: try:
#Connect to printer #Connect to printer
w("Connecting to printer..") w("Connecting to printer..")
try: try:
p=printcore(port,115200) p=printcore(port,115200)
except: except:
print 'Error.' print 'Error.'
raise raise
while not p.online: while not p.online:
time.sleep(1) time.sleep(1)
w('.') w('.')
print " connected." print " connected."
heatup(p,temp) heatup(p,temp)
#Calibration loop #Calibration loop
while n!=m: while n!=m:
heatup(p,temp,True) heatup(p,temp,True)
p.send_now("G92 E0") #Reset e axis p.send_now("G92 E0") #Reset e axis
p.send_now("G1 E%d F%d"%(n,s)) #Extrude length of filament p.send_now("G1 E%d F%d"%(n,s)) #Extrude length of filament
wait(t,'Extruding.. ') wait(t,'Extruding.. ')
m=float_input("How many millimeters of filament were extruded? ") m=float_input("How many millimeters of filament were extruded? ")
if m==0: continue if m==0: continue
if n!=m: if n!=m:
k=(n/m)*k k=(n/m)*k
p.send_now("M92 E%d"%int(round(k))) #Set new step count p.send_now("M92 E%d"%int(round(k))) #Set new step count
print "Steps per mm: %3d steps"%k #Tell user print "Steps per mm: %3d steps"%k #Tell user
print 'Calibration completed.' #Yay! print 'Calibration completed.' #Yay!
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
finally: finally:
if p: p.disconnect() if p: p.disconnect()

View File

@ -263,5 +263,3 @@ class Graph(BufferedCanvas):
self.drawextruder0temp(dc, gc) self.drawextruder0temp(dc, gc)
self.drawextruder1targettemp(dc, gc) self.drawextruder1targettemp(dc, gc)
self.drawextruder1temp(dc, gc) self.drawextruder1temp(dc, gc)

View File

@ -397,4 +397,3 @@ if __name__ == '__main__':
main = window(open("jam.gcode")) main = window(open("jam.gcode"))
main.Show() main.Show()
app.MainLoop() app.MainLoop()

View File

@ -13,9 +13,9 @@ def install_locale(domain):
def imagefile(filename): def imagefile(filename):
for prefix in ['/usr/local/share/pronterface/images', '/usr/share/pronterface/images']: for prefix in ['/usr/local/share/pronterface/images', '/usr/share/pronterface/images']:
candidate = os.path.join(prefix, filename) candidate = os.path.join(prefix, filename)
if os.path.exists(candidate): if os.path.exists(candidate):
return candidate return candidate
local_candidate = os.path.join(os.path.dirname(__file__), "images", filename) local_candidate = os.path.join(os.path.dirname(__file__), "images", filename)
if os.path.exists(local_candidate): if os.path.exists(local_candidate):
return local_candidate return local_candidate
@ -24,9 +24,9 @@ def imagefile(filename):
def lookup_file(filename, prefixes): def lookup_file(filename, prefixes):
for prefix in prefixes: for prefix in prefixes:
candidate = os.path.join(prefix, filename) candidate = os.path.join(prefix, filename)
if os.path.exists(candidate): if os.path.exists(candidate):
return candidate return candidate
return filename return filename
def pixmapfile(filename): def pixmapfile(filename):

View File

@ -82,9 +82,9 @@ class dispframe(wx.Frame):
self.Refresh() self.Refresh()
if self.p != None and self.p.online: if self.p != None and self.p.online:
self.p.send_now("G91") self.p.send_now("G91")
self.p.send_now("G1 Z%f F300" % (self.thickness,)) self.p.send_now("G1 Z%f F300" % (self.thickness,))
self.p.send_now("G90") self.p.send_now("G90")
def nextimg(self, event): def nextimg(self, event):
if self.index < len(self.layers): if self.index < len(self.layers):

View File

@ -304,14 +304,14 @@ class gcview(object):
('v3f/static', vertices), ('v3f/static', vertices),
('n3f/static', normals))) ('n3f/static', normals)))
if lasth is not None: if lasth is not None:
self.layers[lasth] = pyglet.graphics.Batch() self.layers[lasth] = pyglet.graphics.Batch()
indices = range(len(layertemp[lasth][0])) # [[3*i,3*i+1,3*i+2] for i in xrange(len(facets))] indices = range(len(layertemp[lasth][0])) # [[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
self.vlists.append(self.layers[lasth].add_indexed(len(layertemp[lasth][0]) // 3, self.vlists.append(self.layers[lasth].add_indexed(len(layertemp[lasth][0]) // 3,
GL_TRIANGLES, GL_TRIANGLES,
None, # group, None, # group,
indices, indices,
('v3f/static', layertemp[lasth][0]), ('v3f/static', layertemp[lasth][0]),
('n3f/static', layertemp[lasth][1]))) ('n3f/static', layertemp[lasth][1])))
def genline(self, i, h, w): def genline(self, i, h, w):
S = i[0][:3] S = i[0][:3]
@ -356,28 +356,28 @@ class gcview(object):
return spoints, epoints, S, E return spoints, epoints, S, E
def transform(self, line): def transform(self, line):
line = line.split(";")[0] line = line.split(";")[0]
cur = self.prev[:] cur = self.prev[:]
if len(line) > 0: if len(line) > 0:
if "G1" in line or "G0" in line or "G92" in line: if "G1" in line or "G0" in line or "G92" in line:
if("X" in line): if("X" in line):
cur[0] = float(line.split("X")[1].split(" ")[0]) cur[0] = float(line.split("X")[1].split(" ")[0])
if("Y" in line): if("Y" in line):
cur[1] = float(line.split("Y")[1].split(" ")[0]) cur[1] = float(line.split("Y")[1].split(" ")[0])
if("Z" in line): if("Z" in line):
cur[2] = float(line.split("Z")[1].split(" ")[0]) cur[2] = float(line.split("Z")[1].split(" ")[0])
if("E" in line): if("E" in line):
cur[3] = float(line.split("E")[1].split(" ")[0]) cur[3] = float(line.split("E")[1].split(" ")[0])
if self.prev == cur: if self.prev == cur:
return None return None
if self.fline or "G92" in line: if self.fline or "G92" in line:
self.prev = cur self.prev = cur
self.fline = 0 self.fline = 0
return None return None
else: else:
r = [self.prev, cur] r = [self.prev, cur]
self.prev = cur self.prev = cur
return r return r
def delete(self): def delete(self):
for i in self.vlists: for i in self.vlists:
@ -570,27 +570,27 @@ class TestGlPanel(GLPanel):
self.initpos = None self.initpos = None
elif event.Dragging() and event.RightIsDown() and event.ShiftDown(): elif event.Dragging() and event.RightIsDown() and event.ShiftDown():
if self.initpos is None: if self.initpos is None:
self.initpos = event.GetPositionTuple() self.initpos = event.GetPositionTuple()
else: else:
p1 = self.initpos p1 = self.initpos
p2 = event.GetPositionTuple() p2 = event.GetPositionTuple()
sz = self.GetClientSize() sz = self.GetClientSize()
p1 = list(p1) p1 = list(p1)
p2 = list(p2) p2 = list(p2)
p1[1] *= -1 p1[1] *= -1
p2[1] *= -1 p2[1] *= -1
self.transv = map(lambda x, y, z, c: c - self.dist * (x - y) / z, list(p1) + [0], list(p2) + [0], list(sz) + [1], self.transv) self.transv = map(lambda x, y, z, c: c - self.dist * (x - y) / z, list(p1) + [0], list(p2) + [0], list(sz) + [1], self.transv)
glLoadIdentity() glLoadIdentity()
glTranslatef(self.transv[0], self.transv[1], 0) glTranslatef(self.transv[0], self.transv[1], 0)
glTranslatef(0, 0, self.transv[2]) glTranslatef(0, 0, self.transv[2])
if(self.rot): if(self.rot):
glMultMatrixd(build_rotmatrix(self.basequat)) glMultMatrixd(build_rotmatrix(self.basequat))
glGetDoublev(GL_MODELVIEW_MATRIX, self.mvmat) glGetDoublev(GL_MODELVIEW_MATRIX, self.mvmat)
self.rot = 1 self.rot = 1
self.initpos = None self.initpos = None
else: else:
#mouse is moving without a button press #mouse is moving without a button press
p = event.GetPositionTuple() p = event.GetPositionTuple()

View File

@ -40,4 +40,3 @@ if not hasattr(wx.GraphicsPath, "AddEllipticalArc"):
wx.GraphicsPath.AddEllipticalArc = AddEllipticalArc wx.GraphicsPath.AddEllipticalArc = AddEllipticalArc
del AddEllipticalArc del AddEllipticalArc

View File

@ -5,4 +5,3 @@
from pyparsing import nestedExpr from pyparsing import nestedExpr
block = nestedExpr(opener="{", closer="}") block = nestedExpr(opener="{", closer="}")

View File

@ -189,5 +189,3 @@ if __name__ == '__main__':
#~ from tests.test_pathdata import * #~ from tests.test_pathdata import *
#~ unittest.main() #~ unittest.main()
profile() profile()

View File

@ -237,10 +237,10 @@ class WebInterface(object):
def __init__(self, pface): def __init__(self, pface):
if (sys.version_info[1] > 6): if (sys.version_info[1] > 6):
# 'allow_no_value' wasn't added until 2.7 # 'allow_no_value' wasn't added until 2.7
config = ConfigParser.SafeConfigParser(allow_no_value=True) config = ConfigParser.SafeConfigParser(allow_no_value=True)
else: else:
config = ConfigParser.SafeConfigParser() config = ConfigParser.SafeConfigParser()
config.read(configfile(pface.web_auth_config or 'auth.config')) config.read(configfile(pface.web_auth_config or 'auth.config'))
users[config.get("user", "user")] = config.get("user", "pass") users[config.get("user", "user")] = config.get("user", "pass")
self.pface = pface self.pface = pface

View File

@ -56,9 +56,9 @@ class XYButtons(BufferedCanvas):
self.lastMove = None self.lastMove = None
self.lastCorner = None self.lastCorner = None
self.bgcolor = wx.Colour() self.bgcolor = wx.Colour()
self.bgcolor.SetFromName(bgcolor) self.bgcolor.SetFromName(bgcolor)
self.bgcolormask = wx.Colour(self.bgcolor.Red(), self.bgcolor.Green(), self.bgcolor.Blue(), 128) self.bgcolormask = wx.Colour(self.bgcolor.Red(), self.bgcolor.Green(), self.bgcolor.Blue(), 128)
BufferedCanvas.__init__(self, parent, ID) BufferedCanvas.__init__(self, parent, ID)
self.SetSize(self.bg_bmp.GetSize()) self.SetSize(self.bg_bmp.GetSize())
@ -218,7 +218,7 @@ class XYButtons(BufferedCanvas):
def draw(self, dc, w, h): def draw(self, dc, w, h):
dc.SetBackground(wx.Brush(self.bgcolor)) dc.SetBackground(wx.Brush(self.bgcolor))
dc.Clear() dc.Clear()
gc = wx.GraphicsContext.Create(dc) gc = wx.GraphicsContext.Create(dc)

View File

@ -42,9 +42,9 @@ class ZButtons(BufferedCanvas):
# Remember the last clicked value, so we can repeat when spacebar pressed # Remember the last clicked value, so we can repeat when spacebar pressed
self.lastValue = None self.lastValue = None
self.bgcolor = wx.Colour() self.bgcolor = wx.Colour()
self.bgcolor.SetFromName(bgcolor) self.bgcolor.SetFromName(bgcolor)
self.bgcolormask = wx.Colour(self.bgcolor.Red(), self.bgcolor.Green(), self.bgcolor.Blue(), 128) self.bgcolormask = wx.Colour(self.bgcolor.Red(), self.bgcolor.Green(), self.bgcolor.Blue(), 128)
BufferedCanvas.__init__(self, parent, ID) BufferedCanvas.__init__(self, parent, ID)
@ -99,7 +99,7 @@ class ZButtons(BufferedCanvas):
return (self.lookupRange(abs(ydelta)), sign(ydelta)) return (self.lookupRange(abs(ydelta)), sign(ydelta))
def draw(self, dc, w, h): def draw(self, dc, w, h):
dc.SetBackground(wx.Brush(self.bgcolor)) dc.SetBackground(wx.Brush(self.bgcolor))
dc.Clear() dc.Clear()
gc = wx.GraphicsContext.Create(dc) gc = wx.GraphicsContext.Create(dc)
if self.bg_bmp: if self.bg_bmp:

View File

@ -82,4 +82,3 @@ if __name__ == '__main__':
""" """
zimage("catposthtmap2.jpg","testobj.stl") zimage("catposthtmap2.jpg","testobj.stl")
del a del a

View File

@ -1248,4 +1248,3 @@ if __name__=="__main__":
except: except:
interp.p.disconnect() interp.p.disconnect()
#raise #raise

View File

@ -738,7 +738,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.btemp.SetValue(i) self.btemp.SetValue(i)
for i in htemp_choices: for i in htemp_choices:
if i.split()[0] == str(self.settings.last_temperature).split('.')[0] or i.split()[0] == str(self.settings.last_temperature) : if i.split()[0] == str(self.settings.last_temperature).split('.')[0] or i.split()[0] == str(self.settings.last_temperature) :
self.htemp.SetValue(i) self.htemp.SetValue(i)
if( '(' not in self.btemp.Value): if( '(' not in self.btemp.Value):
self.btemp.SetValue(self.btemp.Value + ' (user)') self.btemp.SetValue(self.btemp.Value + ' (user)')
@ -845,7 +845,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.commandbox.SetSelection(0,len(self.commandbox.history[self.commandbox.histindex])) self.commandbox.SetSelection(0,len(self.commandbox.history[self.commandbox.histindex]))
elif e.GetKeyCode()==wx.WXK_DOWN: elif e.GetKeyCode()==wx.WXK_DOWN:
if self.commandbox.histindex==len(self.commandbox.history): if self.commandbox.histindex==len(self.commandbox.history):
self.commandbox.history+=[self.commandbox.GetValue()] #save current command self.commandbox.history+=[self.commandbox.GetValue()] #save current command
if len(self.commandbox.history): if len(self.commandbox.history):
self.commandbox.histindex=(self.commandbox.histindex+1)%len(self.commandbox.history) self.commandbox.histindex=(self.commandbox.histindex+1)%len(self.commandbox.history)
self.commandbox.SetValue(self.commandbox.history[self.commandbox.histindex]) self.commandbox.SetValue(self.commandbox.history[self.commandbox.histindex])
@ -957,10 +957,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
b.SetToolTip(wx.ToolTip(_("click to add new custom button"))) b.SetToolTip(wx.ToolTip(_("click to add new custom button")))
b.Bind(wx.EVT_BUTTON,self.cbutton_edit) b.Bind(wx.EVT_BUTTON,self.cbutton_edit)
else: else:
b=wx.Button(self.panel,-1,".",size=(1,1)) b=wx.Button(self.panel,-1,".",size=(1,1))
#b=wx.StaticText(self.panel,-1,"",size=(72,22),style=wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE) #+wx.SIMPLE_BORDER #b=wx.StaticText(self.panel,-1,"",size=(72,22),style=wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE) #+wx.SIMPLE_BORDER
b.Disable() b.Disable()
#continue #continue
b.custombutton=i b.custombutton=i
b.properties=btndef b.properties=btndef
if btndef is not None: if btndef is not None:
@ -984,9 +984,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def nextarg(rest): def nextarg(rest):
rest=rest.lstrip() rest=rest.lstrip()
if rest.startswith('"'): if rest.startswith('"'):
return rest[1:].split('"',1) return rest[1:].split('"',1)
else: else:
return rest.split(None,1) return rest.split(None,1)
#try: #try:
num,argstr=nextarg(argstr) num,argstr=nextarg(argstr)
num=int(num) num=int(num)
@ -1518,7 +1518,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.f=[i.replace("\n","").replace("\r","") for i in of] self.f=[i.replace("\n","").replace("\r","") for i in of]
of.close() of.close()
if self.p.online: if self.p.online:
wx.CallAfter(self.printbtn.Enable) wx.CallAfter(self.printbtn.Enable)
wx.CallAfter(self.status.SetStatusText,_("Loaded ")+self.filename+_(", %d lines") % (len(self.f),)) wx.CallAfter(self.status.SetStatusText,_("Loaded ")+self.filename+_(", %d lines") % (len(self.f),))
wx.CallAfter(self.pausebtn.Disable) wx.CallAfter(self.pausebtn.Disable)
@ -1553,7 +1553,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except: except:
pass pass
dlg=wx.FileDialog(self,_("Open file to print"),basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST) dlg=wx.FileDialog(self,_("Open file to print"),basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard(_("OBJ, STL, and GCODE files (*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ)|*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ|All Files (*.*)|*.*")) dlg.SetWildcard(_("OBJ, STL, and GCODE files (*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ)|*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ|All Files (*.*)|*.*"))
if(filename is not None or dlg.ShowModal() == wx.ID_OK): if(filename is not None or dlg.ShowModal() == wx.ID_OK):
if filename is not None: if filename is not None:
name=filename name=filename
@ -1810,4 +1810,3 @@ if __name__ == '__main__':
app.MainLoop() app.MainLoop()
except: except:
pass pass