Merge lp:~googol-deactivatedaccount/openlp/bug-787552 into lp:openlp

Proposed by Andreas Preikschat
Status: Merged
Approved by: Jonathan Corwin
Approved revision: 1576
Merged at revision: 1577
Proposed branch: lp:~googol-deactivatedaccount/openlp/bug-787552
Merge into: lp:openlp
Diff against target: 238 lines (+80/-80)
4 files modified
openlp/core/lib/__init__.py (+0/-52)
openlp/core/lib/displaytags.py (+70/-8)
openlp/core/ui/displaytagdialog.py (+0/-5)
openlp/core/ui/displaytagform.py (+10/-15)
To merge this branch: bzr merge lp:~googol-deactivatedaccount/openlp/bug-787552
Reviewer Review Type Date Requested Status
Jonathan Corwin (community) Approve
Tim Bentley Approve
Review via email: mp+62531@code.launchpad.net

This proposal supersedes a proposal from 2011-05-26.

Description of the change

Hello,

- Removed 'Default' button
- Translate the tag description (bug #787552).

Before: http://imageshack.us/m/402/7879/untranslated.png
After: http://imageshack.us/m/835/4747/afterwards.png

To archieve this I moved the "base_html_expands" out of core/lib/__init__ to the static method "reset_html_tags". When we prepare the display tags the app translator will be able to translate the strings (which he wouldn't if we had left "base_html_expands" as constant in core/lib/__init__.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

DisplayTags.resset_html_tags looks like it is broken.
Cannot test but it has not been updated.
Try pressing the "Default" button on the Display Tags UI. It should remove all your changes.

review: Needs Information
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote : Posted in a previous version of this proposal

> DisplayTags.resset_html_tags looks like it is broken.
> Cannot test but it has not been updated.
> Try pressing the "Default" button on the Display Tags UI. It should remove
> all your changes.
It behaves like trunk. But trunk's behaviour is strange.

Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

At work but can we discuss later today when I am at home

Revision history for this message
Tim Bentley (trb143) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Jonathan Corwin (j-corwin) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve
Revision history for this message
Jonathan Corwin (j-corwin) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/lib/__init__.py'
2--- openlp/core/lib/__init__.py 2011-05-26 17:11:22 +0000
3+++ openlp/core/lib/__init__.py 2011-05-26 18:12:33 +0000
4@@ -36,58 +36,6 @@
5
6 log = logging.getLogger(__name__)
7
8-base_html_expands = []
9-
10-# Hex Color tags from http://www.w3schools.com/html/html_colornames.asp
11-base_html_expands.append({u'desc': u'Red', u'start tag': u'{r}',
12- u'start html': u'<span style="-webkit-text-fill-color:red">',
13- u'end tag': u'{/r}', u'end html': u'</span>', u'protected': True})
14-base_html_expands.append({u'desc': u'Black', u'start tag': u'{b}',
15- u'start html': u'<span style="-webkit-text-fill-color:black">',
16- u'end tag': u'{/b}', u'end html': u'</span>', u'protected': True})
17-base_html_expands.append({u'desc': u'Blue', u'start tag': u'{bl}',
18- u'start html': u'<span style="-webkit-text-fill-color:blue">',
19- u'end tag': u'{/bl}', u'end html': u'</span>', u'protected': True})
20-base_html_expands.append({u'desc': u'Yellow', u'start tag': u'{y}',
21- u'start html': u'<span style="-webkit-text-fill-color:yellow">',
22- u'end tag': u'{/y}', u'end html': u'</span>', u'protected': True})
23-base_html_expands.append({u'desc': u'Green', u'start tag': u'{g}',
24- u'start html': u'<span style="-webkit-text-fill-color:green">',
25- u'end tag': u'{/g}', u'end html': u'</span>', u'protected': True})
26-base_html_expands.append({u'desc': u'Pink', u'start tag': u'{pk}',
27- u'start html': u'<span style="-webkit-text-fill-color:#FFC0CB">',
28- u'end tag': u'{/pk}', u'end html': u'</span>', u'protected': True})
29-base_html_expands.append({u'desc': u'Orange', u'start tag': u'{o}',
30- u'start html': u'<span style="-webkit-text-fill-color:#FFA500">',
31- u'end tag': u'{/o}', u'end html': u'</span>', u'protected': True})
32-base_html_expands.append({u'desc': u'Purple', u'start tag': u'{pp}',
33- u'start html': u'<span style="-webkit-text-fill-color:#800080">',
34- u'end tag': u'{/pp}', u'end html': u'</span>', u'protected': True})
35-base_html_expands.append({u'desc': u'White', u'start tag': u'{w}',
36- u'start html': u'<span style="-webkit-text-fill-color:white">',
37- u'end tag': u'{/w}', u'end html': u'</span>', u'protected': True})
38-base_html_expands.append({u'desc': u'Superscript', u'start tag': u'{su}',
39- u'start html': u'<sup>', u'end tag': u'{/su}', u'end html': u'</sup>',
40- u'protected': True})
41-base_html_expands.append({u'desc': u'Subscript', u'start tag': u'{sb}',
42- u'start html': u'<sub>', u'end tag': u'{/sb}', u'end html': u'</sub>',
43- u'protected': True})
44-base_html_expands.append({u'desc': u'Paragraph', u'start tag': u'{p}',
45- u'start html': u'<p>', u'end tag': u'{/p}', u'end html': u'</p>',
46- u'protected': True})
47-base_html_expands.append({u'desc': u'Bold', u'start tag': u'{st}',
48- u'start html': u'<strong>', u'end tag': u'{/st}', u'end html': u'</strong>',
49- u'protected': True})
50-base_html_expands.append({u'desc': u'Italics', u'start tag': u'{it}',
51- u'start html': u'<em>', u'end tag': u'{/it}', u'end html': u'</em>',
52- u'protected': True})
53-base_html_expands.append({u'desc': u'Underline', u'start tag': u'{u}',
54- u'start html': u'<span style="text-decoration: underline;">',
55- u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True})
56-base_html_expands.append({u'desc': u'Break', u'start tag': u'{br}',
57- u'start html': u'<br>', u'end tag': u'', u'end html': u'',
58- u'protected': True})
59-
60 def translate(context, text, comment=None,
61 encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
62 translate=QtCore.QCoreApplication.translate):
63
64=== modified file 'openlp/core/lib/displaytags.py'
65--- openlp/core/lib/displaytags.py 2011-05-26 17:11:22 +0000
66+++ openlp/core/lib/displaytags.py 2011-05-26 18:12:33 +0000
67@@ -28,7 +28,7 @@
68 Provide Html Tag management and Display Tag access class
69 """
70
71-from openlp.core.lib import base_html_expands
72+from openlp.core.lib import translate
73
74 class DisplayTags(object):
75 """
76@@ -50,15 +50,77 @@
77 Resets the html_expands list.
78 """
79 DisplayTags.html_expands = []
80- for html in base_html_expands:
81- DisplayTags.html_expands.append(html)
82+ base_tags = []
83+ # Append the base tags.
84+ # Hex Color tags from http://www.w3schools.com/html/html_colornames.asp
85+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Red'),
86+ u'start tag': u'{r}',
87+ u'start html': u'<span style="-webkit-text-fill-color:red">',
88+ u'end tag': u'{/r}', u'end html': u'</span>', u'protected': True})
89+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Black'),
90+ u'start tag': u'{b}',
91+ u'start html': u'<span style="-webkit-text-fill-color:black">',
92+ u'end tag': u'{/b}', u'end html': u'</span>', u'protected': True})
93+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Blue'),
94+ u'start tag': u'{bl}',
95+ u'start html': u'<span style="-webkit-text-fill-color:blue">',
96+ u'end tag': u'{/bl}', u'end html': u'</span>', u'protected': True})
97+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Yellow'),
98+ u'start tag': u'{y}',
99+ u'start html': u'<span style="-webkit-text-fill-color:yellow">',
100+ u'end tag': u'{/y}', u'end html': u'</span>', u'protected': True})
101+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Green'),
102+ u'start tag': u'{g}',
103+ u'start html': u'<span style="-webkit-text-fill-color:green">',
104+ u'end tag': u'{/g}', u'end html': u'</span>', u'protected': True})
105+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Pink'),
106+ u'start tag': u'{pk}',
107+ u'start html': u'<span style="-webkit-text-fill-color:#FFC0CB">',
108+ u'end tag': u'{/pk}', u'end html': u'</span>', u'protected': True})
109+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Orange'),
110+ u'start tag': u'{o}',
111+ u'start html': u'<span style="-webkit-text-fill-color:#FFA500">',
112+ u'end tag': u'{/o}', u'end html': u'</span>', u'protected': True})
113+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Purple'),
114+ u'start tag': u'{pp}',
115+ u'start html': u'<span style="-webkit-text-fill-color:#800080">',
116+ u'end tag': u'{/pp}', u'end html': u'</span>', u'protected': True})
117+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'White'),
118+ u'start tag': u'{w}',
119+ u'start html': u'<span style="-webkit-text-fill-color:white">',
120+ u'end tag': u'{/w}', u'end html': u'</span>', u'protected': True})
121+ base_tags.append({
122+ u'desc': translate('OpenLP.DisplayTags', 'Superscript'),
123+ u'start tag': u'{su}', u'start html': u'<sup>',
124+ u'end tag': u'{/su}', u'end html': u'</sup>', u'protected': True})
125+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Subscript'),
126+ u'start tag': u'{sb}', u'start html': u'<sub>',
127+ u'end tag': u'{/sb}', u'end html': u'</sub>', u'protected': True})
128+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Paragraph'),
129+ u'start tag': u'{p}', u'start html': u'<p>', u'end tag': u'{/p}',
130+ u'end html': u'</p>', u'protected': True})
131+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Bold'),
132+ u'start tag': u'{st}', u'start html': u'<strong>',
133+ u'end tag': u'{/st}', u'end html': u'</strong>',
134+ u'protected': True})
135+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Italics'),
136+ u'start tag': u'{it}', u'start html': u'<em>', u'end tag': u'{/it}',
137+ u'end html': u'</em>', u'protected': True})
138+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Underline'),
139+ u'start tag': u'{u}',
140+ u'start html': u'<span style="text-decoration: underline;">',
141+ u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True})
142+ base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Break'),
143+ u'start tag': u'{br}', u'start html': u'<br>', u'end tag': u'',
144+ u'end html': u'', u'protected': True})
145+ DisplayTags.add_html_tags(base_tags)
146
147 @staticmethod
148- def add_html_tag(tag):
149- """
150- Add a new tag to the list
151- """
152- DisplayTags.html_expands.append(tag)
153+ def add_html_tags(tags):
154+ """
155+ Add a list of tags to the list
156+ """
157+ DisplayTags.html_expands.extend(tags)
158
159 @staticmethod
160 def remove_html_tag(tag_id):
161
162=== modified file 'openlp/core/ui/displaytagdialog.py'
163--- openlp/core/ui/displaytagdialog.py 2011-05-26 17:11:22 +0000
164+++ openlp/core/ui/displaytagdialog.py 2011-05-26 18:12:33 +0000
165@@ -69,9 +69,6 @@
166 spacerItem = QtGui.QSpacerItem(40, 20,
167 QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
168 self.horizontalLayout.addItem(spacerItem)
169- self.defaultPushButton = QtGui.QPushButton(self.widget)
170- self.defaultPushButton.setObjectName(u'defaultPushButton')
171- self.horizontalLayout.addWidget(self.defaultPushButton)
172 self.deletePushButton = QtGui.QPushButton(self.widget)
173 self.deletePushButton.setObjectName(u'deletePushButton')
174 self.horizontalLayout.addWidget(self.deletePushButton)
175@@ -141,8 +138,6 @@
176 self.endTagLabel.setText(
177 translate('OpenLP.DisplayTagDialog', 'End tag'))
178 self.deletePushButton.setText(UiStrings().Delete)
179- self.defaultPushButton.setText(
180- translate('OpenLP.DisplayTagDialog', 'Default'))
181 self.newPushButton.setText(UiStrings().New)
182 self.tagTableWidget.horizontalHeaderItem(0).setText(
183 translate('OpenLP.DisplayTagDialog', 'Description'))
184
185=== modified file 'openlp/core/ui/displaytagform.py'
186--- openlp/core/ui/displaytagform.py 2011-05-26 17:11:22 +0000
187+++ openlp/core/ui/displaytagform.py 2011-05-26 18:12:33 +0000
188@@ -51,8 +51,6 @@
189 self._loadDisplayTags()
190 QtCore.QObject.connect(self.tagTableWidget,
191 QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected)
192- QtCore.QObject.connect(self.defaultPushButton,
193- QtCore.SIGNAL(u'pressed()'), self.onDefaultPushed)
194 QtCore.QObject.connect(self.newPushButton,
195 QtCore.SIGNAL(u'pressed()'), self.onNewPushed)
196 QtCore.QObject.connect(self.savePushButton,
197@@ -87,8 +85,7 @@
198 if user_expands_string:
199 user_tags = cPickle.loads(user_expands_string)
200 # If we have some user ones added them as well
201- for t in user_tags:
202- DisplayTags.add_html_tag(t)
203+ DisplayTags.add_html_tags(user_tags)
204
205 def onRowSelected(self):
206 """
207@@ -128,22 +125,20 @@
208 'Tag "n" already defined.'))
209 return
210 # Add new tag to list
211- tag = {u'desc': u'New Item', u'start tag': u'{n}',
212- u'start html': u'<Html_here>', u'end tag': u'{/n}',
213- u'end html': u'</and here>', u'protected': False}
214- DisplayTags.add_html_tag(tag)
215+ tag = {
216+ u'desc': translate('OpenLP.DisplayTagTab', 'New Tag'),
217+ u'start tag': u'{n}',
218+ u'start html': translate('OpenLP.DisplayTagTab', '<Html_here>'),
219+ u'end tag': u'{/n}',
220+ u'end html': translate('OpenLP.DisplayTagTab', '</and here>'),
221+ u'protected': False
222+ }
223+ DisplayTags.add_html_tags([tag])
224 self._resetTable()
225 # Highlight new row
226 self.tagTableWidget.selectRow(self.tagTableWidget.rowCount() - 1)
227 self.onRowSelected()
228
229- def onDefaultPushed(self):
230- """
231- Remove all Custom Tags and reset to base set only.
232- """
233- DisplayTags.reset_html_tags()
234- self._resetTable()
235-
236 def onDeletePushed(self):
237 """
238 Delete selected custom tag.