def onCreate (tag, keys): c = keys.get('c') if c: # Check whether the node @data ftp exists in the file being opened. # If so, create a button and register. p = g.findTopLevelNode(c, '@data ftp') if p: pluginController(c)
def onCreate(tag, keys): c = keys.get('c') if c: # Check whether the node @data ftp exists in the file being opened. # If so, create a button and register. p = g.findTopLevelNode(c, '@data ftp') if p: pluginController(c)
def onCreate (tag, keys): c = keys.get('c') if not c: return #@+at # here I want to check, whether the node @data ftp exists in the file, that is being opened. If it exists, create a button and register #@@c p = g.findTopLevelNode(c, '@data ftp') if p != None: controller = pluginController(c)
def upload(self, event=None): c = self.c p = c.p g.es("upload started") p = g.findTopLevelNode(c, '@data ftp') if p: files = json.loads(p.b) # credentials - array of (host, pass) of server, # to while the files must be uploaded I suggest that the locations must be the same. credentials = files[0] for element in credentials: g.es(element[0]) ftp = FTP(element[0]) ftp.login(element[1], element[2]) #@+<<upload all the modified files>> #@+node:ekr.20110110105526.5472: *4* <<upload all the modified files>> #@@c for i in range(1, len(files)): file = files[i] n = len(file) if n < 3: file.append(-1) time = os.path.getmtime(file[0]) if time != file[2]: files[i][2] = time g.es(files[i][0]) FH = open(files[i][0], "rb") ftp.storbinary('STOR ' + files[i][1], FH) FH.close() #@-<<upload all the modified files>> ftp.quit() p.b = json.dumps(files) g.es("Upload complete")
def upload (self,event=None): c = self.c ; p = c.p g.es("upload started") p = g.findTopLevelNode(c, '@data ftp') if p: files = json.loads(p.b) # credentials - array of (host, pass) of server, # to while the files must be uploaded I suggest that the locations must be the same. credentials = files[0] for element in credentials: g.es(element[0]) ftp = FTP(element[0]) ftp.login(element[1], element[2]) #@+<<upload all the modified files>> #@+node:ekr.20110110105526.5472: *4* <<upload all the modified files>> #@@c for i in range(1, len(files)): file = files[i] n = len(file) if n < 3: file.append(-1) time = os.path.getmtime(file[0]) if time != file[2]: files[i][2] = time g.es(files[i][0]) FH = open(files[i][0],"rb") ftp.storbinary('STOR ' + files[i][1], FH) FH.close() #@-<<upload all the modified files>> ftp.quit() p.b = json.dumps(files) g.es("Upload complete")