mirror of https://github.com/kivy/kivy.git
style: wip conversion to dp/sp
This commit is contained in:
parent
75d1ff0b53
commit
086023dc0c
|
@ -250,7 +250,7 @@ class ShowcaseApp(App):
|
|||
return col
|
||||
|
||||
def show_popup(self):
|
||||
btnclose = Button(text='Close this popup', size_hint_y=None, height='50dp')
|
||||
btnclose = Button(text='Close this popup', size_hint_y=None, height='50sp')
|
||||
content = BoxLayout(orientation='vertical')
|
||||
content.add_widget(Label(text='Hello world'))
|
||||
content.add_widget(btnclose)
|
||||
|
@ -259,7 +259,7 @@ class ShowcaseApp(App):
|
|||
auto_dismiss=False)
|
||||
btnclose.bind(on_release=popup.dismiss)
|
||||
button = Button(text='Open popup', size_hint=(None, None),
|
||||
size=('150dp', '70dp'))
|
||||
size=('150sp', '70dp'))
|
||||
button.bind(on_release=popup.open)
|
||||
popup.open()
|
||||
col = AnchorLayout()
|
||||
|
|
|
@ -154,9 +154,9 @@
|
|||
|
||||
[HSeparator@Label]:
|
||||
size_hint_y: None
|
||||
height: 45
|
||||
height: max(dp(45), self.texture_size[1] + dp(10))
|
||||
text: ctx.text if 'text' in ctx else ''
|
||||
text_size: self.size
|
||||
text_size: self.width, None
|
||||
valign: 'middle'
|
||||
halign: 'center'
|
||||
canvas.before:
|
||||
|
@ -258,18 +258,18 @@
|
|||
TextInput:
|
||||
text: 'Monoline textinput'
|
||||
size_hint_y: None
|
||||
height: 30
|
||||
height: sp(30)
|
||||
|
||||
TextInput:
|
||||
text: 'This is a password'
|
||||
size_hint_y: None
|
||||
height: 30
|
||||
height: sp(30)
|
||||
password: True
|
||||
|
||||
TextInput:
|
||||
text: 'Readonly textinput'
|
||||
size_hint_y: None
|
||||
height: 30
|
||||
height: sp(30)
|
||||
readonly: True
|
||||
|
||||
TextInput:
|
||||
|
|
|
@ -252,7 +252,7 @@
|
|||
|
||||
orientation: 'horizontal'
|
||||
size_hint_y: None
|
||||
height: 24
|
||||
height: '24sp'
|
||||
# Don't allow expansion of the ../ node
|
||||
is_leaf: not ctx.isdir or ctx.name.endswith('..' + ctx.sep) or self.locked
|
||||
on_touch_down: self.collide_point(*args[1].pos) and ctx.controller().entry_touched(self, args[1])
|
||||
|
@ -260,12 +260,13 @@
|
|||
BoxLayout:
|
||||
pos: root.pos
|
||||
Label:
|
||||
text_size: self.size
|
||||
id: filename
|
||||
text_size: self.width, None
|
||||
halign: 'left'
|
||||
shorten: True
|
||||
text: unicode(ctx.name)
|
||||
Label:
|
||||
text_size: self.size
|
||||
text_size: self.width, None
|
||||
size_hint_x: None
|
||||
halign: 'right'
|
||||
text: unicode(ctx.get_nice_size())
|
||||
|
@ -291,8 +292,8 @@
|
|||
width: scrollview.width
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
spacing: 10
|
||||
padding: 10
|
||||
spacing: '10dp'
|
||||
padding: '10dp'
|
||||
|
||||
[FileIconEntry@Widget]:
|
||||
locked: False
|
||||
|
@ -302,6 +303,7 @@
|
|||
|
||||
on_touch_down: self.collide_point(*args[1].pos) and ctx.controller().entry_touched(self, args[1])
|
||||
on_touch_up: self.collide_point(*args[1].pos) and ctx.controller().entry_released(self, args[1])
|
||||
size: '100dp', '100dp'
|
||||
|
||||
canvas:
|
||||
Color:
|
||||
|
@ -313,22 +315,22 @@
|
|||
source: 'atlas://data/images/defaulttheme/filechooser_selected'
|
||||
|
||||
Image:
|
||||
size: 48, 48
|
||||
size: '48dp', '48dp'
|
||||
source: 'atlas://data/images/defaulttheme/filechooser_%s' % ('folder' if ctx.isdir else 'file')
|
||||
pos: root.x + 24, root.y + 40
|
||||
pos: root.x + dp(24), root.y + dp(40)
|
||||
Label:
|
||||
text: unicode(ctx.name)
|
||||
text_size: (root.width, self.height)
|
||||
halign: 'center'
|
||||
shorten: True
|
||||
size: 100, 16
|
||||
pos: root.x, root.y + 16
|
||||
size: '100dp', '16dp'
|
||||
pos: root.x, root.y + dp(16)
|
||||
|
||||
Label:
|
||||
text: unicode(ctx.get_nice_size())
|
||||
font_size: '11sp'
|
||||
color: .8, .8, .8, 1
|
||||
size: 100, 16
|
||||
size: '100dp', '16sp'
|
||||
pos: root.pos
|
||||
halign: 'center'
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ class AccordionItem(FloatLayout):
|
|||
'''Link to the :attr:`Accordion.orientation` property.
|
||||
'''
|
||||
|
||||
min_space = NumericProperty(44)
|
||||
min_space = NumericProperty('44dp')
|
||||
'''Link to the :attr:`Accordion.min_space` property.
|
||||
'''
|
||||
|
||||
|
@ -321,7 +321,7 @@ class Accordion(Widget):
|
|||
easing function.
|
||||
'''
|
||||
|
||||
min_space = NumericProperty(44)
|
||||
min_space = NumericProperty('44dp')
|
||||
'''Minimum space to use for title of each item. This value is automatically
|
||||
set on each children, each time the layout happens.
|
||||
|
||||
|
|
|
@ -651,7 +651,7 @@ class ScrollView(StencilView):
|
|||
[.7, .7, .7, .9].
|
||||
'''
|
||||
|
||||
bar_width = NumericProperty(2)
|
||||
bar_width = NumericProperty('2dp')
|
||||
'''Width of the horizontal / vertical scroll bar. The width is interpreted
|
||||
as a height for the horizontal bar.
|
||||
|
||||
|
|
Loading…
Reference in New Issue