Fix bug with importing only links not working properly if fields are left out.
Fix bug with scenes not being always redrawn if links are imported.
This commit is contained in:
@@ -460,7 +460,6 @@ class TabbedPane(QtWidgets.QTabWidget):
|
||||
linkGroupingOverride: bool = False) -> None:
|
||||
for canvas in self.canvasTabs:
|
||||
scene = self.canvasTabs[canvas].scene()
|
||||
sceneChanged = False
|
||||
with scene.resolutionThreadingLock:
|
||||
addedNodes = []
|
||||
|
||||
@@ -469,8 +468,6 @@ class TabbedPane(QtWidgets.QTabWidget):
|
||||
parentUID = newLink[0]
|
||||
if parentUID in scene.nodesDict and uid not in scene.nodesDict:
|
||||
if uid not in scene.sceneGraph.nodes:
|
||||
sceneChanged = True
|
||||
|
||||
nodeJSON = self.entityDB.getEntity(uid)
|
||||
|
||||
# This is more efficient for large canvases than syncing afterwards.
|
||||
@@ -507,9 +504,9 @@ class TabbedPane(QtWidgets.QTabWidget):
|
||||
[scene.removeNode(item) for item in addedNodes]
|
||||
scene.addNodeProgrammatic(uid, itemUIDs, fromServer=True)
|
||||
|
||||
if sceneChanged:
|
||||
scene.rearrangeGraph()
|
||||
# self.mainWindow.syncCanvasByName(canvas)
|
||||
# Even if nothing is added, the graph could need to be rearranged for clarity.
|
||||
scene.rearrangeGraph()
|
||||
# self.mainWindow.syncCanvasByName(canvas)
|
||||
|
||||
def serverLinkAddHelper(self, linkJson: dict, overwrite: bool = False) -> None:
|
||||
"""
|
||||
|
||||
@@ -656,50 +656,52 @@ class MenuBar(QtWidgets.QMenuBar):
|
||||
newLinks.append((entityOneJSON['uid'], entityTwoJSON['uid'],
|
||||
linkJSONThree['Resolution']))
|
||||
|
||||
else:
|
||||
entityOneType = importLinksCSVDialog.entityOneTypeChoiceDropdown.currentText()
|
||||
entityTwoType = importLinksCSVDialog.entityTwoTypeChoiceDropdown.currentText()
|
||||
else:
|
||||
entityOneType = importLinksCSVDialog.entityOneTypeChoiceDropdown.currentText()
|
||||
entityTwoType = importLinksCSVDialog.entityTwoTypeChoiceDropdown.currentText()
|
||||
|
||||
for row in csvDF.itertuples(index=False):
|
||||
count = 0
|
||||
linkJSON = {}
|
||||
entityOneJSON = {}
|
||||
entityTwoJSON = {}
|
||||
resolutionID = ""
|
||||
notes = ""
|
||||
for row in csvDF.itertuples(index=False):
|
||||
count = 0
|
||||
linkJSON = {}
|
||||
entityOneJSON = {}
|
||||
entityTwoJSON = {}
|
||||
resolutionID = ""
|
||||
notes = ""
|
||||
|
||||
for column in row:
|
||||
column = str(column)
|
||||
mapping = csvDF.columns[count]
|
||||
if mapping == 'Entity One':
|
||||
entityOneJSON = self.parent().LENTDB.getEntityOfType(column, entityOneType)
|
||||
elif mapping == 'Entity Two':
|
||||
entityTwoJSON = self.parent().LENTDB.getEntityOfType(column, entityTwoType)
|
||||
elif mapping == 'Notes':
|
||||
notes = column
|
||||
elif mapping == 'Resolution ID':
|
||||
resolutionID = column
|
||||
else:
|
||||
linkJSON[mapping] = column
|
||||
count += 1
|
||||
for column in row:
|
||||
column = str(column)
|
||||
mapping = csvDF.columns[count]
|
||||
if mapping == 'Entity One':
|
||||
entityOneJSON = self.parent().LENTDB.getEntityOfType(column,
|
||||
entityOneType)
|
||||
elif mapping == 'Entity Two':
|
||||
entityTwoJSON = self.parent().LENTDB.getEntityOfType(column,
|
||||
entityTwoType)
|
||||
elif mapping == 'Notes':
|
||||
notes = column
|
||||
elif mapping == 'Resolution ID':
|
||||
resolutionID = column
|
||||
else:
|
||||
linkJSON[mapping] = column
|
||||
count += 1
|
||||
|
||||
if (entityOneJSON is not None) and (entityTwoJSON is not None):
|
||||
linkJSON['uid'] = (entityOneJSON['uid'], entityTwoJSON['uid'])
|
||||
linkJSON['Notes'] = notes
|
||||
if importLinksCSVDialog.randAsIs.isChecked():
|
||||
linkJSON['Resolution'] = resolutionID
|
||||
elif importLinksCSVDialog.randMerge.isChecked():
|
||||
linkJSON['Resolution'] = resolutionID + ' | ' + str(uuid4())
|
||||
elif importLinksCSVDialog.randReplace.isChecked():
|
||||
linkJSON['Resolution'] = str(uuid4())
|
||||
if (entityOneJSON is not None) and (entityTwoJSON is not None):
|
||||
linkJSON['uid'] = (entityOneJSON['uid'], entityTwoJSON['uid'])
|
||||
linkJSON['Notes'] = notes
|
||||
if importLinksCSVDialog.randAsIs.isChecked():
|
||||
linkJSON['Resolution'] = resolutionID
|
||||
elif importLinksCSVDialog.randMerge.isChecked():
|
||||
linkJSON['Resolution'] = resolutionID + ' | ' + str(uuid4())
|
||||
elif importLinksCSVDialog.randReplace.isChecked():
|
||||
linkJSON['Resolution'] = str(uuid4())
|
||||
|
||||
# If 'Resolution ID' is not mapped, generate random IDs.
|
||||
if not linkJSON.get('Resolution'):
|
||||
linkJSON['Resolution'] = str(uuid4())
|
||||
# If 'Resolution ID' is not mapped, generate random IDs.
|
||||
if not linkJSON.get('Resolution'):
|
||||
linkJSON['Resolution'] = str(uuid4())
|
||||
|
||||
if self.parent().LENTDB.addLink(linkJSON) is not None:
|
||||
newLinks.append((entityOneJSON['uid'], entityTwoJSON['uid'],
|
||||
linkJSON['Resolution']))
|
||||
if self.parent().LENTDB.addLink(linkJSON) is not None:
|
||||
newLinks.append((entityOneJSON['uid'], entityTwoJSON['uid'],
|
||||
linkJSON['Resolution']))
|
||||
|
||||
newNodeUIDs = [newEntity['uid'] for newEntity in self.parent().LENTDB.addEntities(newNodes)]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user