예제 #1
0
 def checkTarget(self, filename, write=False):
     if os.path.isfile(filename) and not write:
         return None
     if not os.path.isfile(filename) and write:
         return None
     if self.cOverwrite.isChecked():
         sc = "The file is <b>completely replaced</b> by the current tree"
     else:
         sc = "The file is <b>updated</b> with the current tree contents."
         if self.cDeleteMissing.isChecked():
             sc += "The nodes <b>NOT</b> found in the current tree are removed from the updated file"
         else:
             sc += "The nodes <b>NOT</b> found in the current tree are kept unchanged"
     reply = MSG.wQuestion(self,
                           132,
                           'Saving on an already existing file',
                           """You are going to save into an existing file,
                           based on the current options you have and the target tree you want to save,
                           the result would be the following:<p>%s<p>
                           If this not the way you want the save to operate, please <i>abort</b> this
                           file selection and check the <i>Load/Save option</i> tab.
                           You still want to write on this file?""" % sc,
                           buttons=('Continue to save on existing file',
                                    'Abort save'))
     if reply:
         return None
     return 'User Abort'
예제 #2
0
파일: wtree.py 프로젝트: VincentZhms/pyCGNS
 def linkadd(self):
     if (self._control.selectForLinkDst is None): return
     dst = self._control.selectForLinkDst
     str_dst = "%s:%s" % (dst[3], dst[1])
     tpath = 'relative'
     newname = CGU.getPathLeaf(dst[1])
     if (CGU.checkDuplicatedName(self.selectForLinkSrc[0].sidsNode(),
                                 newname,
                                 dienow=False)):
         str_cnm = "New child node name is <b>%s</b>" % newname
     else:
         count = 0
         while (not CGU.checkDuplicatedName(
                 self.selectForLinkSrc[0].sidsNode(), newname,
                 dienow=False)):
             count += 1
             newname = '{%s#%.3d}' % (dst[0].sidsType(), count)
         str_cnm = """As a child with this name already exists, the name <b>%s</b> is used (generated name)""" % \
                   newname
     str_src = "%s:%s/%s" % (self.FG.filename, self.selectForLinkSrc[1],
                             newname)
     str_msg = "you want to create a link from <b>%s</b> to <b>%s</b><br>%s<br>Your current user options do force " \
               "the link to use <b>%s</b> destination file path.""" % (
     str_src, str_dst, str_cnm, tpath)
     reply = MSG.wQuestion(self, 231, 'Create link as a new node', str_msg)
예제 #3
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()
예제 #4
0
파일: wquery.py 프로젝트: wperkins/pyCGNS
 def setModelData(self, editor, model, index):
     col = self._lastCol
     if col is None:
         return
     value = None
     nodelist = []
     dt = self._parent._data
     if self._mode == CELLCOMBO:
         value = editor.currentText()
     if self._mode == CELLTEXT:
         value = editor.text()
     if self._parent.setToAll():
         reply = MSG.wQuestion(self._parent, 371, 'Apply changes to all...',
                               """The same value is going to be set to all selected nodes,<br>
                                  Do we continue and perform the modification on all selected?<br>
                                  This may fail on some nodes if the data type is not the same
                                  as the original node for example. In that case some of the
                                  nodes would be modified but not the others, you would not
                                  have any status on the actual result of the modification.<br>
                                  """)
         if reply == MSG.OK:
             for rw in self._parent.selectedRows():
                 nodelist.append((rw, self._model.nodeFromPath(dt[rw])))
         else:
             return
     else:
         nodelist.append((index.row(),
                          self._model.nodeFromPath(dt[index.row()])))
     for ndr in nodelist:
         nix = self._model.createIndex(ndr[0], col, ndr[1])
         self._model.setData(nix, value, role=Qt.EditRole)
         self._parent.updateRowData(ndr[0], dt[ndr[0]])
