def removePluginsToBeOverwritten(self, filesInZip): for fileName, filePath in filesInZip: target = os.path.join(cadnano.path(), 'plugins', fileName) if os.path.isfile(target): os.unlink(target) elif os.path.isdir(target): shutil.rmtree(target)
def confirmDestructiveIfNecessary(self, filesInZip): for fileName, filePath in filesInZip: target = os.path.join(cadnano.path(), 'plugins', fileName) if os.path.isfile(target): return self.confirmDestructive() elif os.path.isdir(target): return self.confirmDestructive()
def linuxAuthedMvPluginsIntoPluginsFolder(self, filesInZip): args = ['gksudo', 'cp', '-fR'] args.extend(filePath for fileName, filePath in filesInZip) args.append(cadnano.path()+'/plugins') proc = subprocess.Popen(args) retval = self.waitForProcExit(proc) if retval != 0: self.failWithMsg('cp failed with code %i'%retval)
def addPlugin(self): fdialog = QFileDialog(self.widget, "Install Plugin", cadnano.path(), "Cadnano Plugins (*.cnp)") fdialog.setAcceptMode(QFileDialog.AcceptOpen) fdialog.setWindowFlags(Qt.Sheet) fdialog.setWindowModality(Qt.WindowModal) fdialog.filesSelected.connect(self.addPluginAtPath) self.fileopendialog = fdialog fdialog.open()
def addPlugin(self): fdialog = QFileDialog( self.widget, "Install Plugin", cadnano.path(), "Cadnano Plugins (*.cnp)") fdialog.setAcceptMode(QFileDialog.AcceptOpen) fdialog.setWindowFlags(Qt.Sheet) fdialog.setWindowModality(Qt.WindowModal) fdialog.filesSelected.connect(self.addPluginAtPath) self.fileopendialog = fdialog fdialog.open()
def darwinAuthedMvPluginsIntoPluginsFolder(self, filesInZip): envirn={"DST":cadnano.path()+'/plugins'} srcstr = '' for i in range(len(filesInZip)): fileName, filePath = filesInZip[i] srcstr += ' \\"$SRC' + str(i) + '\\"' envirn['SRC'+str(i)] = filePath proc = subprocess.Popen(['osascript','-e',\ 'do shell script "cp -fR ' + srcstr +\ ' \\"$DST\\"" with administrator privileges'],\ env=envirn) retval = self.waitForProcExit(proc) if retval != 0: self.failWithMsg('cp failed with code %i'%retval)
def movePluginsIntoPluginsFolder(self, filesInZip): for fileName, filePath in filesInZip: target = os.path.join(cadnano.path(), 'plugins', fileName) shutil.move(filePath, target)