On Wed, Jul 29, 2009 at 04:20:15PM +0200, Jon Nordby wrote:
> On Sat, Jul 25, 2009 at 9:32 AM, Martin Renold <[email protected]> wrote:
> 
> > Although one problem is that the brush has no "color picking mode".
> 
> Perhaps there should be such a mode?

...in the Brush engine? I guess that would mix it up with the GUI code
too much. The brush engine has a similar concept already, the "smudge
color".

...as part of the GUI code? Maybe. Technically it already exists to some
extent in the form of a pointer grab (colorpicker.py line 56). Or (just
another way to look at it) in the form of the colorpicker "popup"-state. 
Maybe it could be made a more "ordinary" GUI state (not sure yet how).

> It does make sense for this exact feature.  But how would it turn out for
> the other features that do color picking?  Would it simplify or make
> things harder?

I don't know. It might simplify or complicate things, but I guess not by
much.

>  Some other applications do have the color picker as a "mode".

I guess you are talking about a GIMP-like color picker tool. That doesn't
make sense for painting; after you picked a color, you want to use it, not
pick another color.  (But it could be useful to append colors to a palette
with a single click.)

> > > 1) Make the behaviour on invokation be like the "v" color changer
> >
> > This will fix picking for fullscreen+keyboard users.
> 
> As I see it the only straight forward way to implement this is by using the
> color picker. This will lead to the mentioned case where one can pick other
> things than the actual contents of the palette.

I don't see how the color picker would come into play here, except as a
cheap way to translate the mouse coordinate into a color.

> This might not be ideal, but I cannot think of another implementation that
> handles the "holding down and letting go of the key will get the color of
> the slot you're hovering over" case well.  Any ideas?

That's not so hard to do. Just listen to motion events, and update something
like self.selected_color during them.  Ideally, you also mark the color that
would be selected with a frame (just a matter of calling queue_draw() in the
motion event callback whenever it changes).  Set the brush color when you
finally get the corresponding key release event (see below).

> I guess one possibility might be to register a button release event and look
> for the the invokation key, but this would require the palette to know this
> key (which the user might change).

That's exactly the problem that gui/keyboard.py is solving.

It allows the action handler to register a callback for the release event of
whatever key has invoked the action.  This feature is wrapped by the state
system (gui/stategroup.py line 123) and finally used for example in the "v"
color changer (gui/colorselectionwindow.py line 154).

I'm open to suggestions how to make this code clearer and more explicit. 
Ideally you wouldn't need to study the places above to figure it out.

bye,
Martin

_______________________________________________
Mypaint-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/mypaint-discuss

Reply via email to