Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-1684

Display the file size in the systray

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.4
    • Component/s: GUI

      Description

      Display the file size in the systray. This is a simple function that will help:

      def sizeof_fmt(num: int, suffix: str = "o") -> str:
          """
          Human readable version of file size.
          Supports:
              - all currently known binary prefixes (https://en.wikipedia.org/wiki/Binary_prefix)
              - negative and positive numbers
              - numbers larger than 1,000 Yobibytes
              - arbitrary units
      
          Examples:
      
              >>> sizeof_fmt(168963795964)
              "157.4 Gio"
              >>> sizeof_fmt(168963795964, suffix="B")
              "157.4 GiB"
      
          Source: https://stackoverflow.com/a/1094933/1117028
          """
          val = float(num)
          for unit in ("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"):
              if abs(val) < 1024.0:
                  return f"{val:3.1f} {unit}{suffix}"
              val /= 1024.0
          return f"{val:.1f} Yi{suffix}"
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h