-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Miscellaneous feedback #33
Comments
Nice, thanks! The scrolling behavior (especially using the mouse after using the keyboard) is a bit weird too (also mentioned in #32). I'm not sure how to set / lock the focus to the tree view (currently the plot doesn't have any reason to be in focus). Tab to move focus would be nice. I played with getting from __future__ import annotations
import io
import sys
import matplotlib.pyplot as plt
from base64 import b64encode
import rich.console
import rich.ansi
import rich.panel
from typing import Any
def imgcat(data: bytes, fn: bytes = b"plot.pdf", *, width: str | int = "auto", height: str | int = "auto") -> bytes:
"""Output the image data to the iTerm2 console."""
osc = b"\033]"
st = b"\a"
csi = b"\033["
buf = b""
buf += osc
dims = f"width={width};height={height}"
buf += b"1337;File=name=" + b64encode(fn)
buf += f";size={len(data)};inline=1;{dims}:".encode("utf-8")
buf += b64encode(data) + st
return buf
class Plot:
def __init__(self) -> None:
self.decoder = rich.ansi.AnsiDecoder()
def __rich_console__(
self, console: rich.console.Console, options: rich.console.ConsoleOptions
) -> rich.console.RenderResult:
width = options.max_width or console.width
height = options.height or console.height
plt.figure(figsize=(width,height))
plt.plot([1, 2])
plt.title("test")
buf = io.BytesIO()
plt.savefig(buf, format='png')
buf.seek(0)
canvas = imgcat(buf.read(), width=width, height=height)
yield canvas
rich.print(rich.panel.Panel(Plot(), height=20)) But this |
For some of the other features, I think we are waiting on more features in Textual, like text entry boxes. Though I've seen libraries that add widgets, and we could possibly use those (or make our own) if we are ready to add them before textual does. We plan to use the beautiful tabs feature to toggle several views, like plot, info, table. |
@chrisburr, could you confirm what did you try to plot? I believe Are you talking about the traceback under the |
Firstly and most importantly, I love this! So much that I have a bunch of feedback 😅
At least some of these should probably be separate issues but with GitHub being down at the moment I've ended up with a single dump of thoughts.
Bugs and peculiarities
B Toggle sidebar
andQ Quit
. Seeing the uppercase makes me thing I should typeshit+B
/shift+Q
which doesn't work at alluproot-browser browse uproot-Event.root
. It seems like I have to click on the sidebar before I can use the keyboard to navigateuproot-Event.root:event
. I also think this should show a message like "Something went wrong, this probably means the branch's type isn't supported. If you think it should work the traceback below may hint at the cause of the problem."--iterm
isn't usable with dark mode as the plot background is transparent making the black lines invisibleFeatures
tree->Draw("MyVar", "PT>1000")
browse
could support--iterm
The text was updated successfully, but these errors were encountered: