Skip to content

Commit

Permalink
Merge branch 'kivy'
Browse files Browse the repository at this point in the history
  • Loading branch information
kbublitz committed Feb 21, 2019
2 parents fb9dbc5 + 0a720c4 commit 9d8f21e
Show file tree
Hide file tree
Showing 10 changed files with 711 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ GUI/kicker_scores.db
**/__pycache__
/kicker_scores.db
/kicker_scores.db.bkp
/backup
/kicker_admin.db
383 changes: 383 additions & 0 deletions GUI/KickerUi.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,383 @@
#:kivy 1.10
<KickerWidget>:
do_default_tab: False
tab_width: (self.width - 5) / 3

TabbedPanelItem:
text: "Rangliste"
PlayerPage:
id: player_page

TabbedPanelItem:
text: "Spiele"
GamePage:
player_list: player_page.ranking_list

TabbedPanelItem:
text: "Admin"
AdminPage:

<PlayerPage>:
orientation: 'vertical'
ranking_list: ranking_list
RankingListHeader:
size_hint: 1, 0.1
size_y: dp(10)
RankingList:
id: ranking_list
viewclass: 'RankingListItem'
RecycleBoxLayout:
default_size: None, dp(35)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
spacing: dp(2)
Button:
text: 'Neuer Spieler'
size_hint: 1, 0.1
on_release: root.new_player()

<RankingListHeader@BoxLayout>:
orientation: 'horizontal'
Label:
text: '[b]#[/b]'
markup: True
size_hint_x: None
size_x: dp(.2)
text_size: self.size
halign: 'right'
valign: 'middle'
padding_x: dp(15)
Label:
text: '[b]Spieler[/b]'
markup: True
text_size: self.size
halign: 'left'
valign: 'middle'
Label:
text: '[b]Bewertung[/b]'
markup: True
size_hint_x: None
size_x: dp(.2)
Label:
text: '[b]\u03C3[/b]'
markup: True
size_hint_x: None
size_x: dp(.2)

<RankingListItem@BoxLayout>:
orientation: 'horizontal'
rank: 0
score: .0
sigma: .0
name: ''
canvas.before:
Color:
# alternating colors
r: .5 if (self.rank % 2) else 0.3
g: .5 if (self.rank % 2) else 0.3
b: .5 if (self.rank % 2) else 0.3
a: 1
Rectangle:
size: self.size
pos: self.pos
Label:
text: '{rank}.'.format(rank=root.rank)
size_hint_x: None
size_x: dp(.2)
text_size: self.size
halign: 'right'
valign: 'middle'
padding_x: dp(15)
Label:
text: root.name
text_size: self.size
halign: 'left'
valign: 'middle'
Label:
text: '{score:.2f}'.format(score=root.score)
size_hint_x: None
size_x: dp(.2)
Label:
text: '{sigma:.2f}'.format(sigma=root.sigma)
size_hint_x: None
size_x: dp(.2)

<NewPlayerPopup>:
title: 'Neuer Spieler'
auto_dismiss: False
enable_ok: True
size_hint: None, None
player_name: player_name
size: 400, 400
scan_token_label_text: 'Bitte Token einscannen'
scan_token_label_success_text: '[color=22DD22][b]Token erfolgreich gelesen.[/b][/color]\nBitte Namen eingeben\nund bestätigen.'
scan_token_label_error_text: '[color=FF0000][b]Spieler existiert bereits.\nBitte anderes Token scannen\noder abbrechen.[/b][/color]'
name_error_text: '[color=22DD22][b]Token erfolgreich gelesen.[/b][/color]\nBitte Namen eingeben\nund bestätigen.\n[color=FF0000][b]Der Name ist bereits vergeben.[/b][/color]'

BoxLayout:
orientation: 'vertical'
Image:
source: root.display_image
size_hint_y: 0.5
Label:
text: root.scan_token_label_text
markup: True
size_hint_y: 0.2
Label:
text: 'Name:'
size_hint: 1, .1
TextInput:
id: player_name
multiline: False
size_hint: 1, .1
focus: True
text_validate_unfocus: False
hint_text: 'Spielername eingeben'
on_text: root.validate_input()
on_text_validate: if root.enable_ok: root.on_ok()
disabled: True
# on_focus: root.on_focus(*args)
BoxLayout:
size_hint_y: 0.1
orientation: 'horizontal'
Button:
text: 'Abbrechen'
on_release: root.dismiss()
Button:
text: 'OK'
disabled: not root.enable_ok
on_release: root.on_ok()


<GamePage>:
orientation: 'vertical'
game_list: game_list
GameListHeader:
size_hint: 1, 0.1
size_y: dp(10)
GameList:
id: game_list
viewclass: 'GameListItem'
RecycleBoxLayout:
default_size: None, dp(35)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
spacing: dp(2)
Button:
text: 'Neues Spiel'
size_hint: 1, 0.1
on_release: root.new_game("Hallo")

