toot icon indicating copy to clipboard operation
toot copied to clipboard

Time to move the images branch to master?

Open danschwarz opened this issue 1 year ago • 4 comments

With my latest updates, the images branch is working well with block graphics, kitty and iterm graphics. block is the default, if you want kitty or iterm you select at the command line like so: toot tui -f kitty

Image support is an installable option [images] the same way that [richtext] is. It brings in Pillow and term-image dependencies if selected.

All the image code is in tui/images.py and conditionally loads depending on library availabilty. If you run without image support, everything looks and works much the same as the master branch. ~, with the exception that the author header block in a toot is indented a bit. This can be changed if desired, but I think it looks OK this way. Your call.~

Images branch is up to date with master branch as of now.

image I

danschwarz avatar Jan 19 '24 23:01 danschwarz

Thanks, I'll check it out.

ihabunek avatar Jan 22 '24 08:01 ihabunek

Looking forward to this!!

tramtrist avatar Feb 24 '24 14:02 tramtrist

I tested it, it works great, thanks @danschwarz

git clone [email protected]:ihabunek/toot.git
cd toot
pip install --editable .
pip install pillow term_image
git switch images
python -m toot tui -f iterm
  • macOS 14.3.1
  • WezTerm 20240203-110809-5046fc22
  • Python 3.12

Screenshot 2024-02-25 at 1 19 07 PM

AbeEstrada avatar Feb 26 '24 02:02 AbeEstrada

Same on Fedora (AsahiLinux no less). Ran fine.

tramtrist avatar Feb 26 '24 02:02 tramtrist

Given the emphasis on the tooi front end now, perhaps it'd be best to make the images branch an independent fork of the toot tui in its own right.

danschwarz avatar Mar 15 '24 16:03 danschwarz

image support now merged into master - thanks @ihabunek

danschwarz avatar Apr 14 '24 00:04 danschwarz

Do you have urwidgets library installed? All these dependencies are part of the optional [images] section of pyproject.toml so can be automatically installed if you specify that at toot install time,

If you have all the dependencies and you’re launching with toot tui -f kitty then it should work. If not, are you running in a terminal multiplexer like tmux or screen? Those don’t play nice with kitty graphics in most cases.

On Sun, Apr 28, 2024 at 4:40 PM Carl Davis @.***> wrote:

Is there any dependency/trick for viewing images with kitty under Linux? I've tried --debug and don't see any output that helps me identify why it isn't displaying images.

I'm running toot v0.43.0, kitty 0.33.1, and installed the following two packages based on @AbeEstrada https://github.com/AbeEstrada's post:

extra/python-pillow 10.3.0-2 (814.2 KiB 4.0 MiB) Python Imaging Library (PIL) fork aur/termimage 1.2.1-1 (+0 0.00) Display images in your terminal

— Reply to this email directly, view it on GitHub https://github.com/ihabunek/toot/issues/468#issuecomment-2081647347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAY4FJRKZGPFEEJU722M4O3Y7VND3AVCNFSM6AAAAABCCVMYI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGY2DOMZUG4 . You are receiving this because you modified the open/close state.Message ID: @.***>

danschwarz avatar Apr 28 '24 22:04 danschwarz

I was not using the correct term_image dependency. Everything is working as expected now, thanks!

carldavis avatar Apr 30 '24 11:04 carldavis

What was the correct term_image dependency? I'm also on Arch, the package in the extra repo doesn't list any optional dependencies for image support so I'm not sure if I absolutely have to use pip to handle this one dependency or if there's already a package I'm overlooking that handles this.

HelmicNewciv avatar Jun 15 '24 06:06 HelmicNewciv

What was the correct term_image dependency? I'm also on Arch, the package in the extra repo doesn't list any optional dependencies for image support so I'm not sure if I absolutely have to use pip to handle this one dependency or if there's already a package I'm overlooking that handles this.

Term-Image 0.7.2 is the one you want. Urwidgets 0.2.0 also.

danschwarz avatar Jun 15 '24 14:06 danschwarz

Term-Image 0.7.2 is the one you want. Urwidgets 0.2.0 also.

I see that, but neither are the names of any Arch packages, hence my asking whether those are actually available in an Arch package or if I must install those via pip (which pip discourages in favor of using pacman).

HelmicNewciv avatar Jun 18 '24 06:06 HelmicNewciv

Sorry, I don't run arch, so can't advise you there. Term-image 0.7.2 was just released, so unlikely to have been packaged by any downstreams unless the packagers have some automated process in place (they may, for all I know.) Pip is what I use; all the dependencies are there.

danschwarz avatar Jun 18 '24 11:06 danschwarz