def on_html_saveas(self, html): print 'on_save_as:' filename = gtkdialogs.save(title=_('SaveAS'), name_mimes={_("Html Document"):"text/html"}) #current_name = _('新建文档') #current_name = '' current_name = get_doctitle(html) filename = gtkdialogs.save(title=_('Save As'), name_mimes={_("Html Document"):"text/html"}, current_name=current_name, folder=self.edit.lastDir,) if filename and not '.' in os.path.basename(filename): filename = filename + '.html' if filename: self.add_recent(filename) #添加到最近文件 self.edit.lastDir = os.path.dirname(filename) #html = self.edit.get_html() file(filename, 'w').write(html) pass gtk.gdk.threads_leave() pass
def on_html_save(self, html): print 'on_save:' print self if self.editfile: filename = self.editfile else: #current_name = _('新建文档') #current_name = '' current_name = get_doctitle(html) filename = gtkdialogs.save(title=_('Save'), name_mimes={_("Html Document"):"text/html"}, current_name=current_name,) if filename and not '.' in os.path.basename(filename): filename = filename + '.html' if filename: self.edit.lastDir = os.path.dirname(filename) #html = self.edit.get_html() if not self.editfile: self.add_recent(filename) #添加到最近文件 file(filename, 'w').write(html) self.editfile = filename self.window.set_title(os.path.basename(self.editfile) + ' - ' + Title) pass gtk.gdk.threads_leave() pass