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
18faecc6
Commit
18faecc6
authored
Jul 29, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:kliment/Printrun
parents
04b0ca00
d706b876
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
23 deletions
+35
-23
prontserve.py
prontserve.py
+35
-23
No files found.
prontserve.py
View file @
18faecc6
...
@@ -2,18 +2,49 @@
...
@@ -2,18 +2,49 @@
import
glob
,
os
,
time
,
datetime
,
sys
,
codecs
,
random
,
textwrap
,
re
,
traceback
import
glob
,
os
,
time
,
datetime
,
sys
,
codecs
,
random
,
textwrap
,
re
,
traceback
import
logging
,
argparse
,
tornado
.
ioloop
,
printcore
,
pronsole
import
logging
,
argparse
,
tornado
.
ioloop
,
printcore
,
pronsole
from
pprint
import
pprint
# Allow construct protocol developers to use a specific lib for dev purposes
c_path
=
os
.
getenv
(
'PY_CONSTRUCT_PATH'
)
if
c_path
!=
None
:
print
"$PY_CONSTRUCT_PATH detected, loading server lib from:
\n
%
s"
%
c_path
sys
.
path
.
insert
(
1
,
c_path
)
from
construct_server.construct_server
import
ConstructServer
from
construct_server.construct_server
import
ConstructServer
from
construct_server.event_emitter
import
EventEmitter
from
construct_server.event_emitter
import
EventEmitter
from
pprint
import
pprint
from
printrun
import
gcoder
from
printrun
import
gcoder
sys
.
stdout
=
codecs
.
getwriter
(
'utf8'
)(
sys
.
stdout
)
sys
.
stdout
=
codecs
.
getwriter
(
'utf8'
)(
sys
.
stdout
)
log
=
logging
.
getLogger
(
"root"
)
log
=
logging
.
getLogger
(
"root"
)
# Args
# -------------------------------------------------
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
description
=
'Runs a 3D printer server using the Construct Protocol'
)
parser
.
add_argument
(
'--dry-run'
,
default
=
False
,
action
=
'store_true'
,
help
=
'Does not connect to the 3D printer'
)
parser
.
add_argument
(
'--loud'
,
default
=
False
,
action
=
'store_true'
,
help
=
'Enables verbose printer output'
)
parser
.
add_argument
(
'--heaptrace'
,
default
=
False
,
action
=
'store_true'
,
help
=
'Enables a heap trace on exit (for developer use)'
)
args
=
parser
.
parse_args
()
if
args
.
heaptrace
:
from
guppy
import
hpy
# Routes
# -------------------------------------------------
class
RootHandler
(
tornado
.
web
.
RequestHandler
):
class
RootHandler
(
tornado
.
web
.
RequestHandler
):
def
get
(
self
):
def
get
(
self
):
self
.
render
(
"index.html"
)
self
.
render
(
"index.html"
)
...
@@ -325,23 +356,4 @@ class Prontserve(pronsole.pronsole, EventEmitter):
...
@@ -325,23 +356,4 @@ class Prontserve(pronsole.pronsole, EventEmitter):
# -------------------------------------------------
# -------------------------------------------------
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
description
=
'Runs a 3D printer server using the Construct Protocol'
)
parser
.
add_argument
(
'--dry-run'
,
default
=
False
,
action
=
'store_true'
,
help
=
'Does not connect to the 3D printer'
)
parser
.
add_argument
(
'--loud'
,
default
=
False
,
action
=
'store_true'
,
help
=
'Enables verbose printer output'
)
parser
.
add_argument
(
'--heaptrace'
,
default
=
False
,
action
=
'store_true'
,
help
=
'Enables a heap trace on exit (for developer use)'
)
args
=
parser
.
parse_args
()
if
args
.
heaptrace
:
from
guppy
import
hpy
prontserve
=
Prontserve
(
dry_run
=
args
.
dry_run
,
loud
=
args
.
loud
)
.
start
()
prontserve
=
Prontserve
(
dry_run
=
args
.
dry_run
,
loud
=
args
.
loud
)
.
start
()
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