Skip to content

Commit

Permalink
Updated formatting of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
danyeaw committed May 19, 2017
1 parent 57bfcc2 commit f2afd3a
Show file tree
Hide file tree
Showing 24 changed files with 452 additions and 630 deletions.
1 change: 1 addition & 0 deletions gaphas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""

from __future__ import absolute_import

__version__ = "$Revision$"
# $HeadURL$

Expand Down
28 changes: 13 additions & 15 deletions gaphas/aspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
"""

from __future__ import absolute_import

from gi.repository import Gdk
from simplegeneric import generic
from gaphas.item import Item, Element

from gaphas.item import Element


class ItemFinder(object):
Expand Down Expand Up @@ -134,10 +136,10 @@ def unselect(self):
@HandleSelection.when_type(Element)
class ElementHandleSelection(ItemHandleSelection):
CURSORS = (
Gdk.Cursor.new(Gdk.CursorType.TOP_LEFT_CORNER),
Gdk.Cursor.new(Gdk.CursorType.TOP_RIGHT_CORNER),
Gdk.Cursor.new(Gdk.CursorType.BOTTOM_RIGHT_CORNER),
Gdk.Cursor.new(Gdk.CursorType.BOTTOM_LEFT_CORNER) )
Gdk.Cursor.new(Gdk.CursorType.TOP_LEFT_CORNER),
Gdk.Cursor.new(Gdk.CursorType.TOP_RIGHT_CORNER),
Gdk.Cursor.new(Gdk.CursorType.BOTTOM_RIGHT_CORNER),
Gdk.Cursor.new(Gdk.CursorType.BOTTOM_LEFT_CORNER))

def select(self):
index = self.item.handles().index(self.handle)
Expand All @@ -150,7 +152,6 @@ def unselect(self):
self.view.get_window().set_cursor(cursor)



class ItemHandleInMotion(object):
"""
Move a handle (role is applied to the handle)
Expand Down Expand Up @@ -208,7 +209,7 @@ def glue(self, pos, distance=GLUE_DISTANCE):
return None

connectable, port, glue_pos = \
view.get_port_at_point(pos, distance=distance, exclude=(item,))
view.get_port_at_point(pos, distance=distance, exclude=(item,))

# check if item and found item can be connected on closest port
if port is not None:
Expand All @@ -230,8 +231,7 @@ def glue(self, pos, distance=GLUE_DISTANCE):


class ItemConnector(object):

GLUE_DISTANCE = 10 # Glue distance in view points
GLUE_DISTANCE = 10 # Glue distance in view points

def __init__(self, item, handle):
self.item = item
Expand Down Expand Up @@ -273,7 +273,6 @@ def connect(self, sink):

self.connect_handle(sink)


def connect_handle(self, sink, callback=None):
"""
Create constraint between handle of a line and port of connectable
Expand All @@ -292,8 +291,7 @@ def connect_handle(self, sink, callback=None):
constraint = sink.port.constraint(canvas, item, handle, sink.item)

canvas.connect_item(item, handle, sink.item, sink.port,
constraint, callback=callback)

constraint, callback=callback)

def disconnect(self):
"""
Expand Down Expand Up @@ -334,9 +332,9 @@ def find_port(self, pos):
ConnectionSink = generic(ItemConnectionSink)


##
## Painter aspects
##
#
# Painter aspects
#

class ItemPaintFocused(object):
"""
Expand Down
Loading

0 comments on commit f2afd3a

Please sign in to comment.