コード例 #1
0
ファイル: journal.py プロジェクト: NuggetManCan/rednotebook
 def set_frame_title(self):
     parts = ["RedNotebook"]
     if self.title != "data":
         parts.append(self.title)
     parts.append(
         dates.format_date(self.config.read("exportDateFormat"), self.date))
     self.frame.main_frame.set_title(" - ".join(parts))
コード例 #2
0
    def get_export_string(self, format):
        if self.export_all_days:
            export_days = self.journal.days
        else:
            start, end = sorted([self.start_date, self.end_date])
            export_days = self.journal.get_days_in_date_range((start, end))

        selected_categories = self.exported_categories
        logging.debug('Selected Categories for Export: %s' % selected_categories)
        export_text = self.is_text_exported

        markup_strings_for_each_day = []
        for day in export_days:
            default_export_date_format = '%A, %x'
            # probably no one needs to configure this as i18n already exists
            #date_format = self.journal.config.read('exportDateFormat',
            #                                       default_export_date_format)
            date_format = default_export_date_format
            date_string = dates.format_date(date_format, day.date)
            day_markup = markup.get_markup_for_day(day, with_text=export_text,
                                            categories=selected_categories,
                                            date=date_string)
            markup_strings_for_each_day.append(day_markup)

        markup_string = ''.join(markup_strings_for_each_day)

        options = {'toc': 0}

        return markup.convert(markup_string, format, options=options)
コード例 #3
0
ファイル: templates.py プロジェクト: AndychenCL/rednotebook
 def _replace_macros(self, text):
     # convert every "$date$" to the current date
     config = self.main_window.journal.config
     format_string = config.read('dateTimeString')
     date_string = dates.format_date(format_string)
     text = text.replace('$date$', date_string)
     return text
コード例 #4
0
ファイル: exports.py プロジェクト: nbuss848/rednotebook
    def get_export_string(self, target):
        if self.export_selected_text and self.page2.selected_text:
            markup_string = self.page2.selected_text
        else:
            if self.export_all_days:
                export_days = self.journal.days
            else:
                export_days = self.journal.get_days_in_date_range(*self.page2.get_date_range())

            selected_categories = self.exported_categories
            logging.debug('Selected Categories for Inclusion: %s' % selected_categories)

            markup_strings_for_each_day = []
            for day in export_days:
                include_day = True
                if self.is_filtered:
                    include_day = False
                    catagory_pairs = day.get_category_content_pairs()
                    for category in selected_categories:
                        if category in catagory_pairs:
                            include_day = True
                if include_day:
                    date_format = self.journal.config.read('exportDateFormat')
                    date_string = dates.format_date(date_format, day.date)
                    day_markup = markup.get_markup_for_day(day,
                                                           target,
                                                           with_text=self.page3.is_text_included(),
                                                           with_tags=self.page3.is_tags_included(),
                                                           categories=selected_categories,
                                                           date=date_string)
                    markup_strings_for_each_day.append(day_markup)

            markup_string = ''.join(markup_strings_for_each_day)

        return self.journal.convert(markup_string, target, options={'toc': 0})
コード例 #5
0
ファイル: exports.py プロジェクト: AndychenCL/rednotebook
    def get_export_string(self, format):
        if self.export_selected_text and self.page2.selected_text:
            markup_string = self.page2.selected_text
        else:
            if self.export_all_days:
                export_days = self.journal.days
            else:
                export_days = self.journal.get_days_in_date_range(*self.page2.get_date_range())

            selected_categories = self.exported_categories
            logging.debug('Selected Categories for Inclusion: %s' % selected_categories)

            markup_strings_for_each_day = []
            for day in export_days:
                include_day = True
                if self.is_filtered:
                    include_day = False
                    catagory_pairs = day.get_category_content_pairs()
                    for category in selected_categories:
                        if category in catagory_pairs:
                            include_day = True
                if include_day:
                    date_format = self.journal.config.read('exportDateFormat')
                    date_string = dates.format_date(date_format, day.date)
                    day_markup = markup.get_markup_for_day(day, with_text=self.page3.is_text_included(),
                                                           with_tags=self.page3.is_tags_included(),
                                                           categories=selected_categories,
                                                           date=date_string)
                    markup_strings_for_each_day.append(day_markup)

            markup_string = ''.join(markup_strings_for_each_day)

        return self.journal.convert(markup_string, format, options={'toc': 0})
