Exemple #1
0
 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)
Exemple #2
0
 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()
Exemple #3
0
 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)
Exemple #4
0
 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()
Exemple #5
0
 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()
Exemple #6
0
 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)
Exemple #7
0
 def movePluginsIntoPluginsFolder(self, filesInZip):
     for fileName, filePath in filesInZip:
         target = os.path.join(cadnano.path(), 'plugins', fileName)
         shutil.move(filePath, target)