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
3ba713e5
Commit
3ba713e5
authored
Aug 04, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup status check in pronterface
parent
75fc0140
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
26 deletions
+23
-26
pronterface.py
pronterface.py
+23
-26
No files found.
pronterface.py
View file @
3ba713e5
...
@@ -102,6 +102,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -102,6 +102,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
size
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
size
)
self
.
statuscheck
=
False
self
.
statuscheck
=
False
self
.
status_thread
=
None
self
.
capture_skip
=
{}
self
.
capture_skip
=
{}
self
.
capture_skip_newline
=
False
self
.
capture_skip_newline
=
False
self
.
tempreport
=
""
self
.
tempreport
=
""
...
@@ -1259,7 +1260,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1259,7 +1260,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
raise
raise
def
kill
(
self
,
e
):
def
kill
(
self
,
e
):
self
.
statuscheck
=
0
self
.
statuscheck
=
False
self
.
status_thread
.
join
()
self
.
p
.
recvcb
=
None
self
.
p
.
recvcb
=
None
self
.
p
.
disconnect
()
self
.
p
.
disconnect
()
if
hasattr
(
self
,
"feedrates_changed"
):
if
hasattr
(
self
,
"feedrates_changed"
):
...
@@ -1322,15 +1324,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1322,15 +1324,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
statuschecker
(
self
):
def
statuschecker
(
self
):
try
:
try
:
while
(
self
.
statuscheck
):
while
self
.
statuscheck
:
string
=
""
string
=
""
#if(self.p.online):
# string+=_("Printer is online. ")
#try:
# string+=_("Loaded ")+os.path.split(self.filename)[1]+" "
#except:
# pass
#string+=(self.tempreport.replace("\r","").replace("T:",_("Hotend") + ":").replace("B:",_("Bed") + ":").replace("\n","").replace("ok ",""))+" "
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
try
:
try
:
#self.hottgauge.SetValue(parse_temperature_report(self.tempreport, "T:"))
#self.hottgauge.SetValue(parse_temperature_report(self.tempreport, "T:"))
...
@@ -1341,33 +1336,33 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1341,33 +1336,33 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
pass
pass
fractioncomplete
=
0.0
fractioncomplete
=
0.0
if
self
.
sdprinting
:
if
self
.
sdprinting
:
fractioncomplete
=
float
(
self
.
percentdone
/
100.0
)
fractioncomplete
=
float
(
self
.
percentdone
/
100.0
)
string
+=
_
(
" SD printing:
%04.2
f
%%
"
)
%
(
self
.
percentdone
,)
string
+=
_
(
" SD printing:
%04.2
f
%%
"
)
%
(
self
.
percentdone
,)
if
self
.
p
.
printing
:
if
self
.
p
.
printing
:
fractioncomplete
=
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
fractioncomplete
=
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
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
),)
string
+=
_
(
" Line#
%
d of
%
d lines |"
)
%
(
self
.
p
.
queueindex
,
len
(
self
.
p
.
mainqueue
))
string
+=
_
(
" Line#
%
d of
%
d lines |"
)
%
(
self
.
p
.
queueindex
,
len
(
self
.
p
.
mainqueue
))
if
fractioncomplete
>
0.0
:
if
fractioncomplete
>
0.0
:
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondsestimate
=
secondselapsed
/
fractioncomplete
secondsestimate
=
secondselapsed
/
fractioncomplete
secondsremain
=
secondsestimate
-
secondselapsed
secondsremain
=
secondsestimate
-
secondselapsed
string
+=
_
(
" Est:
%
s of
%
s remaining | "
)
%
(
time
.
strftime
(
'
%
H:
%
M:
%
S'
,
time
.
gmtime
(
secondsremain
)
),
string
+=
_
(
" Est:
%
s of
%
s remaining | "
)
%
(
format_time
(
secondsremain
),
time
.
strftime
(
'
%
H:
%
M:
%
S'
,
time
.
gmtime
(
secondsestimate
)
))
format_time
(
secondsestimate
))
string
+=
_
(
" Z:
%0.2
f mm"
)
%
self
.
curlayer
string
+=
_
(
" Z:
%0.2
f mm"
)
%
self
.
curlayer
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
string
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
string
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
if
(
self
.
monitor
and
self
.
p
.
online
):
if
(
self
.
monitor
and
self
.
p
.
online
):
if
self
.
sdprinting
:
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M27"
)
self
.
p
.
send_now
(
"M27"
)
if
not
hasattr
(
self
,
"auto_monitor_pattern"
):
if
not
hasattr
(
self
,
"auto_monitor_pattern"
):
self
.
auto_monitor_pattern
=
re
.
compile
(
r"(ok\s+)?T:[\d\.]+(\s+B:[\d\.]+)?(\s+@:[\d\.]+)?\s*"
)
self
.
auto_monitor_pattern
=
re
.
compile
(
r"(ok\s+)?T:[\d\.]+(\s+B:[\d\.]+)?(\s+@:[\d\.]+)?\s*"
)
self
.
capture_skip
[
self
.
auto_monitor_pattern
]
=
self
.
capture_skip
.
setdefault
(
self
.
auto_monitor_pattern
,
0
)
+
1
self
.
capture_skip
[
self
.
auto_monitor_pattern
]
=
self
.
capture_skip
.
setdefault
(
self
.
auto_monitor_pattern
,
0
)
+
1
self
.
p
.
send_now
(
"M105"
)
self
.
p
.
send_now
(
"M105"
)
time
.
sleep
(
self
.
monitor_interval
)
time
.
sleep
(
self
.
monitor_interval
)
while
not
self
.
sentlines
.
empty
():
while
not
self
.
sentlines
.
empty
():
try
:
try
:
gc
=
self
.
sentlines
.
get_nowait
()
gc
=
self
.
sentlines
.
get_nowait
()
wx
.
CallAfter
(
self
.
gviz
.
addgcode
,
gc
,
1
)
wx
.
CallAfter
(
self
.
gviz
.
addgcode
,
gc
,
1
)
except
:
except
:
break
break
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
_
(
"Not connected to printer."
))
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
_
(
"Not connected to printer."
))
...
@@ -1699,12 +1694,14 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1699,12 +1694,14 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
set
(
"port"
,
port
)
self
.
set
(
"port"
,
port
)
if
baud
!=
self
.
settings
.
baudrate
:
if
baud
!=
self
.
settings
.
baudrate
:
self
.
set
(
"baudrate"
,
str
(
baud
))
self
.
set
(
"baudrate"
,
str
(
baud
))
threading
.
Thread
(
target
=
self
.
statuschecker
)
.
start
()
self
.
status_thread
=
threading
.
Thread
(
target
=
self
.
statuschecker
)
self
.
status_thread
.
start
()
def
disconnect
(
self
,
event
):
def
disconnect
(
self
,
event
):
print
_
(
"Disconnected."
)
print
_
(
"Disconnected."
)
self
.
p
.
disconnect
()
self
.
p
.
disconnect
()
self
.
statuscheck
=
False
self
.
statuscheck
=
False
self
.
status_thread
.
join
()
self
.
connectbtn
.
SetLabel
(
"Connect"
)
self
.
connectbtn
.
SetLabel
(
"Connect"
)
self
.
connectbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Connect to the printer"
))
self
.
connectbtn
.
SetToolTip
(
wx
.
ToolTip
(
"Connect to the printer"
))
...
...
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