示例#1
0
文件: MainWidget.py 项目: iisd/cgn
    def SaveListAs(self):
        if self.lvThesis.count() <= 0:
            QtGui.QMessageBox.warning(self, self.tr('Save'),
					self.tr('Empty list'))
            return
        path = unicode(str(QtGui.QFileDialog.getExistingDirectory(self,
			            			u"Сохранить Как", './',
            				QtGui.QFileDialog.ShowDirsOnly).toUtf8()), 'UTF8')
        if path == '':
            return
        SubDirs = []
        for Bill, SubDirs, Bob in os.walk(path):
            break
        print SubDirs
        for dir in SubDirs:
            if len(dir) != 2:
                QtGui.QMessageBox.warning(self, self.tr('Save'),
                                self.tr('That directory in not valid'))
                return
        for dir in SubDirs:
            removeall(self.path + u'/' + dir, self)
        sel = self.lvThesis.selectedItems()
        if (len(sel) <= 1):
            self.currentItem.setDesc(self.teThesisView.toPlainText())
        for i in xrange(self.lvThesis.count()):
            self.lvThesis.item(i).saveThesis(path, 1)
        self.path = path
        ThesisBase.saveScheme(self.Scheme, self.path + u'/scheme.sch')
示例#2
0
文件: MainWidget.py 项目: iisd/cgn
 def OpenList(self):
     if self.lvThesis.count() > 0:
         reply = QtGui.QMessageBox.question(self, self.tr("Open"),
           self.tr("All changes will be lost. Continue?"),
                             QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
         if reply == QtGui.QMessageBox.No:
             return
     path = unicode(str(QtGui.QFileDialog.getExistingDirectory(self, self.tr("Open"),
                         './', QtGui.QFileDialog.ShowDirsOnly).toUtf8()), 'UTF8')
     if path == '':
         return
     self.NewWorkspace(1)
     self.path = path
     ThesisBase.loadThesisesToList(self.lvThesis, path)
     ThesisBase.loadScheme(path + u'/scheme.sch', self.lvThesis, self.Scheme)
     self.Scheme.update()
     self.Scheme.updateSelection()
     self.Scheme.arrows.update()