Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5015a4e4e1 | |||
| 90f82e677e | |||
| fac3fe1b34 | |||
| 25135cc7d9 | |||
| 77c156b7db |
@@ -1,6 +1,6 @@
|
||||
[Application]
|
||||
name=Solo Auswertung
|
||||
version=0.9.1
|
||||
version=0.9.4
|
||||
# How to launch the app - this calls the 'main' function from the 'myapp' package:
|
||||
entry_point=main:main
|
||||
# icon=myapp.ico
|
||||
|
||||
@@ -16,6 +16,7 @@ def main():
|
||||
cli = solo_turnier.cli.Cli(l)
|
||||
|
||||
batchWorker = solo_turnier.batch.BatchWorker(cli)
|
||||
batchWorker.prepare()
|
||||
|
||||
if cli.showGUI():
|
||||
raise Exception('Not yet implemented')
|
||||
@@ -26,7 +27,9 @@ def main():
|
||||
port=cli.getPort()
|
||||
)
|
||||
else:
|
||||
combinedData = batchWorker.run()
|
||||
combinedData = batchWorker.run(
|
||||
removeFilteredParicipants=not cli.showAllParticipants()
|
||||
)
|
||||
|
||||
consoleOutputtter = solo_turnier.output.ConsoleOutputter()
|
||||
consoleOutputtter.output(combinedData)
|
||||
|
||||
@@ -5,6 +5,8 @@ import os
|
||||
import pprint
|
||||
|
||||
import tabulate
|
||||
import tkinter.filedialog
|
||||
import tkinter.simpledialog
|
||||
|
||||
class BatchWorker:
|
||||
def __init__(
|
||||
@@ -13,23 +15,39 @@ class BatchWorker:
|
||||
):
|
||||
self.l = logging.getLogger('solo_turnier.batch')
|
||||
self.config = config
|
||||
self.importPath = None
|
||||
|
||||
def prepare(self):
|
||||
self.importPath = self.config.importHtmlPath()
|
||||
if self.importPath is None:
|
||||
self.l.debug('No HTML import path was provided.')
|
||||
self.importPath = tkinter.filedialog.askdirectory(mustexist=True, title='HMTL Export auswählen')
|
||||
|
||||
if self.importPath is None or len(self.importPath) == 0:
|
||||
self.l.critical('Import path was not selected. Aborting.')
|
||||
tkinter.simpledialog.messagebox.showerror(
|
||||
title='Invalid HTML path selected',
|
||||
message='You did not select an appropriate folder. Aborting now.'
|
||||
)
|
||||
exit(1)
|
||||
|
||||
self.l.debug('Using import path %s', self.importPath)
|
||||
|
||||
def run(self, removeFilteredParicipants=True):
|
||||
self.l.debug(self.config.__dict__)
|
||||
|
||||
locator = solo_turnier.html_locator.HtmlLocator()
|
||||
self.l.info('Checking for feasible preview HTML export files in "%s"', self.config.importHtmlPath())
|
||||
htmlCandidatesPreview = locator.findPreviewRoundCandidates(self.config.importHtmlPath())
|
||||
self.l.info('Checking for feasible preview HTML export files in "%s"', self.importPath)
|
||||
htmlCandidatesPreview = locator.findPreviewRoundCandidates(self.importPath)
|
||||
self.l.debug('Found HTML file candidates for preview rounds: %s', htmlCandidatesPreview)
|
||||
|
||||
htmlResultFiles = locator.findCandidates(self.config.importHtmlPath())
|
||||
htmlResultFiles = locator.findCandidates(self.importPath)
|
||||
self.l.debug('Using HTML result files for result extraction: %s', htmlResultFiles)
|
||||
|
||||
worker = solo_turnier.worker.Worker()
|
||||
importedData = worker.collectAllData(htmlCandidatesPreview, htmlResultFiles)
|
||||
combinedData = worker.combineData(importedData)
|
||||
|
||||
if not self.config.showAllParticipants():
|
||||
worker.filterOutFinalists(combinedData, removeFilteredParicipants)
|
||||
|
||||
return combinedData
|
||||
|
||||
@@ -8,9 +8,9 @@ class Cli:
|
||||
parser = argparse.ArgumentParser()
|
||||
# parser.add_argument('--gui', help='Show the GUI', action='store_true')
|
||||
parser.add_argument('--no-flask', action='store_false', dest='flask', help='Disable the internal flask web server')
|
||||
parser.add_argument('--port', help='The port to listen for incoming requests')
|
||||
parser.add_argument('--port', help='The port to listen for incoming requests', default='8082')
|
||||
|
||||
parser.add_argument('html', help='The path from where to look for HTML export files', nargs=1, default=['.'])
|
||||
parser.add_argument('html', help='The path from where to look for HTML export files', nargs='?', default=None)
|
||||
parser.add_argument('-o', '--output', help='Set the output path of the script', nargs=1, default=[None])
|
||||
parser.add_argument('--all-participants', '-a', action='store_true', help='Show all participants not only finalists')
|
||||
|
||||
@@ -40,7 +40,7 @@ class Cli:
|
||||
return self.__args.flask
|
||||
|
||||
def importHtmlPath(self):
|
||||
return self.__args.html[0]
|
||||
return self.__args.html
|
||||
|
||||
def importCSVPath(self):
|
||||
return self.__args.import_from[0]
|
||||
|
||||
@@ -4,7 +4,8 @@ import solo_turnier
|
||||
def startFlask(
|
||||
batchWorker: solo_turnier.batch.BatchWorker,
|
||||
debug: bool = False,
|
||||
port: int = 8082
|
||||
port: int = 8082,
|
||||
showOnlyFinalists: bool = True
|
||||
):
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
@@ -14,4 +15,12 @@ def startFlask(
|
||||
|
||||
return flask.render_template('index.html', data=combinedData)
|
||||
|
||||
@app.get('/custom.css')
|
||||
def css():
|
||||
ret = flask.render_template(
|
||||
'custom.css',
|
||||
onlyFinalists=showOnlyFinalists
|
||||
)
|
||||
return flask.Response(ret, mimetype='text/css')
|
||||
|
||||
app.run(host='0.0.0.0', port=port, debug=debug)
|
||||
|
||||
5
src/solo_turnier/templates/custom.css
Normal file
5
src/solo_turnier/templates/custom.css
Normal file
@@ -0,0 +1,5 @@
|
||||
{% if onlyFinalists %}
|
||||
.no-finalist {
|
||||
display: none;
|
||||
}
|
||||
{% endif %}
|
||||
@@ -6,6 +6,7 @@
|
||||
{# <meta name="description" content="Webpage for xxxx"> #}
|
||||
<!-- http://meyerweb.com/eric/tools/css/reset/ -->
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<link rel="stylesheet" href="/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
{# <h1>Finalauswertung Solo-Turniere</h1> #}
|
||||
|
||||
Reference in New Issue
Block a user