Skip to content

Commit

Permalink
Added stylized UI, and squashed rare bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
cittyinthecloud committed May 5, 2018
1 parent e75bf75 commit bc31025
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 15 deletions.
18 changes: 11 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
modspath = Path.cwd()/"mods"
logging.basicConfig(filename='fDDMEPlayer.log', filemode='w', level=logging.INFO, format="[%(levelname)s|%(levelno)s] (%(funcName)s) %(message)s")

addmodgui = None

def findParent(names, path):
for root, dirs, files in os.walk(path):
for name in names:
Expand Down Expand Up @@ -52,7 +54,7 @@ def moveTree(src, dst):
if os.path.isdir(s):
isRecursive = not isAFlatDir(s)
if isRecursive:
copyTree(s, d)
moveTree(s, d)
else:
forceMergeFlatDir(s, d)

Expand All @@ -69,10 +71,17 @@ def modlist():

@app.route('/addmod')
def addmod():
global addmodgui
addmodgui = gui("Add Mod")
addmodgui.addLabel("title", "Add a Mod")
addmodgui.addLabelEntry("Mod Name")
addmodgui.addFileEntry("f1")
addmodgui.addButtons(["Add", "Cancel"], addmodPress)
addmodgui.go()
return "<meta http-equiv=\"refresh\" content=\"1; url=http://localhost:5000/\">Please wait..."

def addmodPress(button):
global addmodgui
modname = addmodgui.getEntry("Mod Name")
modfile = addmodgui.getEntry("f1")
if button == "Add":
Expand All @@ -91,8 +100,8 @@ def addmodPress(button):

with shelve.open('mods.db',writeback=True) as mods:
mods[slugify(modname)]=modname
addmodgui.clearAllEntries()
addmodgui.stop()
del addmodgui

@app.route('/launchmod/<slug>')
def launchmod(slug):
Expand All @@ -112,10 +121,5 @@ def quitprogram():
print("Press enter to continue...")
input()
raise SystemExit
addmodgui = gui("Add Mod")
addmodgui.addLabel("title", "Add a Mod")
addmodgui.addLabelEntry("Mod Name")
addmodgui.addFileEntry("f1")
addmodgui.addButtons(["Add", "Cancel"], addmodPress)
print("Open your web brower to localhost:5000")
app.run(threaded=False)
Binary file added static/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@import url('https://fonts.googleapis.com/css?family=McLaren|Noto+Sans|Ubuntu');

body {
background-image: url("bg.png");
background-size: cover;
line-height: 1.5;
color: black;
margin: 0;
padding: 0;
}

a {
text-decoration: none;
}

a:hover {
background-color: #B259A6;
}

#allthemcontents {
border: 3px solid black;
margin: 10px;
padding: 10px;
display: inline-block;
background-color: rgba(0, 0, 0, 0.3);
}

#headerdiv {
font-size: 14px;
margin-top: 0;
}

#titletext {
font-size: 50px;
margin-top: 0;
font-family: "McLaren", sans-serif;
color: white;
}

#mainlist {
color: white;
font-size: 18px;
font-family: "Ubuntu", sans-serif;
list-style-type: none;
line-height: 2;
}

.button {
color: black;
background-color: #FF7FED;
border: 2px solid black;
font-family: "Noto Sans", sans-serif;
font-size: 20px;
padding: 3px;
}

#addmod_button {
margin-right: 30px;
}

#launchbutton {
color: black;
background-color: cyan;
border: 2px solid black;
font-family: "Noto Sans", sans-serif;
font-size: 16px;
padding: 3px;
}

#launchbutton:hover {
background-color: #00B2B2;
}
22 changes: 14 additions & 8 deletions templates/modlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
<head>
<meta charset="utf-8">
<title>fDDME Player</title>
<link rel="stylesheet" type="text/css" href="static/style.css">
</head>
<body>
<ul>
{% for slug, mod in mods.items() %}
<li>{{mod}}<sub>{{slug}}</sub> | <a href="launchmod/{{slug}}">Launch {{mod}}</a></li>
{% endfor %}
</ul>
<a href="addmod">Add Mod</a>
<a href="quit">Quit Launcher</a>
<div id="allthemcontents">
<div id="headerdiv">
<p id="titletext">fDDMEPlayer</p>
</div>
<ul id="mainlist">
{% for slug, mod in mods.items() %}
<li>{{mod}}<sub>{{slug}}</sub> | <a href="launchmod/{{slug}}" id="launchbutton">Launch {{mod}}</a></li>
{% endfor %}
</ul>
<a href="addmod" class="button" id="addmod_button">Add Mod</a>
<a href="quit" class="button">Quit Launcher</a>
</div>
</body>
</html>
</html>
Binary file added templates/static/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions templates/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@import url('https://fonts.googleapis.com/css?family=McLaren|Noto+Sans|Ubuntu');

body {
background-image: url("bg.png");
background-size: cover;
line-height: 1.5;
color: black;
margin: 0;
padding: 0;
}

a {
text-decoration: none;
}

a:hover {
background-color: #B259A6;
}

#allthemcontents {
border: 3px solid black;
margin: 10px;
padding: 10px;
display: inline-block;
background-color: rgba(0, 0, 0, 0.3);
}

#headerdiv {
font-size: 14px;
margin-top: 0;
}

#titletext {
font-size: 50px;
margin-top: 0;
font-family: "McLaren", sans-serif;
color: white;
}

#mainlist {
color: white;
font-size: 18px;
font-family: "Ubuntu", sans-serif;
list-style-type: none;
line-height: 2;
}

.button {
color: black;
background-color: #FF7FED;
border: 2px solid black;
font-family: "Noto Sans", sans-serif;
font-size: 20px;
padding: 3px;
}

#addmod_button {
margin-right: 30px;
}

#launchbutton {
color: black;
background-color: cyan;
border: 2px solid black;
font-family: "Noto Sans", sans-serif;
font-size: 16px;
padding: 3px;
}

#launchbutton:hover {
background-color: #00B2B2;
}

0 comments on commit bc31025

Please sign in to comment.