Пример #1
0
def run(args=[],
        files=[],
        datasets=[],
        flags=(False, False, False, False, False, False, False),
        ppath=None,
        query=None):
    hidecontrol = False
    if flags[4]:
        from CGNS.NAV.wquery import Q7Query
        Q7Query.loadUserQueries()
        Q7Query.fillQueries()
        ql = Q7Query.queriesNamesList()
        print('# CGNS.NAV available queries:')
        for q in ql:
            print(' ', q)
    else:
        app = QApplication(args)
        if not flags[5]:
            pixmap = QPixmap(":/images/splash.png")
            splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint)
            splash.show()
            splash.showMessage("Release v%s" % OCTXT._ToolVersion,
                               Qt.AlignHCenter | Qt.AlignBottom)
        app.processEvents()
        t1 = time.time()
        Q7Main.verbose = flags[2]
        wcontrol = Q7Main()
        wcontrol._application = app
        wcontrol.setOptionValue('NAVTrace', flags[2])
        wcontrol.transientRecurse = flags[0]
        wcontrol.transientVTK = flags[3]
        wcontrol.query = query
        wcontrol._T('start')
        wcontrol.setDefaults()
        if flags[1]:
            wcontrol.loadlast()
            hidecontrol = flags[6]
        if files:
            for ff in files:
                wcontrol.loadfile(ff)
            hidecontrol = flags[6]
        if datasets:
            for dd in datasets:
                wcontrol.loadCompleted(dataset_name='FFFF',
                                       dataset_base='BASE',
                                       dataset_tree=dd,
                                       dataset_references=[],
                                       dataset_paths=[])
            hidecontrol = flags[6]
        wcontrol.show()
        if hidecontrol:
            wcontrol.hide()
        if not flags[5]:
            t2 = time.time()
            if t2 - t1 < 2.0:
                time.sleep(2)
            splash.finish(wcontrol)
        app.exec_()
        wcontrol._T('leave')
    sys.exit()
Пример #2
0
 def checkquery(self):
     q = self.cQuery.currentText()
     if (Q7Query.getQuery(q) is not None and
             Q7Query.getQuery(q).hasArgs):
         self.eUserVariable.setEnabled(True)
     else:
         self.eUserVariable.setEnabled(False)
Пример #3
0
 def _runAndSelect(self, qname, value):
     q = Q7Query.getQuery(qname)
     sl = q.run(self.FG.tree, self.FG.links, list(self.FG.lazy), False,
                value)
     self.model().markExtendToList(sl)
     self.model().updateSelected()
     self.treeview.refreshView()
Пример #4
0
 def __init__(self, parent=None):
     self.lastView = None
     self.w = None
     self.fdialog = None
     import platform
     QW.control_log = MSG.Q7Log()
     QW.__init__(self, QW.VIEW_CONTROL, self, None, None)
     self.versions = {
         'pycgnsversion': 'pyCGNS v%s' % config.version,
         #                       'chloneversion':'CHLone %s'%config.CHLONE_VERSION,
         'vtkversion': 'VTK v%s' % config.VTK_VERSION,
         'cythonversion': 'Cython v%s' % config.CYTHON_VERSION,
         'hdf5version': 'HDF5 v%s' % config.HDF5_VERSION,
         'numpyversion': 'numpy v%s' % config.NUMPY_VERSION,
         'pythonversion': 'python v%s' % platform.python_version(),
         'pyqtversion': 'PyQt v%s' % config.PYQT_VERSION,
         'qtversion': 'Qt v%s' % config.QT_VERSION,
     }
     self.getHistory()
     self.bAbout.clicked.connect(self.about)
     self.bOptionView.clicked.connect(self.option)
     self.bTreeLoadLast.clicked.connect(self.loadlast)
     self.lockable(self.bTreeLoadLast)
     self.bTreeLoad.clicked.connect(self.load)
     self.bLog.clicked.connect(self.logView)
     self.lockable(self.bTreeLoad)
     self.bEditTree.clicked.connect(self.edit)
     self.lockable(self.bEditTree)
     self.bInfo.clicked.connect(self.infoControl)
     self.bPatternView.setDisabled(True)
     # self.bResetScrollBars.clicked.connect(self.resetScrolls)
     self.bClose.clicked.connect(self.close)
     # QObject.connect(self.controlTable,
     #                SIGNAL("cellClicked(int,int)"),
     #                self.clickedLine)
     self.controlTable.cellClicked.connect(self.clickedLine)
     self.initControlTable()
     self.controlTable.setItemDelegate(Q7ControlItemDelegate(self))
     self.signals = Q7SignalPool()
     self.signals.loadFile.connect(self.loadStart)
     self.signals.saveFile.connect(self.saving)
     self.signals.cancel.connect(self.cancelUnlock)
     self.signals.loadCompleted.connect(self.loadCompleted)
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     self.popupmenu = QMenu()
     self.transientRecurse = False
     self.transientVTK = False
     self.copyPasteBuffer = None
     self.wOption = None
     self.selectForLinkDst = None
     self.newtreecount = 1
     self.help = None
     self._patternwindow = None
     self._toolswindow = None
     self.query = None
     Q7Query.loadUserQueries()
     Q7Query.fillQueries()
     Q7Query.loadUserFunctions()
