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
1bd51e92
Commit
1bd51e92
authored
Jun 10, 2013
by
D1plo1d
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving the prontserve initialization inside __main__
parent
7d797b75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
37 deletions
+38
-37
prontserve.py
prontserve.py
+38
-37
No files found.
prontserve.py
View file @
1bd51e92
...
@@ -521,45 +521,46 @@ class PrintJobQueue(EventEmitter):
...
@@ -521,45 +521,46 @@ class PrintJobQueue(EventEmitter):
# Server Start Up
# Server Start Up
# -------------------------------------------------
# -------------------------------------------------
parser
=
argparse
.
ArgumentParser
(
if
__name__
==
"__main__"
:
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'
)
args
=
parser
.
parse_args
()
parser
=
argparse
.
ArgumentParser
(
dry_run
=
args
.
dry_run
description
=
'Runs a 3D printer server using the Construct Protocol'
)
def
warn_if_dry_run
():
parser
.
add_argument
(
'--dry-run'
,
default
=
False
,
action
=
'store_true'
,
if
dry_run
:
help
=
'Does not connect to the 3D printer'
for
i
in
range
(
0
,
7
):
)
sys
.
stdout
.
write
(
"
\x1B
[0;33m Dry Run
\x1B
[0m"
)
print
""
print
"Prontserve is starting..."
args
=
parser
.
parse_args
()
prontserve
=
Prontserve
(
dry_run
=
dry_run
)
dry_run
=
args
.
dry_run
if
dry_run
==
False
:
prontserve
.
do_connect
(
""
)
time
.
sleep
(
1
)
def
warn_if_dry_run
():
prontserve
.
run_sensor_loop
()
if
dry_run
:
prontserve
.
run_print_queue_loop
()
for
i
in
range
(
0
,
7
):
sys
.
stdout
.
write
(
"
\x1B
[0;33m Dry Run
\x1B
[0m"
)
print
""
if
__name__
==
"__main__"
:
print
"Prontserve is starting..."
application
.
listen
(
8888
)
prontserve
=
Prontserve
(
dry_run
=
dry_run
)
print
"
\n
"
+
"-"
*
80
if
dry_run
==
False
:
prontserve
.
do_connect
(
""
)
welcome
=
textwrap
.
dedent
(
u"""
+---+
\x1B
[0;32mProntserve: Your printer just got a whole lot better.
\x1B
[0m
time
.
sleep
(
1
)
|
\u2713
| Ready to print.
prontserve
.
run_sensor_loop
()
+---+ More details at http://localhost:8888/"""
)
prontserve
.
run_print_queue_loop
()
warn_if_dry_run
()
sys
.
stdout
.
write
(
welcome
)
application
.
listen
(
8888
)
print
"
\n
"
print
"
\n
"
+
"-"
*
80
warn_if_dry_run
()
welcome
=
textwrap
.
dedent
(
u"""
print
"-"
*
80
+
"
\n
"
+---+
\x1B
[0;32mProntserve: Your printer just got a whole lot better.
\x1B
[0m
|
\u2713
| Ready to print.
try
:
+---+ More details at http://localhost:8888/"""
)
prontserve
.
ioloop
.
start
()
warn_if_dry_run
()
except
:
sys
.
stdout
.
write
(
welcome
)
prontserve
.
p
.
disconnect
()
print
"
\n
"
warn_if_dry_run
()
print
"-"
*
80
+
"
\n
"
try
:
prontserve
.
ioloop
.
start
()
except
:
prontserve
.
p
.
disconnect
()
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