Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)
class OneLineAvatarIconListItem(OneLineAvatarListItem):
# dp(40) = dp(16) + dp(24):
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)
class TwoLineAvatarIconListItem(TwoLineAvatarListItem):
# dp(40) = dp(16) + dp(24):
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)
class ThreeLineAvatarIconListItem(ThreeLineAvatarListItem):
# dp(40) = dp(16) + dp(24):
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)
def display_menu(self, caller):
# We need to pick a starting point, see how big we need to be,
# and where to grow to.
c = caller.to_window(caller.center_x,
caller.center_y) # Starting coords
# ---ESTABLISH INITIAL TARGET SIZE ESTIMATE---
target_width = self.width_mult * m_res.STANDARD_INCREMENT
# If we're wider than the Window...
if target_width > Window.width:
# ...reduce our multiplier to max allowed.
target_width = int(
Window.width / m_res.STANDARD_INCREMENT) * m_res.STANDARD_INCREMENT
target_height = sum([dp(48) for i in self.items])
# If we're over max_height...
if 0 < self.max_height < target_height:
target_height = self.max_height
# ---ESTABLISH VERTICAL GROWTH DIRECTION---
if self.ver_growth is not None:
ver_growth = self.ver_growth
else:
# If there's enough space below us:
class TwoLineRightIconListItem(OneLineRightIconListItem):
_txt_top_pad = NumericProperty(dp(20))
_txt_bot_pad = NumericProperty(dp(15)) # dp(20) - dp(5)
_height = NumericProperty()
_num_lines = 2
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.height = dp(72) if not self._height else self._height
class ThreeLineRightIconListItem(ContainerSupport, ThreeLineListItem):
# dp(40) = dp(16) + dp(24):
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)
class OneLineAvatarIconListItem(OneLineAvatarListItem):
# dp(40) = dp(16) + dp(24):
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)
class TwoLineAvatarIconListItem(TwoLineAvatarListItem):
# dp(40) = dp(16) + dp(24):
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)
class ThreeLineAvatarIconListItem(ThreeLineAvatarListItem):
# dp(40) = dp(16) + dp(24):
_txt_right_pad = NumericProperty(dp(40) + m_res.HORIZ_MARGINS)
def display_menu(self, caller):
# We need to pick a starting point, see how big we need to be,
# and where to grow to.
c = None
if self.starting_coords is None or self.starting_coords == "center":
c = caller.to_window(caller.center_x, caller.center_y)
elif self.starting_coords == "bottom":
c = caller.to_window(caller.x, caller.y)
# Starting coords
# TODO: ESTABLISH INITIAL TARGET SIZE ESTIMATE
target_width = self.width_mult * m_res.STANDARD_INCREMENT
# md_menu = self.ids.md_menu
# opts = md_menu.layout_manager.view_opts
# md_item = md_menu.view_adapter.get_view(1, md_menu.data[1],
# opts[1]['viewclass'])
# If we're wider than the Window...
if target_width > Window.width:
# ...reduce our multiplier to max allowed.
target_width = (
int(Window.width / m_res.STANDARD_INCREMENT)
* m_res.STANDARD_INCREMENT
)
target_height = sum([dp(48) for i in self.items])
# If we're over max_height...
if 0 < self.max_height < target_height:
def display_menu(self, caller):
c = caller.to_window(caller.center_x, caller.center_y)
target_width = self.width_mult * m_res.STANDARD_INCREMENT
if target_width > Window.width:
target_width = (
int(Window.width / m_res.STANDARD_INCREMENT)
* m_res.STANDARD_INCREMENT
)
target_height = sum([dp(48) for i in self.items])
if 0 < self.max_height < target_height:
target_height = self.max_height
if self.ver_growth is not None:
ver_growth = self.ver_growth
else:
if target_height <= c[1] - self.border_margin:
ver_growth = "down"
elif target_height < Window.height - c[1] - self.border_margin:
ver_growth = "up"
else:
if c[1] >= Window.height - c[1]:
elif self.starting_coords == "bottom":
c = caller.to_window(caller.x, caller.y)
# Starting coords
# TODO: ESTABLISH INITIAL TARGET SIZE ESTIMATE
target_width = self.width_mult * m_res.STANDARD_INCREMENT
# md_menu = self.ids.md_menu
# opts = md_menu.layout_manager.view_opts
# md_item = md_menu.view_adapter.get_view(1, md_menu.data[1],
# opts[1]['viewclass'])
# If we're wider than the Window...
if target_width > Window.width:
# ...reduce our multiplier to max allowed.
target_width = (
int(Window.width / m_res.STANDARD_INCREMENT)
* m_res.STANDARD_INCREMENT
)
target_height = sum([dp(48) for i in self.items])
# If we're over max_height...
if 0 < self.max_height < target_height:
target_height = self.max_height
# ---ESTABLISH VERTICAL GROWTH DIRECTION---
if self.ver_growth is not None:
ver_growth = self.ver_growth
else:
# If there's enough space below us:
if target_height <= c[1] - self.border_margin:
ver_growth = "down"
# if there's enough space above us:
"""Text color used for secondary text if secondary_theme_text_color
is set to 'Custom'"""
secondary_theme_text_color = StringProperty("Secondary", allownone=True)
"""Theme text color for secondary primary text"""
secondary_font_style = OptionProperty("Body1", options=theme_font_styles)
divider = OptionProperty(
"Full", options=["Full", "Inset", None], allownone=True
)
_txt_left_pad = NumericProperty(dp(16))
_txt_top_pad = NumericProperty()
_txt_bot_pad = NumericProperty()
_txt_right_pad = NumericProperty(m_res.HORIZ_MARGINS)
_num_lines = 2
class ModifiedOneLineListItem(ModifiedBaseListItem):
"""A one line list item"""
_txt_top_pad = NumericProperty(dp(16))
_txt_bot_pad = NumericProperty(dp(15)) # dp(20) - dp(5)
_num_lines = 1
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.height = dp(48)
class ContainerSupport:
def display_menu(self, caller):
# We need to pick a starting point, see how big we need to be,
# and where to grow to.
c = caller.to_window(
caller.center_x, caller.center_y
) # Starting coords
# TODO: ESTABLISH INITIAL TARGET SIZE ESTIMATE
target_width = self.width_mult * m_res.STANDARD_INCREMENT
# md_menu = self.ids.md_menu
# opts = md_menu.layout_manager.view_opts
# md_item = md_menu.view_adapter.get_view(1, md_menu.data[1],
# opts[1]['viewclass'])
# If we're wider than the Window...
if target_width > Window.width:
# ...reduce our multiplier to max allowed.
target_width = (
int(Window.width / m_res.STANDARD_INCREMENT)
* m_res.STANDARD_INCREMENT
)
target_height = sum([dp(48) for i in self.items])
# If we're over max_height...
if 0 < self.max_height < target_height:
def display_menu(self, caller):
c = caller.to_window(caller.center_x, caller.center_y)
target_width = self.width_mult * m_res.STANDARD_INCREMENT
if target_width > Window.width:
target_width = (
int(Window.width / m_res.STANDARD_INCREMENT)
* m_res.STANDARD_INCREMENT
)
target_height = sum([dp(48) for i in self.items])
if 0 < self.max_height < target_height:
target_height = self.max_height
if self.ver_growth is not None:
ver_growth = self.ver_growth
else:
if target_height <= c[1] - self.border_margin:
ver_growth = "down"
elif target_height < Window.height - c[1] - self.border_margin:
def display_menu(self, caller):
# We need to pick a starting point, see how big we need to be,
# and where to grow to.
c = caller.to_window(caller.center_x,
caller.center_y) # Starting coords
# ---ESTABLISH INITIAL TARGET SIZE ESTIMATE---
target_width = self.width_mult * m_res.STANDARD_INCREMENT
# If we're wider than the Window...
if target_width > Window.width:
# ...reduce our multiplier to max allowed.
target_width = int(
Window.width / m_res.STANDARD_INCREMENT) * m_res.STANDARD_INCREMENT
target_height = sum([dp(48) for i in self.items])
# If we're over max_height...
if 0 < self.max_height < target_height:
target_height = self.max_height
# ---ESTABLISH VERTICAL GROWTH DIRECTION---
if self.ver_growth is not None:
ver_growth = self.ver_growth
else:
# If there's enough space below us:
if target_height <= c[1] - self.border_margin:
ver_growth = 'down'
# if there's enough space above us:
elif target_height < Window.height - c[1] - self.border_margin:
ver_growth = 'up'