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
1d79b123
Commit
1d79b123
authored
Jul 31, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Look for configuration files in ~/.printrun/ before looking in `pwd`
parent
888143be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
printrun_utils.py
printrun/printrun_utils.py
+6
-0
webinterface.py
printrun/webinterface.py
+8
-5
pronterface.py
pronterface.py
+2
-2
No files found.
printrun/printrun_utils.py
View file @
1d79b123
...
@@ -26,3 +26,9 @@ def pixmapfile(filename):
...
@@ -26,3 +26,9 @@ def pixmapfile(filename):
if
os
.
path
.
exists
(
candidate
):
if
os
.
path
.
exists
(
candidate
):
return
candidate
return
candidate
return
filename
return
filename
def
configfile
(
filename
):
candidate
=
os
.
path
.
expanduser
(
"~/.printrun/
%
s"
%
filename
)
if
os
.
path
.
exists
(
candidate
):
return
candidate
return
filename
printrun/webinterface.py
View file @
1d79b123
#!/usr/bin/python
#!/usr/bin/python
import
cherrypy
,
pronterface
,
re
,
ConfigParser
,
threading
,
sys
import
pronterface
import
cherrypy
,
re
,
ConfigParser
,
threading
,
sys
import
os.path
import
os.path
from
printrun.printrun_utils
import
configfile
users
=
{}
users
=
{}
def
PrintHeader
():
def
PrintHeader
():
...
@@ -238,7 +241,7 @@ class WebInterface(object):
...
@@ -238,7 +241,7 @@ class WebInterface(object):
config
=
ConfigParser
.
SafeConfigParser
(
allow_no_value
=
True
)
config
=
ConfigParser
.
SafeConfigParser
(
allow_no_value
=
True
)
else
:
else
:
config
=
ConfigParser
.
SafeConfigParser
()
config
=
ConfigParser
.
SafeConfigParser
()
config
.
read
(
'auth.config'
)
config
.
read
(
configfile
(
'auth.config'
)
)
users
[
config
.
get
(
"user"
,
"user"
)]
=
config
.
get
(
"user"
,
"pass"
)
users
[
config
.
get
(
"user"
,
"user"
)]
=
config
.
get
(
"user"
,
"pass"
)
self
.
pface
=
pface
self
.
pface
=
pface
global
gPronterPtr
global
gPronterPtr
...
@@ -358,7 +361,7 @@ def KillWebInterfaceThread():
...
@@ -358,7 +361,7 @@ def KillWebInterfaceThread():
def
StartWebInterfaceThread
(
webInterface
):
def
StartWebInterfaceThread
(
webInterface
):
current_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
current_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
cherrypy
.
config
.
update
({
'engine.autoreload_on'
:
False
})
cherrypy
.
config
.
update
({
'engine.autoreload_on'
:
False
})
cherrypy
.
config
.
update
(
"http.config"
)
cherrypy
.
config
.
update
(
configfile
(
"http.config"
)
)
conf
=
{
'/css/style.css'
:
{
'tools.staticfile.on'
:
True
,
conf
=
{
'/css/style.css'
:
{
'tools.staticfile.on'
:
True
,
'tools.staticfile.filename'
:
os
.
path
.
join
(
current_dir
,
'css/style.css'
),
'tools.staticfile.filename'
:
os
.
path
.
join
(
current_dir
,
'css/style.css'
),
},
},
...
@@ -368,9 +371,9 @@ def StartWebInterfaceThread(webInterface):
...
@@ -368,9 +371,9 @@ def StartWebInterfaceThread(webInterface):
'/images/control_z.png'
:
{
'tools.staticfile.on'
:
True
,
'/images/control_z.png'
:
{
'tools.staticfile.on'
:
True
,
'tools.staticfile.filename'
:
os
.
path
.
join
(
current_dir
,
'images/control_z.png'
),
'tools.staticfile.filename'
:
os
.
path
.
join
(
current_dir
,
'images/control_z.png'
),
}}
}}
cherrypy
.
config
.
update
(
"http.config"
)
cherrypy
.
config
.
update
(
configfile
(
"http.config"
)
)
cherrypy
.
quickstart
(
webInterface
,
'/'
,
config
=
conf
)
cherrypy
.
quickstart
(
webInterface
,
'/'
,
config
=
conf
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
cherrypy
.
config
.
update
(
"http.config"
)
cherrypy
.
config
.
update
(
configfile
(
"http.config"
)
)
cherrypy
.
quickstart
(
WebInterfaceStub
())
cherrypy
.
quickstart
(
WebInterfaceStub
())
pronterface.py
View file @
1d79b123
...
@@ -51,7 +51,7 @@ from printrun import printcore, gviz
...
@@ -51,7 +51,7 @@ from printrun import printcore, gviz
from
printrun.xybuttons
import
XYButtons
from
printrun.xybuttons
import
XYButtons
from
printrun.zbuttons
import
ZButtons
from
printrun.zbuttons
import
ZButtons
from
printrun.graph
import
Graph
from
printrun.graph
import
Graph
from
printrun.printrun_utils
import
pixmapfile
from
printrun.printrun_utils
import
pixmapfile
,
configfile
import
pronsole
import
pronsole
webavail
=
False
webavail
=
False
...
@@ -137,7 +137,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -137,7 +137,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
panel
.
SetBackgroundColour
(
self
.
settings
.
bgcolor
)
self
.
panel
.
SetBackgroundColour
(
self
.
settings
.
bgcolor
)
customdict
=
{}
customdict
=
{}
try
:
try
:
execfile
(
"custombtn.txt"
,
customdict
)
execfile
(
configfile
(
"custombtn.txt"
)
,
customdict
)
if
len
(
customdict
[
"btns"
]):
if
len
(
customdict
[
"btns"
]):
if
not
len
(
self
.
custombuttons
):
if
not
len
(
self
.
custombuttons
):
try
:
try
:
...
...
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