diff options
author | Jesús Eduardo <heckyel@hyperbola.info> | 2018-01-13 16:49:33 -0500 |
---|---|---|
committer | Jesús Eduardo <heckyel@hyperbola.info> | 2018-01-13 16:49:33 -0500 |
commit | e57e7151ecde0cf50d5031ad87c6e8ad3ec18f0b (patch) | |
tree | 20d145fb7b29d9c93f845d50fb882bb9d7e70e9c | |
parent | 28cdc7efd54697e7a0fdf995faa9fcaada88831c (diff) | |
download | librevideoconverter-e57e7151ecde0cf50d5031ad87c6e8ad3ec18f0b.tar.lz librevideoconverter-e57e7151ecde0cf50d5031ad87c6e8ad3ec18f0b.tar.xz librevideoconverter-e57e7151ecde0cf50d5031ad87c6e8ad3ec18f0b.zip |
pep8 en lvc/widgets/osx/customcontrol.py
-rw-r--r-- | lvc/widgets/osx/customcontrol.py | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/lvc/widgets/osx/customcontrol.py b/lvc/widgets/osx/customcontrol.py index 4a32b8e..8f0904c 100644 --- a/lvc/widgets/osx/customcontrol.py +++ b/lvc/widgets/osx/customcontrol.py @@ -41,6 +41,7 @@ from .base import Widget import drawing from .layoutmanager import LayoutManager + class DrawableButtonCell(NSButtonCell): def startTrackingAt_inView_(self, point, view): view.setState_(NSOnState) @@ -50,11 +51,13 @@ class DrawableButtonCell(NSButtonCell): view.setState_(NSOnState) return YES - def stopTracking_at_inView_mouseIsUp_(self, lastPoint, at, view, mouseIsUp): + def stopTracking_at_inView_mouseIsUp_(self, lastPoint, + at, view, mouseIsUp): if not mouseIsUp: view.mouse_inside = False view.setState_(NSOffState) + class DrawableButton(NSButton): def init(self): self = super(DrawableButton, self).init() @@ -78,11 +81,11 @@ class DrawableButton(NSButton): # get mouseMoved events whenever the mouse is inside our view. self.tracking_area = NSTrackingArea.alloc() self.tracking_area.initWithRect_options_owner_userInfo_( - self.visibleRect(), - NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | - NSTrackingActiveInKeyWindow, - self, - nil) + self.visibleRect(), + NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | + NSTrackingActiveInKeyWindow, + self, + nil) self.addTrackingArea_(self.tracking_area) def mouseEntered_(self, event): @@ -129,11 +132,14 @@ class DrawableButton(NSButton): return YES DrawableButton.setCellClass_(DrawableButtonCell) + class ContinousButtonCell(DrawableButtonCell): - def stopTracking_at_inView_mouseIsUp_(self, lastPoint, at, view, mouseIsUp): + def stopTracking_at_inView_mouseIsUp_(self, lastPoint, + at, view, mouseIsUp): view.onStopTracking(at) NSButtonCell.stopTracking_at_inView_mouseIsUp_(self, lastPoint, at, - view, mouseIsUp) + view, mouseIsUp) + class ContinuousDrawableButton(DrawableButton): def init(self): @@ -144,7 +150,8 @@ class ContinuousDrawableButton(DrawableButton): def mouseDown_(self, event): self.releaseInbounds = self.stopTracking = self.firedOnce = False self.cell().trackMouse_inRect_ofView_untilMouseUp_(event, - self.bounds(), self, YES) + self.bounds(), + self, YES) wrapper = wrappermap.wrapper(self) if not wrapper.get_disabled(): if self.firedOnce: @@ -166,6 +173,7 @@ class ContinuousDrawableButton(DrawableButton): self.stopTracking = True ContinuousDrawableButton.setCellClass_(ContinousButtonCell) + class DragableButtonCell(NSButtonCell): def startTrackingAt_inView_(self, point, view): self.start_x = point.x @@ -180,16 +188,18 @@ class DragableButtonCell(NSButtonCell): wrapper.emit("dragged-right") view.last_drag_event = 'right' elif (view.last_drag_event != 'left' and - at.x < self.start_x - DRAG_THRESHOLD): + at.x < self.start_x - DRAG_THRESHOLD): view.last_drag_event = 'left' wrapper.emit("dragged-left") return YES + class DragableDrawableButton(DrawableButton): def mouseDown_(self, event): self.last_drag_event = None self.cell().trackMouse_inRect_ofView_untilMouseUp_(event, - self.bounds(), self, YES) + self.bounds(), + self, YES) def sendAction_to_(self, action, to): # only send the click event if we didn't send a @@ -203,6 +213,7 @@ DragableDrawableButton.setCellClass_(DragableButtonCell) MouseTrackingInfo = collections.namedtuple("MouseTrackingInfo", "start_pos click_pos") + class CustomSliderCell(NSSliderCell): def calc_slider_amount(self, view, pos, size): slider_size = wrappermap.wrapper(view).slider_size() @@ -272,6 +283,7 @@ class CustomSliderCell(NSSliderCell): wrapper.emit('released') view.mouse_tracking_info = None + class CustomSliderView(NSSlider): def init(self): self = super(CustomSliderView, self).init() @@ -336,6 +348,7 @@ class CustomSliderView(NSSlider): return YES CustomSliderView.setCellClass_(CustomSliderCell) + class CustomControlBase(drawing.DrawingMixin, Widget): def set_cursor(self, cursor): if cursor == widgetconst.CURSOR_NORMAL: @@ -347,8 +360,10 @@ class CustomControlBase(drawing.DrawingMixin, Widget): if self.view.window(): self.view.window().invalidateCursorRectsForView_(self.view) + class CustomButton(CustomControlBase): - """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): CustomControlBase.__init__(self) self.create_signal('clicked') @@ -364,8 +379,10 @@ class CustomButton(CustomControlBase): Widget.disable(self) self.view.setNeedsDisplay_(YES) + class ContinuousCustomButton(CustomButton): - """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): CustomButton.__init__(self) self.create_signal('held-down') @@ -376,16 +393,20 @@ class ContinuousCustomButton(CustomButton): def set_delays(self, initial, repeat): self.view.cell().setPeriodicDelay_interval_(initial, repeat) + class DragableCustomButton(CustomButton): - """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): CustomButton.__init__(self) self.create_signal('dragged-left') self.create_signal('dragged-right') self.view = DragableDrawableButton.alloc().init() + class CustomSlider(CustomControlBase): - """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): CustomControlBase.__init__(self) self.create_signal('pressed') |