Example #1
0
 def mergeAB(self):
     idx_a = int(self.cTreeA.currentText())
     idx_b = int(self.cTreeB.currentText())
     fpa = self._fgprint.getFingerPrint(idx_a)
     fpb = self._fgprint.getFingerPrint(idx_b)
     pfx_a = self.ePrefixA.text()
     pfx_b = self.ePrefixB.text()
     tree = CGL.newCGNSTree()
     tc = fpa.control.newtreecount
     fpc = Q7FingerPrint(fpa.control, '.', 'new#%.3d.hdf' % tc, tree, [],
                         [])
     Q7TreeMergeModel(fpc)
     self.merge = Q7Tree(fpa.control, '/', fpc)
     fpc._status = [Q7FingerPrint.STATUS_MODIFIED]
     fpa.control.newtreecount += 1
     diag = {}
     diffAB(fpa.tree, fpb.tree, '', 'A', diag, False)
     fpc.tree = mergeAB(fpa.tree, fpb.tree, fpc.tree, 'C', diag, pfx_a,
                        pfx_b)
     fpc.model.modelReset()
     dw = Q7Merge(self._control, fpc, diag)
     dw.show()
     self.merge.hide()
Example #2
0
 def __init__(self, control, fgprintindexA, fgprintindexB, diag):
     Q7Window.__init__(self, Q7Window.VIEW_DIFF, control, None,
                       fgprintindexA)
     self._depthExpanded = 0
     self._lastEntered = None
     self._fgidxA = fgprintindexA
     self._fgidxB = fgprintindexB
     ldiag = self.diagAnalysis(diag)
     self.treeviewA.expanded[QModelIndex].connect(self.expandNode)
     self.treeviewA.collapsed.connect(self.collapseNode)
     self.treeviewA.clicked[QModelIndex].connect(self.clickedNode)
     self.treeviewA.customContextMenuRequested[QPoint].connect(
         self.clickedNode)
     self.treeviewB.expanded[QModelIndex].connect(self.expandNode)
     self.treeviewB.collapsed.connect(self.collapseNode)
     self.treeviewB.clicked[QModelIndex].connect(self.clickedNode)
     self.treeviewB.customContextMenuRequested[QPoint].connect(
         self.clickedNode)
     # QObject.connect(self.treeviewA,
     #                 SIGNAL("expanded(QModelIndex)"),
     #                 self.expandNode)
     # QObject.connect(self.treeviewA,
     #                 SIGNAL("collapsed()"),
     #                 self.collapseNode)
     # QObject.connect(self.treeviewA,
     #                 SIGNAL("clicked(QModelIndex)"),
     #                 self.clickedNode)
     # QObject.connect(self.treeviewA,
     #                 SIGNAL("customContextMenuRequested(QPoint)"),
     #                 self.clickedNode)
     # QObject.connect(self.treeviewB,
     #                 SIGNAL("expanded(QModelIndex)"),
     #                 self.expandNode)
     # QObject.connect(self.treeviewB,
     #                 SIGNAL("collapsed()"),
     #                 self.collapseNode)
     # QObject.connect(self.treeviewB,
     #                 SIGNAL("clicked(QModelIndex)"),
     #                 self.clickedNode)
     # QObject.connect(self.treeviewB,
     #                 SIGNAL("customContextMenuRequested(QPoint)"),
     #                 self.clickedNode)
     # QObject.connect(self.bLockScroll,
     #                 SIGNAL("clicked()"),
     #                 self.syncScrolls)
     self.bLockScroll.clicked.connect(self.syncScrolls)
     self.bClose.clicked.connect(self.leave)
     self.bInfo.clicked.connect(self.infoTreeView)
     self.bZoomIn.clicked.connect(self.expandLevel)
     self.bZoomOut.clicked.connect(self.collapseLevel)
     self.bZoomAll.clicked.connect(self.expandMinMax)
     self.bSaveDiff.clicked.connect(self.savediff)
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     self.popupmenu = QMenu()
     self.proxyA = Q7DiffTreeModel(self._fgidxA)
     self.proxyB = Q7DiffTreeModel(self._fgidxB)
     self.proxyA.setDiag(ldiag)
     self.proxyB.setDiag(ldiag)
     self.treeviewA.setModel(self.proxyA)
     self.treeviewB.setModel(self.proxyB)
     fga = Q7FingerPrint.getByIndex(self._fgidxA)
     fgb = Q7FingerPrint.getByIndex(self._fgidxB)
     model_a = fga.model
     model_b = fgb.model
     self.treeviewA.setItemDelegate(
         Q7DiffItemDelegate(self.treeviewA, model_a, ldiag))
     self.treeviewB.setItemDelegate(
         Q7DiffItemDelegate(self.treeviewB, model_b, ldiag))
     self.treeviewA.setControlWindow(self, model_a)
     self.treeviewB.setControlWindow(self, model_b)
     self.treeviewA.hideColumn(NMT.COLUMN_FLAG_LINK)
     self.treeviewA.hideColumn(NMT.COLUMN_FLAG_CHECK)
     self.treeviewA.hideColumn(NMT.COLUMN_FLAG_SELECT)
     self.treeviewA.hideColumn(NMT.COLUMN_FLAG_USER)
     self.treeviewB.hideColumn(NMT.COLUMN_FLAG_LINK)
     self.treeviewB.hideColumn(NMT.COLUMN_FLAG_CHECK)
     self.treeviewB.hideColumn(NMT.COLUMN_FLAG_SELECT)
     self.treeviewB.hideColumn(NMT.COLUMN_FLAG_USER)
     self.wvsa = self.treeviewA.verticalScrollBar()
     self.wvsb = self.treeviewB.verticalScrollBar()
     self.uvsa = self.verticalScrollBarA
     self.uvsb = self.verticalScrollBarB
     self.uvsa.setToolTip("%s/%s" % (fga.filedir, fga.filename))
     self.uvsb.setToolTip("%s/%s" % (fgb.filedir, fgb.filename))
     self.syncScrolls(True)
Example #3
0
 def loadStart(self, *args):
     self._T('loading: [%s]' % self.signals.buffer)
     self.busyCursor()
     Q7FingerPrint.treeLoad(self, self.signals.buffer)
     Q7FingerPrint.refreshScreen()
Example #4
0
 def raiseView(self):
     self.updateLastView()
     if self.lastView is not None:
         Q7FingerPrint.raiseView(self.lastView)
Example #5
0
 def closeView(self):
     self.updateLastView()
     if self.lastView is not None:
         fg = Q7FingerPrint.getFingerPrint(self.lastView)
         fg.closeView(self.lastView)
         self.lastView = None
Example #6
0
 def closeAllTrees(self):
     reply = MSG.wQuestion(self, 101, 'Double check...',
                           """Do you want to close all the views,<br>
                           and <b>forget unsaved</b> modifications?""")
     if reply:
         Q7FingerPrint.closeAllTrees()
Example #7
0
 def expandLevel(self):
     if self._depthExpanded < Q7FingerPrint.getByIndex(self._fgidxA).depth - 2:
         self._depthExpanded += 1
     self.treeviewA.expandToDepth(self._depthExpanded)
     self.treeviewB.expandToDepth(self._depthExpanded)
     self.resizeAll()