first commit

This commit is contained in:
Yura 2024-09-15 15:12:16 +03:00
commit 417e54da96
5696 changed files with 900003 additions and 0 deletions

View file

@ -0,0 +1,39 @@
ShowcaseScreen:
name: 'Accordions'
fullscreen: True
BoxLayout:
size_hint_y: None
height: '48dp'
ToggleButton:
id: tbh
text: 'Horizontal'
group: 'accordion'
state: 'down'
ToggleButton:
text: 'Vertical'
group: 'accordion'
Accordion:
orientation: 'horizontal' if tbh.state == 'down' else 'vertical'
AccordionItem:
title: 'Panel 1'
Label:
text: 'This is a label fit to the content view'
text_size: self.width, None
AccordionItem:
title: 'Panel 2'
Button:
text: 'A button, what else?'
AccordionItem:
title: 'Panel 3'
Label:
text: 'This is a label fit to the content view'
text_size: self.width, None

View file

@ -0,0 +1,33 @@
ShowcaseScreen:
name: 'Bubbles'
Bubble:
size_hint_y: None
height: self.content_height + self.arrow_margin_y
BubbleContent:
size_hint_y: None
height: self.minimum_height
BubbleButton:
text: 'Cut'
BubbleButton:
text: 'Copy'
BubbleButton:
text: 'Paste'
Widget:
size_hint_y: None
height: '48dp'
BoxLayout:
size_hint_y: None
height: '48dp'
Label:
text: 'Hello'
Bubble:
arrow_pos: 'left_mid'
BubbleContent:
Label:
text: 'World'

View file

@ -0,0 +1,26 @@
ShowcaseScreen:
name: 'Buttons'
Button:
size_hint_y: None
height: '48dp'
text: 'Button normal'
Button:
size_hint_y: None
height: '48dp'
text: 'Button down'
state: 'down'
Button:
size_hint_y: None
height: '48dp'
text: 'Button disabled'
disabled: True
Button:
size_hint_y: None
height: '48dp'
text: 'Button down disabled'
state: 'down'
disabled: True

View file

@ -0,0 +1,51 @@
<ColoredLabel@Label>:
font_size: '48sp'
color: (.6, .6, .6, 1)
canvas.before:
Color:
rgb: (.9, .9, .9)
Rectangle:
pos: self.x + sp(2), self.y + sp(2)
size: self.width - sp(4), self.height - sp(4)
ShowcaseScreen:
name: 'Carousel'
fullscreen: True
BoxLayout:
size_hint_y: None
height: '48dp'
ToggleButton:
text: 'Loop'
id: btnloop
Label:
size_hint_x: None
width: self.height
text: '{}'.format(carousel.index)
Button:
size_hint_x: None
width: self.height
text: 'Prev'
on_release: carousel.load_previous()
Button:
size_hint_x: None
width: self.height
text: 'Next'
on_release: carousel.load_next()
Carousel:
id: carousel
loop: btnloop.state == 'down'
ColoredLabel:
text: 'Slide 0'
ColoredLabel:
text: 'Slide 1'
ColoredLabel:
text: 'Slide 2'

View file

@ -0,0 +1,33 @@
ShowcaseScreen:
name: 'CheckBoxes'
GridLayout:
cols: 3
spacing: '8dp'
size_hint: .5, None
height: self.minimum_height
Label:
text: 'Checkbox'
CheckBox:
size_hint_y: None
height: '48dp'
CheckBox:
size_hint_y: None
height: '48dp'
Label:
text: 'CheckBox with group'
CheckBox:
size_hint_y: None
height: '48dp'
group: 'g2'
CheckBox:
size_hint_y: None
height: '48dp'
group: 'g2'

View file

@ -0,0 +1,9 @@
ShowcaseScreen:
fullscreen: True
name: 'CodeInput'
CodeInput:
padding: '4dp'
text: 'class Hello(object):\n\tpass\n\nprint("Hello world")'
focus: True if root.parent else False

View file

@ -0,0 +1,40 @@
ShowcaseScreen:
fullscreen: True
name: 'DropDown'
# trick to not lost the Dropdown instance
# Dropdown itself is not really made to be used in kv.
__safe_id: [dropdown.__self__]
Button:
id: btn
text: '-'
on_release: dropdown.open(self)
size_hint_y: None
height: '48dp'
Widget:
on_parent: dropdown.dismiss()
DropDown:
id: dropdown
on_select: btn.text = 'Selected value: {}'.format(args[1])
Button:
text: 'Value A'
size_hint_y: None
height: '48dp'
on_release: dropdown.select('A')
Button:
text: 'Value B'
size_hint_y: None
height: '48dp'
on_release: dropdown.select('B')
Button:
text: 'Value C'
size_hint_y: None
height: '48dp'
on_release: dropdown.select('C')

