Ejemplo n.º 1
0
 def on_help_menu_item_activate(self, widget):
     temp_dir = self.journal.dirs.temp_dir
     filesystem.write_file(os.path.join(temp_dir, 'source.txt'), info.help_text)
     html = self.journal.convert(info.help_text, 'xhtml',
                           headers=[_('RedNotebook Documentation'), info.version, ''],
                           options={'toc': 1})
     utils.show_html_in_browser(html, os.path.join(temp_dir, 'help.html'))
Ejemplo n.º 2
0
 def on_help_menu_item_activate(self, widget):
     temp_dir = self.journal.dirs.temp_dir
     filesystem.write_file(os.path.join(temp_dir, 'source.txt'), help_text)
     html = self.journal.convert(
         help_text,
         'xhtml',
         headers=[_('RedNotebook Documentation'), info.version, ''],
         options={'toc': 1})
     utils.show_html_in_browser(html, os.path.join(temp_dir, 'help.html'))
Ejemplo n.º 3
0
 def on_help_menu_item_activate(self, widget):
     temp_dir = self.journal.dirs.temp_dir
     filesystem.write_file(os.path.join(temp_dir, "source.txt"), help_text)
     html = self.journal.convert(
         help_text,
         "xhtml",
         headers=[_("RedNotebook Documentation"), info.version, ""],
         options={"toc": 1},
     )
     utils.show_html_in_browser(html, os.path.join(temp_dir, "help.html"))
Ejemplo n.º 4
0
    def export(self):
        format = self.exporter.FORMAT

        if format == 'pdf':
            self.export_pdf()
            return

        export_string = self.get_export_string(format)

        filesystem.write_file(self.path, export_string)
        self.journal.show_message(_('Content exported to %s') % self.path)
Ejemplo n.º 5
0
    def export(self):
        format = self.exporter.FORMAT

        if format == 'pdf':
            self.export_pdf()
            return

        export_string = self.get_export_string(format)

        filesystem.write_file(self.path, export_string)
        self.journal.show_message(_('Content exported to %s') % self.path)
Ejemplo n.º 6
0
    def save_to_disk(self):
        assert self.changed()

        content = ''
        for key, value in sorted(self.iteritems()):
            if key not in self.suppressed_keys:
                content += ('%s=%s\n' % (key, value))

        filesystem.write_file(self.file, content)
        logging.info('Configuration has been saved to disk')
        self.old_config = self.copy()
Ejemplo n.º 7
0
def write_documentation(dir):
    '''
    Write the documenation as html to a directory
    Include the original markup as "source.txt"
    '''
    from rednotebook.util import filesystem
    from rednotebook.util import markup

    filesystem.write_file(os.path.join(dir, 'source.txt'), help_text)
    headers = [_('RedNotebook Documentation'), version, '']
    options = {'toc': 1,}
    html = markup.convert(help_text, 'xhtml', headers, options)
    filesystem.write_file(os.path.join(dir, 'help.html'), html)
Ejemplo n.º 8
0
def write_documentation(dir):
    """
    Write the documenation as html to a directory
    Include the original markup as "source.txt"
    """
    from rednotebook.util import filesystem
    from rednotebook.util import markup

    filesystem.write_file(os.path.join(dir, "source.txt"), help_text)
    headers = [_("RedNotebook Documentation"), version, ""]
    options = {"toc": 1}
    html = markup.convert(help_text, "xhtml", headers, options)
    filesystem.write_file(os.path.join(dir, "help.html"), html)
Ejemplo n.º 9
0
def write_documentation(dir):
    '''
    Write the documenation as html to a directory
    Include the original markup as "source.txt"
    '''
    from rednotebook.util import filesystem
    from rednotebook.util import markup

    filesystem.write_file(os.path.join(dir, 'source.txt'), help_text)
    headers = [_('RedNotebook Documentation'), version, '']
    options = {
        'toc': 1,
    }
    html = markup.convert(help_text, 'xhtml', headers, options)
    filesystem.write_file(os.path.join(dir, 'help.html'), html)
Ejemplo n.º 10
0
    def save_to_disk(self):
        if not self.changed():
            return

        lines = []
        for key, value in sorted(self.iteritems()):
            if key not in self.suppressed_keys:
                lines.append("%s=%s" % (key, value))

        try:
            filesystem.make_directory(os.path.dirname(self.filename))
            filesystem.write_file(self.filename, "\n".join(lines))
        except IOError:
            logging.error("Configuration could not be saved. Please check " "your permissions")
        else:
            logging.info("Configuration has been saved to %s" % self.filename)
            self.save_state()
Ejemplo n.º 11
0
    def save_to_disk(self):
        if not self.changed():
            return

        lines = []
        for key, value in sorted(self.iteritems()):
            if key not in self.suppressed_keys:
                lines.append('%s=%s' % (key, value))

        try:
            filesystem.make_directory(os.path.dirname(self.filename))
            filesystem.write_file(self.filename, '\n'.join(lines))
        except IOError:
            logging.error('Configuration could not be saved. Please check '
                          'your permissions')
        else:
            logging.info('Configuration has been saved to %s' % self.filename)
            self.save_state()
Ejemplo n.º 12
0
    def save_to_disk(self):
        if not self.changed():
            return

        content = ''
        for key, value in sorted(self.iteritems()):
            if key not in self.suppressed_keys:
                content += ('%s=%s\n' % (key, value))

        try:
            filesystem.make_directory(os.path.dirname(self.file))
            filesystem.write_file(self.file, content)
        except IOError:
            logging.error('Configuration could not be saved. Please check '
                          'your permissions')
            return

        logging.info('Configuration has been saved to %s' % self.file)
        self.save_state()
Ejemplo n.º 13
0
    def save_to_disk(self):
        if not self.changed():
            return

        content = ''
        for key, value in sorted(self.iteritems()):
            if key not in self.suppressed_keys:
                content += ('%s=%s\n' % (key, value))

        try:
            filesystem.make_directory(os.path.dirname(self.file))
            filesystem.write_file(self.file, content)
        except IOError:
            logging.error('Configuration could not be saved. Please check '
                          'your permissions')
            return

        logging.info('Configuration has been saved to %s' % self.file)
        self.save_state()
Ejemplo n.º 14
0
def show_html_in_browser(html, filename):
    filesystem.write_file(filename, html)

    html_file = os.path.abspath(filename)
    html_file = 'file://' + html_file
    webbrowser.open(html_file)
Ejemplo n.º 15
0
 def export(self):
     format = self.exporter.FORMAT
     export_string = self.get_export_string(format)
     filesystem.write_file(self.path, export_string)
     self.journal.show_message(_("Content exported to %s") % self.path)
Ejemplo n.º 16
0
def show_html_in_browser(html, filename):
    filesystem.write_file(filename, html)

    html_file = os.path.abspath(filename)
    html_file = 'file://' + html_file
    webbrowser.open(html_file)
Ejemplo n.º 17
0
 def on_save(self, button):
     template = self.main_window.day_text_field.get_text()
     filesystem.write_file(self.get_path(self.tmp_title), template)
Ejemplo n.º 18
0
 def on_save(self, button):
     template = self.main_window.day_text_field.get_text()
     filesystem.write_file(self.get_path(self.tmp_title), template)