예제 #5
0
 def doClearHistory(self):
     if self.rClearNoHDF.isChecked():
         reply = MSG.wQuestion(
             self.parent, 120, 'Clear history',
             """You really want to remove directory entries from history<br>
                                  where no file with defined extensions has been found?<br>"""
         )
         if reply == MSG.OK:
             for d in self.parent.getDirNoHDFFromHistory():
                 self.parent.removeDirFromHistory(d)
                 self.updateHistory()
                 self.lClear.clear()
     if self.rClearNotFound.isChecked():
         reply = MSG.wQuestion(
             self.parent, 121, 'Clear history',
             """You really want to remove <b>NOT FOUND</b> entries from<br>
                                  the history of used directories?<br>""")
         if reply == MSG.OK:
             for d in self.parent.getDirNotFoundFromHistory():
                 self.parent.removeDirFromHistory(d)
                 self.updateHistory()
                 self.lClear.clear()
     if self.rClearAllDirs.isChecked():
         reply = MSG.wQuestion(
             self.parent, 122, 'Clear history',
             """You really want to remove <b>ALL</b> entries from the<br>
                                  the history of used files and directories?<br>"""
         )
         if reply == MSG.OK:
             self.parent.destroyHistory()
             self.updateHistory()
     if self.rClearSelectedDirs.isChecked():
         for it in self.lClear.selectedItems():
             self.parent.removeDirFromHistory(it.text())
         self.updateHistory()
         self.updateClearDirs()
     if self.rClearSelectedFiles.isChecked():
         for it in self.lClear.selectedItems():
             fd = self.parent.getHistoryFile(it.text())
             if fd is not None:
                 self.parent.removeFileFromHistory(*fd)
         self.updateHistory()
         self.updateClearFiles()
예제 #6
0
 def closeTree(self):
     self.updateLastView()
     if self.lastView is None:
         return
     (f, v, d) = Q7FingerPrint.infoView(self.lastView)
     reply = MSG.wQuestion(self, 101, 'Double check...',
                           """Do you want to close the tree and all its views,<br>
                           and <b>forget unsaved</b> modifications?""")
     if reply:
         f.closeAllViews()
예제 #7
0
 def changeDir(self, *args):
     if self.updateMode:
         return
     p = str(self.direntries.currentText())
     if os.path.isdir(p):
         self.updateView()
     else:
         reply = MSG.wQuestion(self.parent, 110, 'Directory not found...',
                               """The path below doesn't exist, do you want to remove<br>
                                  it from the history?<br>%s""" % p)
         if reply == MSG.OK:
             ix = self.direntries.currentIndex()
             self.direntries.removeItem(ix)
예제 #8
0
파일: wquery.py 프로젝트: wperkins/pyCGNS
   def reject(self):
       reply = True
       if self._modified:
           reply = MSG.wQuestion(self._control, 370, 'Leave query panel',
                                 """There are unsaved modified queries,
 leave this panel without save?""", again=False)
       if not reply:
           return
       else:
           self._modified = False
       if self._master._querywindow is not None:
           self._master._querywindow = None
       self.close()
예제 #9
0
 def removeLink(self):
     if not self._links:
         return
     i = self.linkTable.currentItem()
     if i is None:
         return
     reply = MSG.wQuestion(self, 311, 'Remove link entry',
                           """Do you want to remove the selected link entry?
                              Existing sub-tree would be <b>merged</b> in the
                              top file during the next save.""")
     if reply:
         r = i.row()
         self._links.pop(r)
         self.reset()
예제 #10
0
 def closeApplication(self):
     reply = MSG.wQuestion(self, 101, 'Double check...',
                           """Do you want to quit %s,<b>close all views</b>
                           and forget unsaved modifications?"""
                           % OCTXT._ToolName)
     if reply == MSG.OK:
         Q7FingerPrint.closeAllTrees()
         if self.help is not None:
             self.help.close()
         if self._patternwindow is not None:
             self._patternwindow.close()
         if self.control_log is not None:
             self.control_log.close()
         if self._toolswindow is not None:
             self._toolswindow.close()
         return True
     else:
         return False