Esempio n. 1
0
 def insert_new_template(self, package, template, path):
     newfile = readfile(path)
     filename = self.template_filename(package, template)
     makepaths(dirname(filename))
     writefile(filename, newfile)
     try:
         self.traittemplate.insert_template(
             dict(package=package, template=template), file(path))
     except OperationalError:
         dialogs.Message('template already exists')
     self.set_template(package, template)
     self.reset_rows()
Esempio n. 2
0
 def ok_file(self, button, filesel):
     path = filesel.get_filename()
     print path, '  --->is path'
     print self.tmp_path, ' tmppath'
     action = filesel.get_data('action')
     filesel.destroy()
     if action == 'open':
         self._fill_from_path(path)
         self.filename = get_file_path(path, self.tmp_path)
         self.set_title(self.filename)
     elif action == 'save':
         writefile(path, get_buffer_text(self.editor.tbuffer))
Esempio n. 3
0
 def insert_new_template(self, package, template, path):
     newfile = readfile(path)
     filename = self.template_filename(package, template)
     makepaths(dirname(filename))
     writefile(filename, newfile)
     try:
         self.traittemplate.insert_template(dict(package=package, template=template),
                                            file(path))
     except OperationalError:
         dialogs.Message('template already exists')
     self.set_template(package, template)
     self.reset_rows()
Esempio n. 4
0
 def ok_file(self, button, filesel):
     path = filesel.get_filename()
     print path, '  --->is path'
     print self.tmp_path, ' tmppath'
     action = filesel.get_data('action')
     filesel.destroy()
     if action == 'open':
         self._fill_from_path(path)
         self.filename = get_file_path(path, self.tmp_path)
         self.set_title(self.filename)
     elif action == 'save':
         writefile(path, get_buffer_text(self.editor.tbuffer))