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
4ed07aef
Commit
4ed07aef
authored
Jun 08, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add log window and fix print from SD command
parent
f10c2dce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
pronterface.py
pronterface.py
+18
-7
No files found.
pronterface.py
View file @
4ed07aef
...
@@ -91,9 +91,11 @@ class PronterWindow(wx.Frame):
...
@@ -91,9 +91,11 @@ class PronterWindow(wx.Frame):
self
.
pausebtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
pause
)
self
.
pausebtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
pause
)
self
.
sdprintbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"SD Print"
,
pos
=
(
180
,
75
))
self
.
sdprintbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"SD Print"
,
pos
=
(
180
,
75
))
self
.
sdprintbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sdprintfile
)
self
.
sdprintbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sdprintfile
)
self
.
commandbox
=
wx
.
TextCtrl
(
self
.
panel
,
size
=
(
250
,
30
),
pos
=
(
300
,
75
),
style
=
wx
.
TE_PROCESS_ENTER
)
self
.
commandbox
=
wx
.
TextCtrl
(
self
.
panel
,
size
=
(
250
,
30
),
pos
=
(
400
,
400
),
style
=
wx
.
TE_PROCESS_ENTER
)
self
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
sendline
)
self
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
sendline
)
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Send"
,
pos
=
(
560
,
75
))
self
.
logbox
=
wx
.
TextCtrl
(
self
.
panel
,
size
=
(
350
,
300
),
pos
=
(
400
,
75
),
style
=
wx
.
TE_MULTILINE
)
self
.
logbox
.
Disable
()
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Send"
,
pos
=
(
660
,
400
))
self
.
sendbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sendline
)
self
.
sendbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sendline
)
self
.
monitorbox
=
wx
.
CheckBox
(
self
.
panel
,
-
1
,
"Monitor"
,
pos
=
(
10
,
430
))
self
.
monitorbox
=
wx
.
CheckBox
(
self
.
panel
,
-
1
,
"Monitor"
,
pos
=
(
10
,
430
))
self
.
monitorbox
.
Bind
(
wx
.
EVT_CHECKBOX
,
self
.
setmonitor
)
self
.
monitorbox
.
Bind
(
wx
.
EVT_CHECKBOX
,
self
.
setmonitor
)
...
@@ -113,7 +115,13 @@ class PronterWindow(wx.Frame):
...
@@ -113,7 +115,13 @@ class PronterWindow(wx.Frame):
self
.
monitor
=
self
.
monitorbox
.
GetValue
()
self
.
monitor
=
self
.
monitorbox
.
GetValue
()
def
sendline
(
self
,
e
):
def
sendline
(
self
,
e
):
self
.
p
.
send_now
(
self
.
commandbox
.
GetValue
())
command
=
self
.
commandbox
.
GetValue
()
if
not
len
(
command
):
return
if
(
command
[
0
]
==
"g"
or
command
[
0
]
==
"m"
):
command
=
command
.
upper
()
wx
.
CallAfter
(
self
.
logbox
.
AppendText
,
">>>"
+
command
+
"
\n
"
)
self
.
p
.
send_now
(
command
)
def
statuschecker
(
self
):
def
statuschecker
(
self
):
try
:
try
:
...
@@ -123,7 +131,7 @@ class PronterWindow(wx.Frame):
...
@@ -123,7 +131,7 @@ class PronterWindow(wx.Frame):
string
+=
"Printer is online."
string
+=
"Printer is online."
string
+=
(
self
.
tempreport
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
"Hotend"
)
.
replace
(
"B"
,
"Bed"
)
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
))
+
" "
string
+=
(
self
.
tempreport
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
"Hotend"
)
.
replace
(
"B"
,
"Bed"
)
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
))
+
" "
if
self
.
sdprinting
:
if
self
.
sdprinting
:
string
+=
"SD printing:
%04.2
f
%%
"
,(
self
.
s
percentdone
,)
string
+=
"SD printing:
%04.2
f
%%
"
%
(
self
.
percentdone
,)
if
self
.
p
.
printing
:
if
self
.
p
.
printing
:
string
+=
"printing:
%04.2
f
%%
"
%
(
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),)
string
+=
"printing:
%04.2
f
%%
"
%
(
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
string
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
string
)
...
@@ -157,7 +165,10 @@ class PronterWindow(wx.Frame):
...
@@ -157,7 +165,10 @@ class PronterWindow(wx.Frame):
def
recvcb
(
self
,
l
):
def
recvcb
(
self
,
l
):
if
"T:"
in
l
:
if
"T:"
in
l
:
self
.
tempreport
=
l
self
.
tempreport
=
l
print
l
tstring
=
l
.
replace
(
"
\n
"
,
""
)
.
replace
(
"
\r
"
,
""
)
print
tstring
if
(
tstring
!=
"ok"
):
wx
.
CallAfter
(
self
.
logbox
.
AppendText
,
tstring
+
"
\n
"
)
for
i
in
self
.
recvlisteners
:
for
i
in
self
.
recvlisteners
:
i
(
l
)
i
(
l
)
...
@@ -180,8 +191,8 @@ class PronterWindow(wx.Frame):
...
@@ -180,8 +191,8 @@ class PronterWindow(wx.Frame):
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
l
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
l
)
if
"File selected"
in
l
:
if
"File selected"
in
l
:
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
"Starting print"
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
"Starting print"
)
self
.
p
.
send_now
(
"M24"
)
self
.
sdprinting
=
1
self
.
sdprinting
=
1
self
.
p
.
send_now
(
"M24"
)
return
return
if
"Done printing file"
in
l
:
if
"Done printing file"
in
l
:
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
l
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
l
)
...
@@ -201,7 +212,7 @@ class PronterWindow(wx.Frame):
...
@@ -201,7 +212,7 @@ class PronterWindow(wx.Frame):
def
filesloaded
(
self
):
def
filesloaded
(
self
):
dlg
=
wx
.
SingleChoiceDialog
(
self
,
"Select the file to print"
,
"Pick SD file"
,
self
.
sdfiles
)
dlg
=
wx
.
SingleChoiceDialog
(
self
,
"Select the file to print"
,
"Pick SD file"
,
self
.
sdfiles
)
if
(
dlg
.
ShowModal
==
wx
.
ID_OK
):
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
target
=
dlg
.
GetStringSelection
()
target
=
dlg
.
GetStringSelection
()
if
len
(
target
):
if
len
(
target
):
self
.
recvlisteners
+=
[
self
.
waitforsdresponse
]
self
.
recvlisteners
+=
[
self
.
waitforsdresponse
]
...
...
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