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
e986b824
Commit
e986b824
authored
Jul 09, 2011
by
Keegi
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'kliment/master'
parents
d08bc641
61af573e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
5 deletions
+45
-5
pronterface.py
pronterface.py
+45
-5
No files found.
pronterface.py
View file @
e986b824
...
...
@@ -100,6 +100,12 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
online
(
self
):
print
"Printer is now online"
self
.
connectbtn
.
Disable
();
for
i
in
self
.
printerControls
:
i
.
Enable
()
if
self
.
filename
:
self
.
printbtn
.
Enable
()
def
sentcb
(
self
,
line
):
if
(
"G1"
in
line
):
...
...
@@ -216,6 +222,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
Close
()
def
popwindow
(
self
):
# this list will contain all controls that should be only enabled
# when we're connected to a printer
self
.
printerControls
=
[]
#sizer layout: topsizer is a column sizer containing two sections
#upper section contains the mini view buttons
#lower section contains the rest of the window - manual controls, console, visualizations
...
...
@@ -249,6 +259,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
connectbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
connect
)
self
.
disconnectbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Disconnect"
,
pos
=
(
470
,
0
))
self
.
disconnectbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
disconnect
)
self
.
printerControls
.
append
(
self
.
disconnectbtn
)
uts
.
Add
(
self
.
disconnectbtn
)
self
.
resetbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Reset"
,
pos
=
(
560
,
0
))
self
.
resetbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
reset
)
...
...
@@ -273,12 +284,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
ubs
.
Add
(
self
.
loadbtn
)
self
.
uploadbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"SD Upload"
,
pos
=
(
90
,
40
))
self
.
uploadbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
upload
)
self
.
printerControls
.
append
(
self
.
uploadbtn
)
ubs
.
Add
(
self
.
uploadbtn
)
self
.
sdprintbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"SD Print"
,
pos
=
(
180
,
40
))
self
.
sdprintbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sdprintfile
)
self
.
printerControls
.
append
(
self
.
sdprintbtn
)
ubs
.
Add
(
self
.
sdprintbtn
)
self
.
printbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Print"
,
pos
=
(
270
,
40
))
self
.
printbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
printfile
)
self
.
printbtn
.
Disable
()
ubs
.
Add
(
self
.
printbtn
)
self
.
pausebtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Pause"
,
pos
=
(
360
,
40
))
self
.
pausebtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
pause
)
...
...
@@ -303,9 +317,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
lbrs
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
commandbox
=
wx
.
TextCtrl
(
self
.
panel
,
size
=
(
250
,
30
),
pos
=
(
440
,
420
),
style
=
wx
.
TE_PROCESS_ENTER
)
self
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
sendline
)
self
.
printerControls
.
append
(
self
.
commandbox
)
lbrs
.
Add
(
self
.
commandbox
)
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Send"
,
pos
=
(
700
,
420
))
self
.
sendbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sendline
)
self
.
printerControls
.
append
(
self
.
sendbtn
)
lbrs
.
Add
(
self
.
sendbtn
)
lrs
.
Add
(
lbrs
)
...
...
@@ -328,6 +344,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
btn
.
properties
=
i
btn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
procbutton
)
self
.
btndict
[
i
[
1
]]
=
btn
self
.
printerControls
.
append
(
btn
)
lls
.
Add
(
btn
,
pos
=
i
[
2
],
span
=
i
[
4
])
...
...
@@ -339,6 +356,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
lls
.
Add
(
self
.
htemp
,
pos
=
(
11
,
1
),
span
=
(
1
,
3
))
self
.
settbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Set"
,
size
=
(
30
,
-
1
),
pos
=
(
135
,
335
))
self
.
settbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
do_settemp
)
self
.
printerControls
.
append
(
self
.
settbtn
)
lls
.
Add
(
self
.
settbtn
,
pos
=
(
11
,
4
),
span
=
(
1
,
2
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
"Bed:"
,
pos
=
(
0
,
343
)),
pos
=
(
12
,
0
),
span
=
(
1
,
1
))
self
.
btemp
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
...
...
@@ -348,6 +366,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
lls
.
Add
(
self
.
btemp
,
pos
=
(
12
,
1
),
span
=
(
1
,
3
))
self
.
setbbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Set"
,
size
=
(
30
,
-
1
),
pos
=
(
135
,
365
))
self
.
setbbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
do_bedtemp
)
self
.
printerControls
.
append
(
self
.
setbbtn
)
lls
.
Add
(
self
.
setbbtn
,
pos
=
(
12
,
4
),
span
=
(
1
,
2
))
self
.
tempdisp
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
""
)
lls
.
Add
(
self
.
tempdisp
,
pos
=
(
12
,
6
),
span
=
(
1
,
3
))
...
...
@@ -409,6 +428,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
topsizer
.
Layout
()
self
.
topsizer
.
Fit
(
self
)
# disable all printer controls until we connect to a printer
self
.
pausebtn
.
Hide
()
for
i
in
self
.
printerControls
:
i
.
Disable
()
#self.panel.Fit()
#uts.Layout()
...
...
@@ -662,6 +686,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
f
=
[
i
.
replace
(
"
\n
"
,
""
)
.
replace
(
"
\r
"
,
""
)
for
i
in
open
(
name
)]
self
.
filename
=
name
self
.
status
.
SetStatusText
(
"Loaded "
+
name
+
",
%
d lines"
%
(
len
(
self
.
f
),))
self
.
printbtn
.
SetLabel
(
"Print"
)
self
.
pausebtn
.
SetLabel
(
"Pause"
)
self
.
pausebtn
.
Hide
()
if
self
.
p
.
online
:
self
.
printbtn
.
Enable
()
threading
.
Thread
(
target
=
self
.
loadviz
)
.
start
()
def
loadviz
(
self
):
...
...
@@ -676,9 +705,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
printfile
(
self
,
event
):
if
self
.
paused
:
self
.
p
.
paused
=
0
self
.
pausebtn
.
SetLabel
(
"Pause"
)
self
.
printbtn
.
SetLabel
(
"Print"
)
self
.
paused
=
0
self
.
on_startprint
()
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M26 S0"
)
self
.
p
.
send_now
(
"M24"
)
...
...
@@ -690,10 +718,14 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
not
self
.
p
.
online
:
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
"Not connected to printer."
)
return
self
.
pausebtn
.
Enable
()
self
.
printbtn
.
SetLabel
(
"Restart"
)
self
.
on_startprint
()
self
.
p
.
startprint
(
self
.
f
)
def
on_startprint
(
self
):
self
.
pausebtn
.
SetLabel
(
"Pause"
)
self
.
pausebtn
.
Show
()
self
.
printbtn
.
SetLabel
(
"Restart"
)
def
endupload
(
self
):
self
.
p
.
send_now
(
"M29 "
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
"File upload complete"
)
...
...
@@ -742,6 +774,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
sdprintfile
(
self
,
event
):
self
.
on_startprint
()
threading
.
Thread
(
target
=
self
.
getfiles
)
.
start
()
pass
...
...
@@ -778,6 +811,13 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
disconnect
(
self
,
event
):
self
.
p
.
disconnect
()
self
.
statuscheck
=
False
self
.
connectbtn
.
Enable
();
self
.
printbtn
.
Disable
();
self
.
pausebtn
.
Hide
();
for
i
in
self
.
printerControls
:
i
.
Disable
()
if
self
.
paused
:
self
.
p
.
paused
=
0
self
.
p
.
printing
=
0
...
...
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