Пример #5
0
 def queryview(self):
     if (self._querywindow is None):
         self._querywindow = Q7Query(self._control, self.FG.index, self)
         self._querywindow.show()
     else:
         self._querywindow.raise_()
Пример #6
0
 def __init__(self, parent, fgprint, master):
     Q7Window.__init__(self, Q7Window.VIEW_TOOLS, parent, None, None)
     self.bClose.clicked.connect(self.reject)
     self.bInfo.clicked.connect(self.infoToolsView)
     self.bDiff.clicked.connect(self.diffAB)
     self.bMerge.clicked.connect(self.mergeAB)
     self._master = master
     self._fgprint = fgprint
     self._model = fgprint.model
     self._treeview = master.treeview
     self.cGroup.currentIndexChanged.connect(self.fillqueries)
     if HAS_PY2:
         self.cQuery.currentTextChanged[unicode].connect(self.checkquery)
     else:
         self.cQuery.currentTextChanged[str].connect(self.checkquery)
     # QObject.connect(self.cGroup,
     #                SIGNAL("currentIndexChanged(int)"),
     #                self.fillqueries)
     # QObject.connect(self.cQuery,
     #                SIGNAL("valueChanged(int)"),
     #                self.checkquery)
     qlist = Q7Query.queriesNamesList()
     qlist.sort()
     for q in qlist:
         self.cQuery.addItem(q)
     gqlist = Q7Query.queriesGroupsList()
     for gq in gqlist:
         self.cGroup.addItem(gq)
     # ix=-1#self.cQuery.findText()self.querymodel.getCurrentQuery())
     # if (ix!=-1): self.cQuery.setCurrentIndex(ix)
     self.bApply.clicked.connect(self.applyquery)
     pal = self.bApplyBox.palette()
     pal.setColor(QPalette.WindowText, QColor('red'))
     self.bApplyBox.setPalette(pal)
     self.lockable(self.bApply)
     self.bOperateDoc.clicked.connect(self.querydoc)
     self.bRunSearch.clicked.connect(self.runsearch)
     if self._control.query is not None:
         ix = self.cQuery.findText(self._control.query,
                                   flags=Qt.MatchStartsWith)
         if ix != -1:
             self.cQuery.setCurrentIndex(ix)
         self.applyquery()
         self.selectionlist()
     self.sLevel.valueChanged[int].connect(self.updateCriteria)
     if HAS_PY2:
         self.cSIDStype.editTextChanged[unicode].connect(
             self.updateSIDStypeEntry)
     else:
         self.cSIDStype.editTextChanged[str].connect(
             self.updateSIDStypeEntry)
     # QObject.connect(self.sLevel,
     #                SIGNAL("valueChanged(int)"),
     #                self.updateCriteria)
     # QObject.connect(self.cSIDStype,
     #                SIGNAL("editTextChanged(QString)"),
     #                self.updateSIDStypeEntry)
     self.criteria = []
     for l in range(3):
         self.criteria.append(Q7Criteria())
         self.criteria[-1].name = ''
         self.criteria[-1].sidstype = ''
         self.criteria[-1].value = ''
         self.criteria[-1].shape = ''
         self.criteria[-1].rgx_name = False
         self.criteria[-1].not_name = False
         self.criteria[-1].rgx_sids = False
         self.criteria[-1].not_sids = False
     self.criteria[0].title = 'Ancestor criteria'
     self.criteria[1].title = 'Current node criteria'
     self.criteria[2].title = 'Children criteria'
     self.previousLevel = 1
     self.cSIDStype.addItems([''] + CGK.cgnstypes)
     self.cDataType.addItems([''] + list(CGK.adftypes))
     self.updateCriteria()
Пример #7
0
 def querydoc(self):
     q = self.cQuery.currentText()
     if q in Q7Query.queriesNamesList():
         doc = Q7Query.getQuery(q).doc
         self._control.helpWindowDoc(doc)
Пример #8
0
 def fillqueries(self):
     g = self.cGroup.currentText()
     self.cQuery.clear()
     for qn in Q7Query.queriesNamesList():
         if (g == '*') or (Q7Query.getQuery(qn).group == g):
             self.cQuery.addItem(qn)