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
2d3a356e
Commit
2d3a356e
authored
May 25, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop self.f (for memory optimization & code cleanup)
parent
c630318b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
19 deletions
+13
-19
pronsole.py
pronsole.py
+2
-4
pronterface.py
pronterface.py
+11
-15
No files found.
pronsole.py
View file @
2d3a356e
...
...
@@ -301,7 +301,6 @@ class pronsole(cmd.Cmd):
self
.
recvlisteners
=
[]
self
.
in_macro
=
False
self
.
p
.
onlinecb
=
self
.
online
self
.
f
=
None
self
.
fgcode
=
None
self
.
listing
=
0
self
.
sdfiles
=
[]
...
...
@@ -736,10 +735,9 @@ class pronsole(cmd.Cmd):
if
not
os
.
path
.
exists
(
filename
):
self
.
log
(
"File not found!"
)
return
self
.
f
=
[
line
.
strip
()
for
line
in
open
(
filename
)]
self
.
fgcode
=
gcoder
.
GCode
(
self
.
f
)
self
.
fgcode
=
gcoder
.
GCode
(
open
(
filename
))
self
.
filename
=
filename
self
.
log
(
"Loaded
%
s,
%
d lines."
%
(
filename
,
len
(
self
.
f
)))
self
.
log
(
"Loaded
%
s,
%
d lines."
%
(
filename
,
len
(
self
.
f
gcode
)))
def
complete_load
(
self
,
text
,
line
,
begidx
,
endidx
):
s
=
line
.
split
()
...
...
pronterface.py
View file @
2d3a356e
...
...
@@ -205,7 +205,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
capture_skip_newline
=
False
self
.
tempreport
=
""
self
.
monitor
=
0
self
.
f
=
None
self
.
f
gcode
=
None
self
.
skeinp
=
None
self
.
monitor_interval
=
3
self
.
current_pos
=
[
0
,
0
,
0
]
...
...
@@ -570,14 +570,12 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
SetMenuBar
(
self
.
menustrip
)
def
doneediting
(
self
,
gcode
):
f
=
open
(
self
.
filename
,
"w"
)
f
.
write
(
"
\n
"
.
join
(
gcode
))
f
.
close
()
open
(
self
.
filename
,
"w"
)
.
write
(
"
\n
"
.
join
(
gcode
))
wx
.
CallAfter
(
self
.
loadfile
,
None
,
self
.
filename
)
def
do_editgcode
(
self
,
e
=
None
):
if
self
.
filename
is
not
None
:
MacroEditor
(
self
.
filename
,
self
.
f
,
self
.
doneediting
,
1
)
MacroEditor
(
self
.
filename
,
"
\n
"
.
join
([
line
.
raw
for
line
in
self
.
fgcode
])
,
self
.
doneediting
,
1
)
def
new_macro
(
self
,
e
=
None
):
dialog
=
wx
.
Dialog
(
self
,
-
1
,
_
(
"Enter macro name"
),
size
=
(
260
,
85
))
...
...
@@ -680,7 +678,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
obj
=
e
.
GetEventObject
()
popupmenu
=
wx
.
Menu
()
item
=
popupmenu
.
Append
(
-
1
,
_
(
"SD Upload"
))
if
not
self
.
f
:
if
not
self
.
f
gcode
:
item
.
Enable
(
False
)
self
.
Bind
(
wx
.
EVT_MENU
,
self
.
upload
,
id
=
item
.
GetId
())
item
=
popupmenu
.
Append
(
-
1
,
_
(
"SD Print"
))
...
...
@@ -698,7 +696,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
wx
.
CallAfter
(
self
.
btemp
.
SetInsertionPoint
,
0
)
def
showwin
(
self
,
event
):
if
self
.
f
:
if
self
.
f
gcode
:
self
.
gwindow
.
Show
(
True
)
self
.
gwindow
.
SetToolTip
(
wx
.
ToolTip
(
"Mousewheel zooms the display
\n
Shift / Mousewheel scrolls layers"
))
self
.
gwindow
.
Raise
()
...
...
@@ -1341,12 +1339,11 @@ class PronterWindow(MainWindow, pronsole.pronsole):
fn
=
self
.
filename
try
:
self
.
filename
=
self
.
filename
.
replace
(
".stl"
,
"_export.gcode"
)
.
replace
(
".STL"
,
"_export.gcode"
)
.
replace
(
".obj"
,
"_export.gcode"
)
.
replace
(
".OBJ"
,
"_export.gcode"
)
self
.
f
=
[
line
.
strip
()
for
line
in
open
(
self
.
filename
)]
self
.
fgcode
=
gcoder
.
GCode
(
self
.
f
)
self
.
fgcode
=
gcoder
.
GCode
(
open
(
self
.
filename
))
if
self
.
p
.
online
:
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
_
(
"Loaded
%
s,
%
d lines"
)
%
(
self
.
filename
,
len
(
self
.
f
),))
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
_
(
"Loaded
%
s,
%
d lines"
)
%
(
self
.
filename
,
len
(
self
.
f
gcode
),))
wx
.
CallAfter
(
self
.
pausebtn
.
Disable
)
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
...
...
@@ -1407,9 +1404,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
skein
(
name
)
else
:
self
.
filename
=
name
self
.
f
=
[
line
.
strip
()
for
line
in
open
(
self
.
filename
)]
self
.
fgcode
=
gcoder
.
GCode
(
self
.
f
)
self
.
status
.
SetStatusText
(
_
(
"Loaded
%
s,
%
d lines"
)
%
(
name
,
len
(
self
.
f
)))
self
.
fgcode
=
gcoder
.
GCode
(
open
(
self
.
filename
))
self
.
status
.
SetStatusText
(
_
(
"Loaded
%
s,
%
d lines"
)
%
(
name
,
len
(
self
.
fgcode
)))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
pausebtn
.
Disable
)
...
...
@@ -1446,7 +1442,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
p
.
send_now
(
"M24"
)
return
if
not
self
.
f
:
if
not
self
.
f
gcode
:
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
_
(
"No file loaded. Please use load first."
))
return
if
not
self
.
p
.
online
:
...
...
@@ -1477,7 +1473,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
recvlisteners
.
remove
(
self
.
uploadtrigger
)
def
upload
(
self
,
event
):
if
not
self
.
f
:
if
not
self
.
f
gcode
:
return
if
not
self
.
p
.
online
:
return
...
...
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