From fe79970cc391be94d8ddc3daf8a88e603a87d23a Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Tue, 1 Nov 2016 16:58:48 +0100 Subject: [PATCH] Beautify web UI Watch self.css --- boxes/__init__.py | 2 +- scripts/boxesserver | 17 +++++++++++------ scripts/self.css | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/boxes/__init__.py b/boxes/__init__.py index 868c51d..0485d79 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -192,7 +192,7 @@ class Boxes: self.formats = formats.Formats() self.argparser = ArgumentParser(description=self.__doc__) 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( "Default Settings") diff --git a/scripts/boxesserver b/scripts/boxesserver index 9247248..62ed31a 100755 --- a/scripts/boxesserver +++ b/scripts/boxesserver @@ -8,7 +8,8 @@ import os.path import threading 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 @@ -126,10 +127,14 @@ class BServer: e.style.display = "none"; } } + function hideargs() { + for ( i=1; i<""" + str(len(box.argparser._action_groups)-2) + """; i++) { + showHide(i); + } + } - - +
@@ -160,12 +165,12 @@ flex cuts, holes and slots for screws and more high level functions.
""" % (action)] 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 if not group._group_actions: continue prefix = getattr(group, "prefix", None) - result.append('

%s >

\n\n' % (groupid, group.title, groupid)) + result.append('

%s

\n
\n' % (groupid, group.title, groupid)) for a in group._group_actions: if a.dest in ("input", "output"): 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) if __name__=="__main__": - fc = FileChecker() + fc = FileChecker(files=[csspath]) fc.start() boxserver = BServer() httpd = make_server('', 8000, boxserver.serve) diff --git a/scripts/self.css b/scripts/self.css index 2da8dcf..1f09e49 100644 --- a/scripts/self.css +++ b/scripts/self.css @@ -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 */