Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gui: selection fix #2615

Merged
merged 2 commits into from Oct 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 17 additions & 13 deletions src/Gui/Selection.cpp
Expand Up @@ -1608,9 +1608,13 @@ int SelectionSingleton::checkSelection(const char *pDocName, const char *pObject
}
if(!selList)
selList = &_SelList;

if(!pSubName)
pSubName = "";

for (auto &s : *selList) {
if (s.DocName==pDocName && s.FeatName==sel.FeatName) {
if(!pSubName || s.SubName==pSubName)
if(s.SubName==pSubName)
return 1;
if(resolve>1 && boost::starts_with(s.SubName,prefix))
return 1;
Expand All @@ -1620,7 +1624,7 @@ int SelectionSingleton::checkSelection(const char *pDocName, const char *pObject
for(auto &s : *selList) {
if(s.pResolvedObject != sel.pResolvedObject)
continue;
if(!pSubName)
if(!pSubName[0])
return 1;
if(s.elementName.first.size()) {
if(s.elementName.first == sel.elementName.first)
Expand Down Expand Up @@ -1752,7 +1756,7 @@ PyMethodDef SelectionSingleton::Methods[] = {
{"removeSelection", (PyCFunction) SelectionSingleton::sRemoveSelection, METH_VARARGS,
"removeSelection(object) -- Remove an object from the selection"},
{"clearSelection" , (PyCFunction) SelectionSingleton::sClearSelection, METH_VARARGS,
"clearSelection(doc=None,clearPreSelect=True) -- Clear the selection\n"
"clearSelection(docName='',clearPreSelect=True) -- Clear the selection\n"
"Clear the selection to the given document name. If no document is\n"
"given the complete selection is cleared."},
{"isSelected", (PyCFunction) SelectionSingleton::sIsSelected, METH_VARARGS,
Expand All @@ -1769,21 +1773,21 @@ PyMethodDef SelectionSingleton::Methods[] = {
"second argumeht defines the document name. If no document name is given the\n"
"currently active document is used"},
{"getSelection", (PyCFunction) SelectionSingleton::sGetSelection, METH_VARARGS,
"getSelection(docName=None,resolve=1,single=False) -- Return a list of selected objects\n"
"\ndocName - document name. None means the active document, and '*' means all document"
"getSelection(docName='',resolve=1,single=False) -- Return a list of selected objects\n"
"\ndocName - document name. Empty string means the active document, and '*' means all document"
"\nresolve - whether to resolve the subname references."
"\n 0: do not resolve, 1: resolve, 2: resolve with element map"
"\nsingle - only return if there is only one selection"},
{"getPickedList", (PyCFunction) SelectionSingleton::sGetPickedList, 1,
"getPickedList(docName=None) -- Return a list of objects under the last mouse click\n"
"\ndocName - document name. None means the active document, and '*' means all document"},
"getPickedList(docName='') -- Return a list of objects under the last mouse click\n"
"\ndocName - document name. Empty string means the active document, and '*' means all document"},
{"enablePickedList", (PyCFunction) SelectionSingleton::sEnablePickedList, METH_VARARGS,
"enablePickedList(boolean) -- Enable/disable pick list"},
{"getCompleteSelection", (PyCFunction) SelectionSingleton::sGetCompleteSelection, METH_VARARGS,
"getCompleteSelection(resolve=1) -- Return a list of selected objects of all documents."},
{"getSelectionEx", (PyCFunction) SelectionSingleton::sGetSelectionEx, METH_VARARGS,
"getSelectionEx(docName=None,resolve=1, single=False) -- Return a list of SelectionObjects\n"
"\ndocName - document name. None means the active document, and '*' means all document"
"getSelectionEx(docName='',resolve=1, single=False) -- Return a list of SelectionObjects\n"
"\ndocName - document name. Empty string means the active document, and '*' means all document"
"\nresolve - whether to resolve the subname references."
"\n 0: do not resolve, 1: resolve, 2: resolve with element map"
"\nsingle - only return if there is only one selection\n"
Expand Down Expand Up @@ -1822,12 +1826,12 @@ PyMethodDef SelectionSingleton::Methods[] = {
"clearForward: whether to clear the forward selection stack.\n"
"overwrite: overwrite the top back selection stack with current selection."},
{"hasSelection", (PyCFunction) SelectionSingleton::sHasSelection, METH_VARARGS,
"hasSelection(docName=None, resolve=False) -- check if there is any selection\n"},
"hasSelection(docName='', resolve=False) -- check if there is any selection\n"},
{"hasSubSelection", (PyCFunction) SelectionSingleton::sHasSubSelection, METH_VARARGS,
"hasSubSelection(docName=None,subElement=False) -- check if there is any selection with subname\n"},
"hasSubSelection(docName='',subElement=False) -- check if there is any selection with subname\n"},
{"getSelectionFromStack",(PyCFunction) SelectionSingleton::sGetSelectionFromStack, METH_VARARGS,
"getSelectionFromStack(docName=None,resolve=1,index=0) -- Return a list of SelectionObjects from selection stack\n"
"\ndocName - document name. None means the active document, and '*' means all document"
"getSelectionFromStack(docName='',resolve=1,index=0) -- Return a list of SelectionObjects from selection stack\n"
"\ndocName - document name. Empty string means the active document, and '*' means all document"
"\nresolve - whether to resolve the subname references."
"\n 0: do not resolve, 1: resolve, 2: resolve with element map"
"\nindex - select stack index, 0 is the last pushed selection, positive index to trace further back,\n"
Expand Down