Giter VIP home page Giter VIP logo

Comments (11)

bastijnv avatar bastijnv commented on September 22, 2024 1

I agree, makes sense. Would be nice if a on_pane_changed() was there though it might be overkill if we can't find more use-cases for this.

from statusbarextended.

bastijnv avatar bastijnv commented on September 22, 2024 1

@mherrmann so it ends up in your notifications (previous autocorrected to your twitter).

from statusbarextended.

mherrmann avatar mherrmann commented on September 22, 2024 1

Okay, that's the way I'll implement it then. I've created a card so I don't forget.

from statusbarextended.

bastijnv avatar bastijnv commented on September 22, 2024

This is most probably an issue with the on_path_changed() not being fired by fman core itself. Should probably report the issue there.

from statusbarextended.

kek91 avatar kek91 commented on September 22, 2024

But the tab button shouldn't trigger on_path_changed() because it doesn't actually change path, it just moves the cursor to the other pane, so there's nothing wrong with on_path_changed() per se.

I just need a method to hook into (like I did on toggle_selection()), I looked through the core plugin but I couldn't find any methods for changing cursor pane, only "MoveCursorDown/Up" etc (and I guess it would be overkill to refresh statusbar on every cursor movement in the same pane).

I'll tag @mherrmann and maybe he can give us a hint

from statusbarextended.

mherrmann avatar mherrmann commented on September 22, 2024

I can see the need for this. What would be most logical to me would be an on_pane_activated event. What do you guys think?

from statusbarextended.

bastijnv avatar bastijnv commented on September 22, 2024

on_pane_activated suggest you subscribe to both panes (guessing by the API naming). Or did you mean to fire with the activated pane ID in the args and is the API name a bit confusing.

I can think of two situations:

  • You want to know when a specific pane is activated; this would suggest on_pane_actived.
  • You just want to refresh something when a pane is switched. In this case it might be easier to have something like on_active_pane_changed(id).

Of course on_pane_activated(id) could be your intention but I was misinterpreting the API.

from statusbarextended.

mherrmann avatar mherrmann commented on September 22, 2024

Actually, on_activated would be a better name for what I mean. Maybe that already clarifies what you now asked @bastijnv.

I would make on_activated similar to on_path_changed. Say you have:

class Foo(DirectoryPaneListener):
    def on_path_changed(self):
        pass
    def on_activated(self):
        pass

When there are two panes (the default), there would be two instances of Foo. When one pane's path changes, on_path_changed is called on that instance. When the user presses TAB so the other pane becomes active, that other Foo instance's on_activated method is called.

Does that make sense?

from statusbarextended.

kek91 avatar kek91 commented on September 22, 2024

on_pane_activated or on_activated or whatever is perfect. Once that is fired we can simply do self.pane.id to get the current pane :)

from statusbarextended.

mherrmann avatar mherrmann commented on September 22, 2024

What do you think of on_activated @bastijnv ?

from statusbarextended.

bastijnv avatar bastijnv commented on September 22, 2024

That would work. Generic so it could also be reused for other elements in the future.

Thanks @m_herrmann.

from statusbarextended.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.