comparison frontends/src/tools/composition.py @ 719:56aa0e98c92e

frontends tools: moved src/tools/frontends to frontends/src/tools
author souliane <souliane@mailoo.org>
date Thu, 21 Nov 2013 18:57:10 +0100
parents src/tools/frontends/composition.py@481e0f8ae47c
children 1fe00f0c9a91
comparison
equal deleted inserted replaced
718:074970227bc0 719:56aa0e98c92e
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 """
5 Libervia: a Salut à Toi frontend
6 Copyright (C) 2013 Adrien Cossa <souliane@mailoo.org>
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Affero General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Affero General Public License for more details.
17
18 You should have received a copy of the GNU Affero General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 """
21
22 # Map the messages recipient types to their properties.
23 RECIPIENT_TYPES = {"To": {"desc": "Direct recipients", "optional": False},
24 "Cc": {"desc": "Carbon copies", "optional": True},
25 "Bcc": {"desc": "Blind carbon copies", "optional": True}}
26
27 # Rich text buttons icons and descriptions
28 RICH_BUTTONS = {
29 "bold": {"tip": "Bold", "icon": "media/icons/dokuwiki/toolbar/16/bold.png"},
30 "italic": {"tip": "Italic", "icon": "media/icons/dokuwiki/toolbar/16/italic.png"},
31 "underline": {"tip": "Underline", "icon": "media/icons/dokuwiki/toolbar/16/underline.png"},
32 "code": {"tip": "Code", "icon": "media/icons/dokuwiki/toolbar/16/mono.png"},
33 "strikethrough": {"tip": "Strikethrough", "icon": "media/icons/dokuwiki/toolbar/16/strike.png"},
34 "heading": {"tip": "Heading", "icon": "media/icons/dokuwiki/toolbar/16/hequal.png"},
35 "numberedlist": {"tip": "Numbered List", "icon": "media/icons/dokuwiki/toolbar/16/ol.png"},
36 "list": {"tip": "List", "icon": "media/icons/dokuwiki/toolbar/16/ul.png"},
37 "link": {"tip": "Link", "icon": "media/icons/dokuwiki/toolbar/16/linkextern.png"},
38 "horizontalrule": {"tip": "Horizontal rule", "icon": "media/icons/dokuwiki/toolbar/16/hr.png"}
39 }
40
41 # Define here your rich text formats, the key must match the ones used in button.
42 # Tupples values must have 3 elements : prefix to the selection or cursor
43 # position, sample text to write if the marker is not applied on a selection,
44 # suffix to the selection or cursor position.
45 # FIXME: must not be hard-coded like this
46 RICH_FORMATS = {"markdown": {"bold": ("**", "bold", "**"),
47 "italic": ("*", "italic", "*"),
48 "code": ("`", "code", "`"),
49 "heading": ("\n# ", "Heading 1", "\n## Heading 2\n"),
50 "list": ("\n* ", "item", "\n + subitem\n"),
51 "link": ("[desc](", "link", ")"),
52 "horizontalrule": ("\n***\n", "", "")
53 },
54 "bbcode": {"bold": ("[b]", "bold", "[/b]"),
55 "italic": ("[i]", "italic", "[/i]"),
56 "underline": ("[u]", "underline", "[/u]"),
57 "strikethrough": ("[s]", "strikethrough", "[/s]"),
58 "code": ("[code]", "code", "[/code]"),
59 "link": ("[url=", "link", "]desc[/url]"),
60 "list": ("\n[list] [*]", "item 1", " [*]item 2 [/list]\n")
61 },
62 "dokuwiki": {"bold": ("**", "bold", "**"),
63 "italic": ("//", "italic", "//"),
64 "underline": ("__", "underline", "__"),
65 "strikethrough": ("<del>", "strikethrough", "</del>"),
66 "code": ("<code>", "code", "</code>"),
67 "heading": ("\n==== ", "Heading 1", " ====\n=== Heading 2 ===\n"),
68 "link": ("[[", "link", "|desc]]"),
69 "list": ("\n * ", "item\n", "\n * subitem\n"),
70 "horizontalrule": ("\n----\n", "", "")
71 },
72 "XHTML": {"bold": ("<b>", "bold", "</b>"),
73 "italic": ("<i>", "italic", "</i>"),
74 "underline": ("<u>", "underline", "</u>"),
75 "strikethrough": ("<s>", "strikethrough", "</s>"),
76 "code": ("<pre>", "code", "</pre>"),
77 "heading": ("\n<h3>", "Heading 1", "</h3>\n<h4>Heading 2</h4>\n"),
78 "link": ("<a href=\"", "link", "\">desc</a>"),
79 "list": ("\n<ul><li>", "item 1", "</li><li>item 2</li></ul>\n"),
80 "horizontalrule": ("\n<hr/>\n", "", "")
81 }
82
83 }
84
85 # These values should be equal to the ones in plugin_misc_text_syntaxes
86 # FIXME: should the plugin import them from here to avoid duplicity? Importing
87 # the plugin's values from here is not possible because Libervia would fail.
88 PARAM_KEY_COMPOSITION = "Composition"
89 PARAM_NAME_SYNTAX = "Syntax"
90