Only one line and add background color for empty strings
offlate/window.py
40 | 40 | self.showUntranslated = showUntranslated | |
41 | 41 | self.showFuzzy = showFuzzy | |
42 | 42 | self.monospace = monospace | |
43 | + | self.fuzzyColor = QBrush(QColor(255, 127, 80)) | |
44 | + | self.emptyColor = QBrush(QColor(255, 240, 235)) | |
43 | 45 | self.initUI() | |
44 | 46 | ||
45 | 47 | def updateContent(self): | |
… | |||
60 | 62 | item = QTreeWidgetItem([entry.msgids[0].replace('\n', ' '), | |
61 | 63 | entry.msgstrs[0].replace('\n', ' ')]) | |
62 | 64 | if entry.isFuzzy(): | |
63 | - | item.setForeground(1, QBrush(QColor(255, 127, 80))) | |
65 | + | item.setForeground(1, self.fuzzyColor) | |
66 | + | if not entry.isTranslated(): | |
67 | + | item.setBackground(1, self.emptyColor) | |
64 | 68 | item.setFont(0, QFont("sans-serif", 10)) | |
65 | 69 | item.setFont(1, QFont("sans-serif", 10)) | |
66 | 70 | item.setSizeHint(0, QSize(-1, 22)) | |
… | |||
154 | 158 | if self.msgstr.__class__.__name__ == "SpellCheckEdit": | |
155 | 159 | msgstr = self.msgstr.toPlainText() | |
156 | 160 | data.update(0, msgstr) | |
157 | - | item.setText(1, msgstr) | |
161 | + | item.setText(1, msgstr.replace('\n', ' ')) | |
158 | 162 | else: | |
159 | 163 | i = 0 | |
160 | 164 | for msgstr in data.msgstrs: | |
161 | 165 | data.update(i, self.msgstr.widget(i).toPlainText()) | |
162 | 166 | i=i+1 | |
163 | - | item.setText(1, data.get(0)) | |
167 | + | item.setText(1, data.get(0).replace('\n', ' ')) | |
164 | 168 | item.setForeground(1, QBrush()) | |
169 | + | if data.isTranslated(): | |
170 | + | item.setBackground(1, QBrush()) | |
171 | + | else: | |
172 | + | item.setBackground(1, self.emptyColor) | |
165 | 173 | ||
166 | 174 | def save(self): | |
167 | 175 | self.project.save() |