Mejoras en la gui

This commit is contained in:
Ales (Shagi) Zabala Alava 2020-02-16 18:46:30 +01:00
parent c67331539d
commit b6ebd06342
3 changed files with 63 additions and 29 deletions

3
gui/karaoke.ini Normal file
View File

@ -0,0 +1,3 @@
[graphics]
font_name = CyrBit.ttf

View File

@ -7,6 +7,7 @@ import kivy
kivy.require('1.11.1')
from kivy.app import App
from kivy.config import Config
from kivy.core.window import Window
from kivy.properties import StringProperty, ObjectProperty, ListProperty, BooleanProperty
from kivy.uix.boxlayout import BoxLayout
@ -60,7 +61,7 @@ class Song(BoxLayout):
self.ass = str(entry)
elif entry.name == 'thumb.jpg':
self.thumbnail = str(entry)
elif entry.name.endswith('jpg'):
elif entry.name == 'cover.jpg':
self.cover = str(entry)
elif entry.name == 'index.html':
continue
@ -114,7 +115,9 @@ class KaraokeGUI(BoxLayout):
song.active = False
value.active = True
current_song_image = self.ids['current_song_image']
current_song_title = self.ids['current_song_title']
current_song_image.source = value.cover
current_song_title.text = value.name
scrollview = self.ids['songs_scroll']
scrollview.scroll_to(value)
@ -175,4 +178,6 @@ class KaraokeApp(App):
if __name__ == '__main__':
Window.fullscreen = True
Config.set('graphics', 'font_name', 'CyrBit.ttf')
Config.write()
KaraokeApp(Path(sys.argv[1])).run()

View File

@ -1,57 +1,89 @@
KaraokeGUI:
<Label>:
font_name: 'CyrBit.ttf'
font_size: 24
<Action@Button>:
size_hint: 1, None
font_size: 32
height: 40
background_color: 0, 0, 0, 1
<Song>:
size_hint: None, None
size: 200, 200
orientation: 'vertical'
padding: 0
padding: 3
spacing: 0
canvas.before:
Color:
rgb: 0.9, 0.9, 0.9 if self.active else 0.3, 0.3, 0.3
rgb: (0.5, 0.1, 0.5) if self.active else (0.3, 0.3, 0.3)
Line:
rectangle: self.pos[0], self.pos[1], self.size[0], self.size[1]
width: 2
joint: 'miter'
Color:
rgb: 0.9, 0.9, 0.9
Image:
source: self.parent.thumbnail
size_hint: 1, 0.8
Label:
canvas.before:
Color:
rgb: 0.3, 0.3, 0.3
Rectangle:
pos: self.pos
size: self.size
size_hint: 1, 0.1
text: self.parent.name
<KaraokeGUI>:
orientation: 'vertical'
Image:
id: current_song_image
source: ''
Button:
text: '>'
on_press: root.play()
size_hint: 1, 0.1
BoxLayout:
canvas.before:
Rectangle:
source: 'images/fondo_monkey_island_barco.png'
pos: self.pos
size: self.size
canvas.after:
Rectangle:
source: 'images/fondo_monkey_island_pareja.png'
pos: self.pos
size: self.size
orientation: 'vertical'
Label:
id: current_song_title
color: 0.9, 0.1, 0.3, 1
outline_color: 1, 1, 1, 1
outline_width: 1
size_hint: 1, 0.1
text: ''
Image:
id: current_song_image
source: ''
BoxLayout: # Bottom actions and slides
orientation: 'horizontal'
height: 220
size_hint: 1, None
Button:
size_hint: None, None
size: 20, 220
text: '<'
on_press: root.previous()
BoxLayout:
orientation: 'vertical'
height: 220
size_hint: 0.3, None
Action:
text: 'Play'
on_press: root.play()
Action:
text: 'Previous'
on_press: root.previous()
Action:
text: 'Next'
on_press: root.next()
Widget:
ScrollView:
id: songs_scroll
do_scroll_x: True
do_scroll_y: False
size_hint: 1, None
size_hint: 0.7, None
height: 220
GridLayout:
@ -61,9 +93,3 @@ KaraokeGUI:
padding: 10
spacing: 10
size_hint: None, 1
Button:
size_hint: None, None
size: 20, 220
text: '>'
on_press: root.next()