-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #542 from gaphor/feedforward
Feedforward
- Loading branch information
Showing
9 changed files
with
125 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
# flake8: noqa F401 | ||
from gaphas.connector import ConnectionSinkType | ||
from gaphas.handlemove import ( | ||
ElementHandleMove, | ||
HandleMove, | ||
ItemHandleMove, | ||
item_at_point, | ||
) | ||
from gaphas.handlemove import HandleMove, ItemHandleMove, item_at_point |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from functools import singledispatch | ||
from typing import Optional | ||
|
||
from gi.repository import Gtk | ||
|
||
from gaphas.connector import Handle | ||
from gaphas.item import Element, Item, Line | ||
from gaphas.types import Pos | ||
|
||
DEFAULT_CURSOR = "left_ptr" if Gtk.get_major_version() == 3 else "default" | ||
|
||
|
||
@singledispatch | ||
def cursor(item: Optional[Item], handle: Optional[Handle], pos: Pos) -> str: | ||
return DEFAULT_CURSOR | ||
|
||
|
||
ELEMENT_CURSORS = ("nw-resize", "ne-resize", "se-resize", "sw-resize") | ||
|
||
|
||
@cursor.register | ||
def element_hover(item: Element, handle: Optional[Handle], pos: Pos) -> str: | ||
if handle: | ||
index = item.handles().index(handle) | ||
return ELEMENT_CURSORS[index] if index < 4 else DEFAULT_CURSOR | ||
return DEFAULT_CURSOR | ||
|
||
|
||
LINE_CURSOR = "fleur" if Gtk.get_major_version() == 3 else "move" | ||
|
||
|
||
@cursor.register | ||
def line_hover(item: Line, handle: Optional[Handle], pos: Pos) -> str: | ||
return LINE_CURSOR if handle else DEFAULT_CURSOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters