diff options
author | Jesús Eduardo <heckyel@hyperbola.info> | 2018-01-13 17:02:40 -0500 |
---|---|---|
committer | Jesús Eduardo <heckyel@hyperbola.info> | 2018-01-13 17:02:40 -0500 |
commit | 8c2a7859a238f161bb2667e8f4f37b9abb43030c (patch) | |
tree | 25dc9593216a0ac31ae0bea8b933a07f5430fe46 | |
parent | e57e7151ecde0cf50d5031ad87c6e8ad3ec18f0b (diff) | |
download | librevideoconverter-8c2a7859a238f161bb2667e8f4f37b9abb43030c.tar.lz librevideoconverter-8c2a7859a238f161bb2667e8f4f37b9abb43030c.tar.xz librevideoconverter-8c2a7859a238f161bb2667e8f4f37b9abb43030c.zip |
pep8 en lvc/widgets/osx/drawing.py
C:189, 0: Line too long (111/100) (line-too-long)
C:195, 0: Line too long (126/100) (line-too-long)
-rw-r--r-- | lvc/widgets/osx/drawing.py | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/lvc/widgets/osx/drawing.py b/lvc/widgets/osx/drawing.py index aaad1e9..d915100 100644 --- a/lvc/widgets/osx/drawing.py +++ b/lvc/widgets/osx/drawing.py @@ -33,12 +33,13 @@ import math from Foundation import * from AppKit import * -#from Quartz import * +# from Quartz import * from objc import YES, NO, nil class ImageSurface: - """See https://develop.participatoryculture.org/index.php/WidgetAPI for a description of the API for this class.""" + """See https://develop.participatoryculture.org/index.php/WidgetAPI + for a description of the API for this class.""" def __init__(self, image): """Create a new ImageSurface.""" self.image = image.nsimage.copy() @@ -66,12 +67,12 @@ class ImageSurface: # drawing to area larger than our image. Need to tile it. NSColor.colorWithPatternImage_(self.image).set() current_context.setPatternPhase_( - self._calc_pattern_phase(context, x, y)) + self._calc_pattern_phase(context, x, y)) NSBezierPath.fillRect_(dest_rect) current_context.restoreGraphicsState() def draw_rect(self, context, dest_x, dest_y, source_x, source_y, width, - height, fraction=1.0): + height, fraction=1.0): if width == 0 or height == 0: return current_context = NSGraphicsContext.currentContext() @@ -84,7 +85,7 @@ class ImageSurface: source_rect = NSMakeRect(source_x, self.height-source_y-height, width, height) self.image.drawInRect_fromRect_operation_fraction_( - dest_rect, source_rect, NSCompositeSourceOver, fraction) + dest_rect, source_rect, NSCompositeSourceOver, fraction) current_context.restoreGraphicsState() def _calc_pattern_phase(self, context, x, y): @@ -101,13 +102,18 @@ class ImageSurface: # convert to window coords, which is setPatternPhase_ uses return context.view.convertPoint_toView_(view_point, nil) + def convert_cocoa_color(color): rgb = color.colorUsingColorSpaceName_(NSDeviceRGBColorSpace) return (rgb.redComponent(), rgb.greenComponent(), rgb.blueComponent()) + def convert_widget_color(color, alpha=1.0): return NSColor.colorWithDeviceRed_green_blue_alpha_(color[0], color[1], + color[2], alpha) + + def flip_context(height): """Make the current context's coordinates flipped. @@ -121,8 +127,10 @@ def flip_context(height): xform.scaleXBy_yBy_(1.0, -1.0) xform.concat() + class DrawingStyle(object): - """See https://develop.participatoryculture.org/index.php/WidgetAPI for a description of the API for this class.""" + """See https://develop.participatoryculture.org/index.php/WidgetAPI + for a description of the API for this class.""" def __init__(self, bg_color=None, text_color=None): self.use_custom_style = True if text_color is None: @@ -137,8 +145,10 @@ class DrawingStyle(object): default_text_color = convert_cocoa_color(NSColor.textColor()) default_bg_color = convert_cocoa_color(NSColor.textBackgroundColor()) + class DrawingContext: - """See https://develop.participatoryculture.org/index.php/WidgetAPI for a description of the API for this class.""" + """See https://develop.participatoryculture.org/index.php/WidgetAPI + for a description of the API for this class.""" def __init__(self, view, drawing_area, rect): self.view = view self.path = NSBezierPath.bezierPath() @@ -149,7 +159,7 @@ class DrawingContext: if drawing_area.origin != NSZeroPoint: xform = NSAffineTransform.transform() xform.translateXBy_yBy_(drawing_area.origin.x, - drawing_area.origin.y) + drawing_area.origin.y) xform.concat() def move_to(self, x, y): @@ -166,11 +176,11 @@ class DrawingContext: def curve_to(self, x1, y1, x2, y2, x3, y3): self.path.curveToPoint_controlPoint1_controlPoint2_( - NSPoint(x3, y3), NSPoint(x1, y1), NSPoint(x2, y2)) + NSPoint(x3, y3), NSPoint(x1, y1), NSPoint(x2, y2)) def rel_curve_to(self, dx1, dy1, dx2, dy2, dx3, dy3): self.path.relativeCurveToPoint_controlPoint1_controlPoint2_( - NSPoint(dx3, dy3), NSPoint(dx1, dy1), NSPoint(dx2, dy2)) + NSPoint(dx3, dy3), NSPoint(dx1, dy1), NSPoint(dx2, dy2)) def arc(self, x, y, radius, angle1, angle2): angle1 = (angle1 * 360) / (2 * math.pi) @@ -239,8 +249,10 @@ class DrawingContext: gradient.draw() context.restoreGraphicsState() + class Gradient(object): - """See https://develop.participatoryculture.org/index.php/WidgetAPI for a description of the API for this class.""" + """See https://develop.participatoryculture.org/index.php/WidgetAPI + for a description of the API for this class.""" def __init__(self, x1, y1, x2, y2): self.x1, self.y1, self.x2, self.y2 = x1, y1, x2, y2 self.start_color = None @@ -260,6 +272,7 @@ class Gradient(object): end_point = NSPoint(self.x2, self.y2) nsgradient.drawFromPoint_toPoint_options_(start_point, end_point, 0) + class DrawingMixin(object): def calc_size_request(self): return self.size_request(self.view.layout_manager) |