Beispiel #1
0
 def accept(self):
     if not self.name_is_ok:
         return error_dialog(
             self,
             _('No name specified'),
             _('You must specify a name for the new file, with an extension, for example, chapter1.html'
               ),
             show=True)
     tprefs['auto_link_stylesheets'] = self.link_css.isChecked()
     name = unicode(self.name.text())
     name, ext = name.rpartition('.')[0::2]
     name = (name + '.' + ext.lower()).replace('\\', '/')
     mt = guess_type(name)
     if not self.file_data:
         if mt in OEB_DOCS:
             self.file_data = template_for('html').encode('utf-8')
             if tprefs['auto_link_stylesheets']:
                 data = add_stylesheet_links(current_container(), name,
                                             self.file_data)
                 if data is not None:
                     self.file_data = data
             self.using_template = True
         elif mt in OEB_STYLES:
             self.file_data = template_for('css').encode('utf-8')
             self.using_template = True
     self.file_name = name
     QDialog.accept(self)
Beispiel #2
0
 def accept(self):
     if not self.name_is_ok:
         return error_dialog(self, _('No name specified'), _(
             'You must specify a name for the new file, with an extension, for example, chapter1.html'), show=True)
     name = unicode(self.name.text())
     name, ext = name.rpartition('.')[0::2]
     name = (name + '.' + ext.lower()).replace('\\', '/')
     mt = guess_type(name)
     if mt in OEB_DOCS:
         self.file_data = template_for('html').encode('utf-8')
         self.using_template = True
     elif mt in OEB_STYLES:
         self.file_data = template_for('css').encode('utf-8')
         self.using_template = True
     self.file_name = name
     QDialog.accept(self)
Beispiel #3
0
 def accept(self):
     if not self.name_is_ok:
         return error_dialog(self, _('No name specified'), _(
             'You must specify a name for the new file, with an extension, for example, chapter1.html'), show=True)
     name = unicode(self.name.text())
     name, ext = name.rpartition('.')[0::2]
     name = (name + '.' + ext.lower()).replace('\\', '/')
     mt = guess_type(name)
     if not self.file_data:
         if mt in OEB_DOCS:
             self.file_data = template_for('html').encode('utf-8')
             self.using_template = True
         elif mt in OEB_STYLES:
             self.file_data = template_for('css').encode('utf-8')
             self.using_template = True
     self.file_name = name
     QDialog.accept(self)
Beispiel #4
0
 def accept(self):
     if not self.name_is_ok:
         return error_dialog(
             self,
             _("No name specified"),
             _("You must specify a name for the new file, with an extension, for example, chapter1.html"),
             show=True,
         )
     name = unicode(self.name.text())
     name, ext = name.rpartition(".")[0::2]
     name = (name + "." + ext.lower()).replace("\\", "/")
     mt = guess_type(name)
     if mt in OEB_DOCS:
         self.file_data = template_for("html").encode("utf-8")
         self.using_template = True
     elif mt in OEB_STYLES:
         self.file_data = template_for("css").encode("utf-8")
         self.using_template = True
     self.file_name = name
     QDialog.accept(self)
Beispiel #5
0
 def accept(self):
     if not self.name_is_ok:
         return error_dialog(self, _('No name specified'), _(
             'You must specify a name for the new file, with an extension, for example, chapter1.html'), show=True)
     tprefs['auto_link_stylesheets'] = self.link_css.isChecked()
     name = unicode(self.name.text())
     name, ext = name.rpartition('.')[0::2]
     name = (name + '.' + ext.lower()).replace('\\', '/')
     mt = guess_type(name)
     if not self.file_data:
         if mt in OEB_DOCS:
             self.file_data = template_for('html').encode('utf-8')
             if tprefs['auto_link_stylesheets']:
                 data = add_stylesheet_links(current_container(), name, self.file_data)
                 if data is not None:
                     self.file_data = data
             self.using_template = True
         elif mt in OEB_STYLES:
             self.file_data = template_for('css').encode('utf-8')
             self.using_template = True
     self.file_name = name
     QDialog.accept(self)