Merge branch 'devel' into CapnBry-sendperf
Conflicts: octoprint/util/__init__.pymaster
commit
5b976b5300
|
@ -185,7 +185,7 @@ class CommandTrigger(GenericEventListener):
|
||||||
|
|
||||||
The following substitutions are currently supported:
|
The following substitutions are currently supported:
|
||||||
|
|
||||||
- %(currentZ)s : current Z position of the print head
|
- %(currentZ)s : current Z position of the print head, or -1 if not available
|
||||||
- %(filename)s : current selected filename, or "NO FILE" if no file is selected
|
- %(filename)s : current selected filename, or "NO FILE" if no file is selected
|
||||||
- %(progress)s : current print progress in percent, 0 if no print is in progress
|
- %(progress)s : current print progress in percent, 0 if no print is in progress
|
||||||
- %(data)s : the string representation of the event's payload
|
- %(data)s : the string representation of the event's payload
|
||||||
|
|
|
@ -130,6 +130,13 @@ class PrinterStateConnection(tornadio2.SocketConnection):
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
|
branch = None
|
||||||
|
commit = None
|
||||||
|
try:
|
||||||
|
branch, commit = util.getGitInfo()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"index.jinja2",
|
"index.jinja2",
|
||||||
ajaxBaseUrl=BASEURL,
|
ajaxBaseUrl=BASEURL,
|
||||||
|
@ -138,7 +145,9 @@ def index():
|
||||||
enableGCodeVisualizer=settings().get(["feature", "gCodeVisualizer"]),
|
enableGCodeVisualizer=settings().get(["feature", "gCodeVisualizer"]),
|
||||||
enableSystemMenu=settings().get(["system"]) is not None and settings().get(["system", "actions"]) is not None and len(settings().get(["system", "actions"])) > 0,
|
enableSystemMenu=settings().get(["system"]) is not None and settings().get(["system", "actions"]) is not None and len(settings().get(["system", "actions"])) > 0,
|
||||||
enableAccessControl=userManager is not None,
|
enableAccessControl=userManager is not None,
|
||||||
enableSdSupport=settings().get(["feature", "sdSupport"])
|
enableSdSupport=settings().get(["feature", "sdSupport"]),
|
||||||
|
gitBranch=branch,
|
||||||
|
gitCommit=commit
|
||||||
)
|
)
|
||||||
|
|
||||||
#~~ Printer control
|
#~~ Printer control
|
||||||
|
|
|
@ -441,15 +441,22 @@ ul.dropdown-menu li a {
|
||||||
|
|
||||||
/** Footer */
|
/** Footer */
|
||||||
.footer {
|
.footer {
|
||||||
text-align: right;
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
ul li {
|
li {
|
||||||
display: inline;
|
&:first-child {
|
||||||
margin-left: 1em;
|
margin-left: 0;
|
||||||
font-size: 85%;
|
}
|
||||||
a {
|
|
||||||
color: #555;
|
display: inline;
|
||||||
|
margin-left: 1em;
|
||||||
|
font-size: 85%;
|
||||||
|
a {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -568,7 +568,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<ul>
|
{% if gitBranch and gitCommit %}
|
||||||
|
<ul class="pull-left muted">
|
||||||
|
<li><small>Branch: {{ gitBranch }}, Commit: {{ gitCommit }}</small></li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
<ul class="pull-right">
|
||||||
<li><a href="http://octoprint.org"><i class="icon-home"></i> Homepage</a></li>
|
<li><a href="http://octoprint.org"><i class="icon-home"></i> Homepage</a></li>
|
||||||
<li><a href="https://github.com/foosel/OctoPrint/"><i class="icon-download"></i> Sourcecode</a></li>
|
<li><a href="https://github.com/foosel/OctoPrint/"><i class="icon-download"></i> Sourcecode</a></li>
|
||||||
<li><a href="https://github.com/foosel/OctoPrint/wiki"><i class="icon-book"></i> Documentation</a></li>
|
<li><a href="https://github.com/foosel/OctoPrint/wiki"><i class="icon-book"></i> Documentation</a></li>
|
||||||
|
|
|
@ -63,3 +63,22 @@ def getExceptionString():
|
||||||
|
|
||||||
def matchesGcode(line, gcode):
|
def matchesGcode(line, gcode):
|
||||||
return re.search("^%s(\D|$)" % gcode.strip(), line, re.I)
|
return re.search("^%s(\D|$)" % gcode.strip(), line, re.I)
|
||||||
|
|
||||||
|
def getGitInfo():
|
||||||
|
gitPath = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../../.git"))
|
||||||
|
if not os.path.exists(gitPath):
|
||||||
|
return (None, None)
|
||||||
|
|
||||||
|
headref = None
|
||||||
|
with open(os.path.join(gitPath, "HEAD"), "r") as f:
|
||||||
|
headref = f.readline().strip()
|
||||||
|
|
||||||
|
if headref is None:
|
||||||
|
return (None, None)
|
||||||
|
|
||||||
|
headref = headref[len("ref: "):]
|
||||||
|
branch = headref[headref.rfind("/") + 1:]
|
||||||
|
with open(os.path.join(gitPath, headref)) as f:
|
||||||
|
head = f.readline().strip()
|
||||||
|
|
||||||
|
return (branch, head)
|
||||||
|
|
Loading…
Reference in New Issue