ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py

Mon, 10 Feb 2014 19:21:55 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 10 Feb 2014 19:21:55 +0100
changeset 10
ef5694c0bf3a
parent 9
1b11bf54b3b2
child 11
7e3e1ee102c5
permissions
-rw-r--r--

Implemented the 'internatinalization' menu and some Python2 compatibility changes.

2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Django tags menu handler.
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
10 from __future__ import unicode_literals # __IGNORE_WARNING__
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
11 try:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
12 str = unicode
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
13 except NameError:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
14 pass
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
15
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
16 import os
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
17 import datetime
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
18
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from PyQt4.QtCore import QObject
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
20 from PyQt4.QtGui import QMenu, QInputDialog, QDialog, QApplication
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 from E5Gui.E5Application import e5App
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
23 from E5Gui import E5FileDialog, E5MessageBox
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
25 from .DjangoTagInputDialog import DjangoTagInputDialog
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
26
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
27 import Utilities
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
28
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
29
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 class DjangoTagsMenuHandler(QObject):
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 Class implementing the Django tags menu handler.
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 def __init__(self, ui, parent=None):
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 Constructor
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @param ui reference to the user interface object (UI.UserInterface)
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 @param parent reference to the parent object (QObject)
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 super(DjangoTagsMenuHandler, self).__init__(parent)
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.__ui = ui
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.__findDialog = None
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
46 def closeAllWindows(self):
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
47 """
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
48 Public method to close all dialogs managed by the handler.
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
49 """
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
50 if self.__findDialog:
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
51 self.__findDialog.close()
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
52
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 def initMenus(self, mainMenu):
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 Public method to initialize the various menus.
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 @param mainMenu reference to the main tags menu (QMenu)
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 mainMenu.addAction(self.tr("Django Template Tags Locator"),
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.__findTemplateTag)
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
61 mainMenu.addSeparator()
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
62 mainMenu.addMenu(self.__initTagsMenu())
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
63 mainMenu.addMenu(self.__initFiltersMenu())
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
64 mainMenu.addMenu(self.__initHumanizeMenu())
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
65 mainMenu.addMenu(self.__initWebDesignMenu())
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
66 mainMenu.addMenu(self.__initStaticMenu())
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
67 mainMenu.addMenu(self.__initCommentsMenu())
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
68 mainMenu.addMenu(self.__initInternationalizationMenu())
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
69 # TODO: add localization tags/filters menu
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
70 mainMenu.addMenu(self.__initlocalizationMenu())
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
71 # TODO: add timezone tags/filters menu
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
72 mainMenu.addMenu(self.__initTimezoneMenu())
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
73
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
74 def __initTagsMenu(self):
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
75 """
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
76 Private method to initialize the tags menu.
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
77
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
78 @return generated menu (QMenu)
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
79 """
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
80 menu = QMenu(self.tr("Tags"))
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
81 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
82 self.tr("autoescape - Auto Escape Characters"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
83 lambda: self.__applyTemplate("autoescape"))
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
84 menu.addSeparator()
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
85 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
86 self.tr("block - Named Block"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
87 lambda: self.__applyTemplate("block"))
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
88 menu.addSeparator()
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
89 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
90 self.tr("comment - Multiline Comment"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
91 lambda: self.__applyTemplate("comment"))
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
92 menu.addAction(
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
93 self.tr("csrf_token - Cross Site Request Forgery Token"),
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
94 lambda: self.__applyTemplate("csrf_token"))
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
95 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
96 self.tr("cycle - Cycle variables each time used"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
97 lambda: self.__applyTemplate("cycle"))
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
98 menu.addSeparator()
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
99 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
100 self.tr("debug - Output Debug Information"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
101 lambda: self.__applyTemplate("debug"))
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
102 menu.addSeparator()
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
103 menu.addAction(
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
104 self.tr("extends - Extend a template with variable contents"),
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
105 lambda: self.__applyTemplate("extendsvariable"))
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
106 menu.addAction(
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
107 self.tr("extends - Extend a template with file"),
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
108 lambda: self.__applyTemplate("extendsfile"))
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
109 menu.addSeparator()
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
110 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
111 self.tr("filter - Filtered Block for one or more filters"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
112 lambda: self.__applyTemplate("filter"))
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
113 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
114 self.tr("firstof - Outputs first argument variable that is True"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
115 lambda: self.__applyTemplate("firstof"))
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
116 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
117 self.tr("for - For Loop"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
118 lambda: self.__applyTemplate("for"))
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
119 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
120 self.tr("for...empty - For Loop with fallback for empty loop"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
121 lambda: self.__applyTemplate("for...empty"))
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
122 menu.addSeparator()
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
123 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
124 self.tr("if - if...elif...else... clauses"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
125 lambda: self.__applyTemplate("if"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
126 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
127 self.tr("ifchanged - Check if a value has changed"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
128 lambda: self.__applyTemplate("ifchanged"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
129 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
130 self.tr("ifequal - Output block if variables are equal"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
131 lambda: self.__applyTemplate("ifequal"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
132 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
133 self.tr("ifnotequal - Output block if variables are not equal"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
134 lambda: self.__applyTemplate("ifnotequal"))
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
135 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
136 self.tr("include - Render template given by variable"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
137 lambda: self.__applyTemplate("includevariable"))
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
138 menu.addAction(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
139 self.tr("include - Render template given by file name"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
140 lambda: self.__applyTemplate("includefile"))
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
141 menu.addSeparator()
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
142 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
143 self.tr("load - Load a custom template tag set"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
144 lambda: self.__applyTemplate("load"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
145 menu.addSeparator()
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
146 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
147 self.tr("now - Display current date and time"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
148 lambda: self.__applyTemplate("now"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
149 menu.addSeparator()
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
150 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
151 self.tr("regroup - Regroup list of alike objects by a common"
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
152 " attribute"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
153 lambda: self.__applyTemplate("regroup"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
154 menu.addSeparator()
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
155 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
156 self.tr("spaceless - Remove whitespace between HTML tags"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
157 lambda: self.__applyTemplate("spaceless"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
158 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
159 self.tr("ssi - Output contents of a given file into the page"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
160 lambda: self.__applyTemplate("ssi"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
161 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
162 self.tr("ssi - Output contents of a given file into the page"
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
163 " (dialog selection)"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
164 lambda: self.__applyTemplate("ssifile"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
165 menu.addSeparator()
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
166 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
167 self.tr("templatetag - Output syntax characters used for"
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
168 " template"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
169 lambda: self.__applyTemplate("templatetag"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
170 menu.addSeparator()
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
171 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
172 self.tr("url - Return an absolute path reference"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
173 lambda: self.__applyTemplate("url"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
174 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
175 self.tr("url...as - Return an absolute path reference"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
176 lambda: self.__applyTemplate("urlas"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
177 menu.addSeparator()
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
178 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
179 self.tr("verbatim - Output block contents without rendering"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
180 lambda: self.__applyTemplate("verbatim"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
181 menu.addSeparator()
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
182 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
183 self.tr("widthratio - Calculate width ratio"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
184 lambda: self.__applyTemplate("verbatim"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
185 menu.addAction(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
186 self.tr("with - Cache a complex variable under a simpler name"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
187 lambda: self.__applyTemplate("verbatim"))
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
188
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
189 self.__tagsMenu = menu
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
190 return menu
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
192 def __initFiltersMenu(self):
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
193 """
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
194 Private method to initialize the filters menu.
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
195
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
196 @return generated menu (QMenu)
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
197 """
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
198 mainMenu = QMenu(self.tr("Filters"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
199
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
200 menu = QMenu(self.tr("A-I"), mainMenu)
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
201 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
202 self.tr("add - Add variable or string"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
203 lambda: self.__applyTemplate("add"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
204 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
205 self.tr("addslashes - Add slashes before quotes"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
206 lambda: self.__applyTemplate("addslashes"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
207 menu.addSeparator()
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
208 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
209 self.tr("capfirst - Capitalize first character"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
210 lambda: self.__applyTemplate("capfirst"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
211 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
212 self.tr("center - Center value"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
213 lambda: self.__applyTemplate("center"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
214 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
215 self.tr("cut - Cut characters"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
216 lambda: self.__applyTemplate("cut"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
217 menu.addSeparator()
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
218 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
219 self.tr("date - Format date"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
220 lambda: self.__applyTemplate("date"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
221 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
222 self.tr("default - Use dafault if False"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
223 lambda: self.__applyTemplate("default"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
224 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
225 self.tr("default_if_none - Use default if None"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
226 lambda: self.__applyTemplate("default_if_none"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
227 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
228 self.tr("dictsort - Sort dictionaries"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
229 lambda: self.__applyTemplate("dictsort"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
230 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
231 self.tr("dictsortreversed - Sort dictionaries reversed"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
232 lambda: self.__applyTemplate("dictsortreversed"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
233 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
234 self.tr("divisibleby - Check divisibility"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
235 lambda: self.__applyTemplate("divisibleby"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
236 menu.addSeparator()
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
237 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
238 self.tr("escape - Escape as HTML"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
239 lambda: self.__applyTemplate("escape"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
240 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
241 self.tr("escapejs - Escape as JavaScript"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
242 lambda: self.__applyTemplate("escapejs"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
243 menu.addSeparator()
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
244 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
245 self.tr("filesizeformat - Format file sizes"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
246 lambda: self.__applyTemplate("filesizeformat"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
247 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
248 self.tr("first - First item of a list"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
249 lambda: self.__applyTemplate("first"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
250 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
251 self.tr("fix_ampersands - Replace ampersands"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
252 lambda: self.__applyTemplate("fix_ampersands"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
253 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
254 self.tr("floatformat - Format floating numbers"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
255 lambda: self.__applyTemplate("floatformat"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
256 menu.addAction(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
257 self.tr("force_escape - Escape as HTML immediately"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
258 lambda: self.__applyTemplate("force_escape"))
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
259 menu.addSeparator()
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
260 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
261 self.tr("get_digit - Extract rightmost digit"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
262 lambda: self.__applyTemplate("get_digit"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
263 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
264 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
265 self.tr("iriencode - Convert IRI to string"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
266 lambda: self.__applyTemplate("iriencode"))
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
267 mainMenu.addMenu(menu)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
268
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
269 menu = QMenu(self.tr("J-R"), mainMenu)
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
270 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
271 self.tr("join - Join list"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
272 lambda: self.__applyTemplate("join"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
273 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
274 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
275 self.tr("last - Return last item in list"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
276 lambda: self.__applyTemplate("last"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
277 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
278 self.tr("length - Return length of the value"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
279 lambda: self.__applyTemplate("length"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
280 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
281 self.tr("length_is - Check length"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
282 lambda: self.__applyTemplate("length_is"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
283 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
284 self.tr("linebreaks - Replace line breaks with HTML"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
285 lambda: self.__applyTemplate("linebreaks"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
286 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
287 self.tr("linebreaksbr - Replace line breaks with <br/>"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
288 lambda: self.__applyTemplate("linebreaksbr"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
289 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
290 self.tr("linenumbers - Display text with line numbers"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
291 lambda: self.__applyTemplate("linenumbers"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
292 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
293 self.tr("ljust - Left-align value"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
294 lambda: self.__applyTemplate("ljust"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
295 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
296 self.tr("lower - Convert to lowercase"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
297 lambda: self.__applyTemplate("lower"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
298 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
299 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
300 self.tr("make_list - Turn value into a list"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
301 lambda: self.__applyTemplate("make_list"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
302 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
303 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
304 self.tr("phone2numeric - Convert phone number into numeric"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
305 lambda: self.__applyTemplate("phone2numeric"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
306 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
307 self.tr("pluralize - Return plural suffix"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
308 lambda: self.__applyTemplate("pluralize"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
309 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
310 self.tr("pprint - Pretty Print"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
311 lambda: self.__applyTemplate("pprint"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
312 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
313 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
314 self.tr("random - Return random item from list"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
315 lambda: self.__applyTemplate("random"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
316 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
317 self.tr("removetags - Remove HTML tags"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
318 lambda: self.__applyTemplate("removetags"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
319 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
320 self.tr("rjust - Right-align value"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
321 lambda: self.__applyTemplate("rjust"))
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
322 mainMenu.addMenu(menu)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
323
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
324 menu = QMenu(self.tr("S-Z"), mainMenu)
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
325 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
326 self.tr("safe - Mark as not requiring HTML escaping "),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
327 lambda: self.__applyTemplate("safe"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
328 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
329 self.tr("safeseq - Mark as a safe sequence"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
330 lambda: self.__applyTemplate("safeseq"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
331 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
332 self.tr("slice - Return a slice of a list"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
333 lambda: self.__applyTemplate("slice"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
334 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
335 self.tr("slugify - Return value slugified"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
336 lambda: self.__applyTemplate("slugify"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
337 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
338 self.tr("stringformat - Format variable"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
339 lambda: self.__applyTemplate("stringformat"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
340 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
341 self.tr("striptags - Strip all HTML tags"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
342 lambda: self.__applyTemplate("striptags"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
343 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
344 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
345 self.tr("time - Format time"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
346 lambda: self.__applyTemplate("time"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
347 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
348 self.tr("timesince - Format as time since"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
349 lambda: self.__applyTemplate("timesince"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
350 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
351 self.tr("timeuntil - Format as time until"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
352 lambda: self.__applyTemplate("timeuntil"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
353 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
354 self.tr("title - Convert to titlecase"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
355 lambda: self.__applyTemplate("title"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
356 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
357 self.tr("truncatechars - Truncate after a number of characters"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
358 lambda: self.__applyTemplate("truncatechars"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
359 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
360 self.tr("truncatewords - Truncate after a number of words"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
361 lambda: self.__applyTemplate("truncatewords"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
362 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
363 self.tr("truncatewords_html - Truncate after a number of words"
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
364 " (HTML aware)"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
365 lambda: self.__applyTemplate("truncatewords_html"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
366 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
367 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
368 self.tr("unordered_list - Return HTML unordered list"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
369 lambda: self.__applyTemplate("unordered_list"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
370 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
371 self.tr("upper - Convert to uppercase"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
372 lambda: self.__applyTemplate("upper"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
373 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
374 self.tr("urlencode - Escape as URL"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
375 lambda: self.__applyTemplate("urlencode"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
376 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
377 self.tr("urlize - Convert URLs as clickable links"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
378 lambda: self.__applyTemplate("urlize"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
379 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
380 self.tr("urlizetrunc - Convert URLs as clickable links and"
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
381 " truncate"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
382 lambda: self.__applyTemplate("urlizetrunc"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
383 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
384 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
385 self.tr("wordcount - Return number of word"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
386 lambda: self.__applyTemplate("wordcount"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
387 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
388 self.tr("wordwrap - Wrap words"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
389 lambda: self.__applyTemplate("wordwrap"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
390 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
391 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
392 self.tr("yesno - Map True, False and None"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
393 lambda: self.__applyTemplate("yesno"))
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
394 mainMenu.addMenu(menu)
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
395
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
396 self.__filtersMenu = mainMenu
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
397 return mainMenu
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
398
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
399 def __initHumanizeMenu(self):
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
400 """
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
401 Private method to initialize the humanize menu.
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
402
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
403 @return generated menu (QMenu)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
404 """
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
405 menu = QMenu(self.tr("Humanize"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
406 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
407 self.tr("Load Package"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
408 lambda: self.__applyTemplate("loadhumanize"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
409 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
410 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
411 self.tr("apnumber - Format integer the Associated Press style"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
412 lambda: self.__applyTemplate("apnumber"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
413 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
414 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
415 self.tr("intcomma - Format integer with commas"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
416 lambda: self.__applyTemplate("intcomma"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
417 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
418 self.tr("intword - Convert integer to word"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
419 lambda: self.__applyTemplate("intword"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
420 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
421 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
422 self.tr("naturalday - Format date naturally"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
423 lambda: self.__applyTemplate("naturalday"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
424 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
425 self.tr("naturaltime - Format time naturally"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
426 lambda: self.__applyTemplate("naturaltime"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
427 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
428 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
429 self.tr("ordinal - Convert integer to ordinal"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
430 lambda: self.__applyTemplate("ordinal"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
431
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
432 self.__humanizeMenu = menu
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
433 return menu
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
434
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
435 def __initWebDesignMenu(self):
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
436 """
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
437 Private method to initialize the web design menu.
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
438
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
439 @return generated menu (QMenu)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
440 """
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
441 menu = QMenu(self.tr("Web Design"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
442 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
443 self.tr("Load Package"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
444 lambda: self.__applyTemplate("loadweb"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
445 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
446 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
447 self.tr("lorem - Builtin Lorem Impsum Generator"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
448 lambda: self.__applyTemplate("lorem"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
449
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
450 self.__webMenu = menu
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
451 return menu
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
452
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
453 def __initStaticMenu(self):
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
454 """
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
455 Private method to initialize the static menu.
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
456
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
457 @return generated menu (QMenu)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
458 """
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
459 menu = QMenu(self.tr("Static"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
460 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
461 self.tr("Load Package"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
462 lambda: self.__applyTemplate("loadstatic"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
463 menu.addSeparator()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
464 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
465 self.tr("static - Link to static file"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
466 lambda: self.__applyTemplate("staticfile"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
467 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
468 self.tr("static - Link to static file (via variable)"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
469 lambda: self.__applyTemplate("staticvariable"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
470 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
471 self.tr("get_static_prefix - Insert static URL"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
472 lambda: self.__applyTemplate("get_static_prefix"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
473 menu.addAction(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
474 self.tr("get_media_prefix - Insert media URL"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
475 lambda: self.__applyTemplate("get_media_prefix"))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
476
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
477 self.__staticMenu = menu
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
478 return menu
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
479
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
480 def __initCommentsMenu(self):
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
481 """
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
482 Private method to initialize the comments menu.
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
483
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
484 @return generated menu (QMenu)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
485 """
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
486 menu = QMenu(self.tr("Comment"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
487 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
488 self.tr("Single Line Comment Selected Text"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
489 lambda: self.__applyTemplate("singlelinecommentselect"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
490 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
491 self.tr("Multi Line Comment Selected Text"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
492 lambda: self.__applyTemplate("multilinecommentselect"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
493 menu.addSeparator()
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
494 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
495 self.tr("Single Line Comment from Input Dialog"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
496 lambda: self.__applyTemplate("singlelinecommentdialog"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
497 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
498 self.tr("Multi Line Comment from Input Dialog"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
499 lambda: self.__applyTemplate("multilinecommentdialog"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
500 menu.addSeparator()
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
501 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
502 self.tr("Single Line Comment from Clipboard"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
503 lambda: self.__applyTemplate("singlelinecommentclipboard"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
504 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
505 self.tr("Multi Line Comment from Clipboard"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
506 lambda: self.__applyTemplate("multilinecommentclipboard"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
507 menu.addSeparator()
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
508 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
509 self.tr("Multi Line Comment from File"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
510 lambda: self.__applyTemplate("multilinecommentfile"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
511 menu.addSeparator()
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
512 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
513 self.tr("Single Line Comment from Date Time Now"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
514 lambda: self.__applyTemplate("singlelinecommentdatetime"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
515 menu.addSeparator()
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
516 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
517 self.tr("HTML Comment Out Selected Text"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
518 lambda: self.__applyTemplate("htmlcomment"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
519 menu.addAction(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
520 self.tr("MS IE Conditional Comment Selected Text"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
521 lambda: self.__applyTemplate("iecomment"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
522
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
523 self.__commentsMenu = menu
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
524 return menu
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
525
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
526 def __initInternationalizationMenu(self):
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
527 """
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
528 Private method to initialize the static menu.
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
529
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
530 @return generated menu (QMenu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
531 """
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
532 mainMenu = QMenu(self.tr("Internationalization (i18n)"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
533 mainMenu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
534 self.tr("Load Package"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
535 lambda: self.__applyTemplate("loadi18n"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
536 mainMenu.addSeparator()
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
537
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
538 menu = QMenu(self.tr("Tags"), mainMenu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
539 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
540 self.tr("trans - Translate String or Variable"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
541 lambda: self.__applyTemplate("trans"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
542 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
543 self.tr("trans..as - Translate String into Variable"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
544 lambda: self.__applyTemplate("trans..as"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
545 menu.addSeparator()
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
546 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
547 self.tr("blocktrans - Translate Block"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
548 lambda: self.__applyTemplate("blocktrans"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
549 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
550 self.tr("blocktrans..with - Translate Block with Attributes"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
551 lambda: self.__applyTemplate("blocktrans..with"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
552 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
553 self.tr("plural - Plural Block"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
554 lambda: self.__applyTemplate("plural"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
555 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
556 self.tr("language - Switch language"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
557 lambda: self.__applyTemplate("language"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
558 menu.addSeparator()
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
559 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
560 self.tr("get_current_language - Current language"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
561 lambda: self.__applyTemplate("get_current_language"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
562 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
563 self.tr("get_available_languages - Available languages"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
564 lambda: self.__applyTemplate("get_available_languages"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
565 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
566 self.tr("get_current_language_bidi - Current language's"
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
567 " direction"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
568 lambda: self.__applyTemplate("get_current_language_bidi"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
569 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
570 self.tr("get_language_info - Language Information"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
571 lambda: self.__applyTemplate("get_language_info"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
572 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
573 self.tr("get_language_info_list - Language Information for a list"
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
574 " of languages"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
575 lambda: self.__applyTemplate("get_language_info_list"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
576 mainMenu.addMenu(menu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
577
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
578 menu = QMenu(self.tr("Filters"), mainMenu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
579 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
580 self.tr("language_name - Language name"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
581 lambda: self.__applyTemplate("language_name"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
582 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
583 self.tr("language_name_local - Language name translated"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
584 lambda: self.__applyTemplate("language_name_local"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
585 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
586 self.tr("bidi - Language's direction"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
587 lambda: self.__applyTemplate("bidi"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
588 mainMenu.addMenu(menu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
589
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
590 self.__internationalizationMenu = mainMenu
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
591 return mainMenu
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
592
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
593 def __initlocalizationMenu(self):
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
594 """
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
595 Private method to initialize the static menu.
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
596
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
597 @return generated menu (QMenu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
598 """
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
599 mainMenu = QMenu(self.tr("Localization (l10n)"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
600 mainMenu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
601 self.tr("Load Package"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
602 lambda: self.__applyTemplate("loadl10n"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
603 mainMenu.addSeparator()
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
604
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
605 menu = QMenu(self.tr("Tags"), mainMenu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
606
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
607 menu = QMenu(self.tr("Filters"), mainMenu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
608
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
609 self.__localizationMenu = mainMenu
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
610 return mainMenu
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
611
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
612 def __initTimezoneMenu(self):
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
613 """
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
614 Private method to initialize the static menu.
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
615
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
616 @return generated menu (QMenu)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
617 """
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
618 menu = QMenu(self.tr("Timezone (tz)"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
619 menu.addAction(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
620 self.tr("Load Package"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
621 lambda: self.__applyTemplate("loadtz"))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
622 menu.addSeparator()
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
623
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
624 self.__timezoneMenu = menu
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
625 return menu
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
626
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 def __findTemplateTag(self):
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 Private slot to find a template tag and insert its text.
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 if self.__findDialog is None:
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 from .FindTemplateTagDialog import FindTemplateTagDialog
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
633 self.__findDialog = FindTemplateTagDialog()
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 self.__findDialog.tag.connect(self.__applyTemplate)
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 self.__findDialog.show()
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
636 self.__findDialog.raise_()
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
637 self.__findDialog.activateWindow()
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 def __applyTemplate(self, tag):
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 Private slot to generate and insert the template text.
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 @param tag name of the tag to insert (string)
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 editor = e5App().getObject("ViewManager").activeWindow()
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 if editor is None:
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 return
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
649 templateText, replace = self.__generateTemplateText(
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
650 tag, editor.selectedText())
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
652 if templateText:
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
653 editor.beginUndoAction()
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
654 if replace:
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
655 editor.replaceSelectedText(templateText)
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
656 else:
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
657 editor.insert(templateText)
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
658 editor.endUndoAction()
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
660 def __generateTemplateText(self, tag, selectedText):
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 """
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 Private slot to generate the template text.
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 @param tag name of the tag to insert (string)
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
665 @param selectedText selected text of the current editor (string)
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
666 @return tuple of generated template text (string), a flag indicating
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
667 to perform a replace operation (boolean)
2
4be31b0908c7 Started implementing the tags functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 """
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
669 replace = False # safe value
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
670 ok = True
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
671 templateText = ""
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
672
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
673 ####################################################
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
674 ## Template Tags ##
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
675 ####################################################
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
676
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
677 if tag == "autoescape":
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
678 templateText = (
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
679 "{{% autoescape on %}} {0} {{% endautoescape %}}".format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
680 selectedText))
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
681 replace = True
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
682 elif tag == "block":
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
683 data, ok = DjangoTagInputDialog.getText(
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
684 None,
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
685 self.tr("Named Block"),
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
686 [self.tr("Enter block name:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
687 ["block_name"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
688 if ok:
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
689 templateText = "{{% block {0} %}} {1} {{% endblock %}}".format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
690 data[0], selectedText)
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
691 replace = True
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
692 elif tag == "comment":
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
693 templateText = "{{% comment %}} {0} {{% endcomment %}}".format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
694 selectedText)
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
695 replace = True
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
696 elif tag == "csrf_token":
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
697 templateText = "{% csrf_token %}"
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
698 elif tag == "cycle":
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
699 data, ok = DjangoTagInputDialog.getText(
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
700 None,
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
701 self.tr("Cycle Variables"),
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
702 [self.tr("Enter items to cycle, space separated")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
703 ["item1 item2 item3"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
704 if ok:
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
705 templateText = "{{% cycle {0} %}}".format(data[0])
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
706 elif tag == "debug":
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
707 templateText = "{% debug %}"
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
708 elif tag == "extendsvariable":
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
709 data, ok = DjangoTagInputDialog.getText(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
710 None,
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
711 self.tr("Extends"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
712 [self.tr("Enter variable name:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
713 ["variable"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
714 if ok:
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
715 templateText = "{{% extends {0} %}}".format(data[0])
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
716 elif tag == "extendsfile":
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
717 data, ok = DjangoTagInputDialog.getText(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
718 None,
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
719 self.tr("Extends"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
720 [self.tr("Enter parent file name:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
721 ["base.html"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
722 if ok:
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
723 templateText = '{{% extends "{0}" %}}'.format(data[0])
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
724 elif tag == "filter":
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
725 data, ok = DjangoTagInputDialog.getText(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
726 None,
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
727 self.tr("Tag Filters"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
728 [self.tr("Multiple filters with arguments, pipes separated:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
729 ["lower|safe"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
730 if ok:
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
731 templateText = (
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
732 "{{% filter {0} %}} {1} {{% endfilter %}}".format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
733 data[0], selectedText))
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
734 replace = True
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
735 elif tag == "firstof":
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
736 data, ok = DjangoTagInputDialog.getText(
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
737 None,
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
738 self.tr("First Of"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
739 [self.tr("Enter multiple variables, space separated:"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
740 self.tr("Enter fallback value:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
741 ["var1 var2", "fallback_value"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
742 if ok:
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
743 templateText = (
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
744 '{{% filter force_escape %}}{{% firstof {0} "{1}" %}}'
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
745 ' {2} {{% endfilter %}}'.format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
746 data[0], data[1], selectedText))
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
747 replace = True
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
748 elif tag == "for":
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
749 data, ok = DjangoTagInputDialog.getText(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
750 None,
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
751 self.tr("For Loop"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
752 [self.tr("Enter variable to use for iteration:"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
753 self.tr("Enter sequence to iterate over:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
754 ["item", "values"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
755 if ok:
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
756 templateText = (
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
757 "{{% for {0} in {1} %}} {2} {{% endfor %}}".format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
758 data[0], data[1], selectedText))
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
759 replace = True
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
760 elif tag == "for...empty":
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
761 data, ok = DjangoTagInputDialog.getText(
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
762 None,
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
763 self.tr("For Loop"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
764 [self.tr("Enter variable to use for iteration:"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
765 self.tr("Enter sequence to iterate over:"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
766 self.tr("Enter output to use if loop is empty:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
767 ["item", "values", '"Nothing."'])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
768 if ok:
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
769 templateText = (
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
770 "{{% for {0} in {1} %}} {2} {{% empty %}} {3}"
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
771 " {{% endfor %}}".format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
772 data[0], data[1], selectedText, data[2]))
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
773 replace = True
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
774 elif tag == "if":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
775 from .IfTagInputDialog import IfTagInputDialog
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
776 dlg = IfTagInputDialog()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
777 if dlg.exec_() == QDialog.Accepted:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
778 templateText = dlg.getTag()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
779 elif tag == "ifchanged":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
780 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
781 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
782 self.tr("Check Variables for Changes"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
783 [self.tr("Enter variables to check (space separated):")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
784 ["variable1 variable2"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
785 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
786 templateText = (
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
787 '{{% ifchanged {0} %}}{1}{{% endifchanged %}}'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
788 .format(data[0], selectedText))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
789 replace = True
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
790 elif tag == "ifequal":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
791 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
792 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
793 self.tr("Check If Equal"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
794 [self.tr("Enter first variable or string to check:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
795 self.tr("Enter second variable or string to check:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
796 ["user.username", '"adrian"'])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
797 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
798 templateText = (
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
799 '{{% ifequal {0} {1} %}}{2}{{% endifequal %}}'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
800 .format(data[0], data[1], selectedText))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
801 replace = True
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
802 elif tag == "ifnotequal":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
803 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
804 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
805 self.tr("Check If Not Equal"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
806 [self.tr("Enter first variable or string to check:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
807 self.tr("Enter second variable or string to check:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
808 ["user.username", '"adrian"'])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
809 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
810 templateText = (
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
811 '{{% ifnotequal {0} {1} %}}{2}{{% endifnotequal %}}'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
812 .format(data[0], data[1], selectedText))
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
813 replace = True
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
814 elif tag == "includevariable":
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
815 data, ok = DjangoTagInputDialog.getText(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
816 None,
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
817 self.tr("Include"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
818 [self.tr("Enter variable name:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
819 ["variable"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
820 if ok:
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
821 templateText = '{{% include {0} %}}'.format(data[0])
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
822 elif tag == "includefile":
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
823 data, ok = DjangoTagInputDialog.getText(
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
824 None,
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
825 self.tr("Include"),
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
826 [self.tr("Enter file name:")],
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
827 ["other.html"])
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
828 if ok:
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
829 templateText = '{{% include "{0}" %}}'.format(data[0])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
830 elif tag == "load":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
831 data, ok = DjangoTagInputDialog.getText(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
832 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
833 self.tr("Load"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
834 [self.tr("Enter template tag set to load:")],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
835 ["foo bar"])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
836 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
837 templateText = '{{% load "{0}" %}}'.format(data[0])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
838 elif tag == "now":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
839 dateformat, ok = QInputDialog.getItem(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
840 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
841 self.tr("Now"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
842 self.tr("Current date time format:"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
843 ["DATETIME_FORMAT", "SHORT_DATETIME_FORMAT",
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
844 "SHORT_DATE_FORMAT", "DATE_FORMAT"],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
845 0, False)
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
846 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
847 templateText = '{{% now "{0}" %}}'.format(dateformat)
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
848 elif tag == "regroup":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
849 data, ok = DjangoTagInputDialog.getText(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
850 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
851 self.tr("Regroup List"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
852 [self.tr("List Variable:"), self.tr("Common Attribute:"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
853 self.tr("Name of resulting list:")],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
854 ["cities", "country", "country_list"])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
855 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
856 templateText = '{{% regroup {0} by {1} as {2} %}}'.format(
6
5f1c0ebbdf5f Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5
diff changeset
857 data[0], data[1], data[2])
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
858 elif tag == "spaceless":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
859 templateText = "{{% spaceless %}} {0} {{% endspaceless %}}".format(
6
5f1c0ebbdf5f Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5
diff changeset
860 selectedText)
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
861 replace = True
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
862 elif tag == "ssi":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
863 data, ok = DjangoTagInputDialog.getText(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
864 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
865 self.tr("SSI"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
866 [self.tr("Full path to template:")],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
867 ["/tmp/ssi_template.html"])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
868 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
869 templateText = '{{% ssi "{0}" parsed %}}'.format(data[0])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
870 elif tag == "ssifile":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
871 ssi = E5FileDialog.getOpenFileName(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
872 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
873 self.tr("SSI"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
874 os.path.expanduser("~"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
875 self.tr("All Files (*)"))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
876 if ssi:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
877 templateText = '{{% ssi "{0}" parsed %}}'.format(ssi)
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
878 elif tag == "templatetag":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
879 templatetag, ok = QInputDialog.getItem(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
880 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
881 self.tr("Template Tag"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
882 self.tr("Argument:"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
883 ["block", "variable", "brace", "comment"],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
884 0, False)
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
885 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
886 templateText = (
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
887 '{{% templatetag open{0} %}} {1} {{% templatetag'
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
888 ' close{0} %}}'.format(templatetag, selectedText))
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
889 replace = True
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
890 elif tag == "url":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
891 data, ok = DjangoTagInputDialog.getText(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
892 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
893 self.tr("URL"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
894 [self.tr("View method name:"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
895 self.tr("Optional arguments (space separated):")],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
896 ["path.to.some_view", "var1 var2"])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
897 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
898 if data[1]:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
899 data[1] = ' ' + data[1]
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
900 templateText = '{{% url "{0}"{1} %}}'.format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
901 data[0], data[1])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
902 elif tag == "urlas":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
903 data, ok = DjangoTagInputDialog.getText(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
904 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
905 self.tr("URL...as"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
906 [self.tr("View method name:"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
907 self.tr("Optional arguments (space separated):"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
908 self.tr("URL name:")],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
909 ["path.to.some_view", "var1 var2", "url_name"])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
910 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
911 if data[1]:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
912 data[1] = ' ' + data[1]
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
913 templateText = '{{% url "{0}"{1} as {2} %}}'.format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
914 data[0], data[1], data[2])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
915 elif tag == "verbatim":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
916 templateText = "{{% verbatim %}} {0} {{% endverbatim %}}".format(
6
5f1c0ebbdf5f Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5
diff changeset
917 selectedText)
5
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
918 replace = True
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
919 elif tag == "widthratio":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
920 data, ok = DjangoTagInputDialog.getText(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
921 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
922 self.tr("Width Ratio"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
923 [self.tr("Variable:"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
924 self.tr("Maximum Value:"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
925 self.tr("Maximum Width:")],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
926 ["variable", "max_value", "max_width"])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
927 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
928 templateText = "{{% widthratio {0} {1} {2} %}}".format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
929 data[0], data[1], data[2])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
930 elif tag == "with":
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
931 data, ok = DjangoTagInputDialog.getText(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
932 None,
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
933 self.tr("Cache Variables"),
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
934 [self.tr("Variables to cache as key=value (space separated):")
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
935 ],
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
936 ["variable1=foo.bar variable2=bar.baz"])
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
937 if ok:
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
938 templateText = '{{% with {0} %}} {1} {{% endwith %}}'.format(
e2b08694e945 Completed template tags(except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
939 data[0], selectedText)
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
940
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
941 ####################################################
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
942 ## Template Filters ##
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
943 ####################################################
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
944
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
945 elif tag == "add":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
946 data, ok = DjangoTagInputDialog.getText(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
947 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
948 self.tr("Add Variable or String"),
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
949 [self.tr("Variables or String to add:")],
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
950 ["variable"])
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
951 if ok:
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
952 templateText = "|add:{0}".format(data[0])
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
953 elif tag == "addslashes":
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
954 templateText = "|addslashes"
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
955 elif tag == "capfirst":
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
956 templateText = "|capfirst"
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
957 elif tag == "center":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
958 width, ok = QInputDialog.getInt(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
959 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
960 self.tr("Center Value"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
961 self.tr("Enter width of the output:"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
962 10, 1, 99, 1)
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
963 if ok:
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
964 templateText = '|center:"{0}"'.format(width)
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
965 elif tag == "cut":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
966 data, ok = DjangoTagInputDialog.getText(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
967 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
968 self.tr("Cut Characters"),
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
969 [self.tr("Characters to cut:")],
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
970 [" "])
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
971 if ok:
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
972 templateText = '|cut:"{0}"'.format(data[0])
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
973 elif tag == "date":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
974 date, ok = QInputDialog.getItem(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
975 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
976 self.tr("Format Date"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
977 self.tr("Enter date format:"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
978 ["DATETIME_FORMAT", "SHORT_DATETIME_FORMAT",
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
979 "SHORT_DATE_FORMAT", "DATE_FORMAT"],
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
980 0, True)
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
981 if ok:
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
982 if date:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
983 templateText = '|date:"{0}"'.format(date)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
984 else:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
985 templateText = '|date'
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
986 elif tag == "default":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
987 data, ok = DjangoTagInputDialog.getText(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
988 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
989 self.tr("Default Value if False"),
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
990 [self.tr("Enter default value if result is False:")],
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
991 ["nothing"])
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
992 if ok:
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
993 templateText = '|default:"{0}"'.format(data[0])
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
994 elif tag == "default_if_none":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
995 data, ok = DjangoTagInputDialog.getText(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
996 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
997 self.tr("Default Value if None"),
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
998 [self.tr("Enter default value if result is None:")],
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
999 ["nothing"])
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1000 if ok:
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1001 templateText = '|default:"{0}"'.format(data[0])
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1002 elif tag == "dictsort":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1003 data, ok = DjangoTagInputDialog.getText(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1004 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1005 self.tr("Sort Dictionaries"),
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1006 [self.tr("Enter key to sort on:")],
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1007 ["key"])
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1008 if ok:
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1009 templateText = '|dictsort:"{0}"'.format(data[0])
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1010 elif tag == "dictsortreversed":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1011 data, ok = DjangoTagInputDialog.getText(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1012 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1013 self.tr("Sort Dictionaries reversed"),
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1014 [self.tr("Enter key to sort on:")],
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1015 ["key"])
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1016 if ok:
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1017 templateText = '|dictsortreversed:"{0}"'.format(data[0])
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1018 elif tag == "divisibleby":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1019 divisor, ok = QInputDialog.getInt(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1020 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1021 self.tr("Check Divisibility"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1022 self.tr("Enter divisor value:"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1023 2, 1, 99, 1)
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1024 if ok:
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1025 templateText = '|divisibleby:"{0}"'.format(divisor)
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1026 elif tag == "escape":
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1027 templateText = '|escape'
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1028 elif tag == "escapejs":
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1029 templateText = '|escapejs'
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1030 elif tag == "filesizeformat":
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1031 templateText = '|filesizeformat'
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1032 elif tag == "first":
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1033 templateText = '|first'
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1034 elif tag == "fix_ampersands":
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1035 templateText = '|fix_ampersands'
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1036 elif tag == "floatformat":
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1037 decimals, ok = QInputDialog.getInt(
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1038 None,
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1039 self.tr("Format Floating Number"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1040 self.tr("Enter number of decimal places:"),
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1041 2, -20, 20, 1)
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1042 if ok:
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1043 templateText = '|floatformat:"{0}"'.format(decimals)
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1044 elif tag == "force_escape":
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1045 templateText = '|force_escape'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1046 elif tag == "get_digit":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1047 digit, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1048 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1049 self.tr("Get Rightmost Digit"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1050 self.tr("Enter index of digit:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1051 1, 1, 99, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1052 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1053 templateText = '|get_digit:"{0}"'.format(digit)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1054 elif tag == "iriencode":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1055 templateText = '|iriencode'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1056 elif tag == "join":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1057 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1058 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1059 self.tr("Join List"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1060 [self.tr("Enter string to join by:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1061 ["//"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1062 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1063 templateText = '|join:"{0}"'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1064 elif tag == "last":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1065 templateText = '|last'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1066 elif tag == "length":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1067 templateText = '|length'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1068 elif tag == "length_is":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1069 length, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1070 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1071 self.tr("Check Length"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1072 self.tr("Enter desired length:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1073 10, 1, 99, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1074 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1075 templateText = '|length_is:"{0}"'.format(length)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1076 elif tag == "linebreaks":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1077 templateText = '|linebreaks'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1078 elif tag == "linebreaksbr":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1079 templateText = '|linebreaksbr'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1080 elif tag == "linenumbers":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1081 templateText = '|linenumbers'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1082 elif tag == "ljust":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1083 width, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1084 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1085 self.tr("Left-align Value"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1086 self.tr("Enter width of the output:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1087 10, 1, 99, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1088 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1089 templateText = '|ljust:"{0}"'.format(width)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1090 elif tag == "lower":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1091 templateText = '|lower'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1092 elif tag == "make_list":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1093 templateText = '|make_list'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1094 elif tag == "phone2numeric":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1095 templateText = '|phone2numeric'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1096 elif tag == "pluralize":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1097 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1098 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1099 self.tr("Plural Suffix"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1100 [self.tr("Enter plural suffix (nothing for default):")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1101 [""])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1102 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1103 if data[0]:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1104 templateText = '|pluralize:"{0}"'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1105 else:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1106 templateText = '|pluralize'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1107 elif tag == "pprint":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1108 templateText = '|pprint'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1109 elif tag == "random":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1110 templateText = '|random'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1111 elif tag == "removetags":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1112 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1113 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1114 self.tr("Remove HTML Tags"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1115 [self.tr("Enter HTML tags to remove (space separated):")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1116 ["b span"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1117 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1118 templateText = '|removetags:"{0}"'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1119 elif tag == "rjust":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1120 width, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1121 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1122 self.tr("Right-align Value"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1123 self.tr("Enter width of the output:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1124 10, 1, 99, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1125 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1126 templateText = '|rjust:"{0}"'.format(width)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1127 elif tag == "safe":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1128 templateText = '|safe'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1129 elif tag == "safeseq":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1130 templateText = '|safeseq'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1131 elif tag == "slice":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1132 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1133 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1134 self.tr("Extract slice of a list"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1135 [self.tr("Enter Python like slice expression:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1136 ["1:5"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1137 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1138 templateText = '|slice:"{0}"'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1139 elif tag == "slugify":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1140 templateText = '|slugify'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1141 elif tag == "stringformat":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1142 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1143 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1144 self.tr("Perform String Formatting"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1145 [self.tr("Enter Python like string format:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1146 [""])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1147 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1148 templateText = '|stringformat:"{0}"'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1149 elif tag == "striptags":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1150 templateText = '|striptags'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1151 elif tag == "time":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1152 time, ok = QInputDialog.getItem(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1153 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1154 self.tr("Format Date"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1155 self.tr("Enter date format:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1156 ["TIME_FORMAT"],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1157 0, True)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1158 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1159 if time:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1160 templateText = '|time:"{0}"'.format(time)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1161 else:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1162 templateText = '|time'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1163 elif tag == "timesince":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1164 data[0], ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1165 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1166 self.tr("Time Since"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1167 [self.tr("Enter variable containing time reference:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1168 ["comment_date"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1169 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1170 if data[0]:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1171 templateText = '|timesince:{0}'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1172 else:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1173 templateText = '|timesince'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1174 elif tag == "timeuntil":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1175 data[0], ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1176 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1177 self.tr("Time Until"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1178 [self.tr("Enter variable containing time reference:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1179 ["from_date"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1180 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1181 if data[0]:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1182 templateText = '|timeuntil:{0}'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1183 else:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1184 templateText = '|timeuntil'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1185 elif tag == "title":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1186 templateText = '|title'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1187 elif tag == "truncatechars":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1188 characters, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1189 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1190 self.tr("Truncate String"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1191 self.tr("Enter number of characters:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1192 10, 1, 99, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1193 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1194 templateText = '|truncatechars:{0}'.format(characters)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1195 elif tag == "truncatewords":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1196 words, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1197 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1198 self.tr("Truncate String"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1199 self.tr("Enter number of words:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1200 10, 1, 99, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1201 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1202 templateText = '|truncatewords:{0}'.format(words)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1203 elif tag == "truncatewords_html":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1204 words, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1205 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1206 self.tr("Truncate String"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1207 self.tr("Enter number of words:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1208 10, 1, 99, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1209 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1210 templateText = '|truncatewords_html:{0}'.format(words)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1211 elif tag == "unordered_list":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1212 templateText = '|unordered_list'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1213 elif tag == "upper":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1214 templateText = '|upper'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1215 elif tag == "urlencode":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1216 templateText = '|urlencode'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1217 elif tag == "urlize":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1218 templateText = '|urlize'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1219 elif tag == "urlizetrunc":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1220 characters, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1221 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1222 self.tr("Convert URLs as clickable links and truncate"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1223 self.tr("Enter number of characters:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1224 10, 1, 199, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1225 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1226 templateText = '|urlizetrunc:{0}'.format(characters)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1227 elif tag == "wordcount":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1228 templateText = '|wordcount'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1229 elif tag == "wordwrap":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1230 characters, ok = QInputDialog.getInt(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1231 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1232 self.tr("Wrap words"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1233 self.tr("Enter number of characters:"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1234 10, 1, 99, 1)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1235 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1236 templateText = '|wordwrap:{0}'.format(characters)
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1237 elif tag == "yesno":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1238 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1239 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1240 self.tr("Map True, False and None"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1241 [self.tr("Enter mapping (comma separated):")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1242 ["yeah,no,maybe"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1243 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1244 if data[0]:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1245 templateText = '|yesno:"{0}"'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1246 else:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1247 templateText = '|yesno'
7
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1248
8d928ad07c0a Implemented template filters 'a' to 'f'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
1249 ####################################################
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1250 ## Humanize Template Tags ##
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1251 ####################################################
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1252
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1253 elif tag == "loadhumanize":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1254 templateText = '{% load humanize %}'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1255 elif tag == "apnumber":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1256 templateText = '|apnumber'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1257 elif tag == "intcomma":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1258 templateText = '|intcomma'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1259 elif tag == "intword":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1260 templateText = '|intword'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1261 elif tag == "naturalday":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1262 templateText = '|naturalday'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1263 elif tag == "naturaltime":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1264 templateText = '|naturaltime'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1265 elif tag == "ordinal":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1266 templateText = '|ordinal'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1267
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1268 ####################################################
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1269 ## Web Design Template Tags ##
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1270 ####################################################
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1271
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1272 elif tag == "loadweb":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1273 templateText = '{% load webdesign %}'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1274 elif tag == "lorem":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1275 from .LoremTagInputDialog import LoremTagInputDialog
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1276 dlg = LoremTagInputDialog()
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1277 if dlg.exec_() == QDialog.Accepted:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1278 templateText = "{{% {0} %}}".format(dlg.getTag())
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1279
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1280 ####################################################
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1281 ## Static Template Tags ##
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1282 ####################################################
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1283
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1284 elif tag == "loadstatic":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1285 templateText = '{% load static %}'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1286 elif tag == "staticfile":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1287 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1288 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1289 self.tr("Link to static file"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1290 [self.tr("Enter relative path of static file:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1291 ["images/hi.jpg"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1292 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1293 templateText = '{{% static "{0}" %}}'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1294 elif tag == "staticvariable":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1295 data, ok = DjangoTagInputDialog.getText(
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1296 None,
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1297 self.tr("Link to static file"),
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1298 [self.tr("Enter variable containing relative path of"
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1299 " static file:")],
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1300 ["user_stylesheet"])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1301 if ok:
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1302 templateText = '{{% static {0} %}}'.format(data[0])
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1303 elif tag == "get_static_prefix":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1304 templateText = '{% get_static_prefix %}'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1305 elif tag == "get_media_prefix":
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1306 templateText = '{% get_media_prefix %}'
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1307
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1308 ####################################################
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1309 ## Comments ##
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1310 ####################################################
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1311
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1312 elif tag == "singlelinecommentselect":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1313 templateText = '{{# {0} #}}'.format(selectedText)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1314 replace = True
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1315 elif tag == "multilinecommentselect":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1316 templateText = '{{% comment %}} {0} {{% endcomment }}'.format(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1317 selectedText)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1318 replace = True
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1319 elif tag == "singlelinecommentdialog":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1320 data, ok = DjangoTagInputDialog.getText(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1321 None,
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1322 self.tr("Single Line Comment"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1323 [self.tr("Enter comment:")],
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1324 [""])
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1325 if ok:
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1326 templateText = '{{# {0} #}}'.format(data[0])
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1327 elif tag == "multilinecommentdialog":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1328 from .MultiLineInputDialog import MultiLineInputDialog
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1329 comment, ok = MultiLineInputDialog.getText(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1330 None, self.tr("Multi Line Comment"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1331 self.tr("Enter comment:"), "")
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1332 if ok:
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1333 templateText = '{{% comment %}} {0} {{% endcomment }}'.format(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1334 comment)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1335 elif tag == "singlelinecommentclipboard":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1336 templateText = '{{# {0} #}}'.format(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1337 QApplication.clipboard().text().strip())
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1338 elif tag == "multilinecommentclipboard":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1339 templateText = '{{% comment %}} {0} {{% endcomment }}'.format(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1340 QApplication.clipboard().text().strip())
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1341 elif tag == "multilinecommentfile":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1342 filename = E5FileDialog.getOpenFileName(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1343 None,
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1344 self.tr("Comment File"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1345 Utilities.getHomeDir(),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1346 self.tr("All Files (*)"))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1347 if filename:
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1348 try:
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1349 f = open(filename, "r", encoding="utf-8")
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1350 comment = f.read()
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1351 f.close()
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1352 templateText = (
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1353 '{{% comment %}} {0} {{% endcomment }}'.format(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1354 comment))
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1355 except (IOError, OSError) as err:
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1356 E5MessageBox.critical(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1357 None,
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1358 self.tr("Comment File"),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1359 self.tr("""<p>The file <b>{0}</b> could not be"""
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1360 """ read.</p><p>Reason: {1}</p>""").format(
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1361 str(err)))
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1362 elif tag == "singlelinecommentdatetime":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1363 templateText = '{{# {0} by {1} #}}'.format(
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1364 datetime.datetime.now().isoformat().split(),
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1365 Utilities.getUserName())
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1366 elif tag == "htmlcomment":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1367 templateText = '<!-- {0} -->'.format(selectedText)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1368 replace = True
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1369 elif tag == "iecomment":
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1370 from .IeCommentDialog import IeCommentDialog
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1371 tag, ok = IeCommentDialog.getTag(selectedText)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1372 if ok:
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1373 templateText = '<!--{0}-->'.format(tag)
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1374 replace = True
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1375
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1376 ####################################################
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1377 ## Internationalization ##
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1378 ####################################################
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1379
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1380 elif tag == "loadi18n":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1381 templateText = '{% load i18n %}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1382 ## Tags ##
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1383 elif tag == "trans":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1384 if ' ' in selectedText:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1385 selectedText = '"{0}"'.format(selectedText)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1386 templateText = '{{% trans {0} %}}'.format(selectedText)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1387 replace = True
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1388 elif tag == "trans..as":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1389 data, ok = DjangoTagInputDialog.getText(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1390 None,
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1391 self.tr("Translate String into Variable"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1392 [self.tr("Enter variable receiving translation:")],
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1393 ["translation"])
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1394 if ok:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1395 templateText = '{{% trans "{0}" as {1} %}}'.format(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1396 selectedText, data[0])
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1397 replace = True
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1398 elif tag == "blocktrans":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1399 templateText = '{{% blocktrans %}}{0}{{% endblocktrans %}}'.format(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1400 selectedText)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1401 replace = True
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1402 elif tag == "blocktrans..with":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1403 data, ok = DjangoTagInputDialog.getText(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1404 None,
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1405 self.tr("Translate Block with Attributes"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1406 [self.tr("Enter attribute binding expressions"
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1407 " (space separated):")],
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1408 ["myvar1=value1 myvar2=value2"])
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1409 if ok:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1410 templateText = (
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1411 '{{% blocktrans with {0} %}}{1}{{% endblocktrans %}}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1412 .format(data[0], selectedText))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1413 replace = True
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1414 elif tag == "plural":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1415 templateText = '{{% plural %}} {0}'.format(selectedText)
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1416 replace = True
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1417 elif tag == "language":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1418 data, ok = DjangoTagInputDialog.getText(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1419 None,
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1420 self.tr("Switch language"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1421 [self.tr("Enter language:")],
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1422 ["en"])
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1423 if ok:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1424 templateText = (
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1425 "{{% language '{0}' %}}{1}{{% endlanguage %}}"
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1426 .format(data[0], selectedText))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1427 replace = True
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1428 elif tag == "get_current_language":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1429 templateText = '{% get_current_language as LANGUAGE_CODE %}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1430 elif tag == "get_available_languages":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1431 templateText = '{% get_available_languages as LANGUAGES %}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1432 elif tag == "get_current_language_bidi":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1433 templateText = '{% get_current_language_bidi as LANGUAGE_BIDI %}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1434 elif tag == "get_language_info":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1435 data, ok = DjangoTagInputDialog.getText(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1436 None,
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1437 self.tr("Language Information"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1438 [self.tr("Enter language string or variable (empty for"
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1439 " LANGUAGE_CODE):")],
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1440 ['"en"'])
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1441 if ok:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1442 if data[0]:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1443 templateText = (
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1444 '{{% get_language_info for "{0}" as lang %}}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1445 .format(data[0]))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1446 else:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1447 templateText = ("{% get_language_info for LANGUAGE_CODE"
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1448 " as lang %}")
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1449 elif tag == "get_language_info_list":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1450 data, ok = DjangoTagInputDialog.getText(
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1451 None,
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1452 self.tr("Language Information for a list of languages"),
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1453 [self.tr("Enter language list variable (empty for"
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1454 " LANGUAGES):")],
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1455 ["available_languages"])
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1456 if ok:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1457 if data[0]:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1458 templateText = (
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1459 '{{% get_language_info_list for {0} as langs %}}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1460 .format(data[0]))
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1461 else:
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1462 templateText = ("{% get_language_info_list for LANGUAGES"
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1463 " as langs %}")
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1464 ## Filters ##
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1465 elif tag == "language_name":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1466 templateText = '|language_name'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1467 elif tag == "language_name_local":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1468 templateText = '|language_name_local'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1469 elif tag == "bidi":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1470 templateText = '|bidi'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1471
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1472 # TODO: add localization tags/filters
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1473 ####################################################
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1474 ## Localization ##
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1475 ####################################################
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1476
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1477 elif tag == "loadl10n":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1478 templateText = '{% load l10n %}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1479
9
1b11bf54b3b2 Implemented the comments menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
1480 # TODO: add timezone tags/filters
8
7e8f788fe340 Finished the filter tags and implemented the 'humanize', 'web design' and 'static' tags and the various 'if' tags.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
1481 ####################################################
10
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1482 ## Timezone ##
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1483 ####################################################
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1484
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1485 elif tag == "loadtz":
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1486 templateText = '{% load tz %}'
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1487
ef5694c0bf3a Implemented the 'internatinalization' menu and some Python2 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
1488 ####################################################
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
1489 ## Fallback: return just the tag name ##
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
1490 ####################################################
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
1491
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
1492 else:
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
1493 templateText = tag
4
ba04ed0b14a1 Implemented template tags 'f' to 'i' (except 'if').
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
1494
3
6d10c1249cb8 Implemented template tags 'a' to 'e'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
1495 return templateText, replace

eric ide

mercurial