public class SunBurst extends Canvas
Displays a directory hierarchy as concentric rings weighted by file bytes. The center shows the current folder name and its recursive logical size. Each sector represents a subdirectory; space occupied by files directly in its parent remains blank in the next ring. Zero-byte subtrees have no sector in byte mode. When the entire current subtree is zero bytes, sectors instead use recursive entry counts (including one unit per directory). Siblings are ordered by decreasing recursive size counterclockwise from the top of their parent sector; zero-byte ties use entry counts, then names. Up to 64 main folder names are drawn tangentially when their measured width and estimated font height fit inside the sector, with padding at both arcs and side edges.
Hovering displays the full path, bytes, recursive file/folder counts and excluded entries. Click a sector to enter it; click the center or press Backspace to return within the scanned tree. F5 explicitly refreshes it. Symbolic links, Windows reparse points and special files are excluded. Hard links are counted per directory entry; sizes describe logical bytes rather than disk blocks.
background=true and loadFolder() scan on a worker thread, keeping the GUI responsive. A rotating center ring indicates loading; totals and sectors are partial until isLoading becomes false. Progress is published in bounded batches and coalesced approximately every 240 ms. Intermediate reads accumulate data, never queued graphical snapshots: each refresh lays out only the latest accumulated state available on the GUI thread. There is no percentage of completion because the number of entries is unknown until traversal finishes. setFolder() remains synchronous for callers needing immediate statistics. Scanning is iterative, with O(entries) filesystem work and O(directories) retained metadata, plus a bounded publication queue. Windows enumeration supplies sizes without separate per-file queries; POSIX reads type and size together once per entry. Geometry is cached until bounds, zoom, progress or selection change. Hover uses a binary search in one ring and performs no I/O. Sibling sorting costs O(children * log(children)) for visible dirty parents; unchanged and invisible sibling lists are not repeatedly sorted. Subpixel sectors are omitted from drawing and hit testing, retaining their statistics. Text measurements and label placement are cached until geometry or font changes. Descendants beyond maxDepth still contribute to all subtree statistics.
import klyn.gui.windows.filesystem import klyn.io chart = SunBurst(Path.cwd, background=true) chart.maxDepth = 6
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | currentFoldercurrentFolder as FolderPath |
Directory currently displayed at the center of the chart. |
| public readonly property | fileCountfileCount as ULong |
Number of regular file entries in the current subtree, partial while loading. |
| public readonly property | folderCountfolderCount as ULong |
Number of discovered descendant directories, excluding the current directory. |
| public readonly property | isLoadingisLoading as Boolean |
True while a background scan or its pending publications remain active. |
| public readonly property | loadErrorloadError as String |
Last background failure; empty for successful or newly started loads. |
| public property | maxDepthmaxDepth as Int |
Maximum visible directory depth; must be positive. |
| public readonly property | skippedCountskippedCount as ULong |
Number of excluded links, special files or vanished entries. |
| public readonly property | totalSizetotalSize as ULong |
Recursive logical file size in bytes, excluding symbolic links. |
| public readonly property | unreadableCountunreadableCount as ULong |
Number of subtree directories whose enumeration raised IOException. |
| Modifier and Type | Member | Description |
|---|---|---|
| public event | changedchanged as ActionEvent |
Emitted after loading, refreshing or navigating to a folder. |
| public event | loadFailedloadFailed as ActionEvent |
Emitted on the GUI thread on background failure; loadError describes it. |
| public event | loadedloaded as ActionEvent |
Emitted on the GUI thread after a successful background scan finishes. |
| public event | progressChangedprogressChanged as ActionEvent |
Emitted on the GUI thread after partial statistics/geometry are updated. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | SunBurstSunBurst(folder as FolderPath = null, background as Boolean = false) |
Creates the chart and scans the requested folder once. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | goUpgoUp() as Void |
Returns to the cached parent, or does nothing at the scanned root. |
| public | loadFolderloadFolder(folder as FolderPath) as Void |
Starts a background scan and immediately displays the requested root. |
| public override | paintpaint(painter as Painter) as Void |
Paints cached sectors, the named center and the pointer tooltip. |
| public | pollLoadingpollLoading() as Boolean |
Publishes a bounded portion of background results on the calling thread. |
| public | reloadreload() as Void |
Refreshes the current folder, making it the new navigation root. |
| public | setFoldersetFolder(folder as FolderPath) as Void |
Scans a new root and replaces the snapshot only after a successful scan. |
| public | stopLoadingstopLoading() as Void |
Cancels loading without blocking, retaining already displayed statistics. |