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
40ba0e59
Commit
40ba0e59
authored
Jun 10, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restart functionality
parent
cac4a96f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
pronterface.py
pronterface.py
+39
-1
No files found.
pronterface.py
View file @
40ba0e59
...
@@ -222,7 +222,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -222,7 +222,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
logbox
.
SetEditable
(
0
)
self
.
logbox
.
SetEditable
(
0
)
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Send"
,
pos
=
(
700
,
420
))
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
"Send"
,
pos
=
(
700
,
420
))
self
.
sendbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sendline
)
self
.
sendbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
sendline
)
self
.
monitorbox
=
wx
.
CheckBox
(
self
.
panel
,
-
1
,
"Monitor
\n
printer"
,
pos
=
(
450
,
37
))
self
.
monitorbox
=
wx
.
CheckBox
(
self
.
panel
,
-
1
,
""
,
pos
=
(
450
,
37
))
wx
.
StaticText
(
self
.
panel
,
-
1
,
"Monitor
\n
printer"
,
pos
=
(
470
,
37
))
self
.
monitorbox
.
Bind
(
wx
.
EVT_CHECKBOX
,
self
.
setmonitor
)
self
.
monitorbox
.
Bind
(
wx
.
EVT_CHECKBOX
,
self
.
setmonitor
)
self
.
status
=
self
.
CreateStatusBar
()
self
.
status
=
self
.
CreateStatusBar
()
self
.
status
.
SetStatusText
(
"Not connected to printer."
)
self
.
status
.
SetStatusText
(
"Not connected to printer."
)
...
@@ -499,12 +500,24 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -499,12 +500,24 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
status
.
SetStatusText
(
"Loaded "
+
name
+
",
%
d lines"
%
(
len
(
self
.
f
),))
self
.
status
.
SetStatusText
(
"Loaded "
+
name
+
",
%
d lines"
%
(
len
(
self
.
f
),))
def
printfile
(
self
,
event
):
def
printfile
(
self
,
event
):
if
self
.
paused
:
self
.
p
.
paused
=
0
self
.
pausebtn
.
SetLabel
(
"Pause"
)
self
.
printbtn
.
SetLabel
(
"Print"
)
self
.
paused
=
0
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M26 S0"
)
self
.
p
.
send_now
(
"M24"
)
return
if
self
.
f
is
None
or
not
len
(
self
.
f
):
if
self
.
f
is
None
or
not
len
(
self
.
f
):
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
"No file loaded. Please use load first."
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
"No file loaded. Please use load first."
)
return
return
if
not
self
.
p
.
online
:
if
not
self
.
p
.
online
:
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
"Not connected to printer."
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
"Not connected to printer."
)
return
return
self
.
pausebtn
.
Enable
()
self
.
printbtn
.
SetLabel
(
"Restart"
)
self
.
p
.
startprint
(
self
.
f
)
self
.
p
.
startprint
(
self
.
f
)
def
endupload
(
self
):
def
endupload
(
self
):
...
@@ -571,18 +584,43 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -571,18 +584,43 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
baud
=
int
(
self
.
baud
.
GetValue
())
baud
=
int
(
self
.
baud
.
GetValue
())
except
:
except
:
pass
pass
if
self
.
paused
:
self
.
p
.
paused
=
0
self
.
p
.
printing
=
0
self
.
pausebtn
.
SetLabel
(
"Pause"
)
self
.
printbtn
.
SetLabel
(
"Print"
)
self
.
paused
=
0
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M26 S0"
)
self
.
p
.
connect
(
port
,
baud
)
self
.
p
.
connect
(
port
,
baud
)
self
.
statuscheck
=
True
self
.
statuscheck
=
True
threading
.
Thread
(
target
=
self
.
statuschecker
)
.
start
()
threading
.
Thread
(
target
=
self
.
statuschecker
)
.
start
()
def
disconnect
(
self
,
event
):
def
disconnect
(
self
,
event
):
self
.
p
.
disconnect
()
self
.
p
.
disconnect
()
self
.
statuscheck
=
False
self
.
statuscheck
=
False
if
self
.
paused
:
self
.
p
.
paused
=
0
self
.
p
.
printing
=
0
self
.
pausebtn
.
SetLabel
(
"Pause"
)
self
.
printbtn
.
SetLabel
(
"Print"
)
self
.
paused
=
0
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M26 S0"
)
def
reset
(
self
,
event
):
def
reset
(
self
,
event
):
dlg
=
wx
.
MessageDialog
(
self
,
"Are you sure you want to reset the printer?"
,
"Reset?"
,
wx
.
YES
|
wx
.
NO
)
dlg
=
wx
.
MessageDialog
(
self
,
"Are you sure you want to reset the printer?"
,
"Reset?"
,
wx
.
YES
|
wx
.
NO
)
if
dlg
.
ShowModal
()
==
wx
.
ID_YES
:
if
dlg
.
ShowModal
()
==
wx
.
ID_YES
:
self
.
p
.
reset
()
self
.
p
.
reset
()
if
self
.
paused
:
self
.
p
.
paused
=
0
self
.
p
.
printing
=
0
self
.
pausebtn
.
SetLabel
(
"Pause"
)
self
.
printbtn
.
SetLabel
(
"Print"
)
self
.
paused
=
0
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
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