コード例 #6
0
 def _replace_macros(self, text):
     # convert every "$date$" to the current date
     config = self.main_window.journal.config
     format_string = config.read('dateTimeString')
     date_string = dates.format_date(format_string)
     text = text.replace('$date$', date_string)
     return text
コード例 #7
0
ファイル: journal.py プロジェクト: scx/rednotebook
 def set_frame_title(self):
     parts = ['RedNotebook']
     if self.title != 'data':
         parts.append(self.title)
     parts.append(
         dates.format_date(self.config.read('exportDateFormat'), self.date))
     self.frame.main_frame.set_title(' - '.join(parts))
コード例 #8
0
ファイル: main_window.py プロジェクト: AndychenCL/rednotebook
 def on_preview_button_clicked(self, button):
     self.journal.save_old_day()
     if browser.WebKit2:
         self.html_editor.show_day(self.day)
         self.change_mode(preview=True)
     else:
         date_format = self.journal.config.read('exportDateFormat')
         date_string = dates.format_date(date_format, self.day.date)
         markup_string = markup.get_markup_for_day(self.day)
         html = self.journal.convert(
             markup_string, 'xhtml',
             headers=[date_string + ' - RedNotebook', '', ''],
             options={'toc': 0})
         utils.show_html_in_browser(
             html, os.path.join(self.journal.dirs.temp_dir, 'day.html'))
コード例 #9
0
 def on_preview_button_clicked(self, button):
     self.journal.save_old_day()
     if self.html_editor.internal:
         self.html_editor.show_day(self.day)
         self.change_mode(preview=True)
     else:
         date_format = self.journal.config.read('exportDateFormat')
         date_string = dates.format_date(date_format, self.day.date)
         markup_string = markup.get_markup_for_day(self.day)
         html = self.journal.convert(
             markup_string,
             'xhtml',
             headers=[date_string + ' - RedNotebook', '', ''],
             options={'toc': 0})
         utils.show_html_in_browser(
             html, os.path.join(self.journal.dirs.temp_dir, 'day.html'))
コード例 #10
0
 def on_preview_button_clicked(self, button):
     self.journal.save_old_day()
     if self.html_editor.internal:
         self.html_editor.show_day(self.day)
         self.change_mode(preview=True)
     else:
         date_format = self.journal.config.read("exportDateFormat")
         date_string = dates.format_date(date_format, self.day.date)
         markup_string = markup.get_markup_for_day(self.day, "xhtml")
         html = self.journal.convert(
             markup_string,
             "xhtml",
             headers=[date_string + " - RedNotebook", "", ""],
             options={"toc": 0},
         )
         utils.show_html_in_browser(
             html, os.path.join(self.journal.dirs.temp_dir, "day.html"))
コード例 #11
0
ファイル: templates.py プロジェクト: ipeikon/LaBook
    def get_text(self, title):
        filename = self.titles_to_files.get(title, None)
        if not filename:
            return ''

        text = filesystem.read_file(filename)

        # An Error occured
        if not text:
            text = ('This template contains no text or has unreadable content. To edit it, '
                    'click the arrow right of "Template" '
                    'and select the template under "Edit Template".')

        # convert every "$date$" to the current date
        config = self.main_window.journal.config
        format_string = config.read('dateTimeString', '%A, %x %X')
        date_string = dates.format_date(format_string)

        template_text = text.replace(u'$date$', date_string)
        return template_text
