From b5032cf51e0c0c1aa22fc71f04418c6265f9df5f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 8 May 2014 11:43:11 +0530 Subject: [PATCH] Fixed moduleview language issue --- frappe/config/setup.py | 376 +++++++++++++-------------- frappe/config/website.py | 183 ++++++------- frappe/utils/email_lib/email_body.py | 4 +- frappe/widgets/moduleview.py | 3 +- 4 files changed, 282 insertions(+), 284 deletions(-) diff --git a/frappe/config/setup.py b/frappe/config/setup.py index 4ffa119167..9a72577d42 100644 --- a/frappe/config/setup.py +++ b/frappe/config/setup.py @@ -1,193 +1,191 @@ from frappe import _ from frappe.widgets.moduleview import add_setup_section -data = [ - { - "label": _("Users and Permissions"), - "icon": "icon-group", - "items": [ - { - "type": "doctype", - "name": "User", - "description": _("System and Website Users") - }, - { - "type": "doctype", - "name": "Role", - "description": _("User Roles") - }, - { - "type": "page", - "name": "permission-manager", - "label": "Permission Manager", - "icon": "icon-lock", - "description": _("Set Permissions on Document Types and Roles") - }, - { - "type": "page", - "name": "user-properties", - "label": _("User Permission Restrictions"), - "icon": "icon-user", - "description": _("Set Defaults and Restrictions for Users") - }, - ] - }, - { - "label": _("Settings"), - "icon": "icon-wrench", - "items": [ - { - "type": "doctype", - "name": "System Settings", - "label": _("System Settings"), - "description": _("Language, Date and Time settings"), - "hide_count": True - }, - { - "type": "page", - "name": "modules_setup", - "label": _("Show / Hide Modules"), - "icon": "icon-upload", - "description": _("Show or hide modules globally.") - }, - { - "type": "doctype", - "name": "Naming Series", - "description": _("Set numbering series for transactions."), - "hide_count": True - }, - ] - }, - { - "label": _("Data"), - "icon": "icon-th", - "items": [ - { - "type": "page", - "name": "data-import-tool", - "label": _("Import / Export Data"), - "icon": "icon-upload", - "description": _("Import / Export Data from .csv files.") - }, - { - "type": "doctype", - "name": "Rename Tool", - "description": _("Rename many items by uploading a .csv file."), - "hide_count": True - }, - { - "type": "doctype", - "name": "File Data", - "description": _("Manage uploaded files.") - } - ] - }, - { - "label": _("Workflow"), - "icon": "icon-random", - "items": [ - { - "type": "doctype", - "name": "Workflow", - "description": _("Define workflows for forms.") - }, - { - "type": "doctype", - "name": "Workflow State", - "description": _("States for workflow (e.g. Draft, Approved, Cancelled).") - }, - { - "type": "doctype", - "name": "Workflow Action", - "description": _("Actions for workflow (e.g. Approve, Cancel).") - }, - ] - }, - { - "label": _("Email"), - "icon": "icon-envelope", - "items": [ - { - "type": "doctype", - "name": "Outgoing Email Settings", - "description": _("Set outgoing mail server.") - }, - ] - }, - { - "label": _("Printing and Branding"), - "icon": "icon-print", - "items": [ - { - "type": "doctype", - "name": "Print Format", - "description": _("Customized HTML Templates for printing transctions.") - }, - ] - }, - { - "label": _("Customize"), - "icon": "icon-glass", - "items": [ - { - "type": "doctype", - "name": "Customize Form", - "description": _("Change field properties (hide, readonly, permission etc.)"), - "hide_count": True - }, - { - "type": "doctype", - "name": "Custom Field", - "description": _("Add fields to forms.") - }, - { - "type": "doctype", - "name": "Custom Script", - "description": _("Add custom javascript to forms.") - } - ] - }, - { - "label": _("System"), - "icon": "icon-cog", - "items": [ - { - "type": "page", - "name": "applications", - "label": _("Application Installer"), - "description": _("Install Applications."), - "icon": "icon-download" - }, - { - "type": "doctype", - "name": "Backup Manager", - "label": _("Download Backup"), - "onclick": "frappe.ui.toolbar.download_backup", - "icon": "icon-download-alt", - "description": _("Send download link of a recent backup to System Managers"), - "hide_count": True - }, - { - "type": "doctype", - "name": "Social Login Keys", - "description": _("Enter keys to enable login via Facebook, Google, GitHub."), - }, - { - "type": "doctype", - "name": "Backup Manager", - "description": _("Manage cloud backups on Dropbox"), - "hide_count": True - }, - { - "type": "doctype", - "name": "Scheduler Log", - "description": _("Log of error on automated events (scheduler).") - }, - ] - } -] - def get_data(): - out = list(data) - add_setup_section(out, "frappe", "website", _("Website"), "icon-globe") - return out + data = [ + { + "label": _("Users and Permissions"), + "icon": "icon-group", + "items": [ + { + "type": "doctype", + "name": "User", + "description": _("System and Website Users") + }, + { + "type": "doctype", + "name": "Role", + "description": _("User Roles") + }, + { + "type": "page", + "name": "permission-manager", + "label": "Permission Manager", + "icon": "icon-lock", + "description": _("Set Permissions on Document Types and Roles") + }, + { + "type": "page", + "name": "user-properties", + "label": _("User Permission Restrictions"), + "icon": "icon-user", + "description": _("Set Defaults and Restrictions for Users") + }, + ] + }, + { + "label": _("Settings"), + "icon": "icon-wrench", + "items": [ + { + "type": "doctype", + "name": "System Settings", + "label": _("System Settings"), + "description": _("Language, Date and Time settings"), + "hide_count": True + }, + { + "type": "page", + "name": "modules_setup", + "label": _("Show / Hide Modules"), + "icon": "icon-upload", + "description": _("Show or hide modules globally.") + }, + { + "type": "doctype", + "name": "Naming Series", + "description": _("Set numbering series for transactions."), + "hide_count": True + }, + ] + }, + { + "label": _("Data"), + "icon": "icon-th", + "items": [ + { + "type": "page", + "name": "data-import-tool", + "label": _("Import / Export Data"), + "icon": "icon-upload", + "description": _("Import / Export Data from .csv files.") + }, + { + "type": "doctype", + "name": "Rename Tool", + "description": _("Rename many items by uploading a .csv file."), + "hide_count": True + }, + { + "type": "doctype", + "name": "File Data", + "description": _("Manage uploaded files.") + } + ] + }, + { + "label": _("Workflow"), + "icon": "icon-random", + "items": [ + { + "type": "doctype", + "name": "Workflow", + "description": _("Define workflows for forms.") + }, + { + "type": "doctype", + "name": "Workflow State", + "description": _("States for workflow (e.g. Draft, Approved, Cancelled).") + }, + { + "type": "doctype", + "name": "Workflow Action", + "description": _("Actions for workflow (e.g. Approve, Cancel).") + }, + ] + }, + { + "label": _("Email"), + "icon": "icon-envelope", + "items": [ + { + "type": "doctype", + "name": "Outgoing Email Settings", + "description": _("Set outgoing mail server.") + }, + ] + }, + { + "label": _("Printing and Branding"), + "icon": "icon-print", + "items": [ + { + "type": "doctype", + "name": "Print Format", + "description": _("Customized HTML Templates for printing transctions.") + }, + ] + }, + { + "label": _("Customize"), + "icon": "icon-glass", + "items": [ + { + "type": "doctype", + "name": "Customize Form", + "description": _("Change field properties (hide, readonly, permission etc.)"), + "hide_count": True + }, + { + "type": "doctype", + "name": "Custom Field", + "description": _("Add fields to forms.") + }, + { + "type": "doctype", + "name": "Custom Script", + "description": _("Add custom javascript to forms.") + } + ] + }, + { + "label": _("System"), + "icon": "icon-cog", + "items": [ + { + "type": "page", + "name": "applications", + "label": _("Application Installer"), + "description": _("Install Applications."), + "icon": "icon-download" + }, + { + "type": "doctype", + "name": "Backup Manager", + "label": _("Download Backup"), + "onclick": "frappe.ui.toolbar.download_backup", + "icon": "icon-download-alt", + "description": _("Send download link of a recent backup to System Managers"), + "hide_count": True + }, + { + "type": "doctype", + "name": "Social Login Keys", + "description": _("Enter keys to enable login via Facebook, Google, GitHub."), + }, + { + "type": "doctype", + "name": "Backup Manager", + "description": _("Manage cloud backups on Dropbox"), + "hide_count": True + }, + { + "type": "doctype", + "name": "Scheduler Log", + "description": _("Log of error on automated events (scheduler).") + }, + ] + } + ] + add_setup_section(data, "frappe", "website", _("Website"), "icon-globe") + return data diff --git a/frappe/config/website.py b/frappe/config/website.py index ebd8f55a19..4adc17afd9 100644 --- a/frappe/config/website.py +++ b/frappe/config/website.py @@ -1,93 +1,94 @@ from frappe import _ -data = [ - { - "label": _("Documents"), - "icon": "icon-star", - "items": [ - { - "type": "doctype", - "name": "Web Page", - "description": _("Content web page."), - }, - { - "type": "doctype", - "name": "Blog Post", - "description": _("Single Post (article)."), - }, - { - "type": "doctype", - "name": "Blogger", - "description": _("User ID of a blog writer."), - }, - { - "type": "doctype", - "name": "Website Group", - "description": _("Web Site Forum Page."), - }, - { - "type": "doctype", - "name": "Post", - "description": _("List of Web Site Forum's Posts."), - }, - { - "type": "doctype", - "name": "Website Slideshow", - "description": _("Embed image slideshows in website pages."), - }, - ] - }, - { - "label": _("Setup"), - "icon": "icon-cog", - "items": [ - { - "type": "doctype", - "name": "Website Settings", - "description": _("Setup of top navigation bar, footer and logo."), - }, - { - "type": "page", - "name":"sitemap-browser", - "label": _("Sitemap Browser"), - "description": _("View or manage Website Route tree."), - "icon": "icon-sitemap" - }, - { - "type": "doctype", - "name": "Style Settings", - "description": _("Setup of fonts and background."), - }, - { - "type": "doctype", - "name": "Website Script", - "description": _("Javascript to append to the head section of the page."), - }, - { - "type": "doctype", - "name": "Blog Settings", - "description": _("Write titles and introductions to your blog."), - }, - { - "type": "doctype", - "name": "Blog Category", - "description": _("Categorize blog posts."), - }, - { - "type": "doctype", - "name": "About Us Settings", - "description": _("Settings for About Us Page."), - }, - { - "type": "doctype", - "name": "Contact Us Settings", - "description": _("Settings for Contact Us Page."), - }, - { - "type": "doctype", - "name": "Website Page Permission", - "description": _("Define read, write, admin permissions for a Website Page."), - }, - ] - }, -] \ No newline at end of file +def get_data(): + return [ + { + "label": _("Documents"), + "icon": "icon-star", + "items": [ + { + "type": "doctype", + "name": "Web Page", + "description": _("Content web page."), + }, + { + "type": "doctype", + "name": "Blog Post", + "description": _("Single Post (article)."), + }, + { + "type": "doctype", + "name": "Blogger", + "description": _("User ID of a blog writer."), + }, + { + "type": "doctype", + "name": "Website Group", + "description": _("Web Site Forum Page."), + }, + { + "type": "doctype", + "name": "Post", + "description": _("List of Web Site Forum's Posts."), + }, + { + "type": "doctype", + "name": "Website Slideshow", + "description": _("Embed image slideshows in website pages."), + }, + ] + }, + { + "label": _("Setup"), + "icon": "icon-cog", + "items": [ + { + "type": "doctype", + "name": "Website Settings", + "description": _("Setup of top navigation bar, footer and logo."), + }, + { + "type": "page", + "name":"sitemap-browser", + "label": _("Sitemap Browser"), + "description": _("View or manage Website Route tree."), + "icon": "icon-sitemap" + }, + { + "type": "doctype", + "name": "Style Settings", + "description": _("Setup of fonts and background."), + }, + { + "type": "doctype", + "name": "Website Script", + "description": _("Javascript to append to the head section of the page."), + }, + { + "type": "doctype", + "name": "Blog Settings", + "description": _("Write titles and introductions to your blog."), + }, + { + "type": "doctype", + "name": "Blog Category", + "description": _("Categorize blog posts."), + }, + { + "type": "doctype", + "name": "About Us Settings", + "description": _("Settings for About Us Page."), + }, + { + "type": "doctype", + "name": "Contact Us Settings", + "description": _("Settings for Contact Us Page."), + }, + { + "type": "doctype", + "name": "Website Page Permission", + "description": _("Define read, write, admin permissions for a Website Page."), + }, + ] + }, + ] diff --git a/frappe/utils/email_lib/email_body.py b/frappe/utils/email_lib/email_body.py index 0ba1883d7e..6c44498be6 100644 --- a/frappe/utils/email_lib/email_body.py +++ b/frappe/utils/email_lib/email_body.py @@ -6,7 +6,7 @@ import frappe from frappe import msgprint, throw, _ from frappe.utils import scrub_urls import email.utils -from inlinestyler.utils import inline_css +import inlinestyler.utils def get_email(recipients, sender='', msg='', subject='[No Subject]', text_content = None, footer=None, print_html=None, formatted=None): @@ -201,7 +201,7 @@ def get_formatted_html(subject, message, footer=None, print_html=None): if frappe.local.flags.in_test: return rendered_email - return inline_css(rendered_email) + return inlinestyler.utils.inline_css(rendered_email) def get_footer(footer=None): """append a footer (signature)""" diff --git a/frappe/widgets/moduleview.py b/frappe/widgets/moduleview.py index 152512078a..847ca70176 100644 --- a/frappe/widgets/moduleview.py +++ b/frappe/widgets/moduleview.py @@ -6,7 +6,6 @@ import frappe from frappe.widgets import reportview from frappe.utils import cint from frappe import _ -from copy import deepcopy @frappe.whitelist() def get(module): @@ -95,7 +94,7 @@ def combine_common_sections(data): def get_config(app, module): config = frappe.get_module("{app}.config.{module}".format(app=app, module=module)) - config = deepcopy(config.get_data() if hasattr(config, "get_data") else config.data) + config = config.get_data() for section in config: for item in section["items"]: