IconEditor/IconEditorWindow.py

changeset 3345
071afe8be2a1
parent 3201
0f115f6db6cb
child 3484
645c12de6b0c
equal deleted inserted replaced
3343:f7a6d271bb40 3345:071afe8be2a1
191 self.newAct.setStatusTip(self.tr('Create a new icon')) 191 self.newAct.setStatusTip(self.tr('Create a new icon'))
192 self.newAct.setWhatsThis(self.tr( 192 self.newAct.setWhatsThis(self.tr(
193 """<b>New</b>""" 193 """<b>New</b>"""
194 """<p>This creates a new icon.</p>""" 194 """<p>This creates a new icon.</p>"""
195 )) 195 ))
196 self.newAct.triggered[()].connect(self.__newIcon) 196 self.newAct.triggered.connect(self.__newIcon)
197 self.__actions.append(self.newAct) 197 self.__actions.append(self.newAct)
198 198
199 self.newWindowAct = E5Action( 199 self.newWindowAct = E5Action(
200 self.tr('New Window'), 200 self.tr('New Window'),
201 UI.PixmapCache.getIcon("newWindow.png"), 201 UI.PixmapCache.getIcon("newWindow.png"),
205 'Open a new icon editor window')) 205 'Open a new icon editor window'))
206 self.newWindowAct.setWhatsThis(self.tr( 206 self.newWindowAct.setWhatsThis(self.tr(
207 """<b>New Window</b>""" 207 """<b>New Window</b>"""
208 """<p>This opens a new icon editor window.</p>""" 208 """<p>This opens a new icon editor window.</p>"""
209 )) 209 ))
210 self.newWindowAct.triggered[()].connect(self.__newWindow) 210 self.newWindowAct.triggered.connect(self.__newWindow)
211 self.__actions.append(self.newWindowAct) 211 self.__actions.append(self.newWindowAct)
212 212
213 self.openAct = E5Action( 213 self.openAct = E5Action(
214 self.tr('Open'), 214 self.tr('Open'),
215 UI.PixmapCache.getIcon("open.png"), 215 UI.PixmapCache.getIcon("open.png"),
220 self.openAct.setWhatsThis(self.tr( 220 self.openAct.setWhatsThis(self.tr(
221 """<b>Open File</b>""" 221 """<b>Open File</b>"""
222 """<p>This opens a new icon file for editing.""" 222 """<p>This opens a new icon file for editing."""
223 """ It pops up a file selection dialog.</p>""" 223 """ It pops up a file selection dialog.</p>"""
224 )) 224 ))
225 self.openAct.triggered[()].connect(self.__openIcon) 225 self.openAct.triggered.connect(self.__openIcon)
226 self.__actions.append(self.openAct) 226 self.__actions.append(self.openAct)
227 227
228 self.saveAct = E5Action( 228 self.saveAct = E5Action(
229 self.tr('Save'), 229 self.tr('Save'),
230 UI.PixmapCache.getIcon("fileSave.png"), 230 UI.PixmapCache.getIcon("fileSave.png"),
234 self.saveAct.setStatusTip(self.tr('Save the current icon')) 234 self.saveAct.setStatusTip(self.tr('Save the current icon'))
235 self.saveAct.setWhatsThis(self.tr( 235 self.saveAct.setWhatsThis(self.tr(
236 """<b>Save File</b>""" 236 """<b>Save File</b>"""
237 """<p>Save the contents of the icon editor window.</p>""" 237 """<p>Save the contents of the icon editor window.</p>"""
238 )) 238 ))
239 self.saveAct.triggered[()].connect(self.__saveIcon) 239 self.saveAct.triggered.connect(self.__saveIcon)
240 self.__actions.append(self.saveAct) 240 self.__actions.append(self.saveAct)
241 241
242 self.saveAsAct = E5Action( 242 self.saveAsAct = E5Action(
243 self.tr('Save As'), 243 self.tr('Save As'),
244 UI.PixmapCache.getIcon("fileSaveAs.png"), 244 UI.PixmapCache.getIcon("fileSaveAs.png"),
249 self.tr('Save the current icon to a new file')) 249 self.tr('Save the current icon to a new file'))
250 self.saveAsAct.setWhatsThis(self.tr( 250 self.saveAsAct.setWhatsThis(self.tr(
251 """<b>Save As...</b>""" 251 """<b>Save As...</b>"""
252 """<p>Saves the current icon to a new file.</p>""" 252 """<p>Saves the current icon to a new file.</p>"""
253 )) 253 ))
254 self.saveAsAct.triggered[()].connect(self.__saveIconAs) 254 self.saveAsAct.triggered.connect(self.__saveIconAs)
255 self.__actions.append(self.saveAsAct) 255 self.__actions.append(self.saveAsAct)
256 256
257 self.closeAct = E5Action( 257 self.closeAct = E5Action(
258 self.tr('Close'), 258 self.tr('Close'),
259 UI.PixmapCache.getIcon("close.png"), 259 UI.PixmapCache.getIcon("close.png"),
264 'Close the current icon editor window')) 264 'Close the current icon editor window'))
265 self.closeAct.setWhatsThis(self.tr( 265 self.closeAct.setWhatsThis(self.tr(
266 """<b>Close</b>""" 266 """<b>Close</b>"""
267 """<p>Closes the current icon editor window.</p>""" 267 """<p>Closes the current icon editor window.</p>"""
268 )) 268 ))
269 self.closeAct.triggered[()].connect(self.close) 269 self.closeAct.triggered.connect(self.close)
270 self.__actions.append(self.closeAct) 270 self.__actions.append(self.closeAct)
271 271
272 self.closeAllAct = E5Action( 272 self.closeAllAct = E5Action(
273 self.tr('Close All'), 273 self.tr('Close All'),
274 self.tr('Close &All'), 274 self.tr('Close &All'),
277 'Close all icon editor windows')) 277 'Close all icon editor windows'))
278 self.closeAllAct.setWhatsThis(self.tr( 278 self.closeAllAct.setWhatsThis(self.tr(
279 """<b>Close All</b>""" 279 """<b>Close All</b>"""
280 """<p>Closes all icon editor windows except the first one.</p>""" 280 """<p>Closes all icon editor windows except the first one.</p>"""
281 )) 281 ))
282 self.closeAllAct.triggered[()].connect(self.__closeAll) 282 self.closeAllAct.triggered.connect(self.__closeAll)
283 self.__actions.append(self.closeAllAct) 283 self.__actions.append(self.closeAllAct)
284 284
285 self.exitAct = E5Action( 285 self.exitAct = E5Action(
286 self.tr('Quit'), 286 self.tr('Quit'),
287 UI.PixmapCache.getIcon("exit.png"), 287 UI.PixmapCache.getIcon("exit.png"),
292 self.exitAct.setWhatsThis(self.tr( 292 self.exitAct.setWhatsThis(self.tr(
293 """<b>Quit</b>""" 293 """<b>Quit</b>"""
294 """<p>Quit the icon editor.</p>""" 294 """<p>Quit the icon editor.</p>"""
295 )) 295 ))
296 if not self.fromEric: 296 if not self.fromEric:
297 self.exitAct.triggered[()].connect(self.__closeAll) 297 self.exitAct.triggered.connect(self.__closeAll)
298 self.__actions.append(self.exitAct) 298 self.__actions.append(self.exitAct)
299 299
300 def __initEditActions(self): 300 def __initEditActions(self):
301 """ 301 """
302 Private method to create the Edit actions. 302 Private method to create the Edit actions.
311 self.undoAct.setStatusTip(self.tr('Undo the last change')) 311 self.undoAct.setStatusTip(self.tr('Undo the last change'))
312 self.undoAct.setWhatsThis(self.tr( 312 self.undoAct.setWhatsThis(self.tr(
313 """<b>Undo</b>""" 313 """<b>Undo</b>"""
314 """<p>Undo the last change done.</p>""" 314 """<p>Undo the last change done.</p>"""
315 )) 315 ))
316 self.undoAct.triggered[()].connect(self.__editor.editUndo) 316 self.undoAct.triggered.connect(self.__editor.editUndo)
317 self.__actions.append(self.undoAct) 317 self.__actions.append(self.undoAct)
318 318
319 self.redoAct = E5Action( 319 self.redoAct = E5Action(
320 self.tr('Redo'), 320 self.tr('Redo'),
321 UI.PixmapCache.getIcon("editRedo.png"), 321 UI.PixmapCache.getIcon("editRedo.png"),
325 self.redoAct.setStatusTip(self.tr('Redo the last change')) 325 self.redoAct.setStatusTip(self.tr('Redo the last change'))
326 self.redoAct.setWhatsThis(self.tr( 326 self.redoAct.setWhatsThis(self.tr(
327 """<b>Redo</b>""" 327 """<b>Redo</b>"""
328 """<p>Redo the last change done.</p>""" 328 """<p>Redo the last change done.</p>"""
329 )) 329 ))
330 self.redoAct.triggered[()].connect(self.__editor.editRedo) 330 self.redoAct.triggered.connect(self.__editor.editRedo)
331 self.__actions.append(self.redoAct) 331 self.__actions.append(self.redoAct)
332 332
333 self.cutAct = E5Action( 333 self.cutAct = E5Action(
334 self.tr('Cut'), 334 self.tr('Cut'),
335 UI.PixmapCache.getIcon("editCut.png"), 335 UI.PixmapCache.getIcon("editCut.png"),
340 self.cutAct.setStatusTip(self.tr('Cut the selection')) 340 self.cutAct.setStatusTip(self.tr('Cut the selection'))
341 self.cutAct.setWhatsThis(self.tr( 341 self.cutAct.setWhatsThis(self.tr(
342 """<b>Cut</b>""" 342 """<b>Cut</b>"""
343 """<p>Cut the selected image area to the clipboard.</p>""" 343 """<p>Cut the selected image area to the clipboard.</p>"""
344 )) 344 ))
345 self.cutAct.triggered[()].connect(self.__editor.editCut) 345 self.cutAct.triggered.connect(self.__editor.editCut)
346 self.__actions.append(self.cutAct) 346 self.__actions.append(self.cutAct)
347 347
348 self.copyAct = E5Action( 348 self.copyAct = E5Action(
349 self.tr('Copy'), 349 self.tr('Copy'),
350 UI.PixmapCache.getIcon("editCopy.png"), 350 UI.PixmapCache.getIcon("editCopy.png"),
355 self.copyAct.setStatusTip(self.tr('Copy the selection')) 355 self.copyAct.setStatusTip(self.tr('Copy the selection'))
356 self.copyAct.setWhatsThis(self.tr( 356 self.copyAct.setWhatsThis(self.tr(
357 """<b>Copy</b>""" 357 """<b>Copy</b>"""
358 """<p>Copy the selected image area to the clipboard.</p>""" 358 """<p>Copy the selected image area to the clipboard.</p>"""
359 )) 359 ))
360 self.copyAct.triggered[()].connect(self.__editor.editCopy) 360 self.copyAct.triggered.connect(self.__editor.editCopy)
361 self.__actions.append(self.copyAct) 361 self.__actions.append(self.copyAct)
362 362
363 self.pasteAct = E5Action( 363 self.pasteAct = E5Action(
364 self.tr('Paste'), 364 self.tr('Paste'),
365 UI.PixmapCache.getIcon("editPaste.png"), 365 UI.PixmapCache.getIcon("editPaste.png"),
370 self.pasteAct.setStatusTip(self.tr('Paste the clipboard image')) 370 self.pasteAct.setStatusTip(self.tr('Paste the clipboard image'))
371 self.pasteAct.setWhatsThis(self.tr( 371 self.pasteAct.setWhatsThis(self.tr(
372 """<b>Paste</b>""" 372 """<b>Paste</b>"""
373 """<p>Paste the clipboard image.</p>""" 373 """<p>Paste the clipboard image.</p>"""
374 )) 374 ))
375 self.pasteAct.triggered[()].connect(self.__editor.editPaste) 375 self.pasteAct.triggered.connect(self.__editor.editPaste)
376 self.__actions.append(self.pasteAct) 376 self.__actions.append(self.pasteAct)
377 377
378 self.pasteNewAct = E5Action( 378 self.pasteNewAct = E5Action(
379 self.tr('Paste as New'), 379 self.tr('Paste as New'),
380 self.tr('Paste as &New'), 380 self.tr('Paste as &New'),
383 'Paste the clipboard image replacing the current one')) 383 'Paste the clipboard image replacing the current one'))
384 self.pasteNewAct.setWhatsThis(self.tr( 384 self.pasteNewAct.setWhatsThis(self.tr(
385 """<b>Paste as New</b>""" 385 """<b>Paste as New</b>"""
386 """<p>Paste the clipboard image replacing the current one.</p>""" 386 """<p>Paste the clipboard image replacing the current one.</p>"""
387 )) 387 ))
388 self.pasteNewAct.triggered[()].connect(self.__editor.editPasteAsNew) 388 self.pasteNewAct.triggered.connect(self.__editor.editPasteAsNew)
389 self.__actions.append(self.pasteNewAct) 389 self.__actions.append(self.pasteNewAct)
390 390
391 self.deleteAct = E5Action( 391 self.deleteAct = E5Action(
392 self.tr('Clear'), 392 self.tr('Clear'),
393 UI.PixmapCache.getIcon("editDelete.png"), 393 UI.PixmapCache.getIcon("editDelete.png"),
399 self.deleteAct.setWhatsThis(self.tr( 399 self.deleteAct.setWhatsThis(self.tr(
400 """<b>Clear</b>""" 400 """<b>Clear</b>"""
401 """<p>Clear the icon image and set it to be completely""" 401 """<p>Clear the icon image and set it to be completely"""
402 """ transparent.</p>""" 402 """ transparent.</p>"""
403 )) 403 ))
404 self.deleteAct.triggered[()].connect(self.__editor.editClear) 404 self.deleteAct.triggered.connect(self.__editor.editClear)
405 self.__actions.append(self.deleteAct) 405 self.__actions.append(self.deleteAct)
406 406
407 self.selectAllAct = E5Action( 407 self.selectAllAct = E5Action(
408 self.tr('Select All'), 408 self.tr('Select All'),
409 self.tr('&Select All'), 409 self.tr('&Select All'),
414 'Select the complete icon image')) 414 'Select the complete icon image'))
415 self.selectAllAct.setWhatsThis(self.tr( 415 self.selectAllAct.setWhatsThis(self.tr(
416 """<b>Select All</b>""" 416 """<b>Select All</b>"""
417 """<p>Selects the complete icon image.</p>""" 417 """<p>Selects the complete icon image.</p>"""
418 )) 418 ))
419 self.selectAllAct.triggered[()].connect(self.__editor.editSelectAll) 419 self.selectAllAct.triggered.connect(self.__editor.editSelectAll)
420 self.__actions.append(self.selectAllAct) 420 self.__actions.append(self.selectAllAct)
421 421
422 self.resizeAct = E5Action( 422 self.resizeAct = E5Action(
423 self.tr('Change Size'), 423 self.tr('Change Size'),
424 UI.PixmapCache.getIcon("transformResize.png"), 424 UI.PixmapCache.getIcon("transformResize.png"),
428 self.resizeAct.setStatusTip(self.tr('Change the icon size')) 428 self.resizeAct.setStatusTip(self.tr('Change the icon size'))
429 self.resizeAct.setWhatsThis(self.tr( 429 self.resizeAct.setWhatsThis(self.tr(
430 """<b>Change Size...</b>""" 430 """<b>Change Size...</b>"""
431 """<p>Changes the icon size.</p>""" 431 """<p>Changes the icon size.</p>"""
432 )) 432 ))
433 self.resizeAct.triggered[()].connect(self.__editor.editResize) 433 self.resizeAct.triggered.connect(self.__editor.editResize)
434 self.__actions.append(self.resizeAct) 434 self.__actions.append(self.resizeAct)
435 435
436 self.grayscaleAct = E5Action( 436 self.grayscaleAct = E5Action(
437 self.tr('Grayscale'), 437 self.tr('Grayscale'),
438 UI.PixmapCache.getIcon("grayscale.png"), 438 UI.PixmapCache.getIcon("grayscale.png"),
443 'Change the icon to grayscale')) 443 'Change the icon to grayscale'))
444 self.grayscaleAct.setWhatsThis(self.tr( 444 self.grayscaleAct.setWhatsThis(self.tr(
445 """<b>Grayscale</b>""" 445 """<b>Grayscale</b>"""
446 """<p>Changes the icon to grayscale.</p>""" 446 """<p>Changes the icon to grayscale.</p>"""
447 )) 447 ))
448 self.grayscaleAct.triggered[()].connect(self.__editor.grayScale) 448 self.grayscaleAct.triggered.connect(self.__editor.grayScale)
449 self.__actions.append(self.grayscaleAct) 449 self.__actions.append(self.grayscaleAct)
450 450
451 self.redoAct.setEnabled(False) 451 self.redoAct.setEnabled(False)
452 self.__editor.canRedoChanged.connect(self.redoAct.setEnabled) 452 self.__editor.canRedoChanged.connect(self.redoAct.setEnabled)
453 453
479 self.zoomInAct.setStatusTip(self.tr('Zoom in on the icon')) 479 self.zoomInAct.setStatusTip(self.tr('Zoom in on the icon'))
480 self.zoomInAct.setWhatsThis(self.tr( 480 self.zoomInAct.setWhatsThis(self.tr(
481 """<b>Zoom in</b>""" 481 """<b>Zoom in</b>"""
482 """<p>Zoom in on the icon. This makes the grid bigger.</p>""" 482 """<p>Zoom in on the icon. This makes the grid bigger.</p>"""
483 )) 483 ))
484 self.zoomInAct.triggered[()].connect(self.__zoomIn) 484 self.zoomInAct.triggered.connect(self.__zoomIn)
485 self.__actions.append(self.zoomInAct) 485 self.__actions.append(self.zoomInAct)
486 486
487 self.zoomOutAct = E5Action( 487 self.zoomOutAct = E5Action(
488 self.tr('Zoom out'), 488 self.tr('Zoom out'),
489 UI.PixmapCache.getIcon("zoomOut.png"), 489 UI.PixmapCache.getIcon("zoomOut.png"),
493 self.zoomOutAct.setStatusTip(self.tr('Zoom out on the icon')) 493 self.zoomOutAct.setStatusTip(self.tr('Zoom out on the icon'))
494 self.zoomOutAct.setWhatsThis(self.tr( 494 self.zoomOutAct.setWhatsThis(self.tr(
495 """<b>Zoom out</b>""" 495 """<b>Zoom out</b>"""
496 """<p>Zoom out on the icon. This makes the grid smaller.</p>""" 496 """<p>Zoom out on the icon. This makes the grid smaller.</p>"""
497 )) 497 ))
498 self.zoomOutAct.triggered[()].connect(self.__zoomOut) 498 self.zoomOutAct.triggered.connect(self.__zoomOut)
499 self.__actions.append(self.zoomOutAct) 499 self.__actions.append(self.zoomOutAct)
500 500
501 self.zoomResetAct = E5Action( 501 self.zoomResetAct = E5Action(
502 self.tr('Zoom reset'), 502 self.tr('Zoom reset'),
503 UI.PixmapCache.getIcon("zoomReset.png"), 503 UI.PixmapCache.getIcon("zoomReset.png"),
509 self.zoomResetAct.setWhatsThis(self.tr( 509 self.zoomResetAct.setWhatsThis(self.tr(
510 """<b>Zoom reset</b>""" 510 """<b>Zoom reset</b>"""
511 """<p>Reset the zoom of the icon. """ 511 """<p>Reset the zoom of the icon. """
512 """This sets the zoom factor to 100%.</p>""" 512 """This sets the zoom factor to 100%.</p>"""
513 )) 513 ))
514 self.zoomResetAct.triggered[()].connect(self.__zoomReset) 514 self.zoomResetAct.triggered.connect(self.__zoomReset)
515 self.__actions.append(self.zoomResetAct) 515 self.__actions.append(self.zoomResetAct)
516 516
517 self.showGridAct = E5Action( 517 self.showGridAct = E5Action(
518 self.tr('Show Grid'), 518 self.tr('Show Grid'),
519 UI.PixmapCache.getIcon("grid.png"), 519 UI.PixmapCache.getIcon("grid.png"),
551 """<b>Free hand</b>""" 551 """<b>Free hand</b>"""
552 """<p>Draws non linear lines.</p>""" 552 """<p>Draws non linear lines.</p>"""
553 )) 553 ))
554 self.drawPencilAct.setCheckable(True) 554 self.drawPencilAct.setCheckable(True)
555 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil) 555 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil)
556 self.drawPencilAct.triggered[()].connect(self.esm.map) 556 self.drawPencilAct.triggered.connect(self.esm.map)
557 self.__actions.append(self.drawPencilAct) 557 self.__actions.append(self.drawPencilAct)
558 558
559 self.drawColorPickerAct = E5Action( 559 self.drawColorPickerAct = E5Action(
560 self.tr('Color Picker'), 560 self.tr('Color Picker'),
561 UI.PixmapCache.getIcon("colorPicker.png"), 561 UI.PixmapCache.getIcon("colorPicker.png"),
568 """the current draw color.</p>""" 568 """the current draw color.</p>"""
569 )) 569 ))
570 self.drawColorPickerAct.setCheckable(True) 570 self.drawColorPickerAct.setCheckable(True)
571 self.esm.setMapping(self.drawColorPickerAct, 571 self.esm.setMapping(self.drawColorPickerAct,
572 IconEditorGrid.ColorPicker) 572 IconEditorGrid.ColorPicker)
573 self.drawColorPickerAct.triggered[()].connect(self.esm.map) 573 self.drawColorPickerAct.triggered.connect(self.esm.map)
574 self.__actions.append(self.drawColorPickerAct) 574 self.__actions.append(self.drawColorPickerAct)
575 575
576 self.drawRectangleAct = E5Action( 576 self.drawRectangleAct = E5Action(
577 self.tr('Rectangle'), 577 self.tr('Rectangle'),
578 UI.PixmapCache.getIcon("drawRectangle.png"), 578 UI.PixmapCache.getIcon("drawRectangle.png"),
583 """<b>Rectangle</b>""" 583 """<b>Rectangle</b>"""
584 """<p>Draw a rectangle.</p>""" 584 """<p>Draw a rectangle.</p>"""
585 )) 585 ))
586 self.drawRectangleAct.setCheckable(True) 586 self.drawRectangleAct.setCheckable(True)
587 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle) 587 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle)
588 self.drawRectangleAct.triggered[()].connect(self.esm.map) 588 self.drawRectangleAct.triggered.connect(self.esm.map)
589 self.__actions.append(self.drawRectangleAct) 589 self.__actions.append(self.drawRectangleAct)
590 590
591 self.drawFilledRectangleAct = E5Action( 591 self.drawFilledRectangleAct = E5Action(
592 self.tr('Filled Rectangle'), 592 self.tr('Filled Rectangle'),
593 UI.PixmapCache.getIcon("drawRectangleFilled.png"), 593 UI.PixmapCache.getIcon("drawRectangleFilled.png"),
599 """<p>Draw a filled rectangle.</p>""" 599 """<p>Draw a filled rectangle.</p>"""
600 )) 600 ))
601 self.drawFilledRectangleAct.setCheckable(True) 601 self.drawFilledRectangleAct.setCheckable(True)
602 self.esm.setMapping(self.drawFilledRectangleAct, 602 self.esm.setMapping(self.drawFilledRectangleAct,
603 IconEditorGrid.FilledRectangle) 603 IconEditorGrid.FilledRectangle)
604 self.drawFilledRectangleAct.triggered[()].connect(self.esm.map) 604 self.drawFilledRectangleAct.triggered.connect(self.esm.map)
605 self.__actions.append(self.drawFilledRectangleAct) 605 self.__actions.append(self.drawFilledRectangleAct)
606 606
607 self.drawCircleAct = E5Action( 607 self.drawCircleAct = E5Action(
608 self.tr('Circle'), 608 self.tr('Circle'),
609 UI.PixmapCache.getIcon("drawCircle.png"), 609 UI.PixmapCache.getIcon("drawCircle.png"),
614 """<b>Circle</b>""" 614 """<b>Circle</b>"""
615 """<p>Draw a circle.</p>""" 615 """<p>Draw a circle.</p>"""
616 )) 616 ))
617 self.drawCircleAct.setCheckable(True) 617 self.drawCircleAct.setCheckable(True)
618 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle) 618 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle)
619 self.drawCircleAct.triggered[()].connect(self.esm.map) 619 self.drawCircleAct.triggered.connect(self.esm.map)
620 self.__actions.append(self.drawCircleAct) 620 self.__actions.append(self.drawCircleAct)
621 621
622 self.drawFilledCircleAct = E5Action( 622 self.drawFilledCircleAct = E5Action(
623 self.tr('Filled Circle'), 623 self.tr('Filled Circle'),
624 UI.PixmapCache.getIcon("drawCircleFilled.png"), 624 UI.PixmapCache.getIcon("drawCircleFilled.png"),
630 """<p>Draw a filled circle.</p>""" 630 """<p>Draw a filled circle.</p>"""
631 )) 631 ))
632 self.drawFilledCircleAct.setCheckable(True) 632 self.drawFilledCircleAct.setCheckable(True)
633 self.esm.setMapping(self.drawFilledCircleAct, 633 self.esm.setMapping(self.drawFilledCircleAct,
634 IconEditorGrid.FilledCircle) 634 IconEditorGrid.FilledCircle)
635 self.drawFilledCircleAct.triggered[()].connect(self.esm.map) 635 self.drawFilledCircleAct.triggered.connect(self.esm.map)
636 self.__actions.append(self.drawFilledCircleAct) 636 self.__actions.append(self.drawFilledCircleAct)
637 637
638 self.drawEllipseAct = E5Action( 638 self.drawEllipseAct = E5Action(
639 self.tr('Ellipse'), 639 self.tr('Ellipse'),
640 UI.PixmapCache.getIcon("drawEllipse.png"), 640 UI.PixmapCache.getIcon("drawEllipse.png"),
645 """<b>Ellipse</b>""" 645 """<b>Ellipse</b>"""
646 """<p>Draw an ellipse.</p>""" 646 """<p>Draw an ellipse.</p>"""
647 )) 647 ))
648 self.drawEllipseAct.setCheckable(True) 648 self.drawEllipseAct.setCheckable(True)
649 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse) 649 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse)
650 self.drawEllipseAct.triggered[()].connect(self.esm.map) 650 self.drawEllipseAct.triggered.connect(self.esm.map)
651 self.__actions.append(self.drawEllipseAct) 651 self.__actions.append(self.drawEllipseAct)
652 652
653 self.drawFilledEllipseAct = E5Action( 653 self.drawFilledEllipseAct = E5Action(
654 self.tr('Filled Ellipse'), 654 self.tr('Filled Ellipse'),
655 UI.PixmapCache.getIcon("drawEllipseFilled.png"), 655 UI.PixmapCache.getIcon("drawEllipseFilled.png"),
661 """<p>Draw a filled ellipse.</p>""" 661 """<p>Draw a filled ellipse.</p>"""
662 )) 662 ))
663 self.drawFilledEllipseAct.setCheckable(True) 663 self.drawFilledEllipseAct.setCheckable(True)
664 self.esm.setMapping(self.drawFilledEllipseAct, 664 self.esm.setMapping(self.drawFilledEllipseAct,
665 IconEditorGrid.FilledEllipse) 665 IconEditorGrid.FilledEllipse)
666 self.drawFilledEllipseAct.triggered[()].connect(self.esm.map) 666 self.drawFilledEllipseAct.triggered.connect(self.esm.map)
667 self.__actions.append(self.drawFilledEllipseAct) 667 self.__actions.append(self.drawFilledEllipseAct)
668 668
669 self.drawFloodFillAct = E5Action( 669 self.drawFloodFillAct = E5Action(
670 self.tr('Flood Fill'), 670 self.tr('Flood Fill'),
671 UI.PixmapCache.getIcon("drawFill.png"), 671 UI.PixmapCache.getIcon("drawFill.png"),
677 """<p>Fill adjoining pixels with the same color with """ 677 """<p>Fill adjoining pixels with the same color with """
678 """the current color.</p>""" 678 """the current color.</p>"""
679 )) 679 ))
680 self.drawFloodFillAct.setCheckable(True) 680 self.drawFloodFillAct.setCheckable(True)
681 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill) 681 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill)
682 self.drawFloodFillAct.triggered[()].connect(self.esm.map) 682 self.drawFloodFillAct.triggered.connect(self.esm.map)
683 self.__actions.append(self.drawFloodFillAct) 683 self.__actions.append(self.drawFloodFillAct)
684 684
685 self.drawLineAct = E5Action( 685 self.drawLineAct = E5Action(
686 self.tr('Line'), 686 self.tr('Line'),
687 UI.PixmapCache.getIcon("drawLine.png"), 687 UI.PixmapCache.getIcon("drawLine.png"),
692 """<b>Line</b>""" 692 """<b>Line</b>"""
693 """<p>Draw a line.</p>""" 693 """<p>Draw a line.</p>"""
694 )) 694 ))
695 self.drawLineAct.setCheckable(True) 695 self.drawLineAct.setCheckable(True)
696 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line) 696 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line)
697 self.drawLineAct.triggered[()].connect(self.esm.map) 697 self.drawLineAct.triggered.connect(self.esm.map)
698 self.__actions.append(self.drawLineAct) 698 self.__actions.append(self.drawLineAct)
699 699
700 self.drawEraserAct = E5Action( 700 self.drawEraserAct = E5Action(
701 self.tr('Eraser (Transparent)'), 701 self.tr('Eraser (Transparent)'),
702 UI.PixmapCache.getIcon("drawEraser.png"), 702 UI.PixmapCache.getIcon("drawEraser.png"),
707 """<b>Eraser (Transparent)</b>""" 707 """<b>Eraser (Transparent)</b>"""
708 """<p>Erase pixels by setting them to transparent.</p>""" 708 """<p>Erase pixels by setting them to transparent.</p>"""
709 )) 709 ))
710 self.drawEraserAct.setCheckable(True) 710 self.drawEraserAct.setCheckable(True)
711 self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber) 711 self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber)
712 self.drawEraserAct.triggered[()].connect(self.esm.map) 712 self.drawEraserAct.triggered.connect(self.esm.map)
713 self.__actions.append(self.drawEraserAct) 713 self.__actions.append(self.drawEraserAct)
714 714
715 self.drawRectangleSelectionAct = E5Action( 715 self.drawRectangleSelectionAct = E5Action(
716 self.tr('Rectangular Selection'), 716 self.tr('Rectangular Selection'),
717 UI.PixmapCache.getIcon("selectRectangle.png"), 717 UI.PixmapCache.getIcon("selectRectangle.png"),
724 """ the mouse.</p>""" 724 """ the mouse.</p>"""
725 )) 725 ))
726 self.drawRectangleSelectionAct.setCheckable(True) 726 self.drawRectangleSelectionAct.setCheckable(True)
727 self.esm.setMapping(self.drawRectangleSelectionAct, 727 self.esm.setMapping(self.drawRectangleSelectionAct,
728 IconEditorGrid.RectangleSelection) 728 IconEditorGrid.RectangleSelection)
729 self.drawRectangleSelectionAct.triggered[()].connect(self.esm.map) 729 self.drawRectangleSelectionAct.triggered.connect(self.esm.map)
730 self.__actions.append(self.drawRectangleSelectionAct) 730 self.__actions.append(self.drawRectangleSelectionAct)
731 731
732 self.drawCircleSelectionAct = E5Action( 732 self.drawCircleSelectionAct = E5Action(
733 self.tr('Circular Selection'), 733 self.tr('Circular Selection'),
734 UI.PixmapCache.getIcon("selectCircle.png"), 734 UI.PixmapCache.getIcon("selectCircle.png"),
741 """ the mouse.</p>""" 741 """ the mouse.</p>"""
742 )) 742 ))
743 self.drawCircleSelectionAct.setCheckable(True) 743 self.drawCircleSelectionAct.setCheckable(True)
744 self.esm.setMapping(self.drawCircleSelectionAct, 744 self.esm.setMapping(self.drawCircleSelectionAct,
745 IconEditorGrid.CircleSelection) 745 IconEditorGrid.CircleSelection)
746 self.drawCircleSelectionAct.triggered[()].connect(self.esm.map) 746 self.drawCircleSelectionAct.triggered.connect(self.esm.map)
747 self.__actions.append(self.drawCircleSelectionAct) 747 self.__actions.append(self.drawCircleSelectionAct)
748 748
749 self.drawPencilAct.setChecked(True) 749 self.drawPencilAct.setChecked(True)
750 750
751 def __initHelpActions(self): 751 def __initHelpActions(self):
759 self.aboutAct.setStatusTip(self.tr( 759 self.aboutAct.setStatusTip(self.tr(
760 'Display information about this software')) 760 'Display information about this software'))
761 self.aboutAct.setWhatsThis(self.tr( 761 self.aboutAct.setWhatsThis(self.tr(
762 """<b>About</b>""" 762 """<b>About</b>"""
763 """<p>Display some information about this software.</p>""")) 763 """<p>Display some information about this software.</p>"""))
764 self.aboutAct.triggered[()].connect(self.__about) 764 self.aboutAct.triggered.connect(self.__about)
765 self.__actions.append(self.aboutAct) 765 self.__actions.append(self.aboutAct)
766 766
767 self.aboutQtAct = E5Action( 767 self.aboutQtAct = E5Action(
768 self.tr('About Qt'), 768 self.tr('About Qt'),
769 self.tr('About &Qt'), 769 self.tr('About &Qt'),
772 self.tr('Display information about the Qt toolkit')) 772 self.tr('Display information about the Qt toolkit'))
773 self.aboutQtAct.setWhatsThis(self.tr( 773 self.aboutQtAct.setWhatsThis(self.tr(
774 """<b>About Qt</b>""" 774 """<b>About Qt</b>"""
775 """<p>Display some information about the Qt toolkit.</p>""" 775 """<p>Display some information about the Qt toolkit.</p>"""
776 )) 776 ))
777 self.aboutQtAct.triggered[()].connect(self.__aboutQt) 777 self.aboutQtAct.triggered.connect(self.__aboutQt)
778 self.__actions.append(self.aboutQtAct) 778 self.__actions.append(self.aboutQtAct)
779 779
780 self.whatsThisAct = E5Action( 780 self.whatsThisAct = E5Action(
781 self.tr('What\'s This?'), 781 self.tr('What\'s This?'),
782 UI.PixmapCache.getIcon("whatsThis.png"), 782 UI.PixmapCache.getIcon("whatsThis.png"),
790 """ with a question mark, and you can click on the interface""" 790 """ with a question mark, and you can click on the interface"""
791 """ elements to get a short description of what they do and""" 791 """ elements to get a short description of what they do and"""
792 """ how to use them. In dialogs, this feature can be accessed""" 792 """ how to use them. In dialogs, this feature can be accessed"""
793 """ using the context help button in the titlebar.</p>""" 793 """ using the context help button in the titlebar.</p>"""
794 )) 794 ))
795 self.whatsThisAct.triggered[()].connect(self.__whatsThis) 795 self.whatsThisAct.triggered.connect(self.__whatsThis)
796 self.__actions.append(self.whatsThisAct) 796 self.__actions.append(self.whatsThisAct)
797 797
798 def __initMenus(self): 798 def __initMenus(self):
799 """ 799 """
800 Private method to create the menus. 800 Private method to create the menus.
809 menu.addSeparator() 809 menu.addSeparator()
810 menu.addAction(self.saveAct) 810 menu.addAction(self.saveAct)
811 menu.addAction(self.saveAsAct) 811 menu.addAction(self.saveAsAct)
812 menu.addSeparator() 812 menu.addSeparator()
813 menu.addAction(self.closeAct) 813 menu.addAction(self.closeAct)
814 menu.addAction(self.closeAllAct) 814 if self.fromEric:
815 if not self.fromEric: 815 menu.addAction(self.closeAllAct)
816 else:
816 menu.addSeparator() 817 menu.addSeparator()
817 menu.addAction(self.exitAct) 818 menu.addAction(self.exitAct)
818 819
819 menu = mb.addMenu(self.tr("&Edit")) 820 menu = mb.addMenu(self.tr("&Edit"))
820 menu.setTearOffEnabled(True) 821 menu.setTearOffEnabled(True)

eric ide

mercurial