コード例 #12
0
ファイル: templates.py プロジェクト: pakesson/rednotebook
    def get_text(self, title):
        filename = self.titles_to_files.get(title, None)
        if not filename:
            return ''

        text = filesystem.read_file(filename)

        # An Error occured
        if not text:
            text = (
                'This template contains no text or has unreadable content. To edit it, '
                'click the arrow right of "Template" '
                'and select the template under "Edit Template".')

        # convert every "$date$" to the current date
        config = self.main_window.journal.config
        format_string = config.read('dateTimeString', '%A, %x %X')
        date_string = dates.format_date(format_string)

        template_text = text.replace(u'$date$', date_string)
        return template_text
コード例 #13
0
ファイル: exports.py プロジェクト: ipeikon/LaBook
    def get_export_string(self, format):
        if self.export_all_days:
            export_days = self.journal.days
        else:
            export_days = self.journal.get_days_in_date_range(*self.page2.get_date_range())

        selected_categories = self.exported_categories
        logging.debug('Selected Categories for Export: %s' % selected_categories)
        export_text = self.is_text_exported

        markup_strings_for_each_day = []
        for day in export_days:
            # Save selected date format
            date_format = self.page3.date_format.get_value()
            self.journal.config['exportDateFormat'] = date_format
            date_string = dates.format_date(date_format, day.date)
            day_markup = markup.get_markup_for_day(day, with_text=export_text,
                                            categories=selected_categories,
                                            date=date_string)
            markup_strings_for_each_day.append(day_markup)

        markup_string = ''.join(markup_strings_for_each_day)

        return markup.convert(markup_string, format, options={'toc': 0})
コード例 #14
0
 def set_frame_title(self):
     parts = ['RedNotebook']
     if self.title != 'data':
         parts.append(self.title)
     parts.append(dates.format_date('%x', self.date))
     self.frame.main_frame.set_title(' - '.join(parts))
コード例 #15
0
 def on_format_changed(self, widget):
     format_string = self.get_value()
     date_string = dates.format_date(format_string)
     # Translators: Noun
     label_text = '%s %s' % (_('Preview:'), date_string)
     self.preview.set_text(label_text)
コード例 #16
0
 def on_format_changed(self, widget):
     format_string = self.get_value()
     date_string = dates.format_date(format_string)
     # Translators: Noun
     label_text = "{} {}".format(_("Preview:"), date_string)
     self.preview.set_text(label_text)
コード例 #17
0
 def on_insert_date_time(self, sel_text):
     format_string = self.main_window.journal.config.read(
         'dateTimeString', '%A, %x %X')
     return dates.format_date(format_string)
コード例 #18
0
ファイル: journal.py プロジェクト: rakotomandimby/rednotebook
 def set_frame_title(self):
     parts = ['RedNotebook']
     if self.title != 'data':
         parts.append(self.title)
     parts.append(dates.format_date('%x', self.date))
     self.frame.main_frame.set_title(' - '.join(parts))
コード例 #19
0
ファイル: options.py プロジェクト: pakesson/rednotebook
 def on_format_changed(self, widget):
     format_string = self.get_value()
     date_string = dates.format_date(format_string)
     ### Translators: Noun
     label_text = u'%s %s' % (_('Preview:'), date_string)
     self.preview.set_text(label_text)
コード例 #20
0
 def on_insert_date_time(self, sel_text):
     format_string = self.main_window.journal.config.read('dateTimeString', '%A, %x %X')
     return dates.format_date(format_string)
コード例 #21
0
ファイル: journal.py プロジェクト: AndychenCL/rednotebook
 def set_frame_title(self):
     parts = ['RedNotebook']
     if self.title != 'data':
         parts.append(self.title)
     parts.append(dates.format_date(self.config.read('exportDateFormat'), self.date))
     self.frame.main_frame.set_title(' - '.join(parts))