You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Defining AliasProperty explicitly with getter and setter is a bit painful and not very clear as we need to define 2 function and then create the AliasProperty.
Describe the solution you'd like
I'm proposing to kivy to provide alias_property decorator to easily create the alias property.
Current implementation
def _get_disk_total_text(self):
total = self.disk_usage.get('total', 0)
humanfriendly.format_size(total)
if total <= 0:
return ""
return _('Total space %s') % humanfriendly.format_size(total, binary=1)
disk_total_text = AliasProperty(_get_disk_total_text, None, bind=['disk_usage'])
New implementation:
@alias_property(bind=['disk_usage']
def disk_total_text():
total = self.disk_usage.get('total', 0)
humanfriendly.format_size(total)
if total <= 0:
return ""
return _('Total space %s') % humanfriendly.format_size(total, binary=1)
It's clean and concise.
A basic implementation supporting getter would look like this:
Is your feature request related to a problem? Please describe.
Defining AliasProperty explicitly with getter and setter is a bit painful and not very clear as we need to define 2 function and then create the AliasProperty.
Describe the solution you'd like
I'm proposing to kivy to provide
alias_property
decorator to easily create the alias property.Current implementation
New implementation:
It's clean and concise.
A basic implementation supporting getter would look like this:
The text was updated successfully, but these errors were encountered: