Beautify web UI

Watch self.css
This commit is contained in:
Florian Festi 2016-11-01 16:58:48 +01:00
parent 0cde4a71e6
commit fe79970cc3
3 changed files with 28 additions and 7 deletions

View File

@ -192,7 +192,7 @@ class Boxes:
self.formats = formats.Formats() self.formats = formats.Formats()
self.argparser = ArgumentParser(description=self.__doc__) self.argparser = ArgumentParser(description=self.__doc__)
self.edgesettings = {} self.edgesettings = {}
self.argparser._action_groups[1].title = "Generator Settings" self.argparser._action_groups[1].title = self.__class__.__name__ + " Settings"
defaultgroup = self.argparser.add_argument_group( defaultgroup = self.argparser.add_argument_group(
"Default Settings") "Default Settings")

View File

@ -8,7 +8,8 @@ import os.path
import threading import threading
import time import time
css = (open(os.path.join(os.path.dirname(__file__), 'self.css')).read()) csspath = os.path.join(os.path.dirname(__file__), 'self.css')
css = (open(csspath).read())
# Python 2 vs Python 3 compat # Python 2 vs Python 3 compat
@ -126,10 +127,14 @@ class BServer:
e.style.display = "none"; e.style.display = "none";
} }
} }
function hideargs() {
for ( i=1; i<""" + str(len(box.argparser._action_groups)-2) + """; i++) {
showHide(i);
}
}
</script> </script>
</head> </head>
<body> <body onload="hideargs()">
<div class="container" style="background-color: #FFF8EA;"> <div class="container" style="background-color: #FFF8EA;">
@ -160,12 +165,12 @@ flex cuts, holes and slots for screws and more high level functions.
<form action="%s" method="GET" target="_blank"> <form action="%s" method="GET" target="_blank">
""" % (action)] """ % (action)]
groupid = 0 groupid = 0
for group in box.argparser._action_groups[2:] + box.argparser._action_groups[:2]: for group in box.argparser._action_groups[3:] + box.argparser._action_groups[:3]:
groupid += 1 groupid += 1
if not group._group_actions: if not group._group_actions:
continue continue
prefix = getattr(group, "prefix", None) prefix = getattr(group, "prefix", None)
result.append('<h3 onclick="showHide(%s)">%s ></h3>\n<table id="%s">\n' % (groupid, group.title, groupid)) result.append('<h3 onclick="showHide(%s)">%s</h3>\n<table id="%s">\n' % (groupid, group.title, groupid))
for a in group._group_actions: for a in group._group_actions:
if a.dest in ("input", "output"): if a.dest in ("input", "output"):
continue continue
@ -363,7 +368,7 @@ flex cuts, holes and slots for screws and more high level functions.
return (l.encode("utf-8") for l in result) return (l.encode("utf-8") for l in result)
if __name__=="__main__": if __name__=="__main__":
fc = FileChecker() fc = FileChecker(files=[csspath])
fc.start() fc.start()
boxserver = BServer() boxserver = BServer()
httpd = make_server('', 8000, boxserver.serve) httpd = make_server('', 8000, boxserver.serve)

View File

@ -52,6 +52,22 @@ h2 {
} }
h3 {
padding: 5px;
padding-left: 15px;
margin: 0px;
}
h3:hover {
background-color: #333;
color: #eee;
-webkit-border-radius: 10px;
border-radius: 10px;
}
table {
margin-left: 30px;
}
/* Container */ /* Container */