test-kivy-app/kivy_venv/share/kivy-examples/demo/kivycatalog/kivycatalog.kv

145 lines
4.5 KiB
Plaintext
Raw Normal View History

2024-09-15 12:12:16 +00:00
#:kivy 1.4
#:import KivyLexer kivy.extras.highlight.KivyLexer
<Container>:
canvas.before:
Color:
rgb: 0, 0, 0
Rectangle:
pos: self.pos
size: self.size
<Catalog>:
language_box: language_box
screen_manager: screen_manager
auto_reload: chkbx.active
info_label: info_lbl
orientation: 'vertical'
BoxLayout:
padding: '2sp'
canvas:
Color:
rgba: 1, 1, 1, .6
Rectangle:
size: self.size
pos: self.pos
size_hint: 1, None
height: '45sp'
Spinner:
size_hint: None, 1
width: '108sp'
text: 'Welcome'
values: [screen.name for screen in screen_manager.screens]
on_text: root.show_kv(*args)
Widget:
BoxLayout:
size_hint: None, 1
width: '150sp'
Label:
text: "Auto Reload"
CheckBox:
id: chkbx
active: True
size_hint_x: 1
Button:
size_hint: None, 1
width: '108sp'
text: 'Render Now'
on_release: root.change_kv(*args)
BoxLayout:
id: reactive_layout
orientation: 'vertical' if self.width < self.height else 'horizontal'
Splitter:
id: editor_pane
max_size: (reactive_layout.height if self.vertical else reactive_layout.width) - self.strip_size
min_size: sp(30) + self.strip_size
vertical: 1 if reactive_layout.width < reactive_layout.height else 0
sizable_from: 'bottom' if self.vertical else 'right'
size_hint: (1, None) if self.vertical else (None, 1)
size: 400, 400
on_vertical:
mid_size = self.max_size/2
if args[1]: self.height = mid_size
if not args[1]: self.width = mid_size
ScrollView:
id: kr_scroll
KivyRenderTextInput:
catalog: root
id: language_box
auto_indent: True
lexer: KivyLexer()
size_hint: 1, None
height: max(kr_scroll.height, self.minimum_height)
valign: "top"
text: "This box will display the kivy language for whatever has been selected"
on_text: root.schedule_reload()
on_cursor: root.schedule_reload()
ScreenManager:
id: screen_manager
Screen:
name: "Welcome"
PlaygroundContainer:
Screen:
name: "Float Layout"
FloatLayoutContainer
Screen:
name: "Box Layout"
BoxLayoutContainer:
Screen:
name: "Anchor Layout"
AnchorLayoutContainer:
Screen:
name: "Grid Layout"
GridLayoutContainer:
Screen:
name: "Stack Layout"
StackLayoutContainer:
Screen:
name: "Buttons"
ButtonContainer:
Screen:
name: "Labels"
LabelContainer:
Screen:
name: "Booleans"
CheckBoxContainer:
Screen:
name: "Progress Bar"
ProgressBarContainer:
Screen:
name: "Media"
MediaContainer:
Screen:
name: "Text"
TextContainer:
Screen:
name: "Popups"
PopupContainer:
Screen:
name: "Selectors"
SelectorsContainer:
Screen:
name: "File Choosers"
FileChooserContainer:
Screen:
name: "Scatter"
ScatterContainer:
Screen:
name: "ReST"
RestContainer:
FloatLayout:
size_hint: 1, None
height: 0
TextInput:
id:info_lbl
readonly: True
font_size: '14sp'
background_color: (0, 0, 0, 1)
foreground_color: (1, 1, 1, 1)
opacity:0
size_hint: 1, None
text_size: self.size
height: '150pt'
top: 0