<GameListHeader@BoxLayout>:
orientation: 'horizontal'
Label:
text: '[b]#[/b]'
markup: True
size_hint_x: None
size_x: dp(25)
text_size: self.size
halign: 'center'
valign: 'middle'
Label:
text: '[b]Team 1[/b]'
markup: True
size_hint_x: 1
text_size: self.size
halign: 'left'
valign: 'middle'
Label:
text: '[b]Ergebnis[/b]'
markup: True
size_hint_x: None
size_x: dp(25)
Label:
text: '[b]Team 2[/b]'
markup: True
size_hint_x: 1
size_x: dp(.2)

<GameListItem@BoxLayout>:
orientation: 'horizontal'
oddline: False
game_id: 0
score1: 0
score2: 0
player1: ''
player2: ''
player3: ''
player4: ''
canvas.before:
Color:
# alternating colors
r: .5 if self.oddline else 0.3
g: .5 if self.oddline else 0.3
b: .5 if self.oddline else 0.3
a: 1
Rectangle:
size: self.size
pos: self.pos
Label:
text: '{id}'.format(id=root.game_id)
size_hint_x: None
size_x: dp(25)
text_size: self.size
halign: 'center'
valign: 'middle'
Label:
text: '{player1} + {player2}'.format(player1=root.player1, player2=root.player2)
size_hint_x: 1
text_size: self.size
halign: 'right'
valign: 'middle'
#padding_x: dp(15)
Label:
text: '{score1:d} : {score2:d}'.format(score1=root.score1, score2=root.score2)
size_hint_x: None
size_x: dp(25)
text_size: self.size
halign: 'center'
valign: 'middle'
Label:
text: '{player3} + {player4}'.format(player3=root.player3, player4=root.player4)
size_hint_x: 1
text_size: self.size
halign: 'left'
valign: 'middle'
#padding_x: dp(15)

<NewGamePopup>:
title: 'Neues Spiel'
auto_dismiss: False
enable_ok: False
size_hint: None, None
size: 700, 450
team1: team1
team2: team2
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
size_hint_y: 1
TeamDisplay:
id: team1
team: 'Team 1'
size_hint_x: 0.25
Image:
source: 'GUI/Kicker_top.jpg'
size_hint_x: 0.5
TeamDisplay:
id: team2
team: 'Team 2'
size_hint_x: 0.25
BoxLayout:
size_hint_y: 0.1
orientation: 'horizontal'
Button:
text: 'Abbrechen'
on_release: root.dismiss()
Button:
text: 'OK'
disabled: not root.enable_ok
on_release: root.on_ok()

<TeamDisplay@BoxLayout>:
orientation: 'vertical'
team: ''
player1: ''
player2: ''
score: 0
Label:
text: '[b]' + root.team + '[/b]'
markup: True
size_hint_y: 0.1
halign: 'center'
valign: 'top'
Label:
text: root.player1
markup: True
size_hint_y: 0.5
halign: 'center'
valign: 'middle'
Label:
text: '&'
markup: True
size_hint_y: 0.1
halign: 'center'
valign: 'middle'
Label:
text: root.player2
markup: True
size_hint_y: 0.5
halign: 'center'
valign: 'middle'
BoxLayout:
orientation: 'horizontal'
padding: 4
size_hint_y: 0.2
Button:
text: '-'
on_release: root.score -= 1 if root.score > 0 else 0
Label:
text: '[b]' + str(root.score) +'[/b]'
markup: True
font_size: '20sp'
Button:
text: '+'
on_release: root.score += 1 if root.score < 2 else 0

<ConfirmNewGamePopup>:
title: 'Neues Spiel bestätigen'
auto_dismiss: False
size_hint: None, None
size: 500, 400
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'vertical'
size_hint_y: 1
Label:
text: 'Soll das Spiel mit folgendem Ergebnis gewertet werden?'
Label:
text: '{p1} / {p2}'.format(p1 = root.player1, p2 = root.player2)
Label:
text: str(root.team1_score) + ' : ' + str(root.team2_score)
Label:
text: '{p3} / {p4}'.format(p3 = root.player3, p4 = root.player4)
BoxLayout:
orientation: 'horizontal'
size_hint_y: 0.1
Button:
text: 'Abbrechen'
on_release: root.dismiss()
Button:
text: 'Bestätigen'
on_release: root.confirm()

<GameUnplausiblePopup>:
title: 'Spielergebnis unplausibel'
auto_dismiss: False
size_hint: None, None
size: 300, 200
BoxLayout:
orientation: 'vertical'
size_hint: 1, 1
Label:
text: 'Das Spiels muss einen\neindeutigen Sieger haben'
Button:
text: 'Ok'
size_hint_y: 0.3
on_release: root.dismiss()

<AdminPage@BoxLayout>:
BoxLayout:
orientation: 'vertical'
Label:
text: "Admin panel noch nicht implementiert"
Button:
text: "Zurück zur Spieleliste"
size_hint: 1, 0.1
on_release: app.switch_tab(1)
File renamed without changes
Binary file added GUI/check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9d8f21e

Please sign in to comment.