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))
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)
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
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})
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})
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))
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'))
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'))
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"))
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
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
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})
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))
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)
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)
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)
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)
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)
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))