Skip to content

Commit

Permalink
Merge pull request #31 from Hackathon2020/docu_introduction
Browse files Browse the repository at this point in the history
Docu introduction
  • Loading branch information
ditschuk committed Mar 22, 2020
2 parents 4d16611 + 4d690c6 commit 33b0f9e
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 78 deletions.
12 changes: 12 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
"wandb",
"flask",
"jsonschema",
"PyQt5.QtWidgets",
"PyQt5",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QFileDialog",
"PyQt5.QtWidgets.QTableWidgetItem",
"PyQt5.QtWidgets.QTableWidget",
"PyQt5.QtWidgets.QAbstractItemView",
"PyQt5.QtWidgets.QMenuBar",
"PyQt5.QtWidgets.QAction",
"flask_wtf",
"wtforms",
"wtforms.validators",
]

for mod_name in MOCK_MODULES:
Expand Down
27 changes: 20 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ Welcome to the Grenz-er-fahrung!

As part of the WirvsVirus_ hackathon we join the fight against COVID-19.

.. _WirvsVirus: https://wirvsvirushackathon.org/
The last couple of weeks were defined by the spread of the virus around the world. Europe, in particular, rapidly became the epicenter of the current epidemic. As a consequence, borders throughout Europe were closed in a rush leading to heavy traffic jams. Europe's free and borderless market, risks being halted due to merchants, commuters, and truckers being stuck attempting to cross a border.

Introduction
============
For this weekend we chose to **hack** together a prototype app that allows officials to provide questionnaires digitally, enabling border crossers to answer questions in advance and reduce the work of border policemen. Checkout our video on YouTube_ to see what we have achieved!

The last couple of weeks were defined by the spread of the virus around the world. Europe, in particular, rapidly became the epicenter of the current epidemic. As a consequence, borders throughout Europe were closed in a rush leading to heavy traffic jams. Europe's free and borderless market, risks being halted due to merchants, commuters, and truckers being stuck attempting to cross a border.

For this weekend we chose to **hack** together a prototype app that allows officials to provide questionnaires digitally, enabling border crossers to answer questions in advance and reduce the work of border policemen.
.. _WirvsVirus: https://wirvsvirushackathon.org/
.. _YouTube: https://youtu.be/AXAIV9wReHI

Introduction
============
Expand All @@ -30,6 +29,13 @@ Consider the following user story:

The time it would take for the policeman to verify the answers would be only a fraction of the time it currently takes and seriously reduces traffic jams all over Europe's closed borders.

.. figure:: source/images/user.gif
:scale: 60%
:alt: User experience
:align: center

Mock Up of the questions a person crossing the border from Germany to Switzerland might answer answer using our application.


Application
===========
Expand Down Expand Up @@ -64,19 +70,25 @@ Border Crosser Webapp
---------------------
The border crosser's web app consists of only one website that, once opened, downloads the correct questionnaire and allows us to generate the resulting QR-Code without any further internet connection.

.. figure:: source/images/generator.png
Our current state looks like this:

.. figure:: source/images/webapp.png
:alt: Border Crosser App

Image of the Border Crosser App

This is how we imagine the app to be used on a mobile device:

Border Police Website
---------------------

Encoded in the QR code is an URL containing all answers of the border crosser.
The border police can then simply scan the QR code and open the website to see the answers on her/his device.

.. figure:: source/images/generator.png
.. figure:: source/images/police.png
:alt: Police Website
:scale: 50%
:align: center

Image of the Police Website

Expand All @@ -89,6 +101,7 @@ A flask webserver connects the individual parts of our application. A flask web
:glob:
:maxdepth: 2

source/source_files/project.rst
source/source_files/project.questionaire
source/source_files/project.questions_from_json
source/source_files/project.flaskr
Binary file added docs/source/images/police.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/user.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/webapp.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions docs/source/source_files/project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@ project package
.. toctree::
:maxdepth: 1

project.dict_generator
project.questionaire
project.questions_from_json
project.test
project.test_questionaire

Subpackages:

.. toctree::
:maxdepth: 1

project.flaskr



Expand Down
Binary file removed project/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed project/__pycache__/test.cpython-37.pyc
Binary file not shown.
136 changes: 68 additions & 68 deletions project/dict_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@
import json
import uuid

# Contains JSON file which will be exported or has been imported and will be manipulated by the user's actions.
dict_state = {}

# fixme remove, only dummy for debugging
language = "german"

Form, Window = uic.loadUiType("test_gui.ui")


def save_dialog():
"""Open a file dialog to save json dict to file."""
dlg = QFileDialog()
Expand Down Expand Up @@ -429,62 +420,71 @@ def write_to_dict():
def close_application():
exit()


app = QApplication([])
window = Window()
form = Form()
form.setupUi(window)

form.load_dict.clicked.connect(open_dialog)
form.save_dict.clicked.connect(save_dialog)
form.new_dict.clicked.connect(new_dict_dialog)
form.add_language.clicked.connect(add_lang_dialog)
form.new_language_button.clicked.connect(fill_new_language)
form.new_language_button_2.clicked.connect(new_dict_begin_dialog)
form.add_translation_next.clicked.connect(next_new_language)
form.add_translation_back.clicked.connect(prev_new_language)
form.add_translation_finish.clicked.connect(finish_new_language)
form.dict_table.cellClicked.connect(handle_table_click)
form.ok_button.clicked.connect(write_to_dict)
form.cancel_button.clicked.connect(cancel_inspect_mode)
form.comboBox.currentIndexChanged.connect(change_option)
form.tableWidget_2.cellClicked.connect(change_lang_inspect_mode)

# create menu
# menubar = QMenuBar()
menubar = QMenuBar()
window.setMenuBar(menubar)

extractActionNew = QAction("&New")
extractActionNew.setShortcut("Ctrl+N")
extractActionNew.setStatusTip("Create-Dictonary")
extractActionNew.triggered.connect(new_dict_dialog)
menubar.addAction(extractActionNew)

extractActionLoad = QAction("&Load-File")
extractActionLoad.setShortcut("Ctrl+L")
extractActionLoad.setStatusTip("Leave The App")
extractActionLoad.triggered.connect(open_dialog)
menubar.addAction(extractActionLoad)

extractActionSave = QAction("&Save-File")
extractActionSave.setShortcut("Ctrl+S")
extractActionSave.setStatusTip("Leave The App")
extractActionSave.triggered.connect(save_dialog)
menubar.addAction(extractActionSave)

extractActionAddLan = QAction("&Add-Language")
extractActionAddLan.setShortcut("Ctrl+Q")
extractActionAddLan.setStatusTip("Leave The App")
extractActionAddLan.triggered.connect(add_lang_dialog)
menubar.addAction(extractActionAddLan)
menubar.addSeparator()

extractActionClose = QAction("&Close")
extractActionClose.setShortcut("Ctrl+Q")
extractActionClose.setStatusTip("Leave The App")
extractActionClose.triggered.connect(close_application)
menubar.addAction(extractActionClose)

window.show()
app.exec_()
if __name__ == "__main__":
# Contains JSON file which will be exported or has been imported and will be manipulated by the user's actions.
dict_state = {}

# fixme remove, only dummy for debugging
language = "german"

Form, Window = uic.loadUiType("test_gui.ui")


app = QApplication([])
window = Window()
form = Form()
form.setupUi(window)

form.load_dict.clicked.connect(open_dialog)
form.save_dict.clicked.connect(save_dialog)
form.new_dict.clicked.connect(new_dict_dialog)
form.add_language.clicked.connect(add_lang_dialog)
form.new_language_button.clicked.connect(fill_new_language)
form.new_language_button_2.clicked.connect(new_dict_begin_dialog)
form.add_translation_next.clicked.connect(next_new_language)
form.add_translation_back.clicked.connect(prev_new_language)
form.add_translation_finish.clicked.connect(finish_new_language)
form.dict_table.cellClicked.connect(handle_table_click)
form.ok_button.clicked.connect(write_to_dict)
form.cancel_button.clicked.connect(cancel_inspect_mode)
form.comboBox.currentIndexChanged.connect(change_option)
form.tableWidget_2.cellClicked.connect(change_lang_inspect_mode)

# create menu
# menubar = QMenuBar()
menubar = QMenuBar()
window.setMenuBar(menubar)

extractActionNew = QAction("&New")
extractActionNew.setShortcut("Ctrl+N")
extractActionNew.setStatusTip("Create-Dictonary")
extractActionNew.triggered.connect(new_dict_dialog)
menubar.addAction(extractActionNew)

extractActionLoad = QAction("&Load-File")
extractActionLoad.setShortcut("Ctrl+L")
extractActionLoad.setStatusTip("Leave The App")
extractActionLoad.triggered.connect(open_dialog)
menubar.addAction(extractActionLoad)

extractActionSave = QAction("&Save-File")
extractActionSave.setShortcut("Ctrl+S")
extractActionSave.setStatusTip("Leave The App")
extractActionSave.triggered.connect(save_dialog)
menubar.addAction(extractActionSave)

extractActionAddLan = QAction("&Add-Language")
extractActionAddLan.setShortcut("Ctrl+Q")
extractActionAddLan.setStatusTip("Leave The App")
extractActionAddLan.triggered.connect(add_lang_dialog)
menubar.addAction(extractActionAddLan)
menubar.addSeparator()

extractActionClose = QAction("&Close")
extractActionClose.setShortcut("Ctrl+Q")
extractActionClose.setStatusTip("Leave The App")
extractActionClose.triggered.connect(close_application)
menubar.addAction(extractActionClose)

window.show()
app.exec_()
4 changes: 2 additions & 2 deletions project/questionaire.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class Questionaire:
""" initialization
:paran str global_id -- the globally unique identifier of this questionaire. This is needed to connect questionaires with anwsers.
:param dict language_map -- (dict of str: (str: str)) -- containes the text-snippets used in this questionaire in every supported language.
The mapping is "language" -> "id" -> "text
:param dict language_map -- (dict of str: (str: str)) -- containes the text-snippets used in this questionaire in every supported language. \
The mapping is "language" -> "id" -> "text
:param list questions -- (list of Question)the actual questions in the questionaire
"""
def __init__(self, global_id, language_map, questions):
Expand Down
2 changes: 1 addition & 1 deletion project/test_questionaire.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from questionaire import Questionaire, Question
from project.questionaire import Questionaire, Question

class TestStringMethods(unittest.TestCase):

Expand Down

0 comments on commit 33b0f9e

Please sign in to comment.