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
79979ef5
Commit
79979ef5
authored
Oct 23, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:kliment/Printrun
parents
49099158
4b25bb34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
18 deletions
+28
-18
__init__.py
printrun/power/__init__.py
+18
-11
stlplater.py
printrun/stlplater.py
+10
-7
No files found.
printrun/power/__init__.py
View file @
79979ef5
...
...
@@ -77,6 +77,20 @@ else:
try
:
import
psutil
def
get_nice
(
nice
,
p
=
None
):
if
not
p
:
p
=
psutil
.
Process
(
os
.
getpid
())
if
callable
(
p
.
nice
):
return
p
.
nice
()
else
:
return
p
.
nice
def
set_nice
(
nice
,
p
=
None
):
if
not
p
:
p
=
psutil
.
Process
(
os
.
getpid
())
if
callable
(
p
.
nice
):
p
.
nice
(
nice
)
else
:
p
.
nice
=
nice
if
platform
.
system
()
!=
"Windows"
:
import
resource
if
hasattr
(
psutil
,
"RLIMIT_NICE"
):
...
...
@@ -87,22 +101,15 @@ try:
# RLIMIT_NICE is not available (probably OSX), let's probe
# Try setting niceness to -20 .. -1
p
=
psutil
.
Process
(
os
.
getpid
())
orig_nice
=
p
.
get_nice
(
)
orig_nice
=
get_nice
(
p
)
for
i
in
range
(
-
20
,
0
):
try
:
p
.
set_nice
(
i
)
set_nice
(
i
,
p
)
high_priority_nice
=
i
break
except
psutil
.
AccessDenied
,
e
:
pass
p
.
set_nice
(
orig_nice
)
def
set_nice
(
nice
):
p
=
psutil
.
Process
(
os
.
getpid
())
if
callable
(
p
.
nice
):
p
.
nice
(
nice
)
else
:
p
.
nice
=
nice
set_nice
(
orig_nice
,
p
)
def
set_priority
():
if
platform
.
system
()
==
"Windows"
:
...
...
@@ -126,7 +133,7 @@ try:
reset_priority
()
deinhibit_sleep
()
except
ImportError
,
e
:
logging
.
warning
(
"psutil unavailable, could not import power utils:"
+
e
)
logging
.
warning
(
"psutil unavailable, could not import power utils:"
+
str
(
e
)
)
def
powerset_print_start
(
reason
):
pass
...
...
printrun/stlplater.py
View file @
79979ef5
...
...
@@ -266,7 +266,7 @@ class StlPlaterPanel(PlaterPanel):
self
.
menusizer
.
Add
(
cutpanel
,
pos
=
(
nrows
+
1
,
0
),
span
=
(
1
,
2
),
flag
=
wx
.
EXPAND
)
else
:
viewer
=
showstl
(
self
,
(
580
,
580
),
(
0
,
0
))
self
.
simarrange_path
=
simarrange_path
if
simarrange_path
else
"./simarrange/sa"
self
.
simarrange_path
=
simarrange_path
self
.
set_viewer
(
viewer
)
def
start_cutting_tool
(
self
,
event
,
axis
,
direction
):
...
...
@@ -475,12 +475,15 @@ class StlPlaterPanel(PlaterPanel):
logging
.
info
(
_
(
"Wrote plate to
%
s"
)
%
name
)
def
autoplate
(
self
,
event
=
None
):
try
:
self
.
autoplate_simarrange
()
except
Exception
,
e
:
logging
.
warning
(
_
(
"Failed to use simarrange for plating, "
"falling back to the standard method. "
"The error was: "
)
+
e
)
if
self
.
simarrange_path
:
try
:
self
.
autoplate_simarrange
()
except
Exception
,
e
:
logging
.
warning
(
_
(
"Failed to use simarrange for plating, "
"falling back to the standard method. "
"The error was: "
)
+
e
)
super
(
StlPlater
,
self
)
.
autoplate
()
else
:
super
(
StlPlater
,
self
)
.
autoplate
()
def
autoplate_simarrange
(
self
):
...
...
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