funktionierendes Programm, Stationen etc
hinzufgefügt, aber noch nicht die Funktionalität der Routenplanung implementiert
This commit is contained in:
parent
1ca7ce751a
commit
f0dff44166
1 changed files with 58 additions and 6 deletions
|
|
@ -16,26 +16,78 @@ from prompt_toolkit.layout.containers import HSplit, VSplit, Window
|
||||||
from prompt_toolkit.layout.controls import BufferControl
|
from prompt_toolkit.layout.controls import BufferControl
|
||||||
from prompt_toolkit.layout.layout import Layout
|
from prompt_toolkit.layout.layout import Layout
|
||||||
from prompt_toolkit.key_binding import KeyBindings
|
from prompt_toolkit.key_binding import KeyBindings
|
||||||
|
from prompt_toolkit.shortcuts import message_dialog
|
||||||
|
from prompt_toolkit.shortcuts import yes_no_dialog
|
||||||
|
from prompt_toolkit.shortcuts import input_dialog
|
||||||
|
from prompt_toolkit import prompt
|
||||||
|
|
||||||
kb = KeyBindings()
|
kb = KeyBindings()
|
||||||
|
|
||||||
|
start = prompt("Start: ")
|
||||||
|
end = prompt("Ende: ")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
startBuffer = Buffer()
|
startBuffer = Buffer()
|
||||||
|
startBuffer.text = start
|
||||||
|
|
||||||
|
etdBuffer = Buffer()
|
||||||
|
etdBuffer.text = "13:00" #testweise, später mit tatsächlicher Abfahrtszeit von Hafas ersetzen
|
||||||
|
#etdBuffer.text = (ungefähre abfahrtszeit)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
endBuffer = Buffer()
|
endBuffer = Buffer()
|
||||||
|
endBuffer.text = end
|
||||||
|
|
||||||
|
etaBuffer = Buffer()
|
||||||
|
etaBuffer.text = "13:45" #testweise, später mit tatsächlicher Ankunftszeit von Hafas ersetzen
|
||||||
|
#etaBuffer.text = (ungefähre ankunftszeit)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
drivetimeBuffer = Buffer()
|
||||||
|
#drivetimeBuffer.text = Fahrzeit von Hafas.
|
||||||
|
|
||||||
|
infoBuffer = Buffer()
|
||||||
|
infoBuffer.text = f"Routenplanung von {start} nach {end}"
|
||||||
|
|
||||||
|
|
||||||
root_container = HSplit(children=[
|
root_container = HSplit(children=[
|
||||||
HSplit(children=[
|
|
||||||
Window(content=BufferControl(buffer=startBuffer, focusable=True)),
|
|
||||||
Window(width=1, char='-', style="fg:#2A71D5"),
|
|
||||||
|
|
||||||
Window(content=BufferControl(buffer=endBuffer, focusable=True))
|
HSplit(children=[
|
||||||
|
Window(height=2, content=BufferControl(buffer=infoBuffer, focusable=False), style="fg:#2A71D5"), #informationen über Route
|
||||||
|
Window(width=1, height = 1, char='-', style="fg:#2A71D5"), #Trennlinie
|
||||||
|
|
||||||
|
Window(content=BufferControl(buffer=startBuffer, focusable=True)), #start Station
|
||||||
|
Window(content=BufferControl(buffer=etdBuffer, focusable=False)), #abfahrtszeit
|
||||||
|
Window(width = 1, height = 2, char= ".", style= "fg:#A86FD6"), #Trennlinie
|
||||||
|
Window(content=BufferControl(buffer=endBuffer, focusable=True)), #end Station
|
||||||
|
Window(content=BufferControl(buffer=etaBuffer, focusable=False)), #ankunftszeit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Window(content=BufferControl(buffer=drivetimeBuffer, focusable=False)),
|
||||||
|
#Window(Content)
|
||||||
]),
|
]),
|
||||||
Window(height=1, char=' ', style="bg:#2A71D5 fg:black"),
|
Window(height=1, char=' ', style="bg:#2A71D5 fg:black"),
|
||||||
#Window(content=BufferControl(buffer=userBuffer),height=4),
|
#Window(content=BufferControl(buffer=userBuffer),height=4),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@kb.add('c-e')
|
||||||
|
def _(event):
|
||||||
|
result = yes_no_dialog(
|
||||||
|
title='Programm beenden',
|
||||||
|
text='Fenster schließen?').run()
|
||||||
|
if result == True:
|
||||||
|
event.app.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
layout = Layout(root_container)
|
layout = Layout(root_container)
|
||||||
|
|
||||||
app = Application(layout=layout, key_bindings=kb, full_screen=True)
|
app = Application(layout=layout, key_bindings=kb, full_screen=True)
|
||||||
|
|
||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue