示例#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'))
示例#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'))
示例#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"))
示例#4
0
文件: exports.py 项目: ipeikon/LaBook
    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)
示例#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)
示例#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()
示例#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)
示例#8
0
文件: info.py 项目: ipeikon/LaBook
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)
示例#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)
示例#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()
示例#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()
示例#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()
示例#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()
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)