pudb icon indicating copy to clipboard operation
pudb copied to clipboard

Added toggle sidebar feature

Open dan-ess opened this issue 11 years ago • 11 comments

I wanted to add support to copy pudb console output to the clipboard. Unfortunately, python libraries such as tkinter or pyclipboard rely on external modules to provide clipboard support, which makes this feature difficult to provide reliably.

As I work around, I have added support to toggle the sidebar using ctrl ^. When the sidebar is not visible you can select multiple lines of text in the console without selecting text from the sidebar.

dan-ess avatar Feb 14 '15 00:02 dan-ess

Could you add that shortcut to the help screen?

inducer avatar Feb 14 '15 02:02 inducer

Sure! Is that ok?

dan-ess avatar Feb 14 '15 08:02 dan-ess

Now that I've actually tried the patch, I'm actually not completely happy with it. The problem I see is that even in the disabled state, the sidebar can still accept focus, which is confusing. In addition, a small gray bar is still shown on the right.

inducer avatar Feb 14 '15 17:02 inducer

Good points. I updated the PR to unfocus the sidebar and hide the column separator (dividechars = 0) when the side bar is turned off. What do you think?

dan-ess avatar Feb 15 '15 09:02 dan-ess

Not entirely happy--I can still get the focus onto the sidebar, at which point my key events appear to go nowhere... @asmeurer, what do you think?

inducer avatar Feb 15 '15 17:02 inducer

I agree we should not allow the keyboard to get to the sidebar if it's hidden. Can you disable key bindings temporarily?

asmeurer avatar Feb 16 '15 04:02 asmeurer

Hi guys, thanks for the feedback!

I know this is not what was suggested, but what about just making the sidebar visible first if someone tries to focus a sidebar element while the sidebar is not visible? Seems like reasonable UI behaviour.

dan-ess avatar Feb 16 '15 13:02 dan-ess

You don't get notified when the sidebar gets the focus (IIRC), so you'd have to poll (in the event loop or so). Not sure I'm a fan.

inducer avatar Feb 16 '15 16:02 inducer

Sidebar focus is set by RHColumnFocuser when one of 'V', 'S', or 'B' is pressed. RHColumnFocuser receives notification of the key press event from SignalWrap.

I just added code inside RHColumnFocuser before it sets focus to the sidebar, to ensure the sidebar is visible first (no polling for focus on the sidebar required). Does this seem reasonable?

dan-ess avatar Feb 16 '15 23:02 dan-ess

No, because Urwid also messes with the Focus behind our backs. Pressing "Cursor Right" will also get the sidebar focused.

inducer avatar Feb 16 '15 23:02 inducer

Aha! Thanks for the clarification, I figured I was missing something. I'll have a think about this.

dan-ess avatar Feb 17 '15 00:02 dan-ess