View file

@ -0,0 +1,24 @@
ShowcaseScreen:
name: 'FileChoosers'
fullscreen: True
BoxLayout:
size_hint_y: None
height: '48dp'
ToggleButton:
text: 'Icon'
state: 'down'
group: 'filechooser'
on_release: filechooser.view_mode = 'icon'
ToggleButton:
text: 'List'
group: 'filechooser'
on_release: filechooser.view_mode = 'list'
FileChooser:
id: filechooser
FileChooserIconLayout
FileChooserListLayout

View file

@ -0,0 +1,17 @@
ShowcaseScreen:
popup: popup.__self__
fullscreen: True
name: 'Popups'
BoxLayout:
id: bl
Popup:
id: popup
title: "Hello World"
on_parent:
if self.parent == bl: self.parent.remove_widget(self)
Button:
text: 'press to dismiss'
on_release: popup.dismiss()
Button:
text: 'press to show Popup'
on_release: root.popup.open()

View file

@ -0,0 +1,15 @@
ShowcaseScreen:
name: 'ProgressBar'
Label:
text: 'Progression: {}%'.format(int(pb.value))
size_hint_y: None
height: '48dp'
ProgressBar:
id: pb
size_hint_x: .5
size_hint_y: None
height: '48dp'
value: (app.time * 20) % 100.

View file

@ -0,0 +1,24 @@
ShowcaseScreen:
name: 'RstDocument'
fullscreen: True
on_parent: if not args[1]: textinput.focus = False
GridLayout:
cols: 2 if root.width > root.height else 1
spacing: '8dp'
TextInput:
id: textinput
text:
('.. _top:\n'
'\n'
'Hello world\n'
'===========\n'
'\n'
'This is an **emphased text**, *italic text*, ``interpreted text``.\n'
'And this is a reference to top_::\n'
'\n'
' $ print("Hello world")\n')
RstDocument:
text: textinput.text

View file

@ -0,0 +1,14 @@
ShowcaseScreen:
name: 'Scatter'
Widget:
Scatter:
id: scatter
size_hint: None, None
size: image.size
Image:
id: image
source: 'data/faust_github.jpg'
size: self.texture_size

View file

@ -0,0 +1,46 @@
#:import Factory kivy.factory.Factory
ShowcaseScreen:
name: 'ScreenManager'
fullscreen: True
BoxLayout:
size_hint_y: None
height: '48dp'
Spinner:
text: 'Default transition'
values: ('SlideTransition', 'SwapTransition', 'FadeTransition', 'WipeTransition')
on_text: sm.transition = Factory.get(self.text)()
ScreenManager:
id: sm
Screen:
name: 'screen1'
canvas.before:
Color:
rgb: .8, .2, .2
Rectangle:
size: self.size
AnchorLayout:
Button:
size_hint: None, None
size: '150dp', '48dp'
text: 'Go to screen 2'
on_release: sm.current = 'screen2'
Screen:
name: 'screen2'
canvas.before:
Color:
rgb: .2, .8, .2
Rectangle:
size: self.size
AnchorLayout:
Button:
size_hint: None, None
size: '150dp', '48dp'
text: 'Go to screen 1'
on_release: sm.current = 'screen1'

View file

@ -0,0 +1,55 @@
ShowcaseScreen:
name: 'Sliders'
BoxLayout:
size_hint_y: None
height: '48dp'
Label:
text: 'Default'
Slider:
id: s1
Label:
text: '{}'.format(s1.value)
BoxLayout:
size_hint_y: None
height: '48dp'
Label:
text: 'Stepped'
Slider:
id: s2
step: 20
Label:
text: '{}'.format(s2.value)
AnchorLayout:
size_hint_y: None
height: '100dp'
GridLayout:
cols: 2
spacing: '8dp'
size_hint_x: None
width: self.minimum_width
Slider:
size_hint_x: None
width: '48dp'
orientation: 'vertical'
value: s1.value
on_value: s1.value = self.value
Slider:
size_hint_x: None
width: '48dp'
orientation: 'vertical'
step: 20
value: s2.value
on_value: s2.value = self.value

View file

@ -0,0 +1,11 @@
ShowcaseScreen:
name: 'Spinner'
fullscreen: True
Spinner:
text: 'Home'
values: ('Home', 'Work', 'Other', 'Not defined')
size_hint_y: None
height: '48dp'
Widget

