From: Phillip Susi <psusi@cfl.rr.com>
To: linux-btrfs@vger.kernel.org, Hugo Mills <hugo@carfax.org.uk>
Subject: [PATCH 3/3] Add radio knob to show space by position or combined
Date: Tue, 22 Nov 2011 20:13:06 -0500 [thread overview]
Message-ID: <4ECC48A2.6050305@cfl.rr.com> (raw)
In-Reply-To: <4EC67EAE.2090602@cfl.rr.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The previous method was to show chunks combined by type. This knob
allows the user to choose to show each individual chunk in its actual
position.
- ---
btrfsgui/gui/usagedisplay.py | 35 ++++++++++++++++++++++++++++-------
1 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/btrfsgui/gui/usagedisplay.py b/btrfsgui/gui/usagedisplay.py
index aff24da..fd8b1e2 100644
- --- a/btrfsgui/gui/usagedisplay.py
+++ b/btrfsgui/gui/usagedisplay.py
@@ -213,6 +213,22 @@ class UsageDisplay(Frame, Requester):
but.grid(row=2, column=1, sticky=W)
self.df_selection.set("alloc")
+ self.df_byposition = StringVar()
+ Label(box, text="Show allocated space").grid(row=3,column=0)
+ but = Radiobutton(
+ box, text="Combined",
+ variable=self.df_byposition,
+ command=self.change_display,
+ value="combined")
+ but.grid(row=3, column=1, sticky=W)
+ but = Radiobutton(
+ box, text="Individual",
+ variable=self.df_byposition,
+ command=self.change_display,
+ value="individual")
+ but.grid(row=4, column=1, sticky=W)
+ self.df_byposition.set("combined")
+
frm = LabelFrame(self, text="Volumes")
frm.columnconfigure(0, weight=1)
frm.rowconfigure(0, weight=1)
@@ -359,12 +375,17 @@ class UsageDisplay(Frame, Requester):
y = 4
for i, dev in enumerate(self.fs["vols"]):
# Combine chunks with same flags
- - chunks = {}
- - for chunk in dev["vol_df"]["chunks"]:
- - if chunk["flags"] in chunks:
- - chunks[chunk["flags"]]["size"] += chunk["size"]
- - chunks[chunk["flags"]]["used"] += chunk["used"]
- - else: chunks[chunk["flags"]] = chunk
+ if self.df_byposition.get() == "combined":
+ chunks = {}
+ for chunk in dev["vol_df"]["chunks"]:
+ if chunk["flags"] in chunks:
+ chunks[chunk["flags"]]["size"] += chunk["size"]
+ chunks[chunk["flags"]]["used"] += chunk["used"]
+ else: chunks[chunk["flags"]] = chunk
+ chunks = sorted(chunks.values(), key=usage_sort)
+ else:
+ chunks = [{"size": x["size"], "used": x["used"], "flags": x["flags"],
+ "offset": x["poffset"]} for x in dev["vol_df"]["chunks"]]
frame = LabelFrame(self.per_disk,
text=dev["path"])
frame.grid(sticky=N+S+E+W)
@@ -382,7 +403,7 @@ class UsageDisplay(Frame, Requester):
bbox = self.per_disk.bbox(container)
y = bbox[3] + 4
raw_free += self.create_usage_box(canvas,
- - sorted(chunks.values(), key=usage_sort),
+ chunks,
size=dev["vol_df"]["size"],
max_size=max_space)
self.per_disk.configure(
- --
1.7.5.4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk7MSKIACgkQJ4UciIs+XuIx5QCfSHc4/8bPkQuiTGs0R3D6SyPK
6+cAn1n7HcLowmobT48hQc+iPjUqJEer
=Ljl6
-----END PGP SIGNATURE-----
prev parent reply other threads:[~2011-11-23 1:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 23:20 Announcing btrfs-gui Hugo Mills
2011-06-02 8:31 ` Fajar A. Nugraha
2011-06-02 8:41 ` Hugo Mills
2011-06-03 21:48 ` Hugo Mills
2011-06-06 15:40 ` Chris Mason
2011-11-12 0:24 ` Amedee Van Gasse
2011-11-23 12:33 ` Hugo Mills
2011-11-23 17:39 ` cwillu
2011-11-18 15:50 ` Phillip Susi
2011-11-23 1:12 ` [PATCH 0/3] Show Chunks by position Phillip Susi
2011-11-23 12:34 ` Hugo Mills
2011-11-23 1:12 ` [PATCH 1/3] Changed volume_df() to return all chunks with their offsets Phillip Susi
2011-11-23 1:12 ` [PATCH 2/3] Update UsageDisplay to be capable of displaying all chunks by position Phillip Susi
2011-11-23 1:13 ` Phillip Susi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ECC48A2.6050305@cfl.rr.com \
--to=psusi@cfl.rr.com \
--cc=hugo@carfax.org.uk \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).