Make settings update in real time #5

Closed
wants to merge 6 commits into
from

2 participants

@asmeurer
Collaborator

Right now, the line numbers setting doesn't work correctly, and I don't
know enough about urwid/pudb internals to figure out why. Any help here
would be much appreciated.

Also, it would probably be a good idea to factor out the saving to file
so that it only happens when the dialog is closed.

@asmeurer asmeurer Make settings update in real time
Right now, the line numbers setting doesn't work correctly, and I don't
know enough about urwid/pudb internals to figure out why.  Any help here
would be much appreciated.

Also, it would probably be a good idea to factor out the saving to file
so that it only happens when the dialog is closed.
cc521a2
@inducer
Owner

Calling source_widget (or whatever it's called)._invalidate() when the line # setting changes should do the trick. Also, did you remove the cancel button in the dialog?

@asmeurer
Collaborator

Well, I'm, calling the same _invalidate stuff that the run_edit_config calls, but it acts strange (checkout my branch and play with it to see what I mean).

I didn't remove the cancel button. I did make it so that it works, though, i.e., if you make some changes and click cancel, the changes you made are reverted.

@asmeurer
Collaborator

By the way, I didn't notice that the urwid dialog boxes take care of wrapping text on their own. I was a little liberal in wrapping some of my text examples. I'll push up a change fix these (I'll just do it to this branch).

@asmeurer
Collaborator

Actually, "factoring out the saving to file" is easy. Just don't call save_config on incremental updates.

@asmeurer asmeurer Fix the line number setting auto-updating
The problem was that the change didn't propagate to the global dict as I
thought it would.  So instead, we use the get_state() of the checkbox
(which is backwards by the way).  ui.setup_palette() doesn't seem to be
necessary in this case, so I left it out.  Anyway, it will still be
called when the dialog is closed.
39a7569
@asmeurer
Collaborator

OK, I've fixed the problem. Please review again.

@asmeurer
Collaborator

I've updated this to work with the stack frame option.

@inducer
Owner

I got to this before you had made the stack frame changes, and I found it a bit of a mess to clean up. 'Cancel' was broken, as was the 'custom theme'. I also didn't care much for the duplication of the settings apply logic. (All fixed.)

@inducer inducer closed this Jul 28, 2011
@asmeurer
Collaborator

Well, I'm not a fan of the way you changed cancel. To me, it worked just fine. You make experimental changes. If you like them, you choose OK, and they are saved. If you don't, you choose cancel or press ESC, and they are reverted.

This is the way that all auto-updating preferences dialogs work.

@asmeurer
Collaborator

See pull #8. I was more careful this time to avoid code duplication (this is generally easier the more you know a code base, so you have to forgive me for not doing it so well the first time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment