Narrat / Pim

PyGObject based image viewer with vim-like keybindings
MIT License
28 stars 9 forks source link

[wip] next #23

Closed aeosynth closed 4 years ago

aeosynth commented 8 years ago

so i'm rewriting from scratch. not done yet, but i wanted to open this for discussion

my wm doesn't display icons, so win.set_icon_name('image-x-generic') has no effect for me; what do you use to see it?

Narrat commented 8 years ago

I'm using openbox, and with enabled titlebar the icon will be displayed there

aeosynth commented 8 years ago

why do we need to worry about initial window geometry? (i use a tiling wm, this has no effect)

is the mark code useful?

Narrat commented 8 years ago

I don't want, and I don't like if a program takes all screenspace on startup, but as far as a I remember it will happen, without some defined size. So not a problem of tiling wm, but imo for floating ones.

For marking. More or less a POC and to get rid of an entry from your old todo list ;) And maybe not a bad idea. Possible to mark picture paths to pipe those into another program and sorts.

One question to the current deletion implementation. As far I can tell the old problem will appear again. Pictures with the same name getting deleted will error out

aeosynth commented 8 years ago

i think we can implement xdg trash easily enough: https://github.com/sindresorhus/trash/blob/master/lib/linux.js

spec: https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html

i think marks were meant to be 'tags'

Narrat commented 8 years ago

Dunno what you meant back then :P I understood it the way I added it.

Whatever we implement (where xdg-trash is a probably favourable and more default location), errors with moving files shouldn't appear

Narrat commented 8 years ago

Without a placed config the program errors out --> pure optional, global conf file installation, or should generate one.

Window size is this: 1468078638

So, not whole screen this time, but way to small (and yeah, I could set openbox up to set a window size. But the program itself should provide something more useful) And on the left in the pim titlebar you can see the default icon if no icon specified. This icon also appears in panels like tint2 (yeah, tiler don't need that too), or in any graphical switcher (simplest one alt+tab)

Narrat commented 8 years ago

Gif animations need some special behaviour, as those cannot be zoomed and therefor error out currently

aeosynth commented 8 years ago

gifs work fine for me, what issue do you have?

Narrat commented 8 years ago
Traceback (most recent call last):
  File "./pim", line 178, in handle_key
    action[0](*action[1:])
  File "./pim", line 209, in move_index
    render()
  File "./pim", line 141, in render
    scaled = g.pixbuf.scale_simple(pWidth * scale, pHeight * scale,
AttributeError: 'GdkPixbufGifAnim' object has no attribute 'scale_simple'
aeosynth commented 8 years ago

can you share the image? that shouldn't happen, there's a check for g.animated at the start of the function

aeosynth commented 8 years ago

oh i think that's a bug with changing the index and not updating everything

aeosynth commented 8 years ago

this is a wip, not ready for real code review xD

Narrat commented 8 years ago

https://paste.archlinux.de/m-BhU6nR/

aeosynth commented 8 years ago

if i put those 2 images in a directory alone, pim loads them fine

Narrat commented 8 years ago

Not doing any review. Just checking what's working, what changed and writing a list with those points ;)

Jeah, but move a static image into this folder and it won't work with moving to such an animated picture from the static one

aeosynth commented 8 years ago

@Narrat can you test trashing (i don't have a de or file manager)

Narrat commented 8 years ago

Mostly working like it should Error case that remains. If the deleted picture is the last in the queue, pim will error out

trashed: /home/omnius/Programmieren/Pim/test/optic2.jpg
no key binding for: Alt_L
trashed: /home/omnius/Programmieren/Pim/test/optical.gif
trashed: /home/omnius/Programmieren/Pim/test/Helio vs Geocentrism.gif
Traceback (most recent call last):
  File "./pim", line 204, in handle_key
    action[0](*action[1:])
  File "./pim", line 78, in delete
    move_index(0)
  File "./pim", line 223, in move_index
    g.index = (g.index + delta) % len(g.paths)
ZeroDivisionError: integer division or modulo by zero

And still running + showing the last picture

Edit: Recovering isn't working. errors out on the path, although it should be in the info file? Or a case with the renaming of the file

aeosynth commented 8 years ago

fixed. to be clear, your fm can see files in the trash and undelete them?

aeosynth commented 8 years ago

alright trash works for me

Narrat commented 8 years ago

Just for confirmation, yes, the file manager (in this case Thunar, but in general every gvfs capable file manager and those who implemented sth like that) is capable of that

Edit: Works for me too

aeosynth commented 8 years ago

alright this is basically feature complete, just need zoom/rotation locks. with the alternate zoom mode, i don't need zoom lock (for now). it still needs some thought.

marking needs a rethink (tags?)

remember position needs a rework, possibly a single text file with the format path|index\n

Narrat commented 8 years ago

My inspiration of mark came from sxiv https://github.com/muennich/sxiv/blob/master/sxiv.1#L66

Narrat commented 8 years ago

Not sure if I like the calculating of the zoom_factor. I like it, if pictures fit into the window to get an overview and without the need to scroll anywhere and zoom if needed (to height, width or by percent). Which is not happening anymore.

Draging a picture horizontal isn't working?

aeosynth commented 8 years ago

fixed horizontal mouse scrolling. i can take some ideas from sxiv/feh

http://muennich.github.io/sxiv/sxiv.1.html http://man.finalrewind.org/1/feh/

my special mode is equivalent to feh --auto-zoom. --cycle-once (and then exit) would notify the user that the slideshow has ended

Narrat commented 8 years ago

my special mode is equivalent to feh --auto-zoom.

Not sure what you meant there. Care to elaborate?

aeosynth commented 8 years ago
-Z, --auto-zoom Zoom pictures to screen size in fullscreen / fixed geometry mode.

that's what my zoom mode does

Narrat commented 8 years ago

Ah, didn't compare geometry and fullscreen, so failed to see the pictures are the same in size. Still, not really to my liking

aeosynth commented 8 years ago

you can toggle auto zoom with ^z

and it's off by default, the foo config

Narrat commented 8 years ago

Yeah, but toggling it and every picture is at 100%

aeosynth commented 8 years ago

zooming is not complete yet. i'll look at feh/sxiv for ideas.

Narrat commented 8 years ago

Any good resource you can recommend about those Lambda expressions? Just knew it was a thing in Haskell, but apparently not, when looking at line 289.

aeosynth commented 8 years ago

https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions

aeosynth commented 8 years ago

that line specifcally was just copied from an example: https://docs.python.org/3/library/configparser.html#configparser.optionxform

javascript is my main language; it has first class functions, and 'lambdas' (anonymous functions) are natural

i mainly looked at the official docs (language syntax / library) when writing this

Narrat commented 8 years ago

Ok. Still not sure what I should think of those :D

What is currently completly missing (at least I missed it because I overlooked it, or it isn't there):

aeosynth commented 8 years ago

you should try writing some js. honestly one of the biggest pains in python (and other languages i'm trying) is the lack of first class functions

this is kind of on pause; i'm thinking of rewriting this in another language (crystal seems sexy)

Narrat commented 8 years ago

https://en.wikipedia.org/wiki/First-class_function this stuff? Looking at the chart the support doesn't seem that bad?

Well. At least I can say I heared of crystal :P