IconEditor/IconEditorWindow.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3201
0f115f6db6cb
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
118 def __initFileFilters(self): 118 def __initFileFilters(self):
119 """ 119 """
120 Private method to define the supported image file filters. 120 Private method to define the supported image file filters.
121 """ 121 """
122 filters = { 122 filters = {
123 'bmp': self.trUtf8("Windows Bitmap File (*.bmp)"), 123 'bmp': self.tr("Windows Bitmap File (*.bmp)"),
124 'gif': self.trUtf8("Graphic Interchange Format File (*.gif)"), 124 'gif': self.tr("Graphic Interchange Format File (*.gif)"),
125 'ico': self.trUtf8("Windows Icon File (*.ico)"), 125 'ico': self.tr("Windows Icon File (*.ico)"),
126 'jpg': self.trUtf8("JPEG File (*.jpg)"), 126 'jpg': self.tr("JPEG File (*.jpg)"),
127 'jpeg': self.trUtf8("JPEG File (*.jpeg)"), 127 'jpeg': self.tr("JPEG File (*.jpeg)"),
128 'mng': self.trUtf8("Multiple-Image Network Graphics File (*.mng)"), 128 'mng': self.tr("Multiple-Image Network Graphics File (*.mng)"),
129 'pbm': self.trUtf8("Portable Bitmap File (*.pbm)"), 129 'pbm': self.tr("Portable Bitmap File (*.pbm)"),
130 'pcx': self.trUtf8("Paintbrush Bitmap File (*.pcx)"), 130 'pcx': self.tr("Paintbrush Bitmap File (*.pcx)"),
131 'pgm': self.trUtf8("Portable Graymap File (*.pgm)"), 131 'pgm': self.tr("Portable Graymap File (*.pgm)"),
132 'png': self.trUtf8("Portable Network Graphics File (*.png)"), 132 'png': self.tr("Portable Network Graphics File (*.png)"),
133 'ppm': self.trUtf8("Portable Pixmap File (*.ppm)"), 133 'ppm': self.tr("Portable Pixmap File (*.ppm)"),
134 'sgi': self.trUtf8("Silicon Graphics Image File (*.sgi)"), 134 'sgi': self.tr("Silicon Graphics Image File (*.sgi)"),
135 'svg': self.trUtf8("Scalable Vector Graphics File (*.svg)"), 135 'svg': self.tr("Scalable Vector Graphics File (*.svg)"),
136 'svgz': self.trUtf8("Compressed Scalable Vector Graphics File" 136 'svgz': self.tr("Compressed Scalable Vector Graphics File"
137 " (*.svgz)"), 137 " (*.svgz)"),
138 'tga': self.trUtf8("Targa Graphic File (*.tga)"), 138 'tga': self.tr("Targa Graphic File (*.tga)"),
139 'tif': self.trUtf8("TIFF File (*.tif)"), 139 'tif': self.tr("TIFF File (*.tif)"),
140 'tiff': self.trUtf8("TIFF File (*.tiff)"), 140 'tiff': self.tr("TIFF File (*.tiff)"),
141 'wbmp': self.trUtf8("WAP Bitmap File (*.wbmp)"), 141 'wbmp': self.tr("WAP Bitmap File (*.wbmp)"),
142 'xbm': self.trUtf8("X11 Bitmap File (*.xbm)"), 142 'xbm': self.tr("X11 Bitmap File (*.xbm)"),
143 'xpm': self.trUtf8("X11 Pixmap File (*.xpm)"), 143 'xpm': self.tr("X11 Pixmap File (*.xpm)"),
144 } 144 }
145 145
146 inputFormats = [] 146 inputFormats = []
147 readFormats = QImageReader.supportedImageFormats() 147 readFormats = QImageReader.supportedImageFormats()
148 for readFormat in readFormats: 148 for readFormat in readFormats:
149 try: 149 try:
150 inputFormats.append(filters[bytes(readFormat).decode()]) 150 inputFormats.append(filters[bytes(readFormat).decode()])
151 except KeyError: 151 except KeyError:
152 pass 152 pass
153 inputFormats.sort() 153 inputFormats.sort()
154 inputFormats.append(self.trUtf8("All Files (*)")) 154 inputFormats.append(self.tr("All Files (*)"))
155 self.__inputFilter = ';;'.join(inputFormats) 155 self.__inputFilter = ';;'.join(inputFormats)
156 156
157 outputFormats = [] 157 outputFormats = []
158 writeFormats = QImageWriter.supportedImageFormats() 158 writeFormats = QImageWriter.supportedImageFormats()
159 for writeFormat in writeFormats: 159 for writeFormat in writeFormats:
182 def __initFileActions(self): 182 def __initFileActions(self):
183 """ 183 """
184 Private method to define the file related user interface actions. 184 Private method to define the file related user interface actions.
185 """ 185 """
186 self.newAct = E5Action( 186 self.newAct = E5Action(
187 self.trUtf8('New'), 187 self.tr('New'),
188 UI.PixmapCache.getIcon("new.png"), 188 UI.PixmapCache.getIcon("new.png"),
189 self.trUtf8('&New'), 189 self.tr('&New'),
190 QKeySequence(self.trUtf8("Ctrl+N", "File|New")), 190 QKeySequence(self.tr("Ctrl+N", "File|New")),
191 0, self, 'iconEditor_file_new') 191 0, self, 'iconEditor_file_new')
192 self.newAct.setStatusTip(self.trUtf8('Create a new icon')) 192 self.newAct.setStatusTip(self.tr('Create a new icon'))
193 self.newAct.setWhatsThis(self.trUtf8( 193 self.newAct.setWhatsThis(self.tr(
194 """<b>New</b>""" 194 """<b>New</b>"""
195 """<p>This creates a new icon.</p>""" 195 """<p>This creates a new icon.</p>"""
196 )) 196 ))
197 self.newAct.triggered[()].connect(self.__newIcon) 197 self.newAct.triggered[()].connect(self.__newIcon)
198 self.__actions.append(self.newAct) 198 self.__actions.append(self.newAct)
199 199
200 self.newWindowAct = E5Action( 200 self.newWindowAct = E5Action(
201 self.trUtf8('New Window'), 201 self.tr('New Window'),
202 UI.PixmapCache.getIcon("newWindow.png"), 202 UI.PixmapCache.getIcon("newWindow.png"),
203 self.trUtf8('New &Window'), 203 self.tr('New &Window'),
204 0, 0, self, 'iconEditor_file_new_window') 204 0, 0, self, 'iconEditor_file_new_window')
205 self.newWindowAct.setStatusTip(self.trUtf8( 205 self.newWindowAct.setStatusTip(self.tr(
206 'Open a new icon editor window')) 206 'Open a new icon editor window'))
207 self.newWindowAct.setWhatsThis(self.trUtf8( 207 self.newWindowAct.setWhatsThis(self.tr(
208 """<b>New Window</b>""" 208 """<b>New Window</b>"""
209 """<p>This opens a new icon editor window.</p>""" 209 """<p>This opens a new icon editor window.</p>"""
210 )) 210 ))
211 self.newWindowAct.triggered[()].connect(self.__newWindow) 211 self.newWindowAct.triggered[()].connect(self.__newWindow)
212 self.__actions.append(self.newWindowAct) 212 self.__actions.append(self.newWindowAct)
213 213
214 self.openAct = E5Action( 214 self.openAct = E5Action(
215 self.trUtf8('Open'), 215 self.tr('Open'),
216 UI.PixmapCache.getIcon("open.png"), 216 UI.PixmapCache.getIcon("open.png"),
217 self.trUtf8('&Open...'), 217 self.tr('&Open...'),
218 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")), 218 QKeySequence(self.tr("Ctrl+O", "File|Open")),
219 0, self, 'iconEditor_file_open') 219 0, self, 'iconEditor_file_open')
220 self.openAct.setStatusTip(self.trUtf8('Open an icon file for editing')) 220 self.openAct.setStatusTip(self.tr('Open an icon file for editing'))
221 self.openAct.setWhatsThis(self.trUtf8( 221 self.openAct.setWhatsThis(self.tr(
222 """<b>Open File</b>""" 222 """<b>Open File</b>"""
223 """<p>This opens a new icon file for editing.""" 223 """<p>This opens a new icon file for editing."""
224 """ It pops up a file selection dialog.</p>""" 224 """ It pops up a file selection dialog.</p>"""
225 )) 225 ))
226 self.openAct.triggered[()].connect(self.__openIcon) 226 self.openAct.triggered[()].connect(self.__openIcon)
227 self.__actions.append(self.openAct) 227 self.__actions.append(self.openAct)
228 228
229 self.saveAct = E5Action( 229 self.saveAct = E5Action(
230 self.trUtf8('Save'), 230 self.tr('Save'),
231 UI.PixmapCache.getIcon("fileSave.png"), 231 UI.PixmapCache.getIcon("fileSave.png"),
232 self.trUtf8('&Save'), 232 self.tr('&Save'),
233 QKeySequence(self.trUtf8("Ctrl+S", "File|Save")), 233 QKeySequence(self.tr("Ctrl+S", "File|Save")),
234 0, self, 'iconEditor_file_save') 234 0, self, 'iconEditor_file_save')
235 self.saveAct.setStatusTip(self.trUtf8('Save the current icon')) 235 self.saveAct.setStatusTip(self.tr('Save the current icon'))
236 self.saveAct.setWhatsThis(self.trUtf8( 236 self.saveAct.setWhatsThis(self.tr(
237 """<b>Save File</b>""" 237 """<b>Save File</b>"""
238 """<p>Save the contents of the icon editor window.</p>""" 238 """<p>Save the contents of the icon editor window.</p>"""
239 )) 239 ))
240 self.saveAct.triggered[()].connect(self.__saveIcon) 240 self.saveAct.triggered[()].connect(self.__saveIcon)
241 self.__actions.append(self.saveAct) 241 self.__actions.append(self.saveAct)
242 242
243 self.saveAsAct = E5Action( 243 self.saveAsAct = E5Action(
244 self.trUtf8('Save As'), 244 self.tr('Save As'),
245 UI.PixmapCache.getIcon("fileSaveAs.png"), 245 UI.PixmapCache.getIcon("fileSaveAs.png"),
246 self.trUtf8('Save &As...'), 246 self.tr('Save &As...'),
247 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), 247 QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")),
248 0, self, 'iconEditor_file_save_as') 248 0, self, 'iconEditor_file_save_as')
249 self.saveAsAct.setStatusTip( 249 self.saveAsAct.setStatusTip(
250 self.trUtf8('Save the current icon to a new file')) 250 self.tr('Save the current icon to a new file'))
251 self.saveAsAct.setWhatsThis(self.trUtf8( 251 self.saveAsAct.setWhatsThis(self.tr(
252 """<b>Save As...</b>""" 252 """<b>Save As...</b>"""
253 """<p>Saves the current icon to a new file.</p>""" 253 """<p>Saves the current icon to a new file.</p>"""
254 )) 254 ))
255 self.saveAsAct.triggered[()].connect(self.__saveIconAs) 255 self.saveAsAct.triggered[()].connect(self.__saveIconAs)
256 self.__actions.append(self.saveAsAct) 256 self.__actions.append(self.saveAsAct)
257 257
258 self.closeAct = E5Action( 258 self.closeAct = E5Action(
259 self.trUtf8('Close'), 259 self.tr('Close'),
260 UI.PixmapCache.getIcon("close.png"), 260 UI.PixmapCache.getIcon("close.png"),
261 self.trUtf8('&Close'), 261 self.tr('&Close'),
262 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")), 262 QKeySequence(self.tr("Ctrl+W", "File|Close")),
263 0, self, 'iconEditor_file_close') 263 0, self, 'iconEditor_file_close')
264 self.closeAct.setStatusTip(self.trUtf8( 264 self.closeAct.setStatusTip(self.tr(
265 'Close the current icon editor window')) 265 'Close the current icon editor window'))
266 self.closeAct.setWhatsThis(self.trUtf8( 266 self.closeAct.setWhatsThis(self.tr(
267 """<b>Close</b>""" 267 """<b>Close</b>"""
268 """<p>Closes the current icon editor window.</p>""" 268 """<p>Closes the current icon editor window.</p>"""
269 )) 269 ))
270 self.closeAct.triggered[()].connect(self.close) 270 self.closeAct.triggered[()].connect(self.close)
271 self.__actions.append(self.closeAct) 271 self.__actions.append(self.closeAct)
272 272
273 self.closeAllAct = E5Action( 273 self.closeAllAct = E5Action(
274 self.trUtf8('Close All'), 274 self.tr('Close All'),
275 self.trUtf8('Close &All'), 275 self.tr('Close &All'),
276 0, 0, self, 'iconEditor_file_close_all') 276 0, 0, self, 'iconEditor_file_close_all')
277 self.closeAllAct.setStatusTip(self.trUtf8( 277 self.closeAllAct.setStatusTip(self.tr(
278 'Close all icon editor windows')) 278 'Close all icon editor windows'))
279 self.closeAllAct.setWhatsThis(self.trUtf8( 279 self.closeAllAct.setWhatsThis(self.tr(
280 """<b>Close All</b>""" 280 """<b>Close All</b>"""
281 """<p>Closes all icon editor windows except the first one.</p>""" 281 """<p>Closes all icon editor windows except the first one.</p>"""
282 )) 282 ))
283 self.closeAllAct.triggered[()].connect(self.__closeAll) 283 self.closeAllAct.triggered[()].connect(self.__closeAll)
284 self.__actions.append(self.closeAllAct) 284 self.__actions.append(self.closeAllAct)
285 285
286 self.exitAct = E5Action( 286 self.exitAct = E5Action(
287 self.trUtf8('Quit'), 287 self.tr('Quit'),
288 UI.PixmapCache.getIcon("exit.png"), 288 UI.PixmapCache.getIcon("exit.png"),
289 self.trUtf8('&Quit'), 289 self.tr('&Quit'),
290 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit")), 290 QKeySequence(self.tr("Ctrl+Q", "File|Quit")),
291 0, self, 'iconEditor_file_quit') 291 0, self, 'iconEditor_file_quit')
292 self.exitAct.setStatusTip(self.trUtf8('Quit the icon editor')) 292 self.exitAct.setStatusTip(self.tr('Quit the icon editor'))
293 self.exitAct.setWhatsThis(self.trUtf8( 293 self.exitAct.setWhatsThis(self.tr(
294 """<b>Quit</b>""" 294 """<b>Quit</b>"""
295 """<p>Quit the icon editor.</p>""" 295 """<p>Quit the icon editor.</p>"""
296 )) 296 ))
297 if not self.fromEric: 297 if not self.fromEric:
298 self.exitAct.triggered[()].connect(self.__closeAll) 298 self.exitAct.triggered[()].connect(self.__closeAll)
301 def __initEditActions(self): 301 def __initEditActions(self):
302 """ 302 """
303 Private method to create the Edit actions. 303 Private method to create the Edit actions.
304 """ 304 """
305 self.undoAct = E5Action( 305 self.undoAct = E5Action(
306 self.trUtf8('Undo'), 306 self.tr('Undo'),
307 UI.PixmapCache.getIcon("editUndo.png"), 307 UI.PixmapCache.getIcon("editUndo.png"),
308 self.trUtf8('&Undo'), 308 self.tr('&Undo'),
309 QKeySequence(self.trUtf8("Ctrl+Z", "Edit|Undo")), 309 QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")),
310 QKeySequence(self.trUtf8("Alt+Backspace", "Edit|Undo")), 310 QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")),
311 self, 'iconEditor_edit_undo') 311 self, 'iconEditor_edit_undo')
312 self.undoAct.setStatusTip(self.trUtf8('Undo the last change')) 312 self.undoAct.setStatusTip(self.tr('Undo the last change'))
313 self.undoAct.setWhatsThis(self.trUtf8( 313 self.undoAct.setWhatsThis(self.tr(
314 """<b>Undo</b>""" 314 """<b>Undo</b>"""
315 """<p>Undo the last change done.</p>""" 315 """<p>Undo the last change done.</p>"""
316 )) 316 ))
317 self.undoAct.triggered[()].connect(self.__editor.editUndo) 317 self.undoAct.triggered[()].connect(self.__editor.editUndo)
318 self.__actions.append(self.undoAct) 318 self.__actions.append(self.undoAct)
319 319
320 self.redoAct = E5Action( 320 self.redoAct = E5Action(
321 self.trUtf8('Redo'), 321 self.tr('Redo'),
322 UI.PixmapCache.getIcon("editRedo.png"), 322 UI.PixmapCache.getIcon("editRedo.png"),
323 self.trUtf8('&Redo'), 323 self.tr('&Redo'),
324 QKeySequence(self.trUtf8("Ctrl+Shift+Z", "Edit|Redo")), 324 QKeySequence(self.tr("Ctrl+Shift+Z", "Edit|Redo")),
325 0, self, 'iconEditor_edit_redo') 325 0, self, 'iconEditor_edit_redo')
326 self.redoAct.setStatusTip(self.trUtf8('Redo the last change')) 326 self.redoAct.setStatusTip(self.tr('Redo the last change'))
327 self.redoAct.setWhatsThis(self.trUtf8( 327 self.redoAct.setWhatsThis(self.tr(
328 """<b>Redo</b>""" 328 """<b>Redo</b>"""
329 """<p>Redo the last change done.</p>""" 329 """<p>Redo the last change done.</p>"""
330 )) 330 ))
331 self.redoAct.triggered[()].connect(self.__editor.editRedo) 331 self.redoAct.triggered[()].connect(self.__editor.editRedo)
332 self.__actions.append(self.redoAct) 332 self.__actions.append(self.redoAct)
333 333
334 self.cutAct = E5Action( 334 self.cutAct = E5Action(
335 self.trUtf8('Cut'), 335 self.tr('Cut'),
336 UI.PixmapCache.getIcon("editCut.png"), 336 UI.PixmapCache.getIcon("editCut.png"),
337 self.trUtf8('Cu&t'), 337 self.tr('Cu&t'),
338 QKeySequence(self.trUtf8("Ctrl+X", "Edit|Cut")), 338 QKeySequence(self.tr("Ctrl+X", "Edit|Cut")),
339 QKeySequence(self.trUtf8("Shift+Del", "Edit|Cut")), 339 QKeySequence(self.tr("Shift+Del", "Edit|Cut")),
340 self, 'iconEditor_edit_cut') 340 self, 'iconEditor_edit_cut')
341 self.cutAct.setStatusTip(self.trUtf8('Cut the selection')) 341 self.cutAct.setStatusTip(self.tr('Cut the selection'))
342 self.cutAct.setWhatsThis(self.trUtf8( 342 self.cutAct.setWhatsThis(self.tr(
343 """<b>Cut</b>""" 343 """<b>Cut</b>"""
344 """<p>Cut the selected image area to the clipboard.</p>""" 344 """<p>Cut the selected image area to the clipboard.</p>"""
345 )) 345 ))
346 self.cutAct.triggered[()].connect(self.__editor.editCut) 346 self.cutAct.triggered[()].connect(self.__editor.editCut)
347 self.__actions.append(self.cutAct) 347 self.__actions.append(self.cutAct)
348 348
349 self.copyAct = E5Action( 349 self.copyAct = E5Action(
350 self.trUtf8('Copy'), 350 self.tr('Copy'),
351 UI.PixmapCache.getIcon("editCopy.png"), 351 UI.PixmapCache.getIcon("editCopy.png"),
352 self.trUtf8('&Copy'), 352 self.tr('&Copy'),
353 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy")), 353 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")),
354 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")), 354 QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")),
355 self, 'iconEditor_edit_copy') 355 self, 'iconEditor_edit_copy')
356 self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) 356 self.copyAct.setStatusTip(self.tr('Copy the selection'))
357 self.copyAct.setWhatsThis(self.trUtf8( 357 self.copyAct.setWhatsThis(self.tr(
358 """<b>Copy</b>""" 358 """<b>Copy</b>"""
359 """<p>Copy the selected image area to the clipboard.</p>""" 359 """<p>Copy the selected image area to the clipboard.</p>"""
360 )) 360 ))
361 self.copyAct.triggered[()].connect(self.__editor.editCopy) 361 self.copyAct.triggered[()].connect(self.__editor.editCopy)
362 self.__actions.append(self.copyAct) 362 self.__actions.append(self.copyAct)
363 363
364 self.pasteAct = E5Action( 364 self.pasteAct = E5Action(
365 self.trUtf8('Paste'), 365 self.tr('Paste'),
366 UI.PixmapCache.getIcon("editPaste.png"), 366 UI.PixmapCache.getIcon("editPaste.png"),
367 self.trUtf8('&Paste'), 367 self.tr('&Paste'),
368 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")), 368 QKeySequence(self.tr("Ctrl+V", "Edit|Paste")),
369 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")), 369 QKeySequence(self.tr("Shift+Ins", "Edit|Paste")),
370 self, 'iconEditor_edit_paste') 370 self, 'iconEditor_edit_paste')
371 self.pasteAct.setStatusTip(self.trUtf8('Paste the clipboard image')) 371 self.pasteAct.setStatusTip(self.tr('Paste the clipboard image'))
372 self.pasteAct.setWhatsThis(self.trUtf8( 372 self.pasteAct.setWhatsThis(self.tr(
373 """<b>Paste</b>""" 373 """<b>Paste</b>"""
374 """<p>Paste the clipboard image.</p>""" 374 """<p>Paste the clipboard image.</p>"""
375 )) 375 ))
376 self.pasteAct.triggered[()].connect(self.__editor.editPaste) 376 self.pasteAct.triggered[()].connect(self.__editor.editPaste)
377 self.__actions.append(self.pasteAct) 377 self.__actions.append(self.pasteAct)
378 378
379 self.pasteNewAct = E5Action( 379 self.pasteNewAct = E5Action(
380 self.trUtf8('Paste as New'), 380 self.tr('Paste as New'),
381 self.trUtf8('Paste as &New'), 381 self.tr('Paste as &New'),
382 0, 0, self, 'iconEditor_edit_paste_as_new') 382 0, 0, self, 'iconEditor_edit_paste_as_new')
383 self.pasteNewAct.setStatusTip(self.trUtf8( 383 self.pasteNewAct.setStatusTip(self.tr(
384 'Paste the clipboard image replacing the current one')) 384 'Paste the clipboard image replacing the current one'))
385 self.pasteNewAct.setWhatsThis(self.trUtf8( 385 self.pasteNewAct.setWhatsThis(self.tr(
386 """<b>Paste as New</b>""" 386 """<b>Paste as New</b>"""
387 """<p>Paste the clipboard image replacing the current one.</p>""" 387 """<p>Paste the clipboard image replacing the current one.</p>"""
388 )) 388 ))
389 self.pasteNewAct.triggered[()].connect(self.__editor.editPasteAsNew) 389 self.pasteNewAct.triggered[()].connect(self.__editor.editPasteAsNew)
390 self.__actions.append(self.pasteNewAct) 390 self.__actions.append(self.pasteNewAct)
391 391
392 self.deleteAct = E5Action( 392 self.deleteAct = E5Action(
393 self.trUtf8('Clear'), 393 self.tr('Clear'),
394 UI.PixmapCache.getIcon("editDelete.png"), 394 UI.PixmapCache.getIcon("editDelete.png"),
395 self.trUtf8('Cl&ear'), 395 self.tr('Cl&ear'),
396 QKeySequence(self.trUtf8("Alt+Shift+C", "Edit|Clear")), 396 QKeySequence(self.tr("Alt+Shift+C", "Edit|Clear")),
397 0, 397 0,
398 self, 'iconEditor_edit_clear') 398 self, 'iconEditor_edit_clear')
399 self.deleteAct.setStatusTip(self.trUtf8('Clear the icon image')) 399 self.deleteAct.setStatusTip(self.tr('Clear the icon image'))
400 self.deleteAct.setWhatsThis(self.trUtf8( 400 self.deleteAct.setWhatsThis(self.tr(
401 """<b>Clear</b>""" 401 """<b>Clear</b>"""
402 """<p>Clear the icon image and set it to be completely""" 402 """<p>Clear the icon image and set it to be completely"""
403 """ transparent.</p>""" 403 """ transparent.</p>"""
404 )) 404 ))
405 self.deleteAct.triggered[()].connect(self.__editor.editClear) 405 self.deleteAct.triggered[()].connect(self.__editor.editClear)
406 self.__actions.append(self.deleteAct) 406 self.__actions.append(self.deleteAct)
407 407
408 self.selectAllAct = E5Action( 408 self.selectAllAct = E5Action(
409 self.trUtf8('Select All'), 409 self.tr('Select All'),
410 self.trUtf8('&Select All'), 410 self.tr('&Select All'),
411 QKeySequence(self.trUtf8("Ctrl+A", "Edit|Select All")), 411 QKeySequence(self.tr("Ctrl+A", "Edit|Select All")),
412 0, 412 0,
413 self, 'iconEditor_edit_select_all') 413 self, 'iconEditor_edit_select_all')
414 self.selectAllAct.setStatusTip(self.trUtf8( 414 self.selectAllAct.setStatusTip(self.tr(
415 'Select the complete icon image')) 415 'Select the complete icon image'))
416 self.selectAllAct.setWhatsThis(self.trUtf8( 416 self.selectAllAct.setWhatsThis(self.tr(
417 """<b>Select All</b>""" 417 """<b>Select All</b>"""
418 """<p>Selects the complete icon image.</p>""" 418 """<p>Selects the complete icon image.</p>"""
419 )) 419 ))
420 self.selectAllAct.triggered[()].connect(self.__editor.editSelectAll) 420 self.selectAllAct.triggered[()].connect(self.__editor.editSelectAll)
421 self.__actions.append(self.selectAllAct) 421 self.__actions.append(self.selectAllAct)
422 422
423 self.resizeAct = E5Action( 423 self.resizeAct = E5Action(
424 self.trUtf8('Change Size'), 424 self.tr('Change Size'),
425 UI.PixmapCache.getIcon("transformResize.png"), 425 UI.PixmapCache.getIcon("transformResize.png"),
426 self.trUtf8('Change Si&ze...'), 426 self.tr('Change Si&ze...'),
427 0, 0, 427 0, 0,
428 self, 'iconEditor_edit_change_size') 428 self, 'iconEditor_edit_change_size')
429 self.resizeAct.setStatusTip(self.trUtf8('Change the icon size')) 429 self.resizeAct.setStatusTip(self.tr('Change the icon size'))
430 self.resizeAct.setWhatsThis(self.trUtf8( 430 self.resizeAct.setWhatsThis(self.tr(
431 """<b>Change Size...</b>""" 431 """<b>Change Size...</b>"""
432 """<p>Changes the icon size.</p>""" 432 """<p>Changes the icon size.</p>"""
433 )) 433 ))
434 self.resizeAct.triggered[()].connect(self.__editor.editResize) 434 self.resizeAct.triggered[()].connect(self.__editor.editResize)
435 self.__actions.append(self.resizeAct) 435 self.__actions.append(self.resizeAct)
436 436
437 self.grayscaleAct = E5Action( 437 self.grayscaleAct = E5Action(
438 self.trUtf8('Grayscale'), 438 self.tr('Grayscale'),
439 UI.PixmapCache.getIcon("grayscale.png"), 439 UI.PixmapCache.getIcon("grayscale.png"),
440 self.trUtf8('&Grayscale'), 440 self.tr('&Grayscale'),
441 0, 0, 441 0, 0,
442 self, 'iconEditor_edit_grayscale') 442 self, 'iconEditor_edit_grayscale')
443 self.grayscaleAct.setStatusTip(self.trUtf8( 443 self.grayscaleAct.setStatusTip(self.tr(
444 'Change the icon to grayscale')) 444 'Change the icon to grayscale'))
445 self.grayscaleAct.setWhatsThis(self.trUtf8( 445 self.grayscaleAct.setWhatsThis(self.tr(
446 """<b>Grayscale</b>""" 446 """<b>Grayscale</b>"""
447 """<p>Changes the icon to grayscale.</p>""" 447 """<p>Changes the icon to grayscale.</p>"""
448 )) 448 ))
449 self.grayscaleAct.triggered[()].connect(self.__editor.grayScale) 449 self.grayscaleAct.triggered[()].connect(self.__editor.grayScale)
450 self.__actions.append(self.grayscaleAct) 450 self.__actions.append(self.grayscaleAct)
470 def __initViewActions(self): 470 def __initViewActions(self):
471 """ 471 """
472 Private method to create the View actions. 472 Private method to create the View actions.
473 """ 473 """
474 self.zoomInAct = E5Action( 474 self.zoomInAct = E5Action(
475 self.trUtf8('Zoom in'), 475 self.tr('Zoom in'),
476 UI.PixmapCache.getIcon("zoomIn.png"), 476 UI.PixmapCache.getIcon("zoomIn.png"),
477 self.trUtf8('Zoom &in'), 477 self.tr('Zoom &in'),
478 QKeySequence(self.trUtf8("Ctrl++", "View|Zoom in")), 478 QKeySequence(self.tr("Ctrl++", "View|Zoom in")),
479 0, self, 'iconEditor_view_zoom_in') 479 0, self, 'iconEditor_view_zoom_in')
480 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the icon')) 480 self.zoomInAct.setStatusTip(self.tr('Zoom in on the icon'))
481 self.zoomInAct.setWhatsThis(self.trUtf8( 481 self.zoomInAct.setWhatsThis(self.tr(
482 """<b>Zoom in</b>""" 482 """<b>Zoom in</b>"""
483 """<p>Zoom in on the icon. This makes the grid bigger.</p>""" 483 """<p>Zoom in on the icon. This makes the grid bigger.</p>"""
484 )) 484 ))
485 self.zoomInAct.triggered[()].connect(self.__zoomIn) 485 self.zoomInAct.triggered[()].connect(self.__zoomIn)
486 self.__actions.append(self.zoomInAct) 486 self.__actions.append(self.zoomInAct)
487 487
488 self.zoomOutAct = E5Action( 488 self.zoomOutAct = E5Action(
489 self.trUtf8('Zoom out'), 489 self.tr('Zoom out'),
490 UI.PixmapCache.getIcon("zoomOut.png"), 490 UI.PixmapCache.getIcon("zoomOut.png"),
491 self.trUtf8('Zoom &out'), 491 self.tr('Zoom &out'),
492 QKeySequence(self.trUtf8("Ctrl+-", "View|Zoom out")), 492 QKeySequence(self.tr("Ctrl+-", "View|Zoom out")),
493 0, self, 'iconEditor_view_zoom_out') 493 0, self, 'iconEditor_view_zoom_out')
494 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the icon')) 494 self.zoomOutAct.setStatusTip(self.tr('Zoom out on the icon'))
495 self.zoomOutAct.setWhatsThis(self.trUtf8( 495 self.zoomOutAct.setWhatsThis(self.tr(
496 """<b>Zoom out</b>""" 496 """<b>Zoom out</b>"""
497 """<p>Zoom out on the icon. This makes the grid smaller.</p>""" 497 """<p>Zoom out on the icon. This makes the grid smaller.</p>"""
498 )) 498 ))
499 self.zoomOutAct.triggered[()].connect(self.__zoomOut) 499 self.zoomOutAct.triggered[()].connect(self.__zoomOut)
500 self.__actions.append(self.zoomOutAct) 500 self.__actions.append(self.zoomOutAct)
501 501
502 self.zoomResetAct = E5Action( 502 self.zoomResetAct = E5Action(
503 self.trUtf8('Zoom reset'), 503 self.tr('Zoom reset'),
504 UI.PixmapCache.getIcon("zoomReset.png"), 504 UI.PixmapCache.getIcon("zoomReset.png"),
505 self.trUtf8('Zoom &reset'), 505 self.tr('Zoom &reset'),
506 QKeySequence(self.trUtf8("Ctrl+0", "View|Zoom reset")), 506 QKeySequence(self.tr("Ctrl+0", "View|Zoom reset")),
507 0, self, 'iconEditor_view_zoom_reset') 507 0, self, 'iconEditor_view_zoom_reset')
508 self.zoomResetAct.setStatusTip(self.trUtf8( 508 self.zoomResetAct.setStatusTip(self.tr(
509 'Reset the zoom of the icon')) 509 'Reset the zoom of the icon'))
510 self.zoomResetAct.setWhatsThis(self.trUtf8( 510 self.zoomResetAct.setWhatsThis(self.tr(
511 """<b>Zoom reset</b>""" 511 """<b>Zoom reset</b>"""
512 """<p>Reset the zoom of the icon. """ 512 """<p>Reset the zoom of the icon. """
513 """This sets the zoom factor to 100%.</p>""" 513 """This sets the zoom factor to 100%.</p>"""
514 )) 514 ))
515 self.zoomResetAct.triggered[()].connect(self.__zoomReset) 515 self.zoomResetAct.triggered[()].connect(self.__zoomReset)
516 self.__actions.append(self.zoomResetAct) 516 self.__actions.append(self.zoomResetAct)
517 517
518 self.showGridAct = E5Action( 518 self.showGridAct = E5Action(
519 self.trUtf8('Show Grid'), 519 self.tr('Show Grid'),
520 UI.PixmapCache.getIcon("grid.png"), 520 UI.PixmapCache.getIcon("grid.png"),
521 self.trUtf8('Show &Grid'), 521 self.tr('Show &Grid'),
522 0, 0, 522 0, 0,
523 self, 'iconEditor_view_show_grid') 523 self, 'iconEditor_view_show_grid')
524 self.showGridAct.setStatusTip(self.trUtf8( 524 self.showGridAct.setStatusTip(self.tr(
525 'Toggle the display of the grid')) 525 'Toggle the display of the grid'))
526 self.showGridAct.setWhatsThis(self.trUtf8( 526 self.showGridAct.setWhatsThis(self.tr(
527 """<b>Show Grid</b>""" 527 """<b>Show Grid</b>"""
528 """<p>Toggle the display of the grid.</p>""" 528 """<p>Toggle the display of the grid.</p>"""
529 )) 529 ))
530 self.showGridAct.triggered[bool].connect(self.__editor.setGridEnabled) 530 self.showGridAct.triggered[bool].connect(self.__editor.setGridEnabled)
531 self.__actions.append(self.showGridAct) 531 self.__actions.append(self.showGridAct)
541 541
542 self.drawingActGrp = createActionGroup(self) 542 self.drawingActGrp = createActionGroup(self)
543 self.drawingActGrp.setExclusive(True) 543 self.drawingActGrp.setExclusive(True)
544 544
545 self.drawPencilAct = E5Action( 545 self.drawPencilAct = E5Action(
546 self.trUtf8('Freehand'), 546 self.tr('Freehand'),
547 UI.PixmapCache.getIcon("drawBrush.png"), 547 UI.PixmapCache.getIcon("drawBrush.png"),
548 self.trUtf8('&Freehand'), 548 self.tr('&Freehand'),
549 0, 0, 549 0, 0,
550 self.drawingActGrp, 'iconEditor_tools_pencil') 550 self.drawingActGrp, 'iconEditor_tools_pencil')
551 self.drawPencilAct.setWhatsThis(self.trUtf8( 551 self.drawPencilAct.setWhatsThis(self.tr(
552 """<b>Free hand</b>""" 552 """<b>Free hand</b>"""
553 """<p>Draws non linear lines.</p>""" 553 """<p>Draws non linear lines.</p>"""
554 )) 554 ))
555 self.drawPencilAct.setCheckable(True) 555 self.drawPencilAct.setCheckable(True)
556 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil) 556 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil)
557 self.drawPencilAct.triggered[()].connect(self.esm.map) 557 self.drawPencilAct.triggered[()].connect(self.esm.map)
558 self.__actions.append(self.drawPencilAct) 558 self.__actions.append(self.drawPencilAct)
559 559
560 self.drawColorPickerAct = E5Action( 560 self.drawColorPickerAct = E5Action(
561 self.trUtf8('Color Picker'), 561 self.tr('Color Picker'),
562 UI.PixmapCache.getIcon("colorPicker.png"), 562 UI.PixmapCache.getIcon("colorPicker.png"),
563 self.trUtf8('&Color Picker'), 563 self.tr('&Color Picker'),
564 0, 0, 564 0, 0,
565 self.drawingActGrp, 'iconEditor_tools_color_picker') 565 self.drawingActGrp, 'iconEditor_tools_color_picker')
566 self.drawColorPickerAct.setWhatsThis(self.trUtf8( 566 self.drawColorPickerAct.setWhatsThis(self.tr(
567 """<b>Color Picker</b>""" 567 """<b>Color Picker</b>"""
568 """<p>The color of the pixel clicked on will become """ 568 """<p>The color of the pixel clicked on will become """
569 """the current draw color.</p>""" 569 """the current draw color.</p>"""
570 )) 570 ))
571 self.drawColorPickerAct.setCheckable(True) 571 self.drawColorPickerAct.setCheckable(True)
573 IconEditorGrid.ColorPicker) 573 IconEditorGrid.ColorPicker)
574 self.drawColorPickerAct.triggered[()].connect(self.esm.map) 574 self.drawColorPickerAct.triggered[()].connect(self.esm.map)
575 self.__actions.append(self.drawColorPickerAct) 575 self.__actions.append(self.drawColorPickerAct)
576 576
577 self.drawRectangleAct = E5Action( 577 self.drawRectangleAct = E5Action(
578 self.trUtf8('Rectangle'), 578 self.tr('Rectangle'),
579 UI.PixmapCache.getIcon("drawRectangle.png"), 579 UI.PixmapCache.getIcon("drawRectangle.png"),
580 self.trUtf8('&Rectangle'), 580 self.tr('&Rectangle'),
581 0, 0, 581 0, 0,
582 self.drawingActGrp, 'iconEditor_tools_rectangle') 582 self.drawingActGrp, 'iconEditor_tools_rectangle')
583 self.drawRectangleAct.setWhatsThis(self.trUtf8( 583 self.drawRectangleAct.setWhatsThis(self.tr(
584 """<b>Rectangle</b>""" 584 """<b>Rectangle</b>"""
585 """<p>Draw a rectangle.</p>""" 585 """<p>Draw a rectangle.</p>"""
586 )) 586 ))
587 self.drawRectangleAct.setCheckable(True) 587 self.drawRectangleAct.setCheckable(True)
588 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle) 588 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle)
589 self.drawRectangleAct.triggered[()].connect(self.esm.map) 589 self.drawRectangleAct.triggered[()].connect(self.esm.map)
590 self.__actions.append(self.drawRectangleAct) 590 self.__actions.append(self.drawRectangleAct)
591 591
592 self.drawFilledRectangleAct = E5Action( 592 self.drawFilledRectangleAct = E5Action(
593 self.trUtf8('Filled Rectangle'), 593 self.tr('Filled Rectangle'),
594 UI.PixmapCache.getIcon("drawRectangleFilled.png"), 594 UI.PixmapCache.getIcon("drawRectangleFilled.png"),
595 self.trUtf8('F&illed Rectangle'), 595 self.tr('F&illed Rectangle'),
596 0, 0, 596 0, 0,
597 self.drawingActGrp, 'iconEditor_tools_filled_rectangle') 597 self.drawingActGrp, 'iconEditor_tools_filled_rectangle')
598 self.drawFilledRectangleAct.setWhatsThis(self.trUtf8( 598 self.drawFilledRectangleAct.setWhatsThis(self.tr(
599 """<b>Filled Rectangle</b>""" 599 """<b>Filled Rectangle</b>"""
600 """<p>Draw a filled rectangle.</p>""" 600 """<p>Draw a filled rectangle.</p>"""
601 )) 601 ))
602 self.drawFilledRectangleAct.setCheckable(True) 602 self.drawFilledRectangleAct.setCheckable(True)
603 self.esm.setMapping(self.drawFilledRectangleAct, 603 self.esm.setMapping(self.drawFilledRectangleAct,
604 IconEditorGrid.FilledRectangle) 604 IconEditorGrid.FilledRectangle)
605 self.drawFilledRectangleAct.triggered[()].connect(self.esm.map) 605 self.drawFilledRectangleAct.triggered[()].connect(self.esm.map)
606 self.__actions.append(self.drawFilledRectangleAct) 606 self.__actions.append(self.drawFilledRectangleAct)
607 607
608 self.drawCircleAct = E5Action( 608 self.drawCircleAct = E5Action(
609 self.trUtf8('Circle'), 609 self.tr('Circle'),
610 UI.PixmapCache.getIcon("drawCircle.png"), 610 UI.PixmapCache.getIcon("drawCircle.png"),
611 self.trUtf8('Circle'), 611 self.tr('Circle'),
612 0, 0, 612 0, 0,
613 self.drawingActGrp, 'iconEditor_tools_circle') 613 self.drawingActGrp, 'iconEditor_tools_circle')
614 self.drawCircleAct.setWhatsThis(self.trUtf8( 614 self.drawCircleAct.setWhatsThis(self.tr(
615 """<b>Circle</b>""" 615 """<b>Circle</b>"""
616 """<p>Draw a circle.</p>""" 616 """<p>Draw a circle.</p>"""
617 )) 617 ))
618 self.drawCircleAct.setCheckable(True) 618 self.drawCircleAct.setCheckable(True)
619 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle) 619 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle)
620 self.drawCircleAct.triggered[()].connect(self.esm.map) 620 self.drawCircleAct.triggered[()].connect(self.esm.map)
621 self.__actions.append(self.drawCircleAct) 621 self.__actions.append(self.drawCircleAct)
622 622
623 self.drawFilledCircleAct = E5Action( 623 self.drawFilledCircleAct = E5Action(
624 self.trUtf8('Filled Circle'), 624 self.tr('Filled Circle'),
625 UI.PixmapCache.getIcon("drawCircleFilled.png"), 625 UI.PixmapCache.getIcon("drawCircleFilled.png"),
626 self.trUtf8('Fille&d Circle'), 626 self.tr('Fille&d Circle'),
627 0, 0, 627 0, 0,
628 self.drawingActGrp, 'iconEditor_tools_filled_circle') 628 self.drawingActGrp, 'iconEditor_tools_filled_circle')
629 self.drawFilledCircleAct.setWhatsThis(self.trUtf8( 629 self.drawFilledCircleAct.setWhatsThis(self.tr(
630 """<b>Filled Circle</b>""" 630 """<b>Filled Circle</b>"""
631 """<p>Draw a filled circle.</p>""" 631 """<p>Draw a filled circle.</p>"""
632 )) 632 ))
633 self.drawFilledCircleAct.setCheckable(True) 633 self.drawFilledCircleAct.setCheckable(True)
634 self.esm.setMapping(self.drawFilledCircleAct, 634 self.esm.setMapping(self.drawFilledCircleAct,
635 IconEditorGrid.FilledCircle) 635 IconEditorGrid.FilledCircle)
636 self.drawFilledCircleAct.triggered[()].connect(self.esm.map) 636 self.drawFilledCircleAct.triggered[()].connect(self.esm.map)
637 self.__actions.append(self.drawFilledCircleAct) 637 self.__actions.append(self.drawFilledCircleAct)
638 638
639 self.drawEllipseAct = E5Action( 639 self.drawEllipseAct = E5Action(
640 self.trUtf8('Ellipse'), 640 self.tr('Ellipse'),
641 UI.PixmapCache.getIcon("drawEllipse.png"), 641 UI.PixmapCache.getIcon("drawEllipse.png"),
642 self.trUtf8('&Ellipse'), 642 self.tr('&Ellipse'),
643 0, 0, 643 0, 0,
644 self.drawingActGrp, 'iconEditor_tools_ellipse') 644 self.drawingActGrp, 'iconEditor_tools_ellipse')
645 self.drawEllipseAct.setWhatsThis(self.trUtf8( 645 self.drawEllipseAct.setWhatsThis(self.tr(
646 """<b>Ellipse</b>""" 646 """<b>Ellipse</b>"""
647 """<p>Draw an ellipse.</p>""" 647 """<p>Draw an ellipse.</p>"""
648 )) 648 ))
649 self.drawEllipseAct.setCheckable(True) 649 self.drawEllipseAct.setCheckable(True)
650 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse) 650 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse)
651 self.drawEllipseAct.triggered[()].connect(self.esm.map) 651 self.drawEllipseAct.triggered[()].connect(self.esm.map)
652 self.__actions.append(self.drawEllipseAct) 652 self.__actions.append(self.drawEllipseAct)
653 653
654 self.drawFilledEllipseAct = E5Action( 654 self.drawFilledEllipseAct = E5Action(
655 self.trUtf8('Filled Ellipse'), 655 self.tr('Filled Ellipse'),
656 UI.PixmapCache.getIcon("drawEllipseFilled.png"), 656 UI.PixmapCache.getIcon("drawEllipseFilled.png"),
657 self.trUtf8('Fille&d Elli&pse'), 657 self.tr('Fille&d Elli&pse'),
658 0, 0, 658 0, 0,
659 self.drawingActGrp, 'iconEditor_tools_filled_ellipse') 659 self.drawingActGrp, 'iconEditor_tools_filled_ellipse')
660 self.drawFilledEllipseAct.setWhatsThis(self.trUtf8( 660 self.drawFilledEllipseAct.setWhatsThis(self.tr(
661 """<b>Filled Ellipse</b>""" 661 """<b>Filled Ellipse</b>"""
662 """<p>Draw a filled ellipse.</p>""" 662 """<p>Draw a filled ellipse.</p>"""
663 )) 663 ))
664 self.drawFilledEllipseAct.setCheckable(True) 664 self.drawFilledEllipseAct.setCheckable(True)
665 self.esm.setMapping(self.drawFilledEllipseAct, 665 self.esm.setMapping(self.drawFilledEllipseAct,
666 IconEditorGrid.FilledEllipse) 666 IconEditorGrid.FilledEllipse)
667 self.drawFilledEllipseAct.triggered[()].connect(self.esm.map) 667 self.drawFilledEllipseAct.triggered[()].connect(self.esm.map)
668 self.__actions.append(self.drawFilledEllipseAct) 668 self.__actions.append(self.drawFilledEllipseAct)
669 669
670 self.drawFloodFillAct = E5Action( 670 self.drawFloodFillAct = E5Action(
671 self.trUtf8('Flood Fill'), 671 self.tr('Flood Fill'),
672 UI.PixmapCache.getIcon("drawFill.png"), 672 UI.PixmapCache.getIcon("drawFill.png"),
673 self.trUtf8('Fl&ood Fill'), 673 self.tr('Fl&ood Fill'),
674 0, 0, 674 0, 0,
675 self.drawingActGrp, 'iconEditor_tools_flood_fill') 675 self.drawingActGrp, 'iconEditor_tools_flood_fill')
676 self.drawFloodFillAct.setWhatsThis(self.trUtf8( 676 self.drawFloodFillAct.setWhatsThis(self.tr(
677 """<b>Flood Fill</b>""" 677 """<b>Flood Fill</b>"""
678 """<p>Fill adjoining pixels with the same color with """ 678 """<p>Fill adjoining pixels with the same color with """
679 """the current color.</p>""" 679 """the current color.</p>"""
680 )) 680 ))
681 self.drawFloodFillAct.setCheckable(True) 681 self.drawFloodFillAct.setCheckable(True)
682 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill) 682 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill)
683 self.drawFloodFillAct.triggered[()].connect(self.esm.map) 683 self.drawFloodFillAct.triggered[()].connect(self.esm.map)
684 self.__actions.append(self.drawFloodFillAct) 684 self.__actions.append(self.drawFloodFillAct)
685 685
686 self.drawLineAct = E5Action( 686 self.drawLineAct = E5Action(
687 self.trUtf8('Line'), 687 self.tr('Line'),
688 UI.PixmapCache.getIcon("drawLine.png"), 688 UI.PixmapCache.getIcon("drawLine.png"),
689 self.trUtf8('&Line'), 689 self.tr('&Line'),
690 0, 0, 690 0, 0,
691 self.drawingActGrp, 'iconEditor_tools_line') 691 self.drawingActGrp, 'iconEditor_tools_line')
692 self.drawLineAct.setWhatsThis(self.trUtf8( 692 self.drawLineAct.setWhatsThis(self.tr(
693 """<b>Line</b>""" 693 """<b>Line</b>"""
694 """<p>Draw a line.</p>""" 694 """<p>Draw a line.</p>"""
695 )) 695 ))
696 self.drawLineAct.setCheckable(True) 696 self.drawLineAct.setCheckable(True)
697 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line) 697 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line)
698 self.drawLineAct.triggered[()].connect(self.esm.map) 698 self.drawLineAct.triggered[()].connect(self.esm.map)
699 self.__actions.append(self.drawLineAct) 699 self.__actions.append(self.drawLineAct)
700 700
701 self.drawEraserAct = E5Action( 701 self.drawEraserAct = E5Action(
702 self.trUtf8('Eraser (Transparent)'), 702 self.tr('Eraser (Transparent)'),
703 UI.PixmapCache.getIcon("drawEraser.png"), 703 UI.PixmapCache.getIcon("drawEraser.png"),
704 self.trUtf8('Eraser (&Transparent)'), 704 self.tr('Eraser (&Transparent)'),
705 0, 0, 705 0, 0,
706 self.drawingActGrp, 'iconEditor_tools_eraser') 706 self.drawingActGrp, 'iconEditor_tools_eraser')
707 self.drawEraserAct.setWhatsThis(self.trUtf8( 707 self.drawEraserAct.setWhatsThis(self.tr(
708 """<b>Eraser (Transparent)</b>""" 708 """<b>Eraser (Transparent)</b>"""
709 """<p>Erase pixels by setting them to transparent.</p>""" 709 """<p>Erase pixels by setting them to transparent.</p>"""
710 )) 710 ))
711 self.drawEraserAct.setCheckable(True) 711 self.drawEraserAct.setCheckable(True)
712 self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber) 712 self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber)
713 self.drawEraserAct.triggered[()].connect(self.esm.map) 713 self.drawEraserAct.triggered[()].connect(self.esm.map)
714 self.__actions.append(self.drawEraserAct) 714 self.__actions.append(self.drawEraserAct)
715 715
716 self.drawRectangleSelectionAct = E5Action( 716 self.drawRectangleSelectionAct = E5Action(
717 self.trUtf8('Rectangular Selection'), 717 self.tr('Rectangular Selection'),
718 UI.PixmapCache.getIcon("selectRectangle.png"), 718 UI.PixmapCache.getIcon("selectRectangle.png"),
719 self.trUtf8('Rect&angular Selection'), 719 self.tr('Rect&angular Selection'),
720 0, 0, 720 0, 0,
721 self.drawingActGrp, 'iconEditor_tools_selection_rectangle') 721 self.drawingActGrp, 'iconEditor_tools_selection_rectangle')
722 self.drawRectangleSelectionAct.setWhatsThis(self.trUtf8( 722 self.drawRectangleSelectionAct.setWhatsThis(self.tr(
723 """<b>Rectangular Selection</b>""" 723 """<b>Rectangular Selection</b>"""
724 """<p>Select a rectangular section of the icon using""" 724 """<p>Select a rectangular section of the icon using"""
725 """ the mouse.</p>""" 725 """ the mouse.</p>"""
726 )) 726 ))
727 self.drawRectangleSelectionAct.setCheckable(True) 727 self.drawRectangleSelectionAct.setCheckable(True)
729 IconEditorGrid.RectangleSelection) 729 IconEditorGrid.RectangleSelection)
730 self.drawRectangleSelectionAct.triggered[()].connect(self.esm.map) 730 self.drawRectangleSelectionAct.triggered[()].connect(self.esm.map)
731 self.__actions.append(self.drawRectangleSelectionAct) 731 self.__actions.append(self.drawRectangleSelectionAct)
732 732
733 self.drawCircleSelectionAct = E5Action( 733 self.drawCircleSelectionAct = E5Action(
734 self.trUtf8('Circular Selection'), 734 self.tr('Circular Selection'),
735 UI.PixmapCache.getIcon("selectCircle.png"), 735 UI.PixmapCache.getIcon("selectCircle.png"),
736 self.trUtf8('Rect&angular Selection'), 736 self.tr('Rect&angular Selection'),
737 0, 0, 737 0, 0,
738 self.drawingActGrp, 'iconEditor_tools_selection_circle') 738 self.drawingActGrp, 'iconEditor_tools_selection_circle')
739 self.drawCircleSelectionAct.setWhatsThis(self.trUtf8( 739 self.drawCircleSelectionAct.setWhatsThis(self.tr(
740 """<b>Circular Selection</b>""" 740 """<b>Circular Selection</b>"""
741 """<p>Select a circular section of the icon using""" 741 """<p>Select a circular section of the icon using"""
742 """ the mouse.</p>""" 742 """ the mouse.</p>"""
743 )) 743 ))
744 self.drawCircleSelectionAct.setCheckable(True) 744 self.drawCircleSelectionAct.setCheckable(True)
752 def __initHelpActions(self): 752 def __initHelpActions(self):
753 """ 753 """
754 Private method to create the Help actions. 754 Private method to create the Help actions.
755 """ 755 """
756 self.aboutAct = E5Action( 756 self.aboutAct = E5Action(
757 self.trUtf8('About'), 757 self.tr('About'),
758 self.trUtf8('&About'), 758 self.tr('&About'),
759 0, 0, self, 'iconEditor_help_about') 759 0, 0, self, 'iconEditor_help_about')
760 self.aboutAct.setStatusTip(self.trUtf8( 760 self.aboutAct.setStatusTip(self.tr(
761 'Display information about this software')) 761 'Display information about this software'))
762 self.aboutAct.setWhatsThis(self.trUtf8( 762 self.aboutAct.setWhatsThis(self.tr(
763 """<b>About</b>""" 763 """<b>About</b>"""
764 """<p>Display some information about this software.</p>""")) 764 """<p>Display some information about this software.</p>"""))
765 self.aboutAct.triggered[()].connect(self.__about) 765 self.aboutAct.triggered[()].connect(self.__about)
766 self.__actions.append(self.aboutAct) 766 self.__actions.append(self.aboutAct)
767 767
768 self.aboutQtAct = E5Action( 768 self.aboutQtAct = E5Action(
769 self.trUtf8('About Qt'), 769 self.tr('About Qt'),
770 self.trUtf8('About &Qt'), 770 self.tr('About &Qt'),
771 0, 0, self, 'iconEditor_help_about_qt') 771 0, 0, self, 'iconEditor_help_about_qt')
772 self.aboutQtAct.setStatusTip( 772 self.aboutQtAct.setStatusTip(
773 self.trUtf8('Display information about the Qt toolkit')) 773 self.tr('Display information about the Qt toolkit'))
774 self.aboutQtAct.setWhatsThis(self.trUtf8( 774 self.aboutQtAct.setWhatsThis(self.tr(
775 """<b>About Qt</b>""" 775 """<b>About Qt</b>"""
776 """<p>Display some information about the Qt toolkit.</p>""" 776 """<p>Display some information about the Qt toolkit.</p>"""
777 )) 777 ))
778 self.aboutQtAct.triggered[()].connect(self.__aboutQt) 778 self.aboutQtAct.triggered[()].connect(self.__aboutQt)
779 self.__actions.append(self.aboutQtAct) 779 self.__actions.append(self.aboutQtAct)
780 780
781 self.whatsThisAct = E5Action( 781 self.whatsThisAct = E5Action(
782 self.trUtf8('What\'s This?'), 782 self.tr('What\'s This?'),
783 UI.PixmapCache.getIcon("whatsThis.png"), 783 UI.PixmapCache.getIcon("whatsThis.png"),
784 self.trUtf8('&What\'s This?'), 784 self.tr('&What\'s This?'),
785 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")), 785 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")),
786 0, self, 'iconEditor_help_whats_this') 786 0, self, 'iconEditor_help_whats_this')
787 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) 787 self.whatsThisAct.setStatusTip(self.tr('Context sensitive help'))
788 self.whatsThisAct.setWhatsThis(self.trUtf8( 788 self.whatsThisAct.setWhatsThis(self.tr(
789 """<b>Display context sensitive help</b>""" 789 """<b>Display context sensitive help</b>"""
790 """<p>In What's This? mode, the mouse cursor shows an arrow""" 790 """<p>In What's This? mode, the mouse cursor shows an arrow"""
791 """ with a question mark, and you can click on the interface""" 791 """ with a question mark, and you can click on the interface"""
792 """ elements to get a short description of what they do and""" 792 """ elements to get a short description of what they do and"""
793 """ how to use them. In dialogs, this feature can be accessed""" 793 """ how to use them. In dialogs, this feature can be accessed"""
800 """ 800 """
801 Private method to create the menus. 801 Private method to create the menus.
802 """ 802 """
803 mb = self.menuBar() 803 mb = self.menuBar()
804 804
805 menu = mb.addMenu(self.trUtf8('&File')) 805 menu = mb.addMenu(self.tr('&File'))
806 menu.setTearOffEnabled(True) 806 menu.setTearOffEnabled(True)
807 menu.addAction(self.newAct) 807 menu.addAction(self.newAct)
808 menu.addAction(self.newWindowAct) 808 menu.addAction(self.newWindowAct)
809 menu.addAction(self.openAct) 809 menu.addAction(self.openAct)
810 menu.addSeparator() 810 menu.addSeparator()
815 menu.addAction(self.closeAllAct) 815 menu.addAction(self.closeAllAct)
816 if not self.fromEric: 816 if not self.fromEric:
817 menu.addSeparator() 817 menu.addSeparator()
818 menu.addAction(self.exitAct) 818 menu.addAction(self.exitAct)
819 819
820 menu = mb.addMenu(self.trUtf8("&Edit")) 820 menu = mb.addMenu(self.tr("&Edit"))
821 menu.setTearOffEnabled(True) 821 menu.setTearOffEnabled(True)
822 menu.addAction(self.undoAct) 822 menu.addAction(self.undoAct)
823 menu.addAction(self.redoAct) 823 menu.addAction(self.redoAct)
824 menu.addSeparator() 824 menu.addSeparator()
825 menu.addAction(self.cutAct) 825 menu.addAction(self.cutAct)
831 menu.addAction(self.selectAllAct) 831 menu.addAction(self.selectAllAct)
832 menu.addSeparator() 832 menu.addSeparator()
833 menu.addAction(self.resizeAct) 833 menu.addAction(self.resizeAct)
834 menu.addAction(self.grayscaleAct) 834 menu.addAction(self.grayscaleAct)
835 835
836 menu = mb.addMenu(self.trUtf8('&View')) 836 menu = mb.addMenu(self.tr('&View'))
837 menu.setTearOffEnabled(True) 837 menu.setTearOffEnabled(True)
838 menu.addAction(self.zoomInAct) 838 menu.addAction(self.zoomInAct)
839 menu.addAction(self.zoomResetAct) 839 menu.addAction(self.zoomResetAct)
840 menu.addAction(self.zoomOutAct) 840 menu.addAction(self.zoomOutAct)
841 menu.addSeparator() 841 menu.addSeparator()
842 menu.addAction(self.showGridAct) 842 menu.addAction(self.showGridAct)
843 843
844 menu = mb.addMenu(self.trUtf8('&Tools')) 844 menu = mb.addMenu(self.tr('&Tools'))
845 menu.setTearOffEnabled(True) 845 menu.setTearOffEnabled(True)
846 menu.addAction(self.drawPencilAct) 846 menu.addAction(self.drawPencilAct)
847 menu.addAction(self.drawColorPickerAct) 847 menu.addAction(self.drawColorPickerAct)
848 menu.addAction(self.drawRectangleAct) 848 menu.addAction(self.drawRectangleAct)
849 menu.addAction(self.drawFilledRectangleAct) 849 menu.addAction(self.drawFilledRectangleAct)
858 menu.addAction(self.drawRectangleSelectionAct) 858 menu.addAction(self.drawRectangleSelectionAct)
859 menu.addAction(self.drawCircleSelectionAct) 859 menu.addAction(self.drawCircleSelectionAct)
860 860
861 mb.addSeparator() 861 mb.addSeparator()
862 862
863 menu = mb.addMenu(self.trUtf8("&Help")) 863 menu = mb.addMenu(self.tr("&Help"))
864 menu.addAction(self.aboutAct) 864 menu.addAction(self.aboutAct)
865 menu.addAction(self.aboutQtAct) 865 menu.addAction(self.aboutQtAct)
866 menu.addSeparator() 866 menu.addSeparator()
867 menu.addAction(self.whatsThisAct) 867 menu.addAction(self.whatsThisAct)
868 868
869 def __initToolbars(self): 869 def __initToolbars(self):
870 """ 870 """
871 Private method to create the toolbars. 871 Private method to create the toolbars.
872 """ 872 """
873 filetb = self.addToolBar(self.trUtf8("File")) 873 filetb = self.addToolBar(self.tr("File"))
874 filetb.setObjectName("FileToolBar") 874 filetb.setObjectName("FileToolBar")
875 filetb.setIconSize(UI.Config.ToolBarIconSize) 875 filetb.setIconSize(UI.Config.ToolBarIconSize)
876 filetb.addAction(self.newAct) 876 filetb.addAction(self.newAct)
877 filetb.addAction(self.newWindowAct) 877 filetb.addAction(self.newWindowAct)
878 filetb.addAction(self.openAct) 878 filetb.addAction(self.openAct)
882 filetb.addSeparator() 882 filetb.addSeparator()
883 filetb.addAction(self.closeAct) 883 filetb.addAction(self.closeAct)
884 if not self.fromEric: 884 if not self.fromEric:
885 filetb.addAction(self.exitAct) 885 filetb.addAction(self.exitAct)
886 886
887 edittb = self.addToolBar(self.trUtf8("Edit")) 887 edittb = self.addToolBar(self.tr("Edit"))
888 edittb.setObjectName("EditToolBar") 888 edittb.setObjectName("EditToolBar")
889 edittb.setIconSize(UI.Config.ToolBarIconSize) 889 edittb.setIconSize(UI.Config.ToolBarIconSize)
890 edittb.addAction(self.undoAct) 890 edittb.addAction(self.undoAct)
891 edittb.addAction(self.redoAct) 891 edittb.addAction(self.redoAct)
892 edittb.addSeparator() 892 edittb.addSeparator()
895 edittb.addAction(self.pasteAct) 895 edittb.addAction(self.pasteAct)
896 edittb.addSeparator() 896 edittb.addSeparator()
897 edittb.addAction(self.resizeAct) 897 edittb.addAction(self.resizeAct)
898 edittb.addAction(self.grayscaleAct) 898 edittb.addAction(self.grayscaleAct)
899 899
900 viewtb = self.addToolBar(self.trUtf8("View")) 900 viewtb = self.addToolBar(self.tr("View"))
901 viewtb.setObjectName("ViewToolBar") 901 viewtb.setObjectName("ViewToolBar")
902 viewtb.setIconSize(UI.Config.ToolBarIconSize) 902 viewtb.setIconSize(UI.Config.ToolBarIconSize)
903 viewtb.addAction(self.showGridAct) 903 viewtb.addAction(self.showGridAct)
904 904
905 toolstb = self.addToolBar(self.trUtf8("Tools")) 905 toolstb = self.addToolBar(self.tr("Tools"))
906 toolstb.setObjectName("ToolsToolBar") 906 toolstb.setObjectName("ToolsToolBar")
907 toolstb.setIconSize(UI.Config.ToolBarIconSize) 907 toolstb.setIconSize(UI.Config.ToolBarIconSize)
908 toolstb.addAction(self.drawPencilAct) 908 toolstb.addAction(self.drawPencilAct)
909 toolstb.addAction(self.drawColorPickerAct) 909 toolstb.addAction(self.drawColorPickerAct)
910 toolstb.addAction(self.drawRectangleAct) 910 toolstb.addAction(self.drawRectangleAct)
918 toolstb.addAction(self.drawEraserAct) 918 toolstb.addAction(self.drawEraserAct)
919 toolstb.addSeparator() 919 toolstb.addSeparator()
920 toolstb.addAction(self.drawRectangleSelectionAct) 920 toolstb.addAction(self.drawRectangleSelectionAct)
921 toolstb.addAction(self.drawCircleSelectionAct) 921 toolstb.addAction(self.drawCircleSelectionAct)
922 922
923 helptb = self.addToolBar(self.trUtf8("Help")) 923 helptb = self.addToolBar(self.tr("Help"))
924 helptb.setObjectName("HelpToolBar") 924 helptb.setObjectName("HelpToolBar")
925 helptb.setIconSize(UI.Config.ToolBarIconSize) 925 helptb.setIconSize(UI.Config.ToolBarIconSize)
926 helptb.addAction(self.whatsThisAct) 926 helptb.addAction(self.whatsThisAct)
927 927
928 def __createStatusBar(self): 928 def __createStatusBar(self):
932 self.__statusBar = self.statusBar() 932 self.__statusBar = self.statusBar()
933 self.__statusBar.setSizeGripEnabled(True) 933 self.__statusBar.setSizeGripEnabled(True)
934 934
935 self.__sbSize = QLabel(self.__statusBar) 935 self.__sbSize = QLabel(self.__statusBar)
936 self.__statusBar.addPermanentWidget(self.__sbSize) 936 self.__statusBar.addPermanentWidget(self.__sbSize)
937 self.__sbSize.setWhatsThis(self.trUtf8( 937 self.__sbSize.setWhatsThis(self.tr(
938 """<p>This part of the status bar displays the icon size.</p>""" 938 """<p>This part of the status bar displays the icon size.</p>"""
939 )) 939 ))
940 self.__updateSize(*self.__editor.iconSize()) 940 self.__updateSize(*self.__editor.iconSize())
941 941
942 self.__sbPos = QLabel(self.__statusBar) 942 self.__sbPos = QLabel(self.__statusBar)
943 self.__statusBar.addPermanentWidget(self.__sbPos) 943 self.__statusBar.addPermanentWidget(self.__sbPos)
944 self.__sbPos.setWhatsThis(self.trUtf8( 944 self.__sbPos.setWhatsThis(self.tr(
945 """<p>This part of the status bar displays the cursor""" 945 """<p>This part of the status bar displays the cursor"""
946 """ position.</p>""" 946 """ position.</p>"""
947 )) 947 ))
948 self.__updatePosition(0, 0) 948 self.__updatePosition(0, 0)
949 949
1037 if self.__project and self.__project.isOpen(): 1037 if self.__project and self.__project.isOpen():
1038 self.__lastOpenPath = self.__project.getProjectPath() 1038 self.__lastOpenPath = self.__project.getProjectPath()
1039 1039
1040 fileName = E5FileDialog.getOpenFileNameAndFilter( 1040 fileName = E5FileDialog.getOpenFileNameAndFilter(
1041 self, 1041 self,
1042 self.trUtf8("Open icon file"), 1042 self.tr("Open icon file"),
1043 self.__lastOpenPath, 1043 self.__lastOpenPath,
1044 self.__inputFilter, 1044 self.__inputFilter,
1045 self.__defaultFilter)[0] 1045 self.__defaultFilter)[0]
1046 if fileName: 1046 if fileName:
1047 self.__loadIconFile(fileName) 1047 self.__loadIconFile(fileName)
1071 if not self.__lastSavePath and self.__lastOpenPath: 1071 if not self.__lastSavePath and self.__lastOpenPath:
1072 self.__lastSavePath = self.__lastOpenPath 1072 self.__lastSavePath = self.__lastOpenPath
1073 1073
1074 fileName, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( 1074 fileName, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
1075 self, 1075 self,
1076 self.trUtf8("Save icon file"), 1076 self.tr("Save icon file"),
1077 self.__lastSavePath, 1077 self.__lastSavePath,
1078 self.__outputFilter, 1078 self.__outputFilter,
1079 self.__defaultFilter, 1079 self.__defaultFilter,
1080 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) 1080 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
1081 if not fileName: 1081 if not fileName:
1087 if ex: 1087 if ex:
1088 fileName += ex 1088 fileName += ex
1089 if QFileInfo(fileName).exists(): 1089 if QFileInfo(fileName).exists():
1090 res = E5MessageBox.yesNo( 1090 res = E5MessageBox.yesNo(
1091 self, 1091 self,
1092 self.trUtf8("Save icon file"), 1092 self.tr("Save icon file"),
1093 self.trUtf8("<p>The file <b>{0}</b> already exists." 1093 self.tr("<p>The file <b>{0}</b> already exists."
1094 " Overwrite it?</p>").format(fileName), 1094 " Overwrite it?</p>").format(fileName),
1095 icon=E5MessageBox.Warning) 1095 icon=E5MessageBox.Warning)
1096 if not res: 1096 if not res:
1097 return False 1097 return False
1098 1098
1099 self.__lastSavePath = os.path.dirname(fileName) 1099 self.__lastSavePath = os.path.dirname(fileName)
1116 @param fileName name of the icon file to load (string). 1116 @param fileName name of the icon file to load (string).
1117 """ 1117 """
1118 file = QFile(fileName) 1118 file = QFile(fileName)
1119 if not file.exists(): 1119 if not file.exists():
1120 E5MessageBox.warning( 1120 E5MessageBox.warning(
1121 self, self.trUtf8("eric5 Icon Editor"), 1121 self, self.tr("eric5 Icon Editor"),
1122 self.trUtf8("The file '{0}' does not exist.") 1122 self.tr("The file '{0}' does not exist.")
1123 .format(fileName)) 1123 .format(fileName))
1124 return 1124 return
1125 1125
1126 if not file.open(QFile.ReadOnly): 1126 if not file.open(QFile.ReadOnly):
1127 E5MessageBox.warning( 1127 E5MessageBox.warning(
1128 self, self.trUtf8("eric5 Icon Editor"), 1128 self, self.tr("eric5 Icon Editor"),
1129 self.trUtf8("Cannot read file '{0}:\n{1}.") 1129 self.tr("Cannot read file '{0}:\n{1}.")
1130 .format(fileName, file.errorString())) 1130 .format(fileName, file.errorString()))
1131 return 1131 return
1132 file.close() 1132 file.close()
1133 1133
1134 img = QImage(fileName) 1134 img = QImage(fileName)
1143 @return flag indicating success (boolean) 1143 @return flag indicating success (boolean)
1144 """ 1144 """
1145 file = QFile(fileName) 1145 file = QFile(fileName)
1146 if not file.open(QFile.WriteOnly): 1146 if not file.open(QFile.WriteOnly):
1147 E5MessageBox.warning( 1147 E5MessageBox.warning(
1148 self, self.trUtf8("eric5 Icon Editor"), 1148 self, self.tr("eric5 Icon Editor"),
1149 self.trUtf8("Cannot write file '{0}:\n{1}.") 1149 self.tr("Cannot write file '{0}:\n{1}.")
1150 .format(fileName, file.errorString())) 1150 .format(fileName, file.errorString()))
1151 1151
1152 self.__checkActions() 1152 self.__checkActions()
1153 1153
1154 return False 1154 return False
1157 res = img.save(file) 1157 res = img.save(file)
1158 file.close() 1158 file.close()
1159 1159
1160 if not res: 1160 if not res:
1161 E5MessageBox.warning( 1161 E5MessageBox.warning(
1162 self, self.trUtf8("eric5 Icon Editor"), 1162 self, self.tr("eric5 Icon Editor"),
1163 self.trUtf8("Cannot write file '{0}:\n{1}.") 1163 self.tr("Cannot write file '{0}:\n{1}.")
1164 .format(fileName, file.errorString())) 1164 .format(fileName, file.errorString()))
1165 1165
1166 self.__checkActions() 1166 self.__checkActions()
1167 1167
1168 return False 1168 return False
1169 1169
1170 self.__editor.setDirty(False, setCleanState=True) 1170 self.__editor.setDirty(False, setCleanState=True)
1171 1171
1172 self.__setCurrentFile(fileName) 1172 self.__setCurrentFile(fileName)
1173 self.__statusBar.showMessage(self.trUtf8("Icon saved"), 2000) 1173 self.__statusBar.showMessage(self.tr("Icon saved"), 2000)
1174 1174
1175 self.__checkActions() 1175 self.__checkActions()
1176 1176
1177 return True 1177 return True
1178 1178
1183 @param fileName name of the file to register (string) 1183 @param fileName name of the file to register (string)
1184 """ 1184 """
1185 self.__fileName = fileName 1185 self.__fileName = fileName
1186 1186
1187 if not self.__fileName: 1187 if not self.__fileName:
1188 shownName = self.trUtf8("Untitled") 1188 shownName = self.tr("Untitled")
1189 else: 1189 else:
1190 shownName = self.__strippedName(self.__fileName) 1190 shownName = self.__strippedName(self.__fileName)
1191 1191
1192 self.setWindowTitle(self.trUtf8("{0}[*] - {1}") 1192 self.setWindowTitle(self.tr("{0}[*] - {1}")
1193 .format(shownName, self.trUtf8("Icon Editor"))) 1193 .format(shownName, self.tr("Icon Editor")))
1194 1194
1195 self.setWindowModified(self.__editor.isDirty()) 1195 self.setWindowModified(self.__editor.isDirty())
1196 1196
1197 def __strippedName(self, fullFileName): 1197 def __strippedName(self, fullFileName):
1198 """ 1198 """
1210 @return flag indicating, if it is ok to continue (boolean) 1210 @return flag indicating, if it is ok to continue (boolean)
1211 """ 1211 """
1212 if self.__editor.isDirty(): 1212 if self.__editor.isDirty():
1213 ret = E5MessageBox.okToClearData( 1213 ret = E5MessageBox.okToClearData(
1214 self, 1214 self,
1215 self.trUtf8("eric5 Icon Editor"), 1215 self.tr("eric5 Icon Editor"),
1216 self.trUtf8("""The icon image has unsaved changes."""), 1216 self.tr("""The icon image has unsaved changes."""),
1217 self.__saveIcon) 1217 self.__saveIcon)
1218 if not ret: 1218 if not ret:
1219 return False 1219 return False
1220 return True 1220 return True
1221 1221
1299 def __about(self): 1299 def __about(self):
1300 """ 1300 """
1301 Private slot to show a little About message. 1301 Private slot to show a little About message.
1302 """ 1302 """
1303 E5MessageBox.about( 1303 E5MessageBox.about(
1304 self, self.trUtf8("About eric5 Icon Editor"), 1304 self, self.tr("About eric5 Icon Editor"),
1305 self.trUtf8("The eric5 Icon Editor is a simple editor component" 1305 self.tr("The eric5 Icon Editor is a simple editor component"
1306 " to perform icon drawing tasks.")) 1306 " to perform icon drawing tasks."))
1307 1307
1308 def __aboutQt(self): 1308 def __aboutQt(self):
1309 """ 1309 """
1310 Private slot to handle the About Qt dialog. 1310 Private slot to handle the About Qt dialog.
1311 """ 1311 """

eric ide

mercurial