コード例 #1
0
def size_from_entry(entry, lower_bound=None, units=None):
    """ Get a Size object from an entry field.

        :param lower_bound: lower bound for size returned,
        :type lower_bound: :class:`blivet.size.Size` or NoneType
        :param units: units to use if none obtained from entry
        :type units: str or NoneType
        :returns: a Size object corresponding to the text in the entry field
        :rtype: :class:`blivet.size.Size` or NoneType

        Units default to bytes if no units specified in entry or units.

        Rounds up to lower_bound, if value in entry field corresponds
        to a smaller value. The default for lower_bound is None, yielding
        no rounding.
    """
    size_text = entry.get_text().strip()
    size = size_from_input(size_text, units=units)
    if size is None:
        return None
    if lower_bound is not None and size < lower_bound:
        return lower_bound
    return size
コード例 #2
0
def size_from_entry(entry, lower_bound=None, units=None):
    """ Get a Size object from an entry field.

        :param lower_bound: lower bound for size returned,
        :type lower_bound: :class:`blivet.size.Size` or NoneType
        :param units: units to use if none obtained from entry
        :type units: str or NoneType
        :returns: a Size object corresponding to the text in the entry field
        :rtype: :class:`blivet.size.Size` or NoneType

        Units default to bytes if no units specified in entry or units.

        Rounds up to lower_bound, if value in entry field corresponds
        to a smaller value. The default for lower_bound is None, yielding
        no rounding.
    """
    size_text = entry.get_text().strip()
    size = size_from_input(size_text, units=units)
    if size is None:
        return None
    if lower_bound is not None and size < lower_bound:
        return lower_bound
    return size
コード例 #3
0
def size_from_entry(entry):
    size_text = entry.get_text().strip()
    return size_from_input(size_text)
コード例 #4
0
def size_from_entry(entry):
    size_text = entry.get_text().decode("utf-8").strip()
    return size_from_input(size_text)
コード例 #5
0
def size_from_entry(entry):
    size_text = entry.get_text().decode("utf-8").strip()
    return size_from_input(size_text)