diff --git a/lib/pyShelf.py b/lib/pyShelf.py index ecd7c8f..ca78386 100755 --- a/lib/pyShelf.py +++ b/lib/pyShelf.py @@ -34,18 +34,35 @@ class RequestHandler(BaseHTTPRequestHandler): def do_GET(self): # TODO determine how to include stylesheets self.send_response(200) - mimetype = mimetypes.guess_type(self.path) - self.send_header('Content-type', mimetype) if self.path == '/': self.path = '../static/index.html' + mimetype = 'text/html' + serve_file = open(self.path[1:]).read() + self.send_header('Content-type', mimetype) + self.end_headers() + self.wfile.write(bytes(serve_file, 'utf-8')) elif self.path.split('.', 1)[1] == 'css': self.path = '../static' + self.path + mimetype = 'text/css' + serve_file = open(self.path[1:]).read() + self.send_header('Content-type', mimetype) + self.end_headers() + self.wfile.write(bytes(serve_file, 'utf-8')) + elif self.path.endswith('.png'): + self.path = '../static' + self.path + mimetype = 'image/png' + serve_file = open(self.path[1:], 'rb') # Important to rb read binary for images + self.send_header('Content-type', mimetype) + self.end_headers() + self.wfile.write(serve_file.read()) else: self.send_response(404) serve_file = "File Not Found" - serve_file = open(self.path[1:]).read() - self.end_headers() - self.wfile.write(bytes(serve_file, 'utf-8')) + mimetype = 'text/html' + self.send_header('Content-type', mimetype) + self.end_headers() + try: serve_file.close() + except Exception: pass class BookServer: """HTTP Frontend""" diff --git a/static/css/main.css b/static/css/main.css index 30e8f12..be4b28b 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1,21 +1,46 @@ body{ margin: 0px 10px 0px 10px; padding: 0px; + background-color: #DCDCDD; + color: #46494C } #app{ display: grid; grid-template-areas: "app_header" "app_body" "app_footer"; + grid-template-rows: 5vh 90vh 5vh; + max-height: 100% } .app_header{ grid-area: app_header; + display: grid; + grid-template-areas: "title slogan"; + align-items: center; +} +.app_hdr{ + grid-area: title; + margin: 0px; + font-family: 'Audiowide', cursive; + font-size: 25px; + text-align: start; +} +.shadow{ + text-shadow: #4c5c68 -5px 3px 5px; +} +.app_subhdr{ + grid-area: slogan; + margin: 0px; + font-family: 'Audiowide', cursive; + font-size: 18px; + text-shadow: #4c5c68 -5px 3px 5px; + text-align: end; } .app_body{ display: grid; grid-area: app_body; - grid-template-columns: 10% 80% 10%; - grid-template-areas: "left_col shelf right_col" + grid-template-columns: 20% 80%; + grid-template-areas: "left_col shelf"; } .app_footer{ grid-area: app_footer; @@ -24,8 +49,21 @@ body{ grid-area: left_col } .shelf{ - grid-area: shelf + grid-area: shelf; + margin: 0px auto 0px auto; +} +.shelf_contents{ + display: flex; + flex-direction: column; + flex: 1; } .right_col{ grid-area: right_col } +.python_logo{ + +} +#python_logo{ + height: 50px; + width: 91px; +} diff --git a/static/img/py.png b/static/img/py.png new file mode 100755 index 0000000..828eac7 Binary files /dev/null and b/static/img/py.png differ diff --git a/static/img/shelf.png b/static/img/shelf.png old mode 100644 new mode 100755 diff --git a/static/index.html b/static/index.html index 734f2e7..9e95ecb 100644 --- a/static/index.html +++ b/static/index.html @@ -6,26 +6,26 @@