예제 #1
0
 def __idle_save_text(self, status):
     self.__save_text_id = 0
     _logger.debug("autosaving to %s", self.__filename)
     dn,bn = os.path.split(self.__filename)
     try:
         perms = os.stat(self.__filename).st_mode
     except:
         perms = None
     (tempfd, temppath) = tempfile.mkstemp('.tmp', self.__filename, dn)
     os.close(tempfd)
     f = open_text_file(temppath, 'w')
     text = self.input.get_property("text")
     utext = str(text)
     f.write(utext)
     f.flush()
     os.fsync(tempfd)
     f.close()
     if perms is not None:
         os.chmod(temppath, perms)
     atomic_rename(temppath, self.__filename)
     self.__show_msg(status + _("...done"))
     self.__modified = False
     self.__sync_modified_sensitivity()
     _logger.debug("autosave complete")
     return False
예제 #2
0
 def __idle_save_text(self, status):
     self.__save_text_id = 0
     _logger.debug("autosaving to %s", self.__filename)
     dn, bn = os.path.split(self.__filename)
     try:
         perms = os.stat(self.__filename).st_mode
     except:
         perms = None
     (tempfd, temppath) = tempfile.mkstemp('.tmp', self.__filename, dn)
     os.close(tempfd)
     f = open_text_file(temppath, 'w')
     text = self.input.get_property("text")
     utext = unicode(text)
     f.write(utext)
     f.flush()
     os.fsync(tempfd)
     f.close()
     if perms is not None:
         os.chmod(temppath, perms)
     atomic_rename(temppath, self.__filename)
     self.__show_msg(status + _("...done"))
     self.__modified = False
     self.__sync_modified_sensitivity()
     _logger.debug("autosave complete")
     return False
예제 #3
0
 def add(self, path):
     if path in self.__bookmarks:
         return
     self.__bookmarks.append(path) 
     (bdir, bname) = os.path.split(self.__bookmarks_path)
     (fd, temppath) = tempfile.mkstemp('.tmp', bname, bdir)
     f = os.fdopen(fd, 'w')
     for mark in self.__bookmarks:
         f.write(path_tourl(mark))
         f.write('\n')
     f.close()
     atomic_rename(temppath, self.__bookmarks_path)  
     # Might as well signal now             
     dispatcher.send(sender=self)
예제 #4
0
파일: fs.py 프로젝트: zaxebo1/hotwire-shell
 def add(self, path):
     if path in self.__bookmarks:
         return
     self.__bookmarks.append(path)
     (bdir, bname) = os.path.split(self.__bookmarks_path)
     (fd, temppath) = tempfile.mkstemp('.tmp', bname, bdir)
     f = os.fdopen(fd, 'w')
     for mark in self.__bookmarks:
         f.write(path_tourl(mark))
         f.write('\n')
     f.close()
     atomic_rename(temppath, self.__bookmarks_path)
     # Might as well signal now
     dispatcher.send(sender=self)