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
e2e47c49
Commit
e2e47c49
authored
May 31, 2012
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added custom buttons, gui, cleaned up interface
parent
f2e87c6e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
10 deletions
+134
-10
style.css
css/style.css
+38
-1
pronterface.py
pronterface.py
+1
-2
webinterface.py
webinterface.py
+95
-7
No files found.
css/style.css
View file @
e2e47c49
...
...
@@ -38,8 +38,37 @@ color: #000;
#mainmenu
a
:hover
{
color
:
#000
;
}
#content
{
padding-top
:
25px
;
}
#controls
{
float
:
left
;
padding
:
0
0
1em
0
;
overflow
:
hidden
;
width
:
71%
;
/* right column content width */
left
:
102%
;
/* 100% plus left column left padding */
}
#control_xy
{
display
:
inline
;
}
#control_z
{
display
:
inline
;
position
:
absolute
;
}
#gui
{
float
:
left
;
padding
:
0
0
1em
0
;
overflow
:
hidden
;
width
:
21%
;
/* left column content width (column width minus left and right padding) */
left
:
6%
;
/* (right column left and right padding) plus (left column left padding) */
}
#controls
{
width
:
21%
;
/* Width of left column content (column width minus padding on either side) */
left
:
31%
;
/* width of (right column) plus (center column left and right padding) plus (left column left padding) */
}
...
...
@@ -115,6 +144,14 @@ border: none;
}
#file
{
position
:
relative
;
float
:
left
;
width
:
100%
;
height
:
20px
;
/* Height of the footer */
background
:
#eee
;
}
#logframe
{
}
pronterface.py
View file @
e2e47c49
...
...
@@ -748,7 +748,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#uts.Layout()
self
.
cbuttons_reload
()
def
plate
(
self
,
e
):
import
plater
print
"plate function activated"
...
...
webinterface.py
View file @
e2e47c49
...
...
@@ -16,6 +16,9 @@ def PrintFooter():
def
ReloadPage
(
action
):
return
"<html><head><meta http-equiv='refresh' content='0;url=/'></head><body>"
+
action
+
"</body></html>"
def
TReloadPage
(
action
):
return
action
def
clear_text
(
mypass
):
return
mypass
...
...
@@ -119,6 +122,56 @@ class PauseButton(object):
'tools.basic_auth.users'
:
users
,
'tools.basic_auth.encrypt'
:
clear_text
}
class
MoveButton
(
object
):
def
axis
(
self
,
*
args
):
if
not
args
:
raise
cherrypy
.
HTTPError
(
400
,
"No Move Command Provided!"
)
margs
=
list
(
args
)
axis
=
margs
.
pop
(
0
)
if
(
margs
and
axis
==
"x"
):
distance
=
margs
.
pop
(
0
)
gPronterPtr
.
onecmd
(
'move X
%
s'
%
distance
)
return
"Moving X Axis "
+
str
(
distance
)
if
(
margs
and
axis
==
"y"
):
distance
=
margs
.
pop
(
0
)
gPronterPtr
.
onecmd
(
'move Y
%
s'
%
distance
)
return
"Moving Y Axis "
+
str
(
distance
)
if
(
margs
and
axis
==
"z"
):
distance
=
margs
.
pop
(
0
)
gPronterPtr
.
onecmd
(
'move Z
%
s'
%
distance
)
return
"Moving Z Axis "
+
str
(
distance
)
raise
cherrypy
.
HTTPError
(
400
,
"Unmached Move Command!"
)
axis
.
exposed
=
True
axis
.
_cp_config
=
{
'tools.basic_auth.on'
:
True
,
'tools.basic_auth.realm'
:
'My Print Server'
,
'tools.basic_auth.users'
:
users
,
'tools.basic_auth.encrypt'
:
clear_text
}
class
HomeButton
(
object
):
def
axis
(
self
,
*
args
):
if
not
args
:
raise
cherrypy
.
HTTPError
(
400
,
"No Axis Provided!"
)
margs
=
list
(
args
)
taxis
=
margs
.
pop
(
0
)
if
(
taxis
==
"x"
):
gPronterPtr
.
onecmd
(
'home X'
)
return
TReloadPage
(
"Home X"
)
if
(
taxis
==
"y"
):
gPronterPtr
.
onecmd
(
'home Y'
)
return
TReloadPage
(
"Home Y"
)
if
(
taxis
==
"z"
):
gPronterPtr
.
onecmd
(
'home Z'
)
return
TReloadPage
(
"Home Z"
)
if
(
taxis
==
"all"
):
gPronterPtr
.
onecmd
(
'home'
)
return
TReloadPage
(
"Home All"
)
axis
.
exposed
=
True
axis
.
_cp_config
=
{
'tools.basic_auth.on'
:
True
,
'tools.basic_auth.realm'
:
'My Print Server'
,
'tools.basic_auth.users'
:
users
,
'tools.basic_auth.encrypt'
:
clear_text
}
class
XMLstatus
(
object
):
def
index
(
self
):
#handle connect push, then reload page
...
...
@@ -186,16 +239,45 @@ class WebInterface(object):
printbutton
=
PrintButton
()
pausebutton
=
PrintButton
()
status
=
XMLstatus
()
home
=
HomeButton
()
move
=
MoveButton
()
def
index
(
self
):
pageText
=
PrintHeader
()
+
self
.
name
+
PrintMenu
()
pageText
+=
"<div id='controls'>"
pageText
+=
"<ul><li><a href='/connect'>Connect</a></li>"
pageText
+=
"<li><a href='/disconnect'>Disconnect</a></li>"
pageText
+=
"<li><a href='/reset'>Reset</a></li>"
pageText
+=
"<li><a href='/printbutton'>Print</a></li>"
pageText
+=
"<li><a href='/pausebutton'>Pause</a></li></ul>"
pageText
+=
"</div>"
pageText
+=
"<div id='content'>
\n
"
pageText
+=
"<div id='controls'>
\n
"
pageText
+=
"<ul><li><a href='/connect'>Connect</a></li>
\n
"
pageText
+=
"<li><a href='/disconnect'>Disconnect</a></li>
\n
"
pageText
+=
"<li><a href='/reset'>Reset</a></li>
\n
"
pageText
+=
"<li><a href='/printbutton'>Print</a></li>
\n
"
pageText
+=
"<li><a href='/pausebutton'>Pause</a></li>
\n
"
for
i
in
gPronterPtr
.
cpbuttons
:
pageText
+=
"<li><a href='/custom/button/"
+
i
[
1
]
+
"'>"
+
i
[
0
]
+
"</a></li>
\n
"
#for i in gPronterPtr.custombuttons:
# print(str(i));
pageText
+=
"</ul>
\n
"
pageText
+=
"</div>
\n
"
pageText
+=
"<div id='gui'>
\n
"
pageText
+=
"<div id='control_xy'>"
pageText
+=
"<img src='/images/control_xy.png' usemap='#xymap'/>"
pageText
+=
'<map name="xymap">'
pageText
+=
'<area shape="rect" coords="0,0,44,44" href="/home/axis/x" alt="X Home" />'
pageText
+=
'<area shape="rect" coords="200,44,244,0" href="/home/axis/y" alt="Y Home" />'
pageText
+=
'<area shape="rect" coords="195,195,244,244" href="/home/axis/z" alt="Z Home" />'
pageText
+=
'<area shape="rect" coords="0,244,44,196" href="/home/axis/all" alt="All Home" />'
#TODO Map X, Y Moves
pageText
+=
"</map>"
pageText
+=
"</div>
\n
"
#endxy
pageText
+=
"<div id='control_z'>"
pageText
+=
"<img src='/images/control_z.png' />"
#TODO Map Z Moves
pageText
+=
"</div>
\n
"
#endz
pageText
+=
"</div>
\n
"
#endgui
pageText
+=
"</div>
\n
"
#endcontent
pageText
+=
"</br>
\n
"
pageText
=
pageText
+
"<div id='file'>File Loaded: <i>"
+
str
(
gPronterPtr
.
filename
)
+
"</i></div>"
pageText
+=
"<div id='logframe'><iframe src='/logpage' width='100
%
' height='100
%
'>iFraming Not Supported?? No log for you.</iframe></div>"
pageText
+=
PrintFooter
()
...
...
@@ -223,6 +305,12 @@ def StartWebInterfaceThread(webInterface):
cherrypy
.
config
.
update
(
"http.config"
)
conf
=
{
'/css/style.css'
:
{
'tools.staticfile.on'
:
True
,
'tools.staticfile.filename'
:
os
.
path
.
join
(
current_dir
,
'css/style.css'
),
},
'/images/control_xy.png'
:
{
'tools.staticfile.on'
:
True
,
'tools.staticfile.filename'
:
os
.
path
.
join
(
current_dir
,
'images/control_xy.png'
),
},
'/images/control_z.png'
:
{
'tools.staticfile.on'
:
True
,
'tools.staticfile.filename'
:
os
.
path
.
join
(
current_dir
,
'images/control_z.png'
),
}}
cherrypy
.
config
.
update
(
"http.config"
)
cherrypy
.
quickstart
(
webInterface
,
'/'
,
config
=
conf
)
...
...
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