Skip to content

Commit

Permalink
Merge branch 'master' into feature/holding-tags-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
mlampert committed Oct 18, 2019
2 parents 63f5961 + 443b948 commit 2b8248c
Show file tree
Hide file tree
Showing 16 changed files with 447 additions and 177 deletions.
1 change: 1 addition & 0 deletions src/Mod/AddonManager/Resources/AddonManager.qrc
Expand Up @@ -15,6 +15,7 @@
<file>icons/CurvedShapes_workbench_icon.svg</file>
<file>icons/Curves_workbench_icon.svg</file>
<file>icons/Defeaturing_workbench_icon.svg</file>
<file>icons/DesignSPHysics_workbench_icon.svg</file>
<file>icons/dodo_workbench_icon.svg</file>
<file>icons/DynamicData_workbench_icon.svg</file>
<file>icons/EM_workbench_icon.svg</file>
Expand Down
197 changes: 197 additions & 0 deletions src/Mod/AddonManager/Resources/icons/DesignSPHysics_workbench_icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/Mod/Arch/ArchSectionPlane.py
Expand Up @@ -1133,6 +1133,19 @@ def doubleClicked(self,vobj):

self.setEdit(vobj,None)

def setupContextMenu(self,vobj,menu):
"""CONTEXT MENU setup"""
from PySide import QtCore,QtGui
action1 = QtGui.QAction(QtGui.QIcon(":/icons/Draft_Edit.svg"),"Toggle Cutview",menu)
action1.triggered.connect(lambda f=self.contextCutview, arg=vobj:f(arg))
menu.addAction(action1)

def contextCutview(self,vobj):
"""CONTEXT MENU command to toggle CutView property on and off"""
if vobj.CutView:
vobj.CutView = False
else: vobj.CutView = True


class _ArchDrawingView:

Expand Down
29 changes: 27 additions & 2 deletions src/Mod/Draft/DraftEdit.py
Expand Up @@ -41,6 +41,20 @@
from PySide import QtCore
from PySide.QtCore import QT_TRANSLATE_NOOP
from DraftTools import translate

COLORS = {
"default": FreeCADGui.draftToolBar.getDefaultColor("snap"),
"black": (0., 0., 0.),
"white": (1., 1., 1.),
"grey": (.5, .5, .5),
"red": (1., 0., 0.),
"green": (0., 1., 0.),
"blue": (0., 0., 1.),
"yellow": (1., 1., 0.),
"cyan": (0., 1., 1.),
"magenta":(1., 0., 1.)
}


class Edit():

Expand All @@ -49,6 +63,7 @@ class Edit():
def __init__(self):
self.running = False
self.trackers = {'object':[]}
self.overNode = None # preselected node with mouseover
self.obj = None
self.editing = None

Expand Down Expand Up @@ -271,8 +286,18 @@ def mouseMoved(self, event_callback):
if self.editing != None:
self.updateTrackerAndGhost(event)
else:
# TODO add preselection color change for trackers
pass
# look for a node in mouse position and highlight it
pos = event.getPosition()
node = self.getEditNode(pos)
ep = self.getEditNodeIndex(node)
if ep != None:
if self.overNode != None: self.overNode.setColor(COLORS["default"])
self.trackers[str(node.objectName.getValue())][ep].setColor(COLORS["red"])
self.overNode = self.trackers[str(node.objectName.getValue())][ep]
else:
if self.overNode != None:
self.overNode.setColor(COLORS["default"])
self.overNode = None

def startEditing(self, event):
"start editing selected EditNode"
Expand Down
14 changes: 10 additions & 4 deletions src/Mod/Draft/DraftTrackers.py
Expand Up @@ -709,11 +709,11 @@ class editTracker(Tracker):
"""A node edit tracker"""
def __init__(self,pos=Vector(0,0,0),name=None,idx=0,objcol=None,\
marker=FreeCADGui.getMarkerIndex("quad", 9),inactive=False):
color = coin.SoBaseColor()
self.color = coin.SoBaseColor()
if objcol:
color.rgb = objcol[:3]
self.color.rgb = objcol[:3]
else:
color.rgb = FreeCADGui.draftToolBar.getDefaultColor("snap")
self.color.rgb = FreeCADGui.draftToolBar.getDefaultColor("snap")
self.marker = coin.SoMarkerSet() # this is the marker symbol
self.marker.markerIndex = marker
self.coords = coin.SoCoordinate3() # this is the coordinate
Expand All @@ -729,7 +729,7 @@ def __init__(self,pos=Vector(0,0,0),name=None,idx=0,objcol=None,\
selnode.subElementName.setValue("EditNode"+str(idx))
node = coin.SoAnnotation()
selnode.addChild(self.coords)
selnode.addChild(color)
selnode.addChild(self.color)
selnode.addChild(self.marker)
node.addChild(selnode)
ontop = not inactive
Expand All @@ -746,6 +746,12 @@ def get(self):
def move(self,delta):
self.set(self.get().add(delta))

def setColor(self,color):
if color:
self.color.rgb = color
else:
self.color.rgb = FreeCADGui.draftToolBar.getDefaultColor("snap")

class PlaneTracker(Tracker):
"""A working plane tracker"""
def __init__(self):
Expand Down

0 comments on commit 2b8248c

Please sign in to comment.