Actually, here's a better version of that patch. The input_stroke_ended
listeners were redundant.

On Fri, Oct 5, 2012 at 8:23 AM, John Watson <[email protected]> wrote:

> I've attached a new patch that works the way you describe. It uses the
> stroke_observers callback in split_stroke(). I've done some rudimentary
> testing and it seems to work fine but I don't know enough about those
> observers to know if there might be any side effects.
>
> For what it's worth, 1.0.0 doesn't swap between the most recently used
> colors during a stroke, so from the perspective of a 1.0.0 user, this might
> be viewed as a feature change.
>
>
> On Fri, Oct 5, 2012 at 1:51 AM, Martin Renold <[email protected]> wrote:
>
>> hi John
>>
>> Thanks for working on this!
>>
>> I have tried your patch, however it doesn't quite fix the bug. I still
>> cannot use the "x" key in mid-stroke to toggle between two colors.  For
>> this
>> I have to lift the pen first now, which is inconvenient when working fast
>> in
>> black&white for example.
>>
>> I don't think input_stroke_ended_observers is suited for this task, it
>> just
>> listens to mouse up/down events, not to undoable strokes.  Maybe
>> previously
>> worked by checking the undo history?  I'm not sure any more, but there is
>> a
>> call to split_stroke() whenever you press "x", which creates a new
>> undoable
>> stroke if anything was painted.
>>
>> PS: Your mailer seems to have added newlines to the patch. Please send it
>> as
>> attachement next time, it's the easiest way to avoid that problem.
>>
>> Regards
>> Martin
>>
>> On Thu, Oct 04, 2012 at 06:09:42PM -0700, John Watson wrote:
>> > Hi. Long time MyPaint user, just compiled the git master (love the new
>> > features!) and came up against the color history bug (
>> > http://gna.org/bugs/?20129).
>> >
>> > Here's a patch that reverts the color history picker to the 1.0.0
>> behavior:
>> >
>> > From 694d25ab9de7f5e9d82f6f06868b46022db4c208 Mon Sep 17 00:00:00 2001
>> > From: John Watson <[email protected]>
>> > Date: Thu, 4 Oct 2012 17:56:09 -0700
>> > Subject: [PATCH] Fix color history regression bug 20129
>> >
>> > ---
>> >  gui/colors/adjbases.py |    4 ++--
>> >  gui/historypopup.py    |    6 ++++++
>> >  2 files changed, 8 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/gui/colors/adjbases.py b/gui/colors/adjbases.py
>> > index 7586b0e..664b07b 100644
>> > --- a/gui/colors/adjbases.py
>> > +++ b/gui/colors/adjbases.py
>> > @@ -141,8 +141,8 @@ class ColorManager (gobject.GObject):
>> >          """
>> >          while color in self.__hist:
>> >              self.__hist.remove(color)
>> > -        self.__hist.insert(0, color)
>> > -        self.__hist = self.__hist[:self.__HIST_LEN]
>> > +        self.__hist.append(color)
>> > +        self.__hist = self.__hist[-self.__HIST_LEN:]
>> >          key = PREFS_KEY_COLOR_HISTORY
>> >          val = []
>> >          for c in self.__hist:
>> > diff --git a/gui/historypopup.py b/gui/historypopup.py
>> > index 2ea9bd5..cef0a5e 100644
>> > --- a/gui/historypopup.py
>> > +++ b/gui/historypopup.py
>> > @@ -69,6 +69,9 @@ class HistoryPopup(windowing.PopupWindow):
>> >          self.doc = doc
>> >          self.is_shown = False
>> >
>> > +        guidoc = app.doc
>> > +
>> >  guidoc.input_stroke_ended_observers.append(self.input_stroke_ended_cb)
>> > +
>> >      def enter(self):
>> >          # finish pending stroke, if any (causes stroke_finished_cb to
>> get
>> > called)
>> >          self.doc.split_stroke()
>> > @@ -103,6 +106,9 @@ class HistoryPopup(windowing.PopupWindow):
>> >      def button_release_cb(self, widget, event):
>> >          pass
>> >
>> > +    def input_stroke_ended_cb(self, event):
>> > +        self.selection = None
>> > +
>> >      def expose_cb(self, widget, event):
>> >          cr = self.get_window().cairo_create()
>> >          return self.draw_cb(widget, cr)
>> > --
>> > 1.7.9.5
>>
>> > _______________________________________________
>> > Mypaint-discuss mailing list
>> > [email protected]
>> > https://mail.gna.org/listinfo/mypaint-discuss
>>
>>
>> --
>> Martin Renold
>>
>
>

Attachment: 0002-Fixed-color-history-regression-bug-20129.patch
Description: Binary data

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

Reply via email to