3057:10516539f238 | 3058:0a02c433f52d |
---|---|
183 | 183 |
184 def __initFileActions(self): | 184 def __initFileActions(self): |
185 """ | 185 """ |
186 Private method to define the file related user interface actions. | 186 Private method to define the file related user interface actions. |
187 """ | 187 """ |
188 self.newAct = E5Action(self.trUtf8('New'), | 188 self.newAct = E5Action( |
189 self.trUtf8('New'), | |
189 UI.PixmapCache.getIcon("new.png"), | 190 UI.PixmapCache.getIcon("new.png"), |
190 self.trUtf8('&New'), | 191 self.trUtf8('&New'), |
191 QKeySequence(self.trUtf8("Ctrl+N", "File|New")), | 192 QKeySequence(self.trUtf8("Ctrl+N", "File|New")), |
192 0, self, 'iconEditor_file_new') | 193 0, self, 'iconEditor_file_new') |
193 self.newAct.setStatusTip(self.trUtf8('Create a new icon')) | 194 self.newAct.setStatusTip(self.trUtf8('Create a new icon')) |
196 """<p>This creates a new icon.</p>""" | 197 """<p>This creates a new icon.</p>""" |
197 )) | 198 )) |
198 self.newAct.triggered[()].connect(self.__newIcon) | 199 self.newAct.triggered[()].connect(self.__newIcon) |
199 self.__actions.append(self.newAct) | 200 self.__actions.append(self.newAct) |
200 | 201 |
201 self.newWindowAct = E5Action(self.trUtf8('New Window'), | 202 self.newWindowAct = E5Action( |
203 self.trUtf8('New Window'), | |
202 UI.PixmapCache.getIcon("newWindow.png"), | 204 UI.PixmapCache.getIcon("newWindow.png"), |
203 self.trUtf8('New &Window'), | 205 self.trUtf8('New &Window'), |
204 0, 0, self, 'iconEditor_file_new_window') | 206 0, 0, self, 'iconEditor_file_new_window') |
205 self.newWindowAct.setStatusTip(self.trUtf8( | 207 self.newWindowAct.setStatusTip(self.trUtf8( |
206 'Open a new icon editor window')) | 208 'Open a new icon editor window')) |
209 """<p>This opens a new icon editor window.</p>""" | 211 """<p>This opens a new icon editor window.</p>""" |
210 )) | 212 )) |
211 self.newWindowAct.triggered[()].connect(self.__newWindow) | 213 self.newWindowAct.triggered[()].connect(self.__newWindow) |
212 self.__actions.append(self.newWindowAct) | 214 self.__actions.append(self.newWindowAct) |
213 | 215 |
214 self.openAct = E5Action(self.trUtf8('Open'), | 216 self.openAct = E5Action( |
217 self.trUtf8('Open'), | |
215 UI.PixmapCache.getIcon("open.png"), | 218 UI.PixmapCache.getIcon("open.png"), |
216 self.trUtf8('&Open...'), | 219 self.trUtf8('&Open...'), |
217 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")), | 220 QKeySequence(self.trUtf8("Ctrl+O", "File|Open")), |
218 0, self, 'iconEditor_file_open') | 221 0, self, 'iconEditor_file_open') |
219 self.openAct.setStatusTip(self.trUtf8('Open an icon file for editing')) | 222 self.openAct.setStatusTip(self.trUtf8('Open an icon file for editing')) |
223 """ It pops up a file selection dialog.</p>""" | 226 """ It pops up a file selection dialog.</p>""" |
224 )) | 227 )) |
225 self.openAct.triggered[()].connect(self.__openIcon) | 228 self.openAct.triggered[()].connect(self.__openIcon) |
226 self.__actions.append(self.openAct) | 229 self.__actions.append(self.openAct) |
227 | 230 |
228 self.saveAct = E5Action(self.trUtf8('Save'), | 231 self.saveAct = E5Action( |
229 UI.PixmapCache.getIcon("fileSave.png"), | 232 self.trUtf8('Save'), |
230 self.trUtf8('&Save'), | 233 UI.PixmapCache.getIcon("fileSave.png"), |
231 QKeySequence(self.trUtf8("Ctrl+S", "File|Save")), | 234 self.trUtf8('&Save'), |
232 0, self, 'iconEditor_file_save') | 235 QKeySequence(self.trUtf8("Ctrl+S", "File|Save")), |
236 0, self, 'iconEditor_file_save') | |
233 self.saveAct.setStatusTip(self.trUtf8('Save the current icon')) | 237 self.saveAct.setStatusTip(self.trUtf8('Save the current icon')) |
234 self.saveAct.setWhatsThis(self.trUtf8( | 238 self.saveAct.setWhatsThis(self.trUtf8( |
235 """<b>Save File</b>""" | 239 """<b>Save File</b>""" |
236 """<p>Save the contents of the icon editor window.</p>""" | 240 """<p>Save the contents of the icon editor window.</p>""" |
237 )) | 241 )) |
238 self.saveAct.triggered[()].connect(self.__saveIcon) | 242 self.saveAct.triggered[()].connect(self.__saveIcon) |
239 self.__actions.append(self.saveAct) | 243 self.__actions.append(self.saveAct) |
240 | 244 |
241 self.saveAsAct = E5Action(self.trUtf8('Save As'), | 245 self.saveAsAct = E5Action( |
246 self.trUtf8('Save As'), | |
242 UI.PixmapCache.getIcon("fileSaveAs.png"), | 247 UI.PixmapCache.getIcon("fileSaveAs.png"), |
243 self.trUtf8('Save &As...'), | 248 self.trUtf8('Save &As...'), |
244 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), | 249 QKeySequence(self.trUtf8("Shift+Ctrl+S", "File|Save As")), |
245 0, self, 'iconEditor_file_save_as') | 250 0, self, 'iconEditor_file_save_as') |
246 self.saveAsAct.setStatusTip( | 251 self.saveAsAct.setStatusTip( |
250 """<p>Saves the current icon to a new file.</p>""" | 255 """<p>Saves the current icon to a new file.</p>""" |
251 )) | 256 )) |
252 self.saveAsAct.triggered[()].connect(self.__saveIconAs) | 257 self.saveAsAct.triggered[()].connect(self.__saveIconAs) |
253 self.__actions.append(self.saveAsAct) | 258 self.__actions.append(self.saveAsAct) |
254 | 259 |
255 self.closeAct = E5Action(self.trUtf8('Close'), | 260 self.closeAct = E5Action( |
261 self.trUtf8('Close'), | |
256 UI.PixmapCache.getIcon("close.png"), | 262 UI.PixmapCache.getIcon("close.png"), |
257 self.trUtf8('&Close'), | 263 self.trUtf8('&Close'), |
258 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")), | 264 QKeySequence(self.trUtf8("Ctrl+W", "File|Close")), |
259 0, self, 'iconEditor_file_close') | 265 0, self, 'iconEditor_file_close') |
260 self.closeAct.setStatusTip(self.trUtf8( | 266 self.closeAct.setStatusTip(self.trUtf8( |
264 """<p>Closes the current icon editor window.</p>""" | 270 """<p>Closes the current icon editor window.</p>""" |
265 )) | 271 )) |
266 self.closeAct.triggered[()].connect(self.close) | 272 self.closeAct.triggered[()].connect(self.close) |
267 self.__actions.append(self.closeAct) | 273 self.__actions.append(self.closeAct) |
268 | 274 |
269 self.closeAllAct = E5Action(self.trUtf8('Close All'), | 275 self.closeAllAct = E5Action( |
276 self.trUtf8('Close All'), | |
270 self.trUtf8('Close &All'), | 277 self.trUtf8('Close &All'), |
271 0, 0, self, 'iconEditor_file_close_all') | 278 0, 0, self, 'iconEditor_file_close_all') |
272 self.closeAllAct.setStatusTip(self.trUtf8( | 279 self.closeAllAct.setStatusTip(self.trUtf8( |
273 'Close all icon editor windows')) | 280 'Close all icon editor windows')) |
274 self.closeAllAct.setWhatsThis(self.trUtf8( | 281 self.closeAllAct.setWhatsThis(self.trUtf8( |
276 """<p>Closes all icon editor windows except the first one.</p>""" | 283 """<p>Closes all icon editor windows except the first one.</p>""" |
277 )) | 284 )) |
278 self.closeAllAct.triggered[()].connect(self.__closeAll) | 285 self.closeAllAct.triggered[()].connect(self.__closeAll) |
279 self.__actions.append(self.closeAllAct) | 286 self.__actions.append(self.closeAllAct) |
280 | 287 |
281 self.exitAct = E5Action(self.trUtf8('Quit'), | 288 self.exitAct = E5Action( |
289 self.trUtf8('Quit'), | |
282 UI.PixmapCache.getIcon("exit.png"), | 290 UI.PixmapCache.getIcon("exit.png"), |
283 self.trUtf8('&Quit'), | 291 self.trUtf8('&Quit'), |
284 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit")), | 292 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit")), |
285 0, self, 'iconEditor_file_quit') | 293 0, self, 'iconEditor_file_quit') |
286 self.exitAct.setStatusTip(self.trUtf8('Quit the icon editor')) | 294 self.exitAct.setStatusTip(self.trUtf8('Quit the icon editor')) |
294 | 302 |
295 def __initEditActions(self): | 303 def __initEditActions(self): |
296 """ | 304 """ |
297 Private method to create the Edit actions. | 305 Private method to create the Edit actions. |
298 """ | 306 """ |
299 self.undoAct = E5Action(self.trUtf8('Undo'), | 307 self.undoAct = E5Action( |
300 UI.PixmapCache.getIcon("editUndo.png"), | 308 self.trUtf8('Undo'), |
301 self.trUtf8('&Undo'), | 309 UI.PixmapCache.getIcon("editUndo.png"), |
302 QKeySequence(self.trUtf8("Ctrl+Z", "Edit|Undo")), | 310 self.trUtf8('&Undo'), |
303 QKeySequence(self.trUtf8("Alt+Backspace", "Edit|Undo")), | 311 QKeySequence(self.trUtf8("Ctrl+Z", "Edit|Undo")), |
304 self, 'iconEditor_edit_undo') | 312 QKeySequence(self.trUtf8("Alt+Backspace", "Edit|Undo")), |
313 self, 'iconEditor_edit_undo') | |
305 self.undoAct.setStatusTip(self.trUtf8('Undo the last change')) | 314 self.undoAct.setStatusTip(self.trUtf8('Undo the last change')) |
306 self.undoAct.setWhatsThis(self.trUtf8( | 315 self.undoAct.setWhatsThis(self.trUtf8( |
307 """<b>Undo</b>""" | 316 """<b>Undo</b>""" |
308 """<p>Undo the last change done.</p>""" | 317 """<p>Undo the last change done.</p>""" |
309 )) | 318 )) |
310 self.undoAct.triggered[()].connect(self.__editor.editUndo) | 319 self.undoAct.triggered[()].connect(self.__editor.editUndo) |
311 self.__actions.append(self.undoAct) | 320 self.__actions.append(self.undoAct) |
312 | 321 |
313 self.redoAct = E5Action(self.trUtf8('Redo'), | 322 self.redoAct = E5Action( |
314 UI.PixmapCache.getIcon("editRedo.png"), | 323 self.trUtf8('Redo'), |
315 self.trUtf8('&Redo'), | 324 UI.PixmapCache.getIcon("editRedo.png"), |
316 QKeySequence(self.trUtf8("Ctrl+Shift+Z", "Edit|Redo")), | 325 self.trUtf8('&Redo'), |
317 0, self, 'iconEditor_edit_redo') | 326 QKeySequence(self.trUtf8("Ctrl+Shift+Z", "Edit|Redo")), |
327 0, self, 'iconEditor_edit_redo') | |
318 self.redoAct.setStatusTip(self.trUtf8('Redo the last change')) | 328 self.redoAct.setStatusTip(self.trUtf8('Redo the last change')) |
319 self.redoAct.setWhatsThis(self.trUtf8( | 329 self.redoAct.setWhatsThis(self.trUtf8( |
320 """<b>Redo</b>""" | 330 """<b>Redo</b>""" |
321 """<p>Redo the last change done.</p>""" | 331 """<p>Redo the last change done.</p>""" |
322 )) | 332 )) |
323 self.redoAct.triggered[()].connect(self.__editor.editRedo) | 333 self.redoAct.triggered[()].connect(self.__editor.editRedo) |
324 self.__actions.append(self.redoAct) | 334 self.__actions.append(self.redoAct) |
325 | 335 |
326 self.cutAct = E5Action(self.trUtf8('Cut'), | 336 self.cutAct = E5Action( |
327 UI.PixmapCache.getIcon("editCut.png"), | 337 self.trUtf8('Cut'), |
328 self.trUtf8('Cu&t'), | 338 UI.PixmapCache.getIcon("editCut.png"), |
329 QKeySequence(self.trUtf8("Ctrl+X", "Edit|Cut")), | 339 self.trUtf8('Cu&t'), |
330 QKeySequence(self.trUtf8("Shift+Del", "Edit|Cut")), | 340 QKeySequence(self.trUtf8("Ctrl+X", "Edit|Cut")), |
331 self, 'iconEditor_edit_cut') | 341 QKeySequence(self.trUtf8("Shift+Del", "Edit|Cut")), |
342 self, 'iconEditor_edit_cut') | |
332 self.cutAct.setStatusTip(self.trUtf8('Cut the selection')) | 343 self.cutAct.setStatusTip(self.trUtf8('Cut the selection')) |
333 self.cutAct.setWhatsThis(self.trUtf8( | 344 self.cutAct.setWhatsThis(self.trUtf8( |
334 """<b>Cut</b>""" | 345 """<b>Cut</b>""" |
335 """<p>Cut the selected image area to the clipboard.</p>""" | 346 """<p>Cut the selected image area to the clipboard.</p>""" |
336 )) | 347 )) |
337 self.cutAct.triggered[()].connect(self.__editor.editCut) | 348 self.cutAct.triggered[()].connect(self.__editor.editCut) |
338 self.__actions.append(self.cutAct) | 349 self.__actions.append(self.cutAct) |
339 | 350 |
340 self.copyAct = E5Action(self.trUtf8('Copy'), | 351 self.copyAct = E5Action( |
341 UI.PixmapCache.getIcon("editCopy.png"), | 352 self.trUtf8('Copy'), |
342 self.trUtf8('&Copy'), | 353 UI.PixmapCache.getIcon("editCopy.png"), |
343 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy")), | 354 self.trUtf8('&Copy'), |
344 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")), | 355 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy")), |
345 self, 'iconEditor_edit_copy') | 356 QKeySequence(self.trUtf8("Ctrl+Ins", "Edit|Copy")), |
357 self, 'iconEditor_edit_copy') | |
346 self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) | 358 self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) |
347 self.copyAct.setWhatsThis(self.trUtf8( | 359 self.copyAct.setWhatsThis(self.trUtf8( |
348 """<b>Copy</b>""" | 360 """<b>Copy</b>""" |
349 """<p>Copy the selected image area to the clipboard.</p>""" | 361 """<p>Copy the selected image area to the clipboard.</p>""" |
350 )) | 362 )) |
351 self.copyAct.triggered[()].connect(self.__editor.editCopy) | 363 self.copyAct.triggered[()].connect(self.__editor.editCopy) |
352 self.__actions.append(self.copyAct) | 364 self.__actions.append(self.copyAct) |
353 | 365 |
354 self.pasteAct = E5Action(self.trUtf8('Paste'), | 366 self.pasteAct = E5Action( |
355 UI.PixmapCache.getIcon("editPaste.png"), | 367 self.trUtf8('Paste'), |
356 self.trUtf8('&Paste'), | 368 UI.PixmapCache.getIcon("editPaste.png"), |
357 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")), | 369 self.trUtf8('&Paste'), |
358 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")), | 370 QKeySequence(self.trUtf8("Ctrl+V", "Edit|Paste")), |
359 self, 'iconEditor_edit_paste') | 371 QKeySequence(self.trUtf8("Shift+Ins", "Edit|Paste")), |
372 self, 'iconEditor_edit_paste') | |
360 self.pasteAct.setStatusTip(self.trUtf8('Paste the clipboard image')) | 373 self.pasteAct.setStatusTip(self.trUtf8('Paste the clipboard image')) |
361 self.pasteAct.setWhatsThis(self.trUtf8( | 374 self.pasteAct.setWhatsThis(self.trUtf8( |
362 """<b>Paste</b>""" | 375 """<b>Paste</b>""" |
363 """<p>Paste the clipboard image.</p>""" | 376 """<p>Paste the clipboard image.</p>""" |
364 )) | 377 )) |
365 self.pasteAct.triggered[()].connect(self.__editor.editPaste) | 378 self.pasteAct.triggered[()].connect(self.__editor.editPaste) |
366 self.__actions.append(self.pasteAct) | 379 self.__actions.append(self.pasteAct) |
367 | 380 |
368 self.pasteNewAct = E5Action(self.trUtf8('Paste as New'), | 381 self.pasteNewAct = E5Action( |
369 self.trUtf8('Paste as &New'), | 382 self.trUtf8('Paste as New'), |
370 0, 0, self, 'iconEditor_edit_paste_as_new') | 383 self.trUtf8('Paste as &New'), |
384 0, 0, self, 'iconEditor_edit_paste_as_new') | |
371 self.pasteNewAct.setStatusTip(self.trUtf8( | 385 self.pasteNewAct.setStatusTip(self.trUtf8( |
372 'Paste the clipboard image replacing the current one')) | 386 'Paste the clipboard image replacing the current one')) |
373 self.pasteNewAct.setWhatsThis(self.trUtf8( | 387 self.pasteNewAct.setWhatsThis(self.trUtf8( |
374 """<b>Paste as New</b>""" | 388 """<b>Paste as New</b>""" |
375 """<p>Paste the clipboard image replacing the current one.</p>""" | 389 """<p>Paste the clipboard image replacing the current one.</p>""" |
376 )) | 390 )) |
377 self.pasteNewAct.triggered[()].connect(self.__editor.editPasteAsNew) | 391 self.pasteNewAct.triggered[()].connect(self.__editor.editPasteAsNew) |
378 self.__actions.append(self.pasteNewAct) | 392 self.__actions.append(self.pasteNewAct) |
379 | 393 |
380 self.deleteAct = E5Action(self.trUtf8('Clear'), | 394 self.deleteAct = E5Action( |
381 UI.PixmapCache.getIcon("editDelete.png"), | 395 self.trUtf8('Clear'), |
382 self.trUtf8('Cl&ear'), | 396 UI.PixmapCache.getIcon("editDelete.png"), |
383 QKeySequence(self.trUtf8("Alt+Shift+C", "Edit|Clear")), | 397 self.trUtf8('Cl&ear'), |
384 0, | 398 QKeySequence(self.trUtf8("Alt+Shift+C", "Edit|Clear")), |
385 self, 'iconEditor_edit_clear') | 399 0, |
400 self, 'iconEditor_edit_clear') | |
386 self.deleteAct.setStatusTip(self.trUtf8('Clear the icon image')) | 401 self.deleteAct.setStatusTip(self.trUtf8('Clear the icon image')) |
387 self.deleteAct.setWhatsThis(self.trUtf8( | 402 self.deleteAct.setWhatsThis(self.trUtf8( |
388 """<b>Clear</b>""" | 403 """<b>Clear</b>""" |
389 """<p>Clear the icon image and set it to be completely""" | 404 """<p>Clear the icon image and set it to be completely""" |
390 """ transparent.</p>""" | 405 """ transparent.</p>""" |
391 )) | 406 )) |
392 self.deleteAct.triggered[()].connect(self.__editor.editClear) | 407 self.deleteAct.triggered[()].connect(self.__editor.editClear) |
393 self.__actions.append(self.deleteAct) | 408 self.__actions.append(self.deleteAct) |
394 | 409 |
395 self.selectAllAct = E5Action(self.trUtf8('Select All'), | 410 self.selectAllAct = E5Action( |
396 self.trUtf8('&Select All'), | 411 self.trUtf8('Select All'), |
397 QKeySequence(self.trUtf8("Ctrl+A", "Edit|Select All")), | 412 self.trUtf8('&Select All'), |
398 0, | 413 QKeySequence(self.trUtf8("Ctrl+A", "Edit|Select All")), |
399 self, 'iconEditor_edit_select_all') | 414 0, |
415 self, 'iconEditor_edit_select_all') | |
400 self.selectAllAct.setStatusTip(self.trUtf8( | 416 self.selectAllAct.setStatusTip(self.trUtf8( |
401 'Select the complete icon image')) | 417 'Select the complete icon image')) |
402 self.selectAllAct.setWhatsThis(self.trUtf8( | 418 self.selectAllAct.setWhatsThis(self.trUtf8( |
403 """<b>Select All</b>""" | 419 """<b>Select All</b>""" |
404 """<p>Selects the complete icon image.</p>""" | 420 """<p>Selects the complete icon image.</p>""" |
405 )) | 421 )) |
406 self.selectAllAct.triggered[()].connect(self.__editor.editSelectAll) | 422 self.selectAllAct.triggered[()].connect(self.__editor.editSelectAll) |
407 self.__actions.append(self.selectAllAct) | 423 self.__actions.append(self.selectAllAct) |
408 | 424 |
409 self.resizeAct = E5Action(self.trUtf8('Change Size'), | 425 self.resizeAct = E5Action( |
410 UI.PixmapCache.getIcon("transformResize.png"), | 426 self.trUtf8('Change Size'), |
411 self.trUtf8('Change Si&ze...'), | 427 UI.PixmapCache.getIcon("transformResize.png"), |
412 0, 0, | 428 self.trUtf8('Change Si&ze...'), |
413 self, 'iconEditor_edit_change_size') | 429 0, 0, |
430 self, 'iconEditor_edit_change_size') | |
414 self.resizeAct.setStatusTip(self.trUtf8('Change the icon size')) | 431 self.resizeAct.setStatusTip(self.trUtf8('Change the icon size')) |
415 self.resizeAct.setWhatsThis(self.trUtf8( | 432 self.resizeAct.setWhatsThis(self.trUtf8( |
416 """<b>Change Size...</b>""" | 433 """<b>Change Size...</b>""" |
417 """<p>Changes the icon size.</p>""" | 434 """<p>Changes the icon size.</p>""" |
418 )) | 435 )) |
419 self.resizeAct.triggered[()].connect(self.__editor.editResize) | 436 self.resizeAct.triggered[()].connect(self.__editor.editResize) |
420 self.__actions.append(self.resizeAct) | 437 self.__actions.append(self.resizeAct) |
421 | 438 |
422 self.grayscaleAct = E5Action(self.trUtf8('Grayscale'), | 439 self.grayscaleAct = E5Action( |
423 UI.PixmapCache.getIcon("grayscale.png"), | 440 self.trUtf8('Grayscale'), |
424 self.trUtf8('&Grayscale'), | 441 UI.PixmapCache.getIcon("grayscale.png"), |
425 0, 0, | 442 self.trUtf8('&Grayscale'), |
426 self, 'iconEditor_edit_grayscale') | 443 0, 0, |
444 self, 'iconEditor_edit_grayscale') | |
427 self.grayscaleAct.setStatusTip(self.trUtf8( | 445 self.grayscaleAct.setStatusTip(self.trUtf8( |
428 'Change the icon to grayscale')) | 446 'Change the icon to grayscale')) |
429 self.grayscaleAct.setWhatsThis(self.trUtf8( | 447 self.grayscaleAct.setWhatsThis(self.trUtf8( |
430 """<b>Grayscale</b>""" | 448 """<b>Grayscale</b>""" |
431 """<p>Changes the icon to grayscale.</p>""" | 449 """<p>Changes the icon to grayscale.</p>""" |
453 | 471 |
454 def __initViewActions(self): | 472 def __initViewActions(self): |
455 """ | 473 """ |
456 Private method to create the View actions. | 474 Private method to create the View actions. |
457 """ | 475 """ |
458 self.zoomInAct = E5Action(self.trUtf8('Zoom in'), | 476 self.zoomInAct = E5Action( |
477 self.trUtf8('Zoom in'), | |
459 UI.PixmapCache.getIcon("zoomIn.png"), | 478 UI.PixmapCache.getIcon("zoomIn.png"), |
460 self.trUtf8('Zoom &in'), | 479 self.trUtf8('Zoom &in'), |
461 QKeySequence(self.trUtf8("Ctrl++", "View|Zoom in")), | 480 QKeySequence(self.trUtf8("Ctrl++", "View|Zoom in")), |
462 0, self, 'iconEditor_view_zoom_in') | 481 0, self, 'iconEditor_view_zoom_in') |
463 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the icon')) | 482 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the icon')) |
466 """<p>Zoom in on the icon. This makes the grid bigger.</p>""" | 485 """<p>Zoom in on the icon. This makes the grid bigger.</p>""" |
467 )) | 486 )) |
468 self.zoomInAct.triggered[()].connect(self.__zoomIn) | 487 self.zoomInAct.triggered[()].connect(self.__zoomIn) |
469 self.__actions.append(self.zoomInAct) | 488 self.__actions.append(self.zoomInAct) |
470 | 489 |
471 self.zoomOutAct = E5Action(self.trUtf8('Zoom out'), | 490 self.zoomOutAct = E5Action( |
491 self.trUtf8('Zoom out'), | |
472 UI.PixmapCache.getIcon("zoomOut.png"), | 492 UI.PixmapCache.getIcon("zoomOut.png"), |
473 self.trUtf8('Zoom &out'), | 493 self.trUtf8('Zoom &out'), |
474 QKeySequence(self.trUtf8("Ctrl+-", "View|Zoom out")), | 494 QKeySequence(self.trUtf8("Ctrl+-", "View|Zoom out")), |
475 0, self, 'iconEditor_view_zoom_out') | 495 0, self, 'iconEditor_view_zoom_out') |
476 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the icon')) | 496 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the icon')) |
479 """<p>Zoom out on the icon. This makes the grid smaller.</p>""" | 499 """<p>Zoom out on the icon. This makes the grid smaller.</p>""" |
480 )) | 500 )) |
481 self.zoomOutAct.triggered[()].connect(self.__zoomOut) | 501 self.zoomOutAct.triggered[()].connect(self.__zoomOut) |
482 self.__actions.append(self.zoomOutAct) | 502 self.__actions.append(self.zoomOutAct) |
483 | 503 |
484 self.zoomResetAct = E5Action(self.trUtf8('Zoom reset'), | 504 self.zoomResetAct = E5Action( |
505 self.trUtf8('Zoom reset'), | |
485 UI.PixmapCache.getIcon("zoomReset.png"), | 506 UI.PixmapCache.getIcon("zoomReset.png"), |
486 self.trUtf8('Zoom &reset'), | 507 self.trUtf8('Zoom &reset'), |
487 QKeySequence(self.trUtf8("Ctrl+0", "View|Zoom reset")), | 508 QKeySequence(self.trUtf8("Ctrl+0", "View|Zoom reset")), |
488 0, self, 'iconEditor_view_zoom_reset') | 509 0, self, 'iconEditor_view_zoom_reset') |
489 self.zoomResetAct.setStatusTip(self.trUtf8( | 510 self.zoomResetAct.setStatusTip(self.trUtf8( |
494 """This sets the zoom factor to 100%.</p>""" | 515 """This sets the zoom factor to 100%.</p>""" |
495 )) | 516 )) |
496 self.zoomResetAct.triggered[()].connect(self.__zoomReset) | 517 self.zoomResetAct.triggered[()].connect(self.__zoomReset) |
497 self.__actions.append(self.zoomResetAct) | 518 self.__actions.append(self.zoomResetAct) |
498 | 519 |
499 self.showGridAct = E5Action(self.trUtf8('Show Grid'), | 520 self.showGridAct = E5Action( |
521 self.trUtf8('Show Grid'), | |
500 UI.PixmapCache.getIcon("grid.png"), | 522 UI.PixmapCache.getIcon("grid.png"), |
501 self.trUtf8('Show &Grid'), | 523 self.trUtf8('Show &Grid'), |
502 0, 0, | 524 0, 0, |
503 self, 'iconEditor_view_show_grid') | 525 self, 'iconEditor_view_show_grid') |
504 self.showGridAct.setStatusTip(self.trUtf8( | 526 self.showGridAct.setStatusTip(self.trUtf8( |
520 self.esm.mapped[int].connect(self.__editor.setTool) | 542 self.esm.mapped[int].connect(self.__editor.setTool) |
521 | 543 |
522 self.drawingActGrp = createActionGroup(self) | 544 self.drawingActGrp = createActionGroup(self) |
523 self.drawingActGrp.setExclusive(True) | 545 self.drawingActGrp.setExclusive(True) |
524 | 546 |
525 self.drawPencilAct = E5Action(self.trUtf8('Freehand'), | 547 self.drawPencilAct = E5Action( |
548 self.trUtf8('Freehand'), | |
526 UI.PixmapCache.getIcon("drawBrush.png"), | 549 UI.PixmapCache.getIcon("drawBrush.png"), |
527 self.trUtf8('&Freehand'), | 550 self.trUtf8('&Freehand'), |
528 0, 0, | 551 0, 0, |
529 self.drawingActGrp, 'iconEditor_tools_pencil') | 552 self.drawingActGrp, 'iconEditor_tools_pencil') |
530 self.drawPencilAct.setWhatsThis(self.trUtf8( | 553 self.drawPencilAct.setWhatsThis(self.trUtf8( |
534 self.drawPencilAct.setCheckable(True) | 557 self.drawPencilAct.setCheckable(True) |
535 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil) | 558 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil) |
536 self.drawPencilAct.triggered[()].connect(self.esm.map) | 559 self.drawPencilAct.triggered[()].connect(self.esm.map) |
537 self.__actions.append(self.drawPencilAct) | 560 self.__actions.append(self.drawPencilAct) |
538 | 561 |
539 self.drawColorPickerAct = E5Action(self.trUtf8('Color Picker'), | 562 self.drawColorPickerAct = E5Action( |
563 self.trUtf8('Color Picker'), | |
540 UI.PixmapCache.getIcon("colorPicker.png"), | 564 UI.PixmapCache.getIcon("colorPicker.png"), |
541 self.trUtf8('&Color Picker'), | 565 self.trUtf8('&Color Picker'), |
542 0, 0, | 566 0, 0, |
543 self.drawingActGrp, 'iconEditor_tools_color_picker') | 567 self.drawingActGrp, 'iconEditor_tools_color_picker') |
544 self.drawColorPickerAct.setWhatsThis(self.trUtf8( | 568 self.drawColorPickerAct.setWhatsThis(self.trUtf8( |
550 self.esm.setMapping(self.drawColorPickerAct, | 574 self.esm.setMapping(self.drawColorPickerAct, |
551 IconEditorGrid.ColorPicker) | 575 IconEditorGrid.ColorPicker) |
552 self.drawColorPickerAct.triggered[()].connect(self.esm.map) | 576 self.drawColorPickerAct.triggered[()].connect(self.esm.map) |
553 self.__actions.append(self.drawColorPickerAct) | 577 self.__actions.append(self.drawColorPickerAct) |
554 | 578 |
555 self.drawRectangleAct = E5Action(self.trUtf8('Rectangle'), | 579 self.drawRectangleAct = E5Action( |
580 self.trUtf8('Rectangle'), | |
556 UI.PixmapCache.getIcon("drawRectangle.png"), | 581 UI.PixmapCache.getIcon("drawRectangle.png"), |
557 self.trUtf8('&Rectangle'), | 582 self.trUtf8('&Rectangle'), |
558 0, 0, | 583 0, 0, |
559 self.drawingActGrp, 'iconEditor_tools_rectangle') | 584 self.drawingActGrp, 'iconEditor_tools_rectangle') |
560 self.drawRectangleAct.setWhatsThis(self.trUtf8( | 585 self.drawRectangleAct.setWhatsThis(self.trUtf8( |
564 self.drawRectangleAct.setCheckable(True) | 589 self.drawRectangleAct.setCheckable(True) |
565 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle) | 590 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle) |
566 self.drawRectangleAct.triggered[()].connect(self.esm.map) | 591 self.drawRectangleAct.triggered[()].connect(self.esm.map) |
567 self.__actions.append(self.drawRectangleAct) | 592 self.__actions.append(self.drawRectangleAct) |
568 | 593 |
569 self.drawFilledRectangleAct = E5Action(self.trUtf8('Filled Rectangle'), | 594 self.drawFilledRectangleAct = E5Action( |
595 self.trUtf8('Filled Rectangle'), | |
570 UI.PixmapCache.getIcon("drawRectangleFilled.png"), | 596 UI.PixmapCache.getIcon("drawRectangleFilled.png"), |
571 self.trUtf8('F&illed Rectangle'), | 597 self.trUtf8('F&illed Rectangle'), |
572 0, 0, | 598 0, 0, |
573 self.drawingActGrp, 'iconEditor_tools_filled_rectangle') | 599 self.drawingActGrp, 'iconEditor_tools_filled_rectangle') |
574 self.drawFilledRectangleAct.setWhatsThis(self.trUtf8( | 600 self.drawFilledRectangleAct.setWhatsThis(self.trUtf8( |
579 self.esm.setMapping(self.drawFilledRectangleAct, | 605 self.esm.setMapping(self.drawFilledRectangleAct, |
580 IconEditorGrid.FilledRectangle) | 606 IconEditorGrid.FilledRectangle) |
581 self.drawFilledRectangleAct.triggered[()].connect(self.esm.map) | 607 self.drawFilledRectangleAct.triggered[()].connect(self.esm.map) |
582 self.__actions.append(self.drawFilledRectangleAct) | 608 self.__actions.append(self.drawFilledRectangleAct) |
583 | 609 |
584 self.drawCircleAct = E5Action(self.trUtf8('Circle'), | 610 self.drawCircleAct = E5Action( |
611 self.trUtf8('Circle'), | |
585 UI.PixmapCache.getIcon("drawCircle.png"), | 612 UI.PixmapCache.getIcon("drawCircle.png"), |
586 self.trUtf8('Circle'), | 613 self.trUtf8('Circle'), |
587 0, 0, | 614 0, 0, |
588 self.drawingActGrp, 'iconEditor_tools_circle') | 615 self.drawingActGrp, 'iconEditor_tools_circle') |
589 self.drawCircleAct.setWhatsThis(self.trUtf8( | 616 self.drawCircleAct.setWhatsThis(self.trUtf8( |
593 self.drawCircleAct.setCheckable(True) | 620 self.drawCircleAct.setCheckable(True) |
594 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle) | 621 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle) |
595 self.drawCircleAct.triggered[()].connect(self.esm.map) | 622 self.drawCircleAct.triggered[()].connect(self.esm.map) |
596 self.__actions.append(self.drawCircleAct) | 623 self.__actions.append(self.drawCircleAct) |
597 | 624 |
598 self.drawFilledCircleAct = E5Action(self.trUtf8('Filled Circle'), | 625 self.drawFilledCircleAct = E5Action( |
626 self.trUtf8('Filled Circle'), | |
599 UI.PixmapCache.getIcon("drawCircleFilled.png"), | 627 UI.PixmapCache.getIcon("drawCircleFilled.png"), |
600 self.trUtf8('Fille&d Circle'), | 628 self.trUtf8('Fille&d Circle'), |
601 0, 0, | 629 0, 0, |
602 self.drawingActGrp, 'iconEditor_tools_filled_circle') | 630 self.drawingActGrp, 'iconEditor_tools_filled_circle') |
603 self.drawFilledCircleAct.setWhatsThis(self.trUtf8( | 631 self.drawFilledCircleAct.setWhatsThis(self.trUtf8( |
608 self.esm.setMapping(self.drawFilledCircleAct, | 636 self.esm.setMapping(self.drawFilledCircleAct, |
609 IconEditorGrid.FilledCircle) | 637 IconEditorGrid.FilledCircle) |
610 self.drawFilledCircleAct.triggered[()].connect(self.esm.map) | 638 self.drawFilledCircleAct.triggered[()].connect(self.esm.map) |
611 self.__actions.append(self.drawFilledCircleAct) | 639 self.__actions.append(self.drawFilledCircleAct) |
612 | 640 |
613 self.drawEllipseAct = E5Action(self.trUtf8('Ellipse'), | 641 self.drawEllipseAct = E5Action( |
642 self.trUtf8('Ellipse'), | |
614 UI.PixmapCache.getIcon("drawEllipse.png"), | 643 UI.PixmapCache.getIcon("drawEllipse.png"), |
615 self.trUtf8('&Ellipse'), | 644 self.trUtf8('&Ellipse'), |
616 0, 0, | 645 0, 0, |
617 self.drawingActGrp, 'iconEditor_tools_ellipse') | 646 self.drawingActGrp, 'iconEditor_tools_ellipse') |
618 self.drawEllipseAct.setWhatsThis(self.trUtf8( | 647 self.drawEllipseAct.setWhatsThis(self.trUtf8( |
622 self.drawEllipseAct.setCheckable(True) | 651 self.drawEllipseAct.setCheckable(True) |
623 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse) | 652 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse) |
624 self.drawEllipseAct.triggered[()].connect(self.esm.map) | 653 self.drawEllipseAct.triggered[()].connect(self.esm.map) |
625 self.__actions.append(self.drawEllipseAct) | 654 self.__actions.append(self.drawEllipseAct) |
626 | 655 |
627 self.drawFilledEllipseAct = E5Action(self.trUtf8('Filled Ellipse'), | 656 self.drawFilledEllipseAct = E5Action( |
657 self.trUtf8('Filled Ellipse'), | |
628 UI.PixmapCache.getIcon("drawEllipseFilled.png"), | 658 UI.PixmapCache.getIcon("drawEllipseFilled.png"), |
629 self.trUtf8('Fille&d Elli&pse'), | 659 self.trUtf8('Fille&d Elli&pse'), |
630 0, 0, | 660 0, 0, |
631 self.drawingActGrp, 'iconEditor_tools_filled_ellipse') | 661 self.drawingActGrp, 'iconEditor_tools_filled_ellipse') |
632 self.drawFilledEllipseAct.setWhatsThis(self.trUtf8( | 662 self.drawFilledEllipseAct.setWhatsThis(self.trUtf8( |
637 self.esm.setMapping(self.drawFilledEllipseAct, | 667 self.esm.setMapping(self.drawFilledEllipseAct, |
638 IconEditorGrid.FilledEllipse) | 668 IconEditorGrid.FilledEllipse) |
639 self.drawFilledEllipseAct.triggered[()].connect(self.esm.map) | 669 self.drawFilledEllipseAct.triggered[()].connect(self.esm.map) |
640 self.__actions.append(self.drawFilledEllipseAct) | 670 self.__actions.append(self.drawFilledEllipseAct) |
641 | 671 |
642 self.drawFloodFillAct = E5Action(self.trUtf8('Flood Fill'), | 672 self.drawFloodFillAct = E5Action( |
673 self.trUtf8('Flood Fill'), | |
643 UI.PixmapCache.getIcon("drawFill.png"), | 674 UI.PixmapCache.getIcon("drawFill.png"), |
644 self.trUtf8('Fl&ood Fill'), | 675 self.trUtf8('Fl&ood Fill'), |
645 0, 0, | 676 0, 0, |
646 self.drawingActGrp, 'iconEditor_tools_flood_fill') | 677 self.drawingActGrp, 'iconEditor_tools_flood_fill') |
647 self.drawFloodFillAct.setWhatsThis(self.trUtf8( | 678 self.drawFloodFillAct.setWhatsThis(self.trUtf8( |
652 self.drawFloodFillAct.setCheckable(True) | 683 self.drawFloodFillAct.setCheckable(True) |
653 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill) | 684 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill) |
654 self.drawFloodFillAct.triggered[()].connect(self.esm.map) | 685 self.drawFloodFillAct.triggered[()].connect(self.esm.map) |
655 self.__actions.append(self.drawFloodFillAct) | 686 self.__actions.append(self.drawFloodFillAct) |
656 | 687 |
657 self.drawLineAct = E5Action(self.trUtf8('Line'), | 688 self.drawLineAct = E5Action( |
689 self.trUtf8('Line'), | |
658 UI.PixmapCache.getIcon("drawLine.png"), | 690 UI.PixmapCache.getIcon("drawLine.png"), |
659 self.trUtf8('&Line'), | 691 self.trUtf8('&Line'), |
660 0, 0, | 692 0, 0, |
661 self.drawingActGrp, 'iconEditor_tools_line') | 693 self.drawingActGrp, 'iconEditor_tools_line') |
662 self.drawLineAct.setWhatsThis(self.trUtf8( | 694 self.drawLineAct.setWhatsThis(self.trUtf8( |
666 self.drawLineAct.setCheckable(True) | 698 self.drawLineAct.setCheckable(True) |
667 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line) | 699 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line) |
668 self.drawLineAct.triggered[()].connect(self.esm.map) | 700 self.drawLineAct.triggered[()].connect(self.esm.map) |
669 self.__actions.append(self.drawLineAct) | 701 self.__actions.append(self.drawLineAct) |
670 | 702 |
671 self.drawEraserAct = E5Action(self.trUtf8('Eraser (Transparent)'), | 703 self.drawEraserAct = E5Action( |
704 self.trUtf8('Eraser (Transparent)'), | |
672 UI.PixmapCache.getIcon("drawEraser.png"), | 705 UI.PixmapCache.getIcon("drawEraser.png"), |
673 self.trUtf8('Eraser (&Transparent)'), | 706 self.trUtf8('Eraser (&Transparent)'), |
674 0, 0, | 707 0, 0, |
675 self.drawingActGrp, 'iconEditor_tools_eraser') | 708 self.drawingActGrp, 'iconEditor_tools_eraser') |
676 self.drawEraserAct.setWhatsThis(self.trUtf8( | 709 self.drawEraserAct.setWhatsThis(self.trUtf8( |
720 | 753 |
721 def __initHelpActions(self): | 754 def __initHelpActions(self): |
722 """ | 755 """ |
723 Private method to create the Help actions. | 756 Private method to create the Help actions. |
724 """ | 757 """ |
725 self.aboutAct = E5Action(self.trUtf8('About'), | 758 self.aboutAct = E5Action( |
726 self.trUtf8('&About'), | 759 self.trUtf8('About'), |
727 0, 0, self, 'iconEditor_help_about') | 760 self.trUtf8('&About'), |
761 0, 0, self, 'iconEditor_help_about') | |
728 self.aboutAct.setStatusTip(self.trUtf8( | 762 self.aboutAct.setStatusTip(self.trUtf8( |
729 'Display information about this software')) | 763 'Display information about this software')) |
730 self.aboutAct.setWhatsThis(self.trUtf8( | 764 self.aboutAct.setWhatsThis(self.trUtf8( |
731 """<b>About</b>""" | 765 """<b>About</b>""" |
732 """<p>Display some information about this software.</p>""")) | 766 """<p>Display some information about this software.</p>""")) |
733 self.aboutAct.triggered[()].connect(self.__about) | 767 self.aboutAct.triggered[()].connect(self.__about) |
734 self.__actions.append(self.aboutAct) | 768 self.__actions.append(self.aboutAct) |
735 | 769 |
736 self.aboutQtAct = E5Action(self.trUtf8('About Qt'), | 770 self.aboutQtAct = E5Action( |
737 self.trUtf8('About &Qt'), | 771 self.trUtf8('About Qt'), |
738 0, 0, self, 'iconEditor_help_about_qt') | 772 self.trUtf8('About &Qt'), |
773 0, 0, self, 'iconEditor_help_about_qt') | |
739 self.aboutQtAct.setStatusTip( | 774 self.aboutQtAct.setStatusTip( |
740 self.trUtf8('Display information about the Qt toolkit')) | 775 self.trUtf8('Display information about the Qt toolkit')) |
741 self.aboutQtAct.setWhatsThis(self.trUtf8( | 776 self.aboutQtAct.setWhatsThis(self.trUtf8( |
742 """<b>About Qt</b>""" | 777 """<b>About Qt</b>""" |
743 """<p>Display some information about the Qt toolkit.</p>""" | 778 """<p>Display some information about the Qt toolkit.</p>""" |
744 )) | 779 )) |
745 self.aboutQtAct.triggered[()].connect(self.__aboutQt) | 780 self.aboutQtAct.triggered[()].connect(self.__aboutQt) |
746 self.__actions.append(self.aboutQtAct) | 781 self.__actions.append(self.aboutQtAct) |
747 | 782 |
748 self.whatsThisAct = E5Action(self.trUtf8('What\'s This?'), | 783 self.whatsThisAct = E5Action( |
784 self.trUtf8('What\'s This?'), | |
749 UI.PixmapCache.getIcon("whatsThis.png"), | 785 UI.PixmapCache.getIcon("whatsThis.png"), |
750 self.trUtf8('&What\'s This?'), | 786 self.trUtf8('&What\'s This?'), |
751 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")), | 787 QKeySequence(self.trUtf8("Shift+F1", "Help|What's This?'")), |
752 0, self, 'iconEditor_help_whats_this') | 788 0, self, 'iconEditor_help_whats_this') |
753 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) | 789 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) |
1051 if not ext: | 1087 if not ext: |
1052 ex = selectedFilter.split("(*")[1].split(")")[0] | 1088 ex = selectedFilter.split("(*")[1].split(")")[0] |
1053 if ex: | 1089 if ex: |
1054 fileName += ex | 1090 fileName += ex |
1055 if QFileInfo(fileName).exists(): | 1091 if QFileInfo(fileName).exists(): |
1056 res = E5MessageBox.yesNo(self, | 1092 res = E5MessageBox.yesNo( |
1093 self, | |
1057 self.trUtf8("Save icon file"), | 1094 self.trUtf8("Save icon file"), |
1058 self.trUtf8("<p>The file <b>{0}</b> already exists." | 1095 self.trUtf8("<p>The file <b>{0}</b> already exists." |
1059 " Overwrite it?</p>").format(fileName), | 1096 " Overwrite it?</p>").format(fileName), |
1060 icon=E5MessageBox.Warning) | 1097 icon=E5MessageBox.Warning) |
1061 if not res: | 1098 if not res: |
1173 Private method to ask the user to save the file, if it was modified. | 1210 Private method to ask the user to save the file, if it was modified. |
1174 | 1211 |
1175 @return flag indicating, if it is ok to continue (boolean) | 1212 @return flag indicating, if it is ok to continue (boolean) |
1176 """ | 1213 """ |
1177 if self.__editor.isDirty(): | 1214 if self.__editor.isDirty(): |
1178 ret = E5MessageBox.okToClearData(self, | 1215 ret = E5MessageBox.okToClearData( |
1216 self, | |
1179 self.trUtf8("eric5 Icon Editor"), | 1217 self.trUtf8("eric5 Icon Editor"), |
1180 self.trUtf8("""The icon image has unsaved changes."""), | 1218 self.trUtf8("""The icon image has unsaved changes."""), |
1181 self.__saveIcon) | 1219 self.__saveIcon) |
1182 if not ret: | 1220 if not ret: |
1183 return False | 1221 return False |