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
883adcb4
Commit
883adcb4
authored
Apr 02, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup. No more if( !
parent
7abe770d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
17 deletions
+17
-17
objectplater.py
printrun/objectplater.py
+1
-1
plater.py
printrun/plater.py
+1
-1
projectlayer.py
printrun/projectlayer.py
+1
-1
pronsole.py
printrun/pronsole.py
+10
-10
pronterface.py
printrun/pronterface.py
+1
-1
stltool.py
printrun/stltool.py
+2
-2
stlview.py
printrun/stlview.py
+1
-1
No files found.
printrun/objectplater.py
View file @
883adcb4
...
@@ -266,7 +266,7 @@ class Plater(wx.Frame):
...
@@ -266,7 +266,7 @@ class Plater(wx.Frame):
def
export
(
self
,
event
):
def
export
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
_
(
"Pick file to save to"
),
self
.
basedir
,
style
=
wx
.
FD_SAVE
)
dlg
=
wx
.
FileDialog
(
self
,
_
(
"Pick file to save to"
),
self
.
basedir
,
style
=
wx
.
FD_SAVE
)
dlg
.
SetWildcard
(
self
.
save_wildcard
)
dlg
.
SetWildcard
(
self
.
save_wildcard
)
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
)
:
if
dlg
.
ShowModal
()
==
wx
.
ID_OK
:
name
=
dlg
.
GetPath
()
name
=
dlg
.
GetPath
()
self
.
export_to
(
name
)
self
.
export_to
(
name
)
dlg
.
Destroy
()
dlg
.
Destroy
()
...
...
printrun/plater.py
View file @
883adcb4
...
@@ -94,7 +94,7 @@ class showstl(wx.Window):
...
@@ -94,7 +94,7 @@ class showstl(wx.Window):
def
move
(
self
,
event
):
def
move
(
self
,
event
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
(
self
.
initpos
is
not
None
)
:
if
self
.
initpos
is
not
None
:
currentpos
=
event
.
GetPositionTuple
()
currentpos
=
event
.
GetPositionTuple
()
delta
=
(
0.5
*
(
currentpos
[
0
]
-
self
.
initpos
[
0
]),
delta
=
(
0.5
*
(
currentpos
[
0
]
-
self
.
initpos
[
0
]),
-
0.5
*
(
currentpos
[
1
]
-
self
.
initpos
[
1
])
-
0.5
*
(
currentpos
[
1
]
-
self
.
initpos
[
1
])
...
...
printrun/projectlayer.py
View file @
883adcb4
...
@@ -575,7 +575,7 @@ class SettingsFrame(wx.Frame):
...
@@ -575,7 +575,7 @@ class SettingsFrame(wx.Frame):
def
load_file
(
self
,
event
):
def
load_file
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
(
"Open file to print"
),
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
=
wx
.
FileDialog
(
self
,
(
"Open file to print"
),
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
.
SetWildcard
((
"Slic3r or Skeinforge svg files (;*.svg;*.SVG;);3DLP Zip (;*.3dlp.zip;)"
))
dlg
.
SetWildcard
((
"Slic3r or Skeinforge svg files (;*.svg;*.SVG;);3DLP Zip (;*.3dlp.zip;)"
))
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
)
:
if
dlg
.
ShowModal
()
==
wx
.
ID_OK
:
name
=
dlg
.
GetPath
()
name
=
dlg
.
GetPath
()
if
not
(
os
.
path
.
exists
(
name
)):
if
not
(
os
.
path
.
exists
(
name
)):
self
.
status
.
SetStatusText
((
"File not found!"
))
self
.
status
.
SetStatusText
((
"File not found!"
))
...
...
printrun/pronsole.py
View file @
883adcb4
...
@@ -711,7 +711,7 @@ class pronsole(cmd.Cmd):
...
@@ -711,7 +711,7 @@ class pronsole(cmd.Cmd):
def
complete_macro
(
self
,
text
,
line
,
begidx
,
endidx
):
def
complete_macro
(
self
,
text
,
line
,
begidx
,
endidx
):
if
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
!=
" "
)
or
(
len
(
line
.
split
())
==
1
and
line
[
-
1
]
==
" "
):
if
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
!=
" "
)
or
(
len
(
line
.
split
())
==
1
and
line
[
-
1
]
==
" "
):
return
[
i
for
i
in
self
.
macros
.
keys
()
if
i
.
startswith
(
text
)]
return
[
i
for
i
in
self
.
macros
.
keys
()
if
i
.
startswith
(
text
)]
elif
(
len
(
line
.
split
())
==
3
or
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
==
" "
)
):
elif
len
(
line
.
split
())
==
3
or
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
==
" "
):
return
[
i
for
i
in
[
"/D"
,
"/S"
]
+
self
.
completenames
(
text
)
if
i
.
startswith
(
text
)]
return
[
i
for
i
in
[
"/D"
,
"/S"
]
+
self
.
completenames
(
text
)
if
i
.
startswith
(
text
)]
else
:
else
:
return
[]
return
[]
...
@@ -883,7 +883,7 @@ class pronsole(cmd.Cmd):
...
@@ -883,7 +883,7 @@ class pronsole(cmd.Cmd):
def
complete_set
(
self
,
text
,
line
,
begidx
,
endidx
):
def
complete_set
(
self
,
text
,
line
,
begidx
,
endidx
):
if
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
!=
" "
)
or
(
len
(
line
.
split
())
==
1
and
line
[
-
1
]
==
" "
):
if
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
!=
" "
)
or
(
len
(
line
.
split
())
==
1
and
line
[
-
1
]
==
" "
):
return
[
i
for
i
in
dir
(
self
.
settings
)
if
not
i
.
startswith
(
"_"
)
and
i
.
startswith
(
text
)]
return
[
i
for
i
in
dir
(
self
.
settings
)
if
not
i
.
startswith
(
"_"
)
and
i
.
startswith
(
text
)]
elif
(
len
(
line
.
split
())
==
3
or
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
==
" "
)
):
elif
len
(
line
.
split
())
==
3
or
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
==
" "
):
return
[
i
for
i
in
self
.
settings
.
_tabcomplete
(
line
.
split
()[
1
])
if
i
.
startswith
(
text
)]
return
[
i
for
i
in
self
.
settings
.
_tabcomplete
(
line
.
split
()[
1
])
if
i
.
startswith
(
text
)]
else
:
else
:
return
[]
return
[]
...
@@ -1071,7 +1071,7 @@ class pronsole(cmd.Cmd):
...
@@ -1071,7 +1071,7 @@ class pronsole(cmd.Cmd):
self
.
log
(
"connect <port> <baudrate>"
)
self
.
log
(
"connect <port> <baudrate>"
)
self
.
log
(
"If port and baudrate are not specified, connects to first detected port at 115200bps"
)
self
.
log
(
"If port and baudrate are not specified, connects to first detected port at 115200bps"
)
ports
=
self
.
scanserial
()
ports
=
self
.
scanserial
()
if
(
len
(
ports
))
:
if
ports
:
self
.
log
(
"Available ports: "
,
" "
.
join
(
ports
))
self
.
log
(
"Available ports: "
,
" "
.
join
(
ports
))
else
:
else
:
self
.
log
(
"No serial ports were automatically found."
)
self
.
log
(
"No serial ports were automatically found."
)
...
@@ -1079,7 +1079,7 @@ class pronsole(cmd.Cmd):
...
@@ -1079,7 +1079,7 @@ class pronsole(cmd.Cmd):
def
complete_connect
(
self
,
text
,
line
,
begidx
,
endidx
):
def
complete_connect
(
self
,
text
,
line
,
begidx
,
endidx
):
if
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
!=
" "
)
or
(
len
(
line
.
split
())
==
1
and
line
[
-
1
]
==
" "
):
if
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
!=
" "
)
or
(
len
(
line
.
split
())
==
1
and
line
[
-
1
]
==
" "
):
return
[
i
for
i
in
self
.
scanserial
()
if
i
.
startswith
(
text
)]
return
[
i
for
i
in
self
.
scanserial
()
if
i
.
startswith
(
text
)]
elif
(
len
(
line
.
split
())
==
3
or
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
==
" "
)
):
elif
len
(
line
.
split
())
==
3
or
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
==
" "
):
return
[
i
for
i
in
[
"2400"
,
"9600"
,
"19200"
,
"38400"
,
"57600"
,
"115200"
]
if
i
.
startswith
(
text
)]
return
[
i
for
i
in
[
"2400"
,
"9600"
,
"19200"
,
"38400"
,
"57600"
,
"115200"
]
if
i
.
startswith
(
text
)]
else
:
else
:
return
[]
return
[]
...
@@ -1658,7 +1658,7 @@ class pronsole(cmd.Cmd):
...
@@ -1658,7 +1658,7 @@ class pronsole(cmd.Cmd):
self
.
log
(
_
(
"Switches to the specified tool (e.g. doing tool 1 will emit a T1 G-Code)."
))
self
.
log
(
_
(
"Switches to the specified tool (e.g. doing tool 1 will emit a T1 G-Code)."
))
def
do_move
(
self
,
l
):
def
do_move
(
self
,
l
):
if
(
len
(
l
.
split
())
<
2
)
:
if
len
(
l
.
split
())
<
2
:
self
.
logError
(
_
(
"No move specified."
))
self
.
logError
(
_
(
"No move specified."
))
return
return
if
self
.
p
.
printing
:
if
self
.
p
.
printing
:
...
@@ -1668,16 +1668,16 @@ class pronsole(cmd.Cmd):
...
@@ -1668,16 +1668,16 @@ class pronsole(cmd.Cmd):
self
.
logError
(
_
(
"Printer is not online. Unable to move."
))
self
.
logError
(
_
(
"Printer is not online. Unable to move."
))
return
return
l
=
l
.
split
()
l
=
l
.
split
()
if
(
l
[
0
]
.
lower
()
==
"x"
)
:
if
l
[
0
]
.
lower
()
==
"x"
:
feed
=
self
.
settings
.
xy_feedrate
feed
=
self
.
settings
.
xy_feedrate
axis
=
"X"
axis
=
"X"
elif
(
l
[
0
]
.
lower
()
==
"y"
)
:
elif
l
[
0
]
.
lower
()
==
"y"
:
feed
=
self
.
settings
.
xy_feedrate
feed
=
self
.
settings
.
xy_feedrate
axis
=
"Y"
axis
=
"Y"
elif
(
l
[
0
]
.
lower
()
==
"z"
)
:
elif
l
[
0
]
.
lower
()
==
"z"
:
feed
=
self
.
settings
.
z_feedrate
feed
=
self
.
settings
.
z_feedrate
axis
=
"Z"
axis
=
"Z"
elif
(
l
[
0
]
.
lower
()
==
"e"
)
:
elif
l
[
0
]
.
lower
()
==
"e"
:
feed
=
self
.
settings
.
e_feedrate
feed
=
self
.
settings
.
e_feedrate
axis
=
"E"
axis
=
"E"
else
:
else
:
...
@@ -1706,7 +1706,7 @@ class pronsole(cmd.Cmd):
...
@@ -1706,7 +1706,7 @@ class pronsole(cmd.Cmd):
def
complete_move
(
self
,
text
,
line
,
begidx
,
endidx
):
def
complete_move
(
self
,
text
,
line
,
begidx
,
endidx
):
if
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
!=
" "
)
or
(
len
(
line
.
split
())
==
1
and
line
[
-
1
]
==
" "
):
if
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
!=
" "
)
or
(
len
(
line
.
split
())
==
1
and
line
[
-
1
]
==
" "
):
return
[
i
for
i
in
[
"X "
,
"Y "
,
"Z "
,
"E "
]
if
i
.
lower
()
.
startswith
(
text
)]
return
[
i
for
i
in
[
"X "
,
"Y "
,
"Z "
,
"E "
]
if
i
.
lower
()
.
startswith
(
text
)]
elif
(
len
(
line
.
split
())
==
3
or
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
==
" "
)
):
elif
len
(
line
.
split
())
==
3
or
(
len
(
line
.
split
())
==
2
and
line
[
-
1
]
==
" "
):
base
=
line
.
split
()[
-
1
]
base
=
line
.
split
()[
-
1
]
rlen
=
0
rlen
=
0
if
base
.
startswith
(
"-"
):
if
base
.
startswith
(
"-"
):
...
...
printrun/pronterface.py
View file @
883adcb4
...
@@ -1200,7 +1200,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1200,7 +1200,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
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
.
append
(
self
.
waitforsdresponse
)
self
.
recvlisteners
.
append
(
self
.
waitforsdresponse
)
...
...
printrun/stltool.py
View file @
883adcb4
...
@@ -232,12 +232,12 @@ if __name__ == "__main__":
...
@@ -232,12 +232,12 @@ if __name__ == "__main__":
for
i
in
xrange
(
11
,
11
):
for
i
in
xrange
(
11
,
11
):
working
=
s
.
facets
[:]
working
=
s
.
facets
[:]
for
j
in
reversed
(
sorted
(
s
.
facetsminz
)):
for
j
in
reversed
(
sorted
(
s
.
facetsminz
)):
if
(
j
[
0
]
>
i
)
:
if
j
[
0
]
>
i
:
working
.
remove
(
j
[
1
])
working
.
remove
(
j
[
1
])
else
:
else
:
break
break
for
j
in
(
sorted
(
s
.
facetsmaxz
)):
for
j
in
(
sorted
(
s
.
facetsmaxz
)):
if
(
j
[
0
]
<
i
)
:
if
j
[
0
]
<
i
:
working
.
remove
(
j
[
1
])
working
.
remove
(
j
[
1
])
else
:
else
:
break
break
...
...
printrun/stlview.py
View file @
883adcb4
...
@@ -233,7 +233,7 @@ class StlViewPanel(wxGLPanel):
...
@@ -233,7 +233,7 @@ class StlViewPanel(wxGLPanel):
time
.
sleep
(
dt
)
time
.
sleep
(
dt
)
obj
.
offsets
[
2
]
-=
v
*
dt
obj
.
offsets
[
2
]
-=
v
*
dt
v
+=
g
*
dt
v
+=
g
*
dt
if
(
obj
.
offsets
[
2
]
<
0
)
:
if
obj
.
offsets
[
2
]
<
0
:
obj
.
scale
[
2
]
*=
1
-
3
*
dt
obj
.
scale
[
2
]
*=
1
-
3
*
dt
#return
#return
v
=
v
/
4
v
=
v
/
4
...
...
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