On Fri, Feb 17, 2012 at 5:14 PM, Richard Jones <[email protected]> wrote:
> Thank you very much maxy for the detailed report.
> I had a chance to fix the merge conflicts and commited the new branch as
> rj/linemode.
> The icons can be added by merging with Deevad's icon branch.
> None of the code changes have been attempted yet.
> I was not able to apply savageorange's patch after fixing the merge
> conflicts.
> I'll continue as I can.
I suspect I already fixed the merge conflicts (I'm running a number of
patches including yours on top of my master branch), which means that
the attached patches should work for you.
HTH,
David ('savageorange' on mypaint forums)
From f31c3ffd75167db47e079066e899b5936bab5c34 Mon Sep 17 00:00:00 2001
From: David Gowers <[email protected]>
Date: Fri, 27 Jan 2012 23:08:48 +1030
Subject: [PATCH] Curve-based adjustment of line shape.
---
gui/curve.py | 72 ++++++++++++++++++++++++++++++++++++++++-
gui/linemode.py | 97 +++++++++++++++++++++++++++++--------------------------
gui/toolbar.py | 77 +++++++++++++++++++++++++++++++++-----------
3 files changed, 180 insertions(+), 66 deletions(-)
diff --git a/gui/curve.py b/gui/curve.py
index 4161ce1..675eb4d 100644
--- a/gui/curve.py
+++ b/gui/curve.py
@@ -167,9 +167,79 @@ class CurveWidget(gtk.DrawingArea):
return True
+class FixedCurveWidget(CurveWidget):
+ """CurveWidget subclass with fixed number of points, and support for locking together the Y values of
+ specific points.
+ """
+ def __init__(self, npoints=4, ylockgroups = (), changed_cb=None, magnetic=True):
+ CurveWidget.__init__ (self, changed_cb, magnetic)
+ self.points = [(0.0, 0.2), (.25, .5), (.75, .75), (1.0, 1.0)] # doesn't matter
+ self.npoints = npoints
+ self.ylock = {}
+ for items in ylockgroups:
+ for thisitem in items:
+ others = list(items)
+ others.remove (thisitem)
+ self.ylock[thisitem] = tuple(others)
+ def set_point (self, index, value):
+ y = value[1]
+ self.points[index] = value
+ if index in self.ylock:
+ for lockedto in self.ylock[index]:
+ self.points[lockedto] = (self.points[lockedto][0], y)
+ def button_press_cb(self, widget, event):
+ if not event.button == 1: return
+ x, y = self.eventpoint(event.x, event.y)
+ nearest = None
+ for i in range(len(self.points)):
+ px, py = self.points[i]
+ dist = abs(px - x) + 0.5*abs(py - y)
+ if nearest is None or dist < mindist:
+ mindist = dist
+ nearest = i
+ # XXX HOW DO WE STOP THE POP?!?!
+ # CAN BE NO INSERTINGS OR MERGINGS.. IfYouKnowWhatIMean.
+ self.grabbed = nearest
+# def button_release_cb(self, widget, event):
+# if not event.button == 1: return
+# if self.grabbed:
+# i = self.grabbed
+# # THE FOLLOWING MEANS WHAT?
+# if self.points[i] is None:
+# self.points.pop(i)
+# self.grabbed = None
+# # notify user of the widget
+# self.changed_cb(self)
+ def motion_notify_cb(self, widget, event):
+ if self.grabbed is None: return
+ x, y = self.eventpoint(event.x, event.y)
+ i = self.grabbed
+ out = False # by default, the point cannot be removed by drawing it out
+ if i == len(self.points)-1:
+ # last point stays right
+ leftbound = rightbound = 1.0
+ elif i == 0:
+ # first point stays left
+ leftbound = rightbound = 0.0
+ else:
+ # other points can be dragged out
+ leftbound = self.points[i-1][0]
+ rightbound = self.points[i+1][0]
+
+ if y > 1.0: y = 1.0
+ if y < 0.0: y = 0.0
+ if self.magnetic:
+ if y > 0.48 and y < 0.52: y = 0.5
+ if x > 0.48 and x < 0.52: x = 0.5
+ if x < leftbound: x = leftbound
+ if x > rightbound: x = rightbound
+ self.set_point(i, (x, y))
+ self.queue_draw()
+
+
if __name__ == '__main__':
win = gtk.Window()
- curve = CurveWidget()
+ curve = FixedCurveWidget(ylockgroups = ((1,2),))
win.add(curve)
win.set_title("curve test")
win.connect("destroy", lambda *a: gtk.main_quit())
diff --git a/gui/linemode.py b/gui/linemode.py
index da670ed..b2ea6a4 100644
--- a/gui/linemode.py
+++ b/gui/linemode.py
@@ -20,8 +20,8 @@ line_mode_settings_list = [
['entry_pressure', _('Entrance Pressure'), False, 0.0001, 0.3, 1.0, _("Stroke entrance pressure for line tools")],
['midpoint_pressure', _('Midpoint Pressure'), False, 0.0001, 0.75, 1.0, _("Mid-Stroke pressure for line tools")],
['exit_pressure', _('Exit Pressure'), False, 0.0001, 0.3, 1.0, _("Stroke exit pressure for line tools")],
- ['line_head', _('Head'), False, 0.0001, 0.2, 1.0, _("Stroke lead-in ratio")],
- ['line_tail', _('Tail'), False, 0.0001, 0.2, 1.0, _("Stroke trail-off ratio")],
+ ['line_head', _('Head'), False, 0.0001, 0.3, 1.0, _("Stroke lead-in end")],
+ ['line_tail', _('Tail'), False, 0.0001, 0.7, 1.0, _("Stroke trail-off beginning")],
]
class LineModeSettings:
@@ -144,17 +144,18 @@ Rotate holding the Control key."),
return self.line_mode
def change_line_setting(self, setting, value):
- if setting == 'entry_pressure':
- self.entry_pressure = value
- if setting == 'midpoint_pressure':
- self.midpoint_pressure = value
- if setting == 'exit_pressure':
- self.exit_pressure = value
- if setting == 'line_head':
- self.head = value
- if setting == 'line_tail':
- self.tail = value
- self.redraw_with_new_settings()
+ if setting in ('entry_pressure', 'midpoint_pressure',
+ 'exit_pressure', 'line_head', 'line_tail'):
+ if setting in ('line_head', 'line_tail'):
+ setting = setting[5:]
+ try:
+ old = getattr (self, setting)
+ except AttributeError:
+ old = None
+ if old == value:
+ return
+ setattr (self, setting, value)
+ self.redraw_with_new_settings()
###
@@ -494,45 +495,47 @@ Rotate holding the Control key."),
mx, my = self.multiply_add(sx, sy, nx, ny, 0.25)
self.stroke_to(mx, my, entry_p)
# Middle start
- length = length/2
+ #length = length/2
mx, my = self.multiply_add(sx, sy, nx, ny, head * length)
self.stroke_to(mx, my, midpoint_p)
# Middle end
- mx, my = self.multiply_add(x, y, nx, ny, tail * -length)
+ mx, my = self.multiply_add(sx, sy, nx, ny, tail * length)
self.stroke_to(mx, my, midpoint_p)
# End
self.stroke_to(x, y, self.exit_pressure)
# Ellipse
def dynamic_ellipse(self, x, y, sx, sy):
+ points_in_curve = 360
x1, y1 = self.difference(sx, sy, x, y)
x1, y1, sin, cos = self.starting_point_for_ellipse(x1, y1, self.angle)
rx, ry = self.point_in_ellipse(x1, y1, sin, cos, 0)
self.brush_prep(sx+rx, sy+ry)
entry_p, midpoint_p, prange1, prange2, h, t = self.line_settings()
- head = int(180*h) + 1
- head_ratio = max(float(head),1.0)
- tail = 360 - int(180*t) + 1
- tail_ratio = max(float(360-tail),1.0)
+ head = points_in_curve * h
+ head_range = int(head)+1
+ tail = points_in_curve * t
+ tail_range = int(tail)+1
+ tail_length = points_in_curve - tail
# Beginning
px, py = self.point_in_ellipse(x1, y1, sin, cos, 1)
length, nx, ny = self.length_and_normal(rx, ry, px, py)
mx, my = self.multiply_add(rx, ry, nx, ny, 0.25)
self.stroke_to(sx+mx, sy+my, entry_p)
- pressure = abs(1/head_ratio * prange1 + entry_p)
+ pressure = abs(1/head * prange1 + entry_p)
self.stroke_to(sx+px, sy+py, pressure)
- for degree in xrange(2, head):
+ for degree in xrange(2, head_range):
px, py = self.point_in_ellipse(x1, y1, sin, cos, degree)
- pressure = abs(degree/head_ratio * prange1 + entry_p)
+ pressure = abs(degree/head * prange1 + entry_p)
self.stroke_to(sx+px, sy+py, pressure)
# Middle
- for degree in xrange(head, tail):
+ for degree in xrange(head_range, tail_range):
px, py = self.point_in_ellipse(x1, y1, sin, cos, degree)
self.stroke_to(sx+px, sy+py, midpoint_p)
# End
- for degree in xrange(tail, 361):
+ for degree in xrange(tail_range, points_in_curve+1):
px, py = self.point_in_ellipse(x1, y1, sin, cos, degree)
- pressure = abs((degree-tail)/tail_ratio * prange2 + midpoint_p)
+ pressure = abs((degree-tail)/tail_length * prange2 + midpoint_p)
self.stroke_to(sx+px, sy+py, pressure)
def dynamic_curve_1(self, cx, cy, sx, sy, ex, ey):
@@ -554,32 +557,34 @@ Rotate holding the Control key."),
cx, cy = self.multiply_add(mx, my, nx, ny, length*2)
x1, y1 = self.difference(sx, sy, cx, cy)
x2, y2 = self.difference(cx, cy, ex, ey)
- head = int(points_in_curve*0.5*h) + 1
- head_ratio = max(float(head),1.0)
- tail = points_in_curve - int(points_in_curve*0.5*t) + 1
- tail_ratio = max(float(points_in_curve-tail),1.0)
+ head = points_in_curve * h
+ head_range = int(head)+1
+ tail = points_in_curve * t
+ tail_range = int(tail)+1
+ tail_length = points_in_curve - tail
# Beginning
px, py = self.point_on_curve_1(1, cx, cy, sx, sy, x1, y1, x2, y2)
length, nx, ny = self.length_and_normal(sx, sy, px, py)
bx, by = self.multiply_add(sx, sy, nx, ny, 0.25)
self.stroke_to(bx, by, entry_p)
- pressure = abs((1/head_ratio) * prange1 + entry_p)
+ pressure = abs(1/head * prange1 + entry_p)
self.stroke_to(px, py, pressure)
- for i in xrange(2, head):
+ for i in xrange(2, head_range):
px, py = self.point_on_curve_1(i, cx, cy, sx, sy, x1, y1, x2, y2)
- pressure = abs((i/head_ratio) * prange1 + entry_p)
+ pressure = abs(i/head * prange1 + entry_p)
self.stroke_to(px, py, pressure)
# Middle
- for i in xrange(head, tail):
+ for i in xrange(head_range, tail_range):
px, py = self.point_on_curve_1(i, cx, cy, sx, sy, x1, y1, x2, y2)
self.stroke_to(px, py, midpoint_p)
# End
- for i in xrange(tail, points_in_curve+1):
+ for i in xrange(tail_range, points_in_curve+1):
px, py = self.point_on_curve_1(i, cx, cy, sx, sy, x1, y1, x2, y2)
- pressure = abs((i-tail)/tail_ratio * prange2 + midpoint_p)
+ pressure = abs((i-tail)/tail_length * prange2 + midpoint_p)
self.stroke_to(px, py, pressure)
def draw_curve_2(self, cx, cy, sx, sy, ex, ey, kx, ky):
+ points_in_curve = 100
self.brush_prep(sx, sy)
entry_p, midpoint_p, prange1, prange2, h, t = self.line_settings()
mx, my = (cx+sx+ex+kx)/4.0, (cy+sy+ey+ky)/4.0
@@ -590,29 +595,30 @@ Rotate holding the Control key."),
x1, y1 = self.difference(sx, sy, cx, cy)
x2, y2 = self.difference(cx, cy, kx, ky)
x3, y3 = self.difference(kx, ky, ex, ey)
- head = int(50*h) + 1
- head_ratio = max(float(head),1.0)
- tail = 100 - int(50*t) + 1
- tail_ratio = max(float(100-tail),1.0)
+ head = points_in_curve * h
+ head_range = int(head)+1
+ tail = points_in_curve * t
+ tail_range = int(tail)+1
+ tail_length = points_in_curve - tail
# Beginning
px, py = self.point_on_curve_2(1, cx, cy, sx, sy, kx, ky, x1, y1, x2, y2, x3, y3)
length, nx, ny = self.length_and_normal(sx, sy, px, py)
bx, by = self.multiply_add(sx, sy, nx, ny, 0.25)
self.stroke_to(bx, by, entry_p)
- pressure = abs((1/head_ratio) * prange1 + entry_p)
+ pressure = abs(1/head * prange1 + entry_p)
self.stroke_to(px, py, pressure)
- for i in xrange(2, head):
+ for i in xrange(2, head_range):
px, py = self.point_on_curve_2(i, cx, cy, sx, sy, kx, ky, x1, y1, x2, y2, x3, y3)
- pressure = abs((i/head_ratio) * prange1 + entry_p)
+ pressure = abs(i/head * prange1 + entry_p)
self.stroke_to(px, py, pressure)
# Middle
- for i in xrange(head, tail):
+ for i in xrange(head_range, tail_range):
px, py = self.point_on_curve_2(i, cx, cy, sx, sy, kx, ky, x1, y1, x2, y2, x3, y3)
self.stroke_to(px, py, midpoint_p)
# End
- for i in xrange(tail, 101):
+ for i in xrange(tail_range, points_in_curve+1):
px, py = self.point_on_curve_2(i, cx, cy, sx, sy, kx, ky, x1, y1, x2, y2, x3, y3)
- pressure = abs((i-tail)/tail_ratio * prange2 + midpoint_p)
+ pressure = abs((i-tail)/tail_length * prange2 + midpoint_p)
self.stroke_to(px, py, pressure)
def stroke_to(self, x, y, pressure):
@@ -724,4 +730,3 @@ Rotate holding the Control key."),
# self.snapshot = self.model.layer.save_snapshot()
# else:
# self.model.layer.stroke_to(brush, x, y, pressure, 0.0, 0.0, duration)
-
diff --git a/gui/toolbar.py b/gui/toolbar.py
index 9baa620..66094f1 100644
--- a/gui/toolbar.py
+++ b/gui/toolbar.py
@@ -140,6 +140,17 @@ class LineDropdownToolItem (gtk.ToolItem):
linemode_settings = ['LineModeFreeHand', 'LineModeStraight', 'LineModeSequence', 'LineModeEllipse']
pressure_settings = ["entry_pressure", "midpoint_pressure", "exit_pressure"]
head_tail_settings = ["line_head", "line_tail"]
+ shape_settings = ["entry_pressure", "midpoint_pressure", "exit_pressure", "line_head", "line_tail"]
+ settings_coordinate = {'entry_pressure': (0,1),
+ 'midpoint_pressure': (1,1),
+ 'exit_pressure': (3,1),
+ 'line_head': (1,0),
+ 'line_tail': (2,0),
+ #'line_head': (1,0),
+ #'line_tail': (2,0),
+ }
+
+
def __init__(self):
gtk.ToolItem.__init__(self)
@@ -188,14 +199,32 @@ class LineDropdownToolItem (gtk.ToolItem):
# Pressure settings.
def settings_frame():
- table = gtk.Table()
- table.set_homogeneous(False)
- table.set_row_spacings(widgets.SPACING_TIGHT)
- table.set_col_spacings(widgets.SPACING)
- table.set_border_width(widgets.SPACING)
- frame.add(table)
self.vbox.pack_start(frame, True, True)
- return table
+ from curve import FixedCurveWidget
+ curve = FixedCurveWidget(npoints = 4,
+ ylockgroups = ((1,2),),
+ changed_cb = self.curve_changed_cb)
+ frame.add(curve)
+ #vbox.pack_start(w, True, True)
+ curve.show()
+ curve.points = [(0.0,0.2), (0.33,.5),(0.66, .5), (1.0,.33)]
+ print('PT',curve.points)
+ for setting in (self.shape_settings):
+ value = app.line_mode_adjustment[setting].get_value()
+ index, subindex = self.settings_coordinate[setting]
+ #print ("%d %d" % (index, subindex))
+ if not setting.startswith ('line'):#if setting != 'line_head
+ value = 1.0 - value
+ coord = None
+ if subindex == 0:
+ #print ("FFF %d %d" % (index, subindex))
+ coord = (value, curve.points[index][1])
+ else:
+ coord = (curve.points[index][0], value )
+ #if setting ==
+ curve.set_point(index, coord)
+ self.curve_changed_cb (curve)
+ #return table
def settings_widgets(settings_group):
sg_row_height = gtk.SizeGroup(gtk.SIZE_GROUP_VERTICAL)
@@ -222,18 +251,28 @@ class LineDropdownToolItem (gtk.ToolItem):
table.attach(scale, 1, 2, row, row+1, gtk.FILL|gtk.EXPAND)
row += 1
- frame = widgets.section_frame(_("Pressure Settings"))
- table = settings_frame()
- settings_widgets(self.pressure_settings)
- frame = widgets.section_frame(_("Head Tail Stroke Settings"))
- table = settings_frame()
- settings_widgets(self.head_tail_settings)
-
- table.set_col_spacing(1, widgets.SPACING_TIGHT)
-
- def adjustment_changed_cb(self, widget, setting):
- value = widget.get_value()
- self.app.linemode.change_line_setting(setting, value)
+ frame = widgets.section_frame(_("Line Shape"))
+ settings_frame()
+ #settings_widgets(self.pressure_settings)
+ #frame = widgets.section_frame(_("Head Tail Stroke Settings"))
+ #table = settings_frame()
+ #settings_widgets(self.head_tail_settings)
+
+ #table.set_col_spacing(1, widgets.SPACING_TIGHT)
+
+ def curve_changed_cb(self, curve):
+ for setting in self.shape_settings:
+ coord = self.settings_coordinate [setting]
+ points = curve.points
+ value = curve.points[coord[0]][coord[1]]
+ if not setting.startswith('line'):
+ value = 1.0 - value
+ value = max(0.0001, value)
+ print ('setting %r (%s) to %f' % (coord, setting, value))
+ #if setting.startswith('line_'):
+ # setting = {'line_tail':'line_head', 'line_head':'line_tail'}[setting]
+ self.app.linemode.change_line_setting(setting, value)
+ print (curve.points)
class ColorDropdownToolItem (gtk.ToolItem):
--
1.7.9.1
From e11f71424ffc2d834e00eb6890422a828bbd48a7 Mon Sep 17 00:00:00 2001
From: David Gowers <[email protected]>
Date: Thu, 9 Feb 2012 10:25:43 +1030
Subject: [PATCH] Curve widget: snapping and bugfixes.
---
gui/curve.py | 21 +++++++++++++++++----
gui/toolbar.py | 43 +++++++------------------------------------
2 files changed, 24 insertions(+), 40 deletions(-)
diff --git a/gui/curve.py b/gui/curve.py
index 675eb4d..e7cd833 100644
--- a/gui/curve.py
+++ b/gui/curve.py
@@ -171,6 +171,7 @@ class FixedCurveWidget(CurveWidget):
"""CurveWidget subclass with fixed number of points, and support for locking together the Y values of
specific points.
"""
+ snapto = (0.0, 0.25, 0.5, 0.75, 1.0)
def __init__(self, npoints=4, ylockgroups = (), changed_cb=None, magnetic=True):
CurveWidget.__init__ (self, changed_cb, magnetic)
self.points = [(0.0, 0.2), (.25, .5), (.75, .75), (1.0, 1.0)] # doesn't matter
@@ -197,9 +198,8 @@ class FixedCurveWidget(CurveWidget):
if nearest is None or dist < mindist:
mindist = dist
nearest = i
- # XXX HOW DO WE STOP THE POP?!?!
- # CAN BE NO INSERTINGS OR MERGINGS.. IfYouKnowWhatIMean.
self.grabbed = nearest
+
# def button_release_cb(self, widget, event):
# if not event.button == 1: return
# if self.grabbed:
@@ -214,6 +214,16 @@ class FixedCurveWidget(CurveWidget):
if self.grabbed is None: return
x, y = self.eventpoint(event.x, event.y)
i = self.grabbed
+ # XXX this may fail for non contiguous groups.
+ if i in self.ylock:
+ possiblei = None
+ if x > self.points[max(self.ylock[i])][0]:
+ possiblei = max ((i,) + self.ylock[i])
+ elif x < self.points[min(self.ylock[i])][0]:
+ possiblei = min ((i,) + self.ylock[i])
+ if (possiblei != None and
+ abs (self.points[i][0] - self.points[possiblei][0]) < 0.001):
+ i = possiblei
out = False # by default, the point cannot be removed by drawing it out
if i == len(self.points)-1:
# last point stays right
@@ -229,8 +239,11 @@ class FixedCurveWidget(CurveWidget):
if y > 1.0: y = 1.0
if y < 0.0: y = 0.0
if self.magnetic:
- if y > 0.48 and y < 0.52: y = 0.5
- if x > 0.48 and x < 0.52: x = 0.5
+ xdiff = [abs(x - v) for v in self.snapto]
+ ydiff = [abs(y - v) for v in self.snapto]
+ if min (xdiff) < 0.015 and min (ydiff) < 0.015:
+ y = self.snapto[ydiff.index (min (ydiff))]
+ x = self.snapto[xdiff.index (min (xdiff))]
if x < leftbound: x = leftbound
if x > rightbound: x = rightbound
self.set_point(i, (x, y))
diff --git a/gui/toolbar.py b/gui/toolbar.py
index 66094f1..32b4514 100644
--- a/gui/toolbar.py
+++ b/gui/toolbar.py
@@ -205,60 +205,31 @@ class LineDropdownToolItem (gtk.ToolItem):
ylockgroups = ((1,2),),
changed_cb = self.curve_changed_cb)
frame.add(curve)
+ curve.set_tooltip_text('Curve defining the amount of pressure applied at different points in the line.\n'
+ '\nX position = distance along the line;\n'
+ ' minimum X = start of line;\n'
+ ' maximum X = end of line\n'
+ ' (only the central two points can be adjusted in X axis)\n'
+ 'Y position = amount of pressure\n'
+ ' The Y position of the central two points is locked together.\n')
#vbox.pack_start(w, True, True)
curve.show()
curve.points = [(0.0,0.2), (0.33,.5),(0.66, .5), (1.0,.33)]
- print('PT',curve.points)
for setting in (self.shape_settings):
value = app.line_mode_adjustment[setting].get_value()
index, subindex = self.settings_coordinate[setting]
- #print ("%d %d" % (index, subindex))
if not setting.startswith ('line'):#if setting != 'line_head
value = 1.0 - value
coord = None
if subindex == 0:
- #print ("FFF %d %d" % (index, subindex))
coord = (value, curve.points[index][1])
else:
coord = (curve.points[index][0], value )
- #if setting ==
curve.set_point(index, coord)
self.curve_changed_cb (curve)
- #return table
-
- def settings_widgets(settings_group):
- sg_row_height = gtk.SizeGroup(gtk.SIZE_GROUP_VERTICAL)
- sg_slider_width = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
- row = 0
- for setting in settings_group:
- scale = gtk.HScale()
- scale.set_size_request(128, -1)
- scale.set_draw_value(True)
- scale.set_value_pos(gtk.POS_LEFT)
- s = linemode.line_mode_settings_dict[setting]
- adj = app.line_mode_adjustment[setting]
- scale.set_adjustment(adj)
- scale.set_tooltip_text(s.tooltip)
- sg_row_height.add_widget(scale)
- sg_slider_width.add_widget(scale)
- label = gtk.Label(_("%s:") % s.name)
- label.set_alignment(0.0, 0.5)
- label.set_tooltip_text(s.tooltip)
- sg_row_height.add_widget(label)
- adj.connect("value-changed", self.adjustment_changed_cb, setting)
- adj.value_changed()
- table.attach(label, 0, 1, row, row+1, gtk.FILL)
- table.attach(scale, 1, 2, row, row+1, gtk.FILL|gtk.EXPAND)
- row += 1
frame = widgets.section_frame(_("Line Shape"))
settings_frame()
- #settings_widgets(self.pressure_settings)
- #frame = widgets.section_frame(_("Head Tail Stroke Settings"))
- #table = settings_frame()
- #settings_widgets(self.head_tail_settings)
-
- #table.set_col_spacing(1, widgets.SPACING_TIGHT)
def curve_changed_cb(self, curve):
for setting in self.shape_settings:
--
1.7.9.1
From fbc3e338fa17ac64ca75f4054337d052ebade7f7 Mon Sep 17 00:00:00 2001
From: David Gowers <[email protected]>
Date: Thu, 16 Feb 2012 17:33:32 +1030
Subject: [PATCH] Curve: minor optimization
---
gui/curve.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/gui/curve.py b/gui/curve.py
index e7cd833..1b1699c 100644
--- a/gui/curve.py
+++ b/gui/curve.py
@@ -172,11 +172,13 @@ class FixedCurveWidget(CurveWidget):
specific points.
"""
snapto = (0.0, 0.25, 0.5, 0.75, 1.0)
+ ylock = {}
def __init__(self, npoints=4, ylockgroups = (), changed_cb=None, magnetic=True):
CurveWidget.__init__ (self, changed_cb, magnetic)
self.points = [(0.0, 0.2), (.25, .5), (.75, .75), (1.0, 1.0)] # doesn't matter
self.npoints = npoints
- self.ylock = {}
+ if ylockgroups:
+ self.ylock = {}
for items in ylockgroups:
for thisitem in items:
others = list(items)
--
1.7.9.1
_______________________________________________
Mypaint-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/mypaint-discuss