View file

@ -0,0 +1,13 @@
ShowcaseScreen:
name: 'Splitter'
fullscreen: True
RelativeLayout:
id: rl
Splitter:
sizable_from: 'right'
min_size: 10
max_size: rl.width
Button:
text: 'Panel'

View file

@ -0,0 +1,39 @@
ShowcaseScreen:
name: 'Switches'
BoxLayout:
size_hint_y: None
height: '48dp'
Label:
text: 'Switch normal'
Switch:
BoxLayout:
size_hint_y: None
height: '48dp'
Label:
text: 'Switch active'
Switch:
active: True
BoxLayout:
size_hint_y: None
height: '48dp'
Label:
text: 'Switch off & disabled'
Switch:
disabled: True
active: False
BoxLayout:
size_hint_y: None
height: '48dp'
Label:
text: 'Switch on & disabled'
Switch:
disabled: True
active: True

View file

@ -0,0 +1,69 @@
#:import random random.random
ShowcaseScreen:
name: 'TabbedPanel + Layouts'
fullscreen: True
on_parent: if args[1] and tp.current_tab == tab_fl: app.showcase_floatlayout(fl)
TabbedPanel:
id: tp
do_default_tab: False
TabbedPanelItem:
id: tab_fl
text: 'FloatLayout'
on_release: app.showcase_floatlayout(fl)
FloatLayout:
CFloatLayout:
id: fl
TabbedPanelItem:
text: 'BoxLayout'
on_release: app.showcase_boxlayout(box)
FloatLayout
CBoxLayout:
id: box
TabbedPanelItem:
text: 'GridLayout'
on_release: app.showcase_gridlayout(grid)
FloatLayout
CGridLayout:
id: grid
rows: 3
TabbedPanelItem:
on_release: app.showcase_stacklayout(stack)
text: 'StackLayout'
FloatLayout
CStackLayout:
id: stack
TabbedPanelItem:
text: 'AnchorLayout'
on_release: app.showcase_anchorlayout(anchor)
FloatLayout
CAnchorLayout:
id: anchor
BoxLayout:
orientation: 'vertical'
size_hint: .4, .5
Button
Button
text: 'anchor_x: {}'.format(anchor.anchor_x)
Button
text: 'anchor_y: {}'.format(anchor.anchor_y)
Button
<CFloatLayout@FloatLayout+BackgroundColor>
<CBoxLayout@BoxLayout+BackgroundColor>
<CGridLayout@GridLayout+BackgroundColor>
<CStackLayout@StackLayout+BackgroundColor>
<CAnchorLayout@AnchorLayout+BackgroundColor>
<BackgroundColor@Widget>
pos_hint: {'center_x': .5, 'center_y': .5}
size_hint: .9, .9
canvas.before:
Color:
rgba: .2, .3, .4, 1
Rectangle:
size: self.size
pos: self.pos

View file

@ -0,0 +1,48 @@
ShowcaseScreen:
name: 'TextInputs'
focused: ti_default
on_parent:
if not args[1] and self.focused: self.focused.focus = False
if args[1]: ti_default.focus = True
CTextInput
size_hint_y: None
height: '32dp'
multiline: False
text: 'Monoline textinput'
CTextInput:
id: ti_default
size_hint_y: None
height: '32dp'
text: 'Focused textinput'
focus: True
CTextInput:
size_hint_y: None
height: '32dp'
text: 'Password'
password: True
CTextInput:
size_hint_y: None
height: '32dp'
text: 'Readonly textinput'
readonly: True
CTextInput:
size_hint_y: None
height: '48dp'
text: 'Multiline textinput\nSecond line'
multiline: True
CTextInput:
size_hint_y: None
height: '32dp'
disabled: True
text: 'Disabled textinput'
<CTextInput@TextInput>
on_focus:
screen = self.parent.parent.parent.parent
if screen.parent: screen.focused = self

View file

@ -0,0 +1,39 @@
ShowcaseScreen:
name: 'ToggleButton'
GridLayout:
cols: 3
spacing: '8dp'
size_hint_y: None
height: self.minimum_height
Label:
text: 'Choice 1'
ToggleButton:
size_hint_y: None
height: '48dp'
text: 'A'
group: 'g1'
ToggleButton:
size_hint_y: None
height: '48dp'
text: 'B'
group: 'g1'
Label:
text: 'Choice 2'
ToggleButton:
size_hint_y: None
height: '48dp'
text: 'A'
group: 'g2'
ToggleButton:
size_hint_y: None
height: '48dp'
text: 'B'
group: 'g2'