Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
930a4334
Commit
930a4334
authored
Aug 20, 2012
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'experimental' of github.com:kliment/Printrun into experimental
Conflicts: pronterface.py
parents
4a5e13f2
4d39b266
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
139 additions
and
46 deletions
+139
-46
dot.pronsolerc.example
dot.pronsolerc.example
+1
-12
printcore.py
printcore.py
+12
-6
pronsole.py
pronsole.py
+8
-3
pronterface.py
pronterface.py
+54
-25
PCB-milling-and-(comment).gcode
testfiles/PCB-milling-and-(comment).gcode
+64
-0
No files found.
.pronsolerc.example
→
dot
.pronsolerc.example
View file @
930a4334
# Sample .pronsolerc file - copy this into your home directory and rename it to .pronsolerc
!print "Loaded " + self.rc_filename
macro loud
!if self.p.loud:
!self.p.loud = 0
!if hasattr(self,"cur_button") and self.cur_button is not None:
!self.onecmd('button %d "loud (off)" /c green loud' % self.cur_button)
!else:
!self.p.loud = 1
!if hasattr(self,"cur_button") and self.cur_button is not None:
!self.onecmd('button %d "loud (on)" /c yellow loud' % self.cur_button)
button 0 "loud (off)" /c "green" loud
macro fan
!global _fan
!if '_fan' in globals() and _fan:
...
...
@@ -24,4 +13,4 @@ macro fan
M106
!if hasattr(self,"cur_button") and self.cur_button is not None:
!self.onecmd('button %d "fan (on)" /c yellow fan' % self.cur_button)
button
1
"fan (off)" /c "green" fan
button
0
"fan (off)" /c "green" fan
printcore.py
View file @
930a4334
...
...
@@ -147,13 +147,19 @@ class printcore():
pass
#callback for errors
pass
# Teststrings for resend parsing # Firmware exp. result
# line="rs N2 Expected checksum 67" # Teacup 2
if
line
.
lower
()
.
startswith
(
"resend"
)
or
line
.
startswith
(
"rs"
):
try
:
toresend
=
int
(
line
.
replace
(
"N:"
,
" "
)
.
replace
(
"N"
,
" "
)
.
replace
(
":"
,
" "
)
.
split
()[
-
1
])
except
:
if
line
.
startswith
(
"rs"
):
toresend
=
int
(
line
.
split
()[
1
])
self
.
resendfrom
=
toresend
line
=
line
.
replace
(
"N:"
,
" "
)
.
replace
(
"N"
,
" "
)
.
replace
(
":"
,
" "
)
linewords
=
line
.
split
()
while
len
(
linewords
)
!=
0
:
try
:
toresend
=
int
(
linewords
.
pop
(
0
))
self
.
resendfrom
=
toresend
#print str(toresend)
break
except
:
pass
self
.
clear
=
True
self
.
clear
=
True
#callback for disconnect
...
...
pronsole.py
View file @
930a4334
...
...
@@ -621,6 +621,9 @@ class pronsole(cmd.Cmd):
print
"Disconnects from the printer"
def
do_load
(
self
,
l
):
self
.
_do_load
(
l
)
def
_do_load
(
self
,
l
):
if
len
(
l
)
==
0
:
print
"No file name given."
return
...
...
@@ -631,7 +634,7 @@ class pronsole(cmd.Cmd):
self
.
f
=
[
i
.
replace
(
"
\n
"
,
""
)
.
replace
(
"
\r
"
,
""
)
for
i
in
open
(
l
)]
self
.
filename
=
l
print
"Loaded "
,
l
,
", "
,
len
(
self
.
f
),
" lines."
def
complete_load
(
self
,
text
,
line
,
begidx
,
endidx
):
s
=
line
.
split
()
if
len
(
s
)
>
2
:
...
...
@@ -874,14 +877,16 @@ class pronsole(cmd.Cmd):
def
default
(
self
,
l
):
if
(
l
[
0
]
in
self
.
commandprefixes
.
upper
()):
if
(
self
.
p
and
self
.
p
.
online
):
print
"SENDING:"
+
l
if
(
not
self
.
p
.
loud
):
print
"SENDING:"
+
l
self
.
p
.
send_now
(
l
)
else
:
print
"Printer is not online."
return
elif
(
l
[
0
]
in
self
.
commandprefixes
.
lower
()):
if
(
self
.
p
and
self
.
p
.
online
):
print
"SENDING:"
+
l
.
upper
()
if
(
not
self
.
p
.
loud
):
print
"SENDING:"
+
l
.
upper
()
self
.
p
.
send_now
(
l
.
upper
())
else
:
print
"Printer is not online."
...
...
pronterface.py
View file @
930a4334
...
...
@@ -173,6 +173,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
webInterface
=
webinterface
.
WebInterface
(
self
)
self
.
webThread
=
Thread
(
target
=
webinterface
.
StartWebInterfaceThread
,
args
=
(
self
.
webInterface
,
))
self
.
webThread
.
start
()
if
(
self
.
filename
is
not
None
):
self
.
do_load
(
self
.
filename
)
def
startcb
(
self
):
self
.
starttime
=
time
.
time
()
...
...
@@ -434,6 +436,12 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
Bind
(
wx
.
EVT_MENU
,
lambda
*
e
:
options
(
self
),
m
.
Append
(
-
1
,
_
(
"&Options"
),
_
(
" Options dialog"
)))
self
.
Bind
(
wx
.
EVT_MENU
,
lambda
x
:
threading
.
Thread
(
target
=
lambda
:
self
.
do_skein
(
"set"
))
.
start
(),
m
.
Append
(
-
1
,
_
(
"Slicing Settings"
),
_
(
" Adjust slicing settings"
)))
mItem
=
m
.
AppendCheckItem
(
-
1
,
_
(
"Debug G-code"
),
_
(
"Print all G-code sent to and received from the printer."
))
m
.
Check
(
mItem
.
GetId
(),
self
.
p
.
loud
)
self
.
Bind
(
wx
.
EVT_MENU
,
self
.
setloud
,
mItem
)
#try:
# from SkeinforgeQuickEditDialog import SkeinforgeQuickEditDialog
# self.Bind(wx.EVT_MENU, lambda *e:SkeinforgeQuickEditDialog(self), m.Append(-1,_("SFACT Quick Settings"),_(" Quickly adjust SFACT settings for active profile")))
...
...
@@ -483,14 +491,14 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
macro
==
""
:
return
self
.
new_macro
()
if
self
.
macros
.
has_key
(
macro
):
old_def
=
self
.
macros
[
macro
]
elif
hasattr
(
self
.
__class__
,
"do_"
+
macro
):
print
_
(
"Name '
%
s' is being used by built-in command"
)
%
macro
return
elif
len
([
c
for
c
in
macro
if
not
c
.
isalnum
()
and
c
!=
"_"
]):
print
_
(
"Macro name may contain only alphanumeric symbols and underscores"
)
elif
len
([
c
for
c
in
macro
.
encode
(
"ascii"
,
"replace"
)
if
not
c
.
isalnum
()
and
c
!=
"_"
]):
print
_
(
"Macro name may contain only ASCII alphanumeric symbols and underscores"
)
if
webavail
:
self
.
webInterface
.
AddLog
(
"Macro name may contain only alphanumeric symbols and underscores"
)
return
elif
hasattr
(
self
.
__class__
,
"do_"
+
macro
):
print
_
(
"Name '
%
s' is being used by built-in command"
)
%
macro
return
else
:
old_def
=
""
self
.
start_macro
(
macro
,
old_def
)
...
...
@@ -541,14 +549,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
rescanbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Port"
),
size
=
buttonSize
)
self
.
rescanbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Communication Settings
\n
Click to rescan ports"
))
self
.
rescanbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
rescanports
)
uts
.
Add
(
self
.
rescanbtn
,
0
,
wx
.
TOP
|
wx
.
LEFT
,
0
)
self
.
serialport
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
choices
=
self
.
scanserial
(),
style
=
wx
.
CB_DROPDOWN
,
size
=
(
100
,
25
))
self
.
serialport
.
SetToolTip
(
wx
.
ToolTip
(
"Select Port Printer is connected to"
))
self
.
rescanports
()
uts
.
Add
(
self
.
serialport
)
uts
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
"@"
),
0
,
wx
.
RIGHT
|
wx
.
ALIGN_CENTER
,
0
)
self
.
baud
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
choices
=
[
"2400"
,
"9600"
,
"19200"
,
"38400"
,
"57600"
,
"115200"
,
"250000"
],
...
...
@@ -560,20 +569,22 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except
:
pass
uts
.
Add
(
self
.
baud
)
self
.
connectbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Connect"
),
size
=
buttonSize
)
uts
.
Add
(
self
.
connectbtn
)
self
.
connectbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Connect to the printer"
))
self
.
connectbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
connect
)
uts
.
Add
(
self
.
connectbtn
)
self
.
resetbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Reset"
),
style
=
wx
.
BU_EXACTFIT
,
size
=
(
-
1
,
buttonSize
[
1
]))
self
.
resetbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
reset
)
self
.
resetbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Reset the printer"
))
uts
.
Add
(
self
.
resetbtn
)
#self.minibtn=wx.Button(self.panel,-1,_("Mini mode"),style=wx.BU_EXACTFIT)
#self.minibtn.Bind(wx.EVT_BUTTON,self.toggleview)
#uts.Add((25,-1))
#uts.Add((15,-1),flag=wx.EXPAND)
#self.minibtn=wx.Button(self.panel,-1,_("Mini mode"),style=wx.BU_EXACTFIT)
#self.minibtn.Bind(wx.EVT_BUTTON,self.toggleview)
#uts.Add(self.minibtn,0,wx.ALIGN_CENTER)
#SECOND ROW
...
...
@@ -948,7 +959,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"click to add new custom button"
)))
b
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
cbutton_edit
)
else
:
continue
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
.
Disable
()
#continue
b
.
custombutton
=
i
b
.
properties
=
btndef
if
btndef
is
not
None
:
...
...
@@ -1112,13 +1126,25 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
not
hasattr
(
self
,
"dragging"
):
# init dragging of the custom button
if
hasattr
(
obj
,
"custombutton"
)
and
obj
.
properties
is
not
None
:
self
.
newbuttonbutton
.
SetLabel
(
""
)
self
.
newbuttonbutton
.
SetFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_NORMAL
))
self
.
newbuttonbutton
.
SetForegroundColour
(
"black"
)
self
.
newbuttonbutton
.
SetSize
(
obj
.
GetSize
())
if
self
.
upperbottomsizer
.
GetItem
(
self
.
newbuttonbutton
)
is
not
None
:
self
.
upperbottomsizer
.
SetItemMinSize
(
self
.
newbuttonbutton
,
obj
.
GetSize
())
self
.
topsizer
.
Layout
()
#self.newbuttonbutton.SetLabel("")
#self.newbuttonbutton.SetFont(wx.Font(10,wx.FONTFAMILY_DEFAULT,wx.FONTSTYLE_NORMAL,wx.FONTWEIGHT_NORMAL))
#self.newbuttonbutton.SetForegroundColour("black")
#self.newbuttonbutton.SetSize(obj.GetSize())
#if self.upperbottomsizer.GetItem(self.newbuttonbutton) is not None:
# self.upperbottomsizer.SetItemMinSize(self.newbuttonbutton,obj.GetSize())
# self.topsizer.Layout()
for
b
in
self
.
custombuttonbuttons
:
#if b.IsFrozen(): b.Thaw()
if
b
.
properties
is
None
:
b
.
Enable
()
b
.
SetLabel
(
""
)
b
.
SetFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_NORMAL
))
b
.
SetForegroundColour
(
"black"
)
b
.
SetSize
(
obj
.
GetSize
())
if
self
.
upperbottomsizer
.
GetItem
(
b
)
is
not
None
:
self
.
upperbottomsizer
.
SetItemMinSize
(
b
,
obj
.
GetSize
())
self
.
topsizer
.
Layout
()
# b.SetStyle(wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE+wx.SIMPLE_BORDER)
self
.
dragging
=
wx
.
Button
(
self
.
panel
,
-
1
,
obj
.
GetLabel
(),
style
=
wx
.
BU_EXACTFIT
)
self
.
dragging
.
SetBackgroundColour
(
obj
.
GetBackgroundColour
())
self
.
dragging
.
SetForegroundColour
(
obj
.
GetForegroundColour
())
...
...
@@ -1126,11 +1152,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
dragging
.
Raise
()
self
.
dragging
.
Disable
()
self
.
dragging
.
SetPosition
(
self
.
panel
.
ScreenToClient
(
scrpos
))
for
b
in
self
.
custombuttonbuttons
:
#if b.IsFrozen(): b.Thaw()
if
b
.
properties
is
None
:
b
.
Enable
()
# b.SetStyle(wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE+wx.SIMPLE_BORDER)
self
.
last_drag_dest
=
obj
self
.
dragging
.
label
=
obj
.
s_label
=
obj
.
GetLabel
()
self
.
dragging
.
bgc
=
obj
.
s_bgc
=
obj
.
GetBackgroundColour
()
...
...
@@ -1311,6 +1332,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
webavail
:
self
.
webInterface
.
AppendLog
(
text
)
def
setloud
(
self
,
e
):
self
.
p
.
loud
=
e
.
IsChecked
()
def
sendline
(
self
,
e
):
command
=
self
.
commandbox
.
GetValue
()
...
...
@@ -1409,7 +1432,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
pass
tstring
=
l
.
rstrip
()
#print tstring
if
(
tstring
!=
"ok"
)
and
(
tstring
!=
"wait"
)
and
(
"ok T:"
not
in
tstring
):
if
(
tstring
!=
"ok"
)
and
(
tstring
!=
"wait"
)
and
(
"ok T:"
not
in
tstring
)
and
(
not
self
.
p
.
loud
)
:
# print "*"+tstring+"*"
# print "[" + time.strftime('%H:%M:%S',time.localtime(time.time())) + "] " + tstring
wx
.
CallAfter
(
self
.
addtexttolog
,
tstring
+
"
\n
"
);
...
...
@@ -1538,6 +1561,12 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
thread
(
target
=
self
.
skein_func
)
.
start
()
thread
(
target
=
self
.
skein_monitor
)
.
start
()
def
do_load
(
self
,
l
):
if
hasattr
(
self
,
'skeining'
):
self
.
loadfile
(
None
,
l
)
else
:
self
.
_do_load
(
l
)
def
loadfile
(
self
,
event
,
filename
=
None
):
if
self
.
skeining
and
self
.
skeinp
is
not
None
:
self
.
skeinp
.
terminate
()
...
...
@@ -2067,10 +2096,10 @@ class TempGauge(wx.Panel):
#gc.DrawText(text,29,-2)
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
),
wx
.
WHITE
))
gc
.
DrawText
(
self
.
title
,
x0
+
19
,
y0
+
4
)
gc
.
DrawText
(
text
,
x0
+
1
33
,
y0
+
4
)
gc
.
DrawText
(
text
,
x0
+
1
19
,
y0
+
4
)
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
)))
gc
.
DrawText
(
self
.
title
,
x0
+
18
,
y0
+
3
)
gc
.
DrawText
(
text
,
x0
+
1
32
,
y0
+
3
)
gc
.
DrawText
(
text
,
x0
+
1
18
,
y0
+
3
)
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
...
...
testfiles/PCB-milling-and-(comment).gcode
0 → 100644
View file @
930a4334
(Created by G-code exporter)
(Fri Apr 27 22:20:09 2012)
(Board size: 100.00 x 130.00 mm)
(---------------------------------)
G21
G90
G0 X14.392 Y30.94113 Z1.
G4
M104 S255
G1 Z-0.2 F60
G1 X14.05334 Y30.60247
G1 X12.02134 Y30.60247
G1 X11.598 Y30.85647
G1 X11.00534 Y31.5338
G1 X10.074 Y32.5498
G1 X9.98933 Y34.41247
G0 Z1.
(RepRap Gen7 v1.4)
G0 Z1.
(R)
G0 X9.9753 Y6.9723
G1 Z-0.20 F60
G1 X11.4761 Y6.9723 F250
G1 X11.8514 Y6.5971
G1 X11.8514 Y5.8467
G1 X11.4761 Y5.4715
G1 X10.3505 Y5.4715
G1 X11.8514 Y3.9456
G0 Z1.
G0 X10.3505 Y6.9723
G1 Z-0.20 F60
G1 X10.3505 Y3.9456 F250
G0 Z1.
(e)
G0 X12.7519 Y4.696
G1 Z-0.20 F60
G1 X14.2778 Y4.696 F250
G1 X14.2778 Y5.0962
G1 X13.9025 Y5.4715
G1 X13.1271 Y5.4715
G1 X12.7519 Y5.0962
G1 X12.7519 Y4.3208
G1 X13.1271 Y3.9456
G1 X14.2778 Y3.9456
G0 Z1.
(p)
G0 X15.5535 Y2.8199
G1 Z-0.20 F60
G1 X15.5535 Y5.0962 F250
G1 X15.1783 Y5.4715
G1 X15.5535 Y5.0962
G1 X15.9287 Y5.4715
G1 X16.6792 Y5.4715
G1 X17.0544 Y5.0962
G1 X17.0544 Y4.3208
G1 X16.6792 Y3.9456
G1 X15.9287 Y3.9456
G1 X15.5535 Y4.3208
G0 Z1.
G4
M104 S0
(tool change position)
G1 X2. Y2. Z40. F400
M2
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment