IconEditor/IconEditorWindow.py

changeset 453
a81097a85889
parent 414
8c91e942d2da
child 454
d28d558f7484
child 455
9a7e0b7b801e
equal deleted inserted replaced
452:0bc58cbb64b2 453:a81097a85889
170 self.newAct.setStatusTip(self.trUtf8('Create a new icon')) 170 self.newAct.setStatusTip(self.trUtf8('Create a new icon'))
171 self.newAct.setWhatsThis(self.trUtf8( 171 self.newAct.setWhatsThis(self.trUtf8(
172 """<b>New</b>""" 172 """<b>New</b>"""
173 """<p>This creates a new icon.</p>""" 173 """<p>This creates a new icon.</p>"""
174 )) 174 ))
175 self.connect(self.newAct, SIGNAL('triggered()'), self.__newIcon) 175 self.newAct.triggered.connect(self.__newIcon)
176 self.__actions.append(self.newAct) 176 self.__actions.append(self.newAct)
177 177
178 self.newWindowAct = E5Action(self.trUtf8('New Window'), 178 self.newWindowAct = E5Action(self.trUtf8('New Window'),
179 UI.PixmapCache.getIcon("newWindow.png"), 179 UI.PixmapCache.getIcon("newWindow.png"),
180 self.trUtf8('New &Window'), 180 self.trUtf8('New &Window'),
182 self.newWindowAct.setStatusTip(self.trUtf8('Open a new icon editor window')) 182 self.newWindowAct.setStatusTip(self.trUtf8('Open a new icon editor window'))
183 self.newWindowAct.setWhatsThis(self.trUtf8( 183 self.newWindowAct.setWhatsThis(self.trUtf8(
184 """<b>New Window</b>""" 184 """<b>New Window</b>"""
185 """<p>This opens a new icon editor window.</p>""" 185 """<p>This opens a new icon editor window.</p>"""
186 )) 186 ))
187 self.connect(self.newWindowAct, SIGNAL('triggered()'), self.__newWindow) 187 self.newWindowAct.triggered.connect(self.__newWindow)
188 self.__actions.append(self.newWindowAct) 188 self.__actions.append(self.newWindowAct)
189 189
190 self.openAct = E5Action(self.trUtf8('Open'), 190 self.openAct = E5Action(self.trUtf8('Open'),
191 UI.PixmapCache.getIcon("open.png"), 191 UI.PixmapCache.getIcon("open.png"),
192 self.trUtf8('&Open...'), 192 self.trUtf8('&Open...'),
196 self.openAct.setWhatsThis(self.trUtf8( 196 self.openAct.setWhatsThis(self.trUtf8(
197 """<b>Open File</b>""" 197 """<b>Open File</b>"""
198 """<p>This opens a new icon file for editing.""" 198 """<p>This opens a new icon file for editing."""
199 """ It pops up a file selection dialog.</p>""" 199 """ It pops up a file selection dialog.</p>"""
200 )) 200 ))
201 self.connect(self.openAct, SIGNAL('triggered()'), self.__openIcon) 201 self.openAct.triggered.connect(self.__openIcon)
202 self.__actions.append(self.openAct) 202 self.__actions.append(self.openAct)
203 203
204 self.saveAct = E5Action(self.trUtf8('Save'), 204 self.saveAct = E5Action(self.trUtf8('Save'),
205 UI.PixmapCache.getIcon("fileSave.png"), 205 UI.PixmapCache.getIcon("fileSave.png"),
206 self.trUtf8('&Save'), 206 self.trUtf8('&Save'),
209 self.saveAct.setStatusTip(self.trUtf8('Save the current icon')) 209 self.saveAct.setStatusTip(self.trUtf8('Save the current icon'))
210 self.saveAct.setWhatsThis(self.trUtf8( 210 self.saveAct.setWhatsThis(self.trUtf8(
211 """<b>Save File</b>""" 211 """<b>Save File</b>"""
212 """<p>Save the contents of the icon editor window.</p>""" 212 """<p>Save the contents of the icon editor window.</p>"""
213 )) 213 ))
214 self.connect(self.saveAct, SIGNAL('triggered()'), self.__saveIcon) 214 self.saveAct.triggered.connect(self.__saveIcon)
215 self.__actions.append(self.saveAct) 215 self.__actions.append(self.saveAct)
216 216
217 self.saveAsAct = E5Action(self.trUtf8('Save As'), 217 self.saveAsAct = E5Action(self.trUtf8('Save As'),
218 UI.PixmapCache.getIcon("fileSaveAs.png"), 218 UI.PixmapCache.getIcon("fileSaveAs.png"),
219 self.trUtf8('Save &As...'), 219 self.trUtf8('Save &As...'),
223 self.trUtf8('Save the current icon to a new file')) 223 self.trUtf8('Save the current icon to a new file'))
224 self.saveAsAct.setWhatsThis(self.trUtf8( 224 self.saveAsAct.setWhatsThis(self.trUtf8(
225 """<b>Save As...</b>""" 225 """<b>Save As...</b>"""
226 """<p>Saves the current icon to a new file.</p>""" 226 """<p>Saves the current icon to a new file.</p>"""
227 )) 227 ))
228 self.connect(self.saveAsAct, SIGNAL('triggered()'), self.__saveIconAs) 228 self.saveAsAct.triggered.connect(self.__saveIconAs)
229 self.__actions.append(self.saveAsAct) 229 self.__actions.append(self.saveAsAct)
230 230
231 self.closeAct = E5Action(self.trUtf8('Close'), 231 self.closeAct = E5Action(self.trUtf8('Close'),
232 UI.PixmapCache.getIcon("close.png"), 232 UI.PixmapCache.getIcon("close.png"),
233 self.trUtf8('&Close'), 233 self.trUtf8('&Close'),
236 self.closeAct.setStatusTip(self.trUtf8('Close the current icon editor window')) 236 self.closeAct.setStatusTip(self.trUtf8('Close the current icon editor window'))
237 self.closeAct.setWhatsThis(self.trUtf8( 237 self.closeAct.setWhatsThis(self.trUtf8(
238 """<b>Close</b>""" 238 """<b>Close</b>"""
239 """<p>Closes the current icon editor window.</p>""" 239 """<p>Closes the current icon editor window.</p>"""
240 )) 240 ))
241 self.connect(self.closeAct, SIGNAL('triggered()'), self.close) 241 self.closeAct.triggered.connect(self.close)
242 self.__actions.append(self.closeAct) 242 self.__actions.append(self.closeAct)
243 243
244 self.closeAllAct = E5Action(self.trUtf8('Close All'), 244 self.closeAllAct = E5Action(self.trUtf8('Close All'),
245 self.trUtf8('Close &All'), 245 self.trUtf8('Close &All'),
246 0, 0, self, 'iconEditor_file_close_all') 246 0, 0, self, 'iconEditor_file_close_all')
247 self.closeAllAct.setStatusTip(self.trUtf8('Close all icon editor windows')) 247 self.closeAllAct.setStatusTip(self.trUtf8('Close all icon editor windows'))
248 self.closeAllAct.setWhatsThis(self.trUtf8( 248 self.closeAllAct.setWhatsThis(self.trUtf8(
249 """<b>Close All</b>""" 249 """<b>Close All</b>"""
250 """<p>Closes all icon editor windows except the first one.</p>""" 250 """<p>Closes all icon editor windows except the first one.</p>"""
251 )) 251 ))
252 self.connect(self.closeAllAct, SIGNAL('triggered()'), self.__closeAll) 252 self.closeAllAct.triggered.connect(self.__closeAll)
253 self.__actions.append(self.closeAllAct) 253 self.__actions.append(self.closeAllAct)
254 254
255 self.exitAct = E5Action(self.trUtf8('Quit'), 255 self.exitAct = E5Action(self.trUtf8('Quit'),
256 UI.PixmapCache.getIcon("exit.png"), 256 UI.PixmapCache.getIcon("exit.png"),
257 self.trUtf8('&Quit'), 257 self.trUtf8('&Quit'),
261 self.exitAct.setWhatsThis(self.trUtf8( 261 self.exitAct.setWhatsThis(self.trUtf8(
262 """<b>Quit</b>""" 262 """<b>Quit</b>"""
263 """<p>Quit the icon editor.</p>""" 263 """<p>Quit the icon editor.</p>"""
264 )) 264 ))
265 if self.fromEric: 265 if self.fromEric:
266 self.connect(self.exitAct, SIGNAL('triggered()'), self.close) 266 self.exitAct.triggered.connect(self.close)
267 else: 267 else:
268 self.connect(self.exitAct, SIGNAL('triggered()'), 268 self.connect(self.exitAct, SIGNAL('triggered()'),
269 qApp, SLOT('closeAllWindows()')) 269 qApp, SLOT('closeAllWindows()'))
270 self.__actions.append(self.exitAct) 270 self.__actions.append(self.exitAct)
271 271
282 self.undoAct.setStatusTip(self.trUtf8('Undo the last change')) 282 self.undoAct.setStatusTip(self.trUtf8('Undo the last change'))
283 self.undoAct.setWhatsThis(self.trUtf8(\ 283 self.undoAct.setWhatsThis(self.trUtf8(\
284 """<b>Undo</b>""" 284 """<b>Undo</b>"""
285 """<p>Undo the last change done.</p>""" 285 """<p>Undo the last change done.</p>"""
286 )) 286 ))
287 self.connect(self.undoAct, SIGNAL('triggered()'), self.__editor.editUndo) 287 self.undoAct.triggered.connect(self.__editor.editUndo)
288 self.__actions.append(self.undoAct) 288 self.__actions.append(self.undoAct)
289 289
290 self.redoAct = E5Action(self.trUtf8('Redo'), 290 self.redoAct = E5Action(self.trUtf8('Redo'),
291 UI.PixmapCache.getIcon("editRedo.png"), 291 UI.PixmapCache.getIcon("editRedo.png"),
292 self.trUtf8('&Redo'), 292 self.trUtf8('&Redo'),
295 self.redoAct.setStatusTip(self.trUtf8('Redo the last change')) 295 self.redoAct.setStatusTip(self.trUtf8('Redo the last change'))
296 self.redoAct.setWhatsThis(self.trUtf8(\ 296 self.redoAct.setWhatsThis(self.trUtf8(\
297 """<b>Redo</b>""" 297 """<b>Redo</b>"""
298 """<p>Redo the last change done.</p>""" 298 """<p>Redo the last change done.</p>"""
299 )) 299 ))
300 self.connect(self.redoAct, SIGNAL('triggered()'), self.__editor.editRedo) 300 self.redoAct.triggered.connect(self.__editor.editRedo)
301 self.__actions.append(self.redoAct) 301 self.__actions.append(self.redoAct)
302 302
303 self.cutAct = E5Action(self.trUtf8('Cut'), 303 self.cutAct = E5Action(self.trUtf8('Cut'),
304 UI.PixmapCache.getIcon("editCut.png"), 304 UI.PixmapCache.getIcon("editCut.png"),
305 self.trUtf8('Cu&t'), 305 self.trUtf8('Cu&t'),
309 self.cutAct.setStatusTip(self.trUtf8('Cut the selection')) 309 self.cutAct.setStatusTip(self.trUtf8('Cut the selection'))
310 self.cutAct.setWhatsThis(self.trUtf8(\ 310 self.cutAct.setWhatsThis(self.trUtf8(\
311 """<b>Cut</b>""" 311 """<b>Cut</b>"""
312 """<p>Cut the selected image area to the clipboard.</p>""" 312 """<p>Cut the selected image area to the clipboard.</p>"""
313 )) 313 ))
314 self.connect(self.cutAct, SIGNAL('triggered()'), self.__editor.editCut) 314 self.cutAct.triggered.connect(self.__editor.editCut)
315 self.__actions.append(self.cutAct) 315 self.__actions.append(self.cutAct)
316 316
317 self.copyAct = E5Action(self.trUtf8('Copy'), 317 self.copyAct = E5Action(self.trUtf8('Copy'),
318 UI.PixmapCache.getIcon("editCopy.png"), 318 UI.PixmapCache.getIcon("editCopy.png"),
319 self.trUtf8('&Copy'), 319 self.trUtf8('&Copy'),
323 self.copyAct.setStatusTip(self.trUtf8('Copy the selection')) 323 self.copyAct.setStatusTip(self.trUtf8('Copy the selection'))
324 self.copyAct.setWhatsThis(self.trUtf8(\ 324 self.copyAct.setWhatsThis(self.trUtf8(\
325 """<b>Copy</b>""" 325 """<b>Copy</b>"""
326 """<p>Copy the selected image area to the clipboard.</p>""" 326 """<p>Copy the selected image area to the clipboard.</p>"""
327 )) 327 ))
328 self.connect(self.copyAct, SIGNAL('triggered()'), self.__editor.editCopy) 328 self.copyAct.triggered.connect(self.__editor.editCopy)
329 self.__actions.append(self.copyAct) 329 self.__actions.append(self.copyAct)
330 330
331 self.pasteAct = E5Action(self.trUtf8('Paste'), 331 self.pasteAct = E5Action(self.trUtf8('Paste'),
332 UI.PixmapCache.getIcon("editPaste.png"), 332 UI.PixmapCache.getIcon("editPaste.png"),
333 self.trUtf8('&Paste'), 333 self.trUtf8('&Paste'),
337 self.pasteAct.setStatusTip(self.trUtf8('Paste the clipboard image')) 337 self.pasteAct.setStatusTip(self.trUtf8('Paste the clipboard image'))
338 self.pasteAct.setWhatsThis(self.trUtf8(\ 338 self.pasteAct.setWhatsThis(self.trUtf8(\
339 """<b>Paste</b>""" 339 """<b>Paste</b>"""
340 """<p>Paste the clipboard image.</p>""" 340 """<p>Paste the clipboard image.</p>"""
341 )) 341 ))
342 self.connect(self.pasteAct, SIGNAL('triggered()'), self.__editor.editPaste) 342 self.pasteAct.triggered.connect(self.__editor.editPaste)
343 self.__actions.append(self.pasteAct) 343 self.__actions.append(self.pasteAct)
344 344
345 self.pasteNewAct = E5Action(self.trUtf8('Paste as New'), 345 self.pasteNewAct = E5Action(self.trUtf8('Paste as New'),
346 self.trUtf8('Paste as &New'), 346 self.trUtf8('Paste as &New'),
347 0, 0, self, 'iconEditor_edit_paste_as_new') 347 0, 0, self, 'iconEditor_edit_paste_as_new')
349 'Paste the clipboard image replacing the current one')) 349 'Paste the clipboard image replacing the current one'))
350 self.pasteNewAct.setWhatsThis(self.trUtf8(\ 350 self.pasteNewAct.setWhatsThis(self.trUtf8(\
351 """<b>Paste as New</b>""" 351 """<b>Paste as New</b>"""
352 """<p>Paste the clipboard image replacing the current one.</p>""" 352 """<p>Paste the clipboard image replacing the current one.</p>"""
353 )) 353 ))
354 self.connect(self.pasteNewAct, SIGNAL('triggered()'), self.__editor.editPasteAsNew) 354 self.pasteNewAct.triggered.connect(self.__editor.editPasteAsNew)
355 self.__actions.append(self.pasteNewAct) 355 self.__actions.append(self.pasteNewAct)
356 356
357 self.deleteAct = E5Action(self.trUtf8('Clear'), 357 self.deleteAct = E5Action(self.trUtf8('Clear'),
358 UI.PixmapCache.getIcon("editDelete.png"), 358 UI.PixmapCache.getIcon("editDelete.png"),
359 self.trUtf8('Cl&ear'), 359 self.trUtf8('Cl&ear'),
363 self.deleteAct.setStatusTip(self.trUtf8('Clear the icon image')) 363 self.deleteAct.setStatusTip(self.trUtf8('Clear the icon image'))
364 self.deleteAct.setWhatsThis(self.trUtf8(\ 364 self.deleteAct.setWhatsThis(self.trUtf8(\
365 """<b>Clear</b>""" 365 """<b>Clear</b>"""
366 """<p>Clear the icon image and set it to be completely transparent.</p>""" 366 """<p>Clear the icon image and set it to be completely transparent.</p>"""
367 )) 367 ))
368 self.connect(self.deleteAct, SIGNAL('triggered()'), self.__editor.editClear) 368 self.deleteAct.triggered.connect(self.__editor.editClear)
369 self.__actions.append(self.deleteAct) 369 self.__actions.append(self.deleteAct)
370 370
371 self.selectAllAct = E5Action(self.trUtf8('Select All'), 371 self.selectAllAct = E5Action(self.trUtf8('Select All'),
372 self.trUtf8('&Select All'), 372 self.trUtf8('&Select All'),
373 QKeySequence(self.trUtf8("Ctrl+A", "Edit|Select All")), 373 QKeySequence(self.trUtf8("Ctrl+A", "Edit|Select All")),
376 self.selectAllAct.setStatusTip(self.trUtf8('Select the complete icon image')) 376 self.selectAllAct.setStatusTip(self.trUtf8('Select the complete icon image'))
377 self.selectAllAct.setWhatsThis(self.trUtf8(\ 377 self.selectAllAct.setWhatsThis(self.trUtf8(\
378 """<b>Select All</b>""" 378 """<b>Select All</b>"""
379 """<p>Selects the complete icon image.</p>""" 379 """<p>Selects the complete icon image.</p>"""
380 )) 380 ))
381 self.connect(self.selectAllAct, SIGNAL('triggered()'), self.__editor.editSelectAll) 381 self.selectAllAct.triggered.connect(self.__editor.editSelectAll)
382 self.__actions.append(self.selectAllAct) 382 self.__actions.append(self.selectAllAct)
383 383
384 self.resizeAct = E5Action(self.trUtf8('Change Size'), 384 self.resizeAct = E5Action(self.trUtf8('Change Size'),
385 UI.PixmapCache.getIcon("transformResize.png"), 385 UI.PixmapCache.getIcon("transformResize.png"),
386 self.trUtf8('Change Si&ze...'), 386 self.trUtf8('Change Si&ze...'),
389 self.resizeAct.setStatusTip(self.trUtf8('Change the icon size')) 389 self.resizeAct.setStatusTip(self.trUtf8('Change the icon size'))
390 self.resizeAct.setWhatsThis(self.trUtf8(\ 390 self.resizeAct.setWhatsThis(self.trUtf8(\
391 """<b>Change Size...</b>""" 391 """<b>Change Size...</b>"""
392 """<p>Changes the icon size.</p>""" 392 """<p>Changes the icon size.</p>"""
393 )) 393 ))
394 self.connect(self.resizeAct, SIGNAL('triggered()'), self.__editor.editResize) 394 self.resizeAct.triggered.connect(self.__editor.editResize)
395 self.__actions.append(self.resizeAct) 395 self.__actions.append(self.resizeAct)
396 396
397 self.grayscaleAct = E5Action(self.trUtf8('Grayscale'), 397 self.grayscaleAct = E5Action(self.trUtf8('Grayscale'),
398 UI.PixmapCache.getIcon("grayscale.png"), 398 UI.PixmapCache.getIcon("grayscale.png"),
399 self.trUtf8('&Grayscale'), 399 self.trUtf8('&Grayscale'),
402 self.grayscaleAct.setStatusTip(self.trUtf8('Change the icon to grayscale')) 402 self.grayscaleAct.setStatusTip(self.trUtf8('Change the icon to grayscale'))
403 self.grayscaleAct.setWhatsThis(self.trUtf8(\ 403 self.grayscaleAct.setWhatsThis(self.trUtf8(\
404 """<b>Grayscale</b>""" 404 """<b>Grayscale</b>"""
405 """<p>Changes the icon to grayscale.</p>""" 405 """<p>Changes the icon to grayscale.</p>"""
406 )) 406 ))
407 self.connect(self.grayscaleAct, SIGNAL('triggered()'), self.__editor.grayScale) 407 self.grayscaleAct.triggered.connect(self.__editor.grayScale)
408 self.__actions.append(self.grayscaleAct) 408 self.__actions.append(self.grayscaleAct)
409 409
410 self.redoAct.setEnabled(False) 410 self.redoAct.setEnabled(False)
411 self.connect(self.__editor, SIGNAL("canRedoChanged(bool)"), 411 self.connect(self.__editor, SIGNAL("canRedoChanged(bool)"),
412 self.redoAct, SLOT("setEnabled(bool)")) 412 self.redoAct, SLOT("setEnabled(bool)"))
441 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the icon')) 441 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the icon'))
442 self.zoomInAct.setWhatsThis(self.trUtf8( 442 self.zoomInAct.setWhatsThis(self.trUtf8(
443 """<b>Zoom in</b>""" 443 """<b>Zoom in</b>"""
444 """<p>Zoom in on the icon. This makes the grid bigger.</p>""" 444 """<p>Zoom in on the icon. This makes the grid bigger.</p>"""
445 )) 445 ))
446 self.connect(self.zoomInAct, SIGNAL('triggered()'), self.__zoomIn) 446 self.zoomInAct.triggered.connect(self.__zoomIn)
447 self.__actions.append(self.zoomInAct) 447 self.__actions.append(self.zoomInAct)
448 448
449 self.zoomOutAct = E5Action(self.trUtf8('Zoom out'), 449 self.zoomOutAct = E5Action(self.trUtf8('Zoom out'),
450 UI.PixmapCache.getIcon("zoomOut.png"), 450 UI.PixmapCache.getIcon("zoomOut.png"),
451 self.trUtf8('Zoom &out'), 451 self.trUtf8('Zoom &out'),
454 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the icon')) 454 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the icon'))
455 self.zoomOutAct.setWhatsThis(self.trUtf8( 455 self.zoomOutAct.setWhatsThis(self.trUtf8(
456 """<b>Zoom out</b>""" 456 """<b>Zoom out</b>"""
457 """<p>Zoom out on the icon. This makes the grid smaller.</p>""" 457 """<p>Zoom out on the icon. This makes the grid smaller.</p>"""
458 )) 458 ))
459 self.connect(self.zoomOutAct, SIGNAL('triggered()'), self.__zoomOut) 459 self.zoomOutAct.triggered.connect(self.__zoomOut)
460 self.__actions.append(self.zoomOutAct) 460 self.__actions.append(self.zoomOutAct)
461 461
462 self.zoomResetAct = E5Action(self.trUtf8('Zoom reset'), 462 self.zoomResetAct = E5Action(self.trUtf8('Zoom reset'),
463 UI.PixmapCache.getIcon("zoomReset.png"), 463 UI.PixmapCache.getIcon("zoomReset.png"),
464 self.trUtf8('Zoom &reset'), 464 self.trUtf8('Zoom &reset'),
468 self.zoomResetAct.setWhatsThis(self.trUtf8( 468 self.zoomResetAct.setWhatsThis(self.trUtf8(
469 """<b>Zoom reset</b>""" 469 """<b>Zoom reset</b>"""
470 """<p>Reset the zoom of the icon. """ 470 """<p>Reset the zoom of the icon. """
471 """This sets the zoom factor to 100%.</p>""" 471 """This sets the zoom factor to 100%.</p>"""
472 )) 472 ))
473 self.connect(self.zoomResetAct, SIGNAL('triggered()'), self.__zoomReset) 473 self.zoomResetAct.triggered.connect(self.__zoomReset)
474 self.__actions.append(self.zoomResetAct) 474 self.__actions.append(self.zoomResetAct)
475 475
476 self.zoomToAct = E5Action(self.trUtf8('Zoom'), 476 self.zoomToAct = E5Action(self.trUtf8('Zoom'),
477 UI.PixmapCache.getIcon("zoomTo.png"), 477 UI.PixmapCache.getIcon("zoomTo.png"),
478 self.trUtf8('&Zoom...'), 478 self.trUtf8('&Zoom...'),
483 self.zoomToAct.setWhatsThis(self.trUtf8( 483 self.zoomToAct.setWhatsThis(self.trUtf8(
484 """<b>Zoom</b>""" 484 """<b>Zoom</b>"""
485 """<p>Zoom the icon. This opens a dialog where the""" 485 """<p>Zoom the icon. This opens a dialog where the"""
486 """ desired zoom factor can be entered.</p>""" 486 """ desired zoom factor can be entered.</p>"""
487 )) 487 ))
488 self.connect(self.zoomToAct, SIGNAL('triggered()'), self.__zoom) 488 self.zoomToAct.triggered.connect(self.__zoom)
489 self.__actions.append(self.zoomToAct) 489 self.__actions.append(self.zoomToAct)
490 490
491 self.showGridAct = E5Action(self.trUtf8('Show Grid'), 491 self.showGridAct = E5Action(self.trUtf8('Show Grid'),
492 UI.PixmapCache.getIcon("grid.png"), 492 UI.PixmapCache.getIcon("grid.png"),
493 self.trUtf8('Show &Grid'), 493 self.trUtf8('Show &Grid'),
523 """<b>Free hand</b>""" 523 """<b>Free hand</b>"""
524 """<p>Draws non linear lines.</p>""" 524 """<p>Draws non linear lines.</p>"""
525 )) 525 ))
526 self.drawPencilAct.setCheckable(True) 526 self.drawPencilAct.setCheckable(True)
527 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil) 527 self.esm.setMapping(self.drawPencilAct, IconEditorGrid.Pencil)
528 self.connect(self.drawPencilAct, SIGNAL('triggered()'), 528 self.drawPencilAct.triggered.connect(self.esm.map)
529 self.esm, SLOT('map()'))
530 self.__actions.append(self.drawPencilAct) 529 self.__actions.append(self.drawPencilAct)
531 530
532 self.drawColorPickerAct = E5Action(self.trUtf8('Color Picker'), 531 self.drawColorPickerAct = E5Action(self.trUtf8('Color Picker'),
533 UI.PixmapCache.getIcon("colorPicker.png"), 532 UI.PixmapCache.getIcon("colorPicker.png"),
534 self.trUtf8('&Color Picker'), 533 self.trUtf8('&Color Picker'),
539 """<p>The color of the pixel clicked on will become """ 538 """<p>The color of the pixel clicked on will become """
540 """the current draw color.</p>""" 539 """the current draw color.</p>"""
541 )) 540 ))
542 self.drawColorPickerAct.setCheckable(True) 541 self.drawColorPickerAct.setCheckable(True)
543 self.esm.setMapping(self.drawColorPickerAct, IconEditorGrid.ColorPicker) 542 self.esm.setMapping(self.drawColorPickerAct, IconEditorGrid.ColorPicker)
544 self.connect(self.drawColorPickerAct, SIGNAL('triggered()'), 543 self.drawColorPickerAct.triggered.connect(self.esm.map)
545 self.esm, SLOT('map()'))
546 self.__actions.append(self.drawColorPickerAct) 544 self.__actions.append(self.drawColorPickerAct)
547 545
548 self.drawRectangleAct = E5Action(self.trUtf8('Rectangle'), 546 self.drawRectangleAct = E5Action(self.trUtf8('Rectangle'),
549 UI.PixmapCache.getIcon("drawRectangle.png"), 547 UI.PixmapCache.getIcon("drawRectangle.png"),
550 self.trUtf8('&Rectangle'), 548 self.trUtf8('&Rectangle'),
554 """<b>Rectangle</b>""" 552 """<b>Rectangle</b>"""
555 """<p>Draw a rectangle.</p>""" 553 """<p>Draw a rectangle.</p>"""
556 )) 554 ))
557 self.drawRectangleAct.setCheckable(True) 555 self.drawRectangleAct.setCheckable(True)
558 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle) 556 self.esm.setMapping(self.drawRectangleAct, IconEditorGrid.Rectangle)
559 self.connect(self.drawRectangleAct, SIGNAL('triggered()'), 557 self.drawRectangleAct.triggered.connect(self.esm.map)
560 self.esm, SLOT('map()'))
561 self.__actions.append(self.drawRectangleAct) 558 self.__actions.append(self.drawRectangleAct)
562 559
563 self.drawFilledRectangleAct = E5Action(self.trUtf8('Filled Rectangle'), 560 self.drawFilledRectangleAct = E5Action(self.trUtf8('Filled Rectangle'),
564 UI.PixmapCache.getIcon("drawRectangleFilled.png"), 561 UI.PixmapCache.getIcon("drawRectangleFilled.png"),
565 self.trUtf8('F&illed Rectangle'), 562 self.trUtf8('F&illed Rectangle'),
569 """<b>Filled Rectangle</b>""" 566 """<b>Filled Rectangle</b>"""
570 """<p>Draw a filled rectangle.</p>""" 567 """<p>Draw a filled rectangle.</p>"""
571 )) 568 ))
572 self.drawFilledRectangleAct.setCheckable(True) 569 self.drawFilledRectangleAct.setCheckable(True)
573 self.esm.setMapping(self.drawFilledRectangleAct, IconEditorGrid.FilledRectangle) 570 self.esm.setMapping(self.drawFilledRectangleAct, IconEditorGrid.FilledRectangle)
574 self.connect(self.drawFilledRectangleAct, SIGNAL('triggered()'), 571 self.drawFilledRectangleAct.triggered.connect(self.esm.map)
575 self.esm, SLOT('map()'))
576 self.__actions.append(self.drawFilledRectangleAct) 572 self.__actions.append(self.drawFilledRectangleAct)
577 573
578 self.drawCircleAct = E5Action(self.trUtf8('Circle'), 574 self.drawCircleAct = E5Action(self.trUtf8('Circle'),
579 UI.PixmapCache.getIcon("drawCircle.png"), 575 UI.PixmapCache.getIcon("drawCircle.png"),
580 self.trUtf8('Circle'), 576 self.trUtf8('Circle'),
584 """<b>Circle</b>""" 580 """<b>Circle</b>"""
585 """<p>Draw a circle.</p>""" 581 """<p>Draw a circle.</p>"""
586 )) 582 ))
587 self.drawCircleAct.setCheckable(True) 583 self.drawCircleAct.setCheckable(True)
588 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle) 584 self.esm.setMapping(self.drawCircleAct, IconEditorGrid.Circle)
589 self.connect(self.drawCircleAct, SIGNAL('triggered()'), 585 self.drawCircleAct.triggered.connect(self.esm.map)
590 self.esm, SLOT('map()'))
591 self.__actions.append(self.drawCircleAct) 586 self.__actions.append(self.drawCircleAct)
592 587
593 self.drawFilledCircleAct = E5Action(self.trUtf8('Filled Circle'), 588 self.drawFilledCircleAct = E5Action(self.trUtf8('Filled Circle'),
594 UI.PixmapCache.getIcon("drawCircleFilled.png"), 589 UI.PixmapCache.getIcon("drawCircleFilled.png"),
595 self.trUtf8('Fille&d Circle'), 590 self.trUtf8('Fille&d Circle'),
599 """<b>Filled Circle</b>""" 594 """<b>Filled Circle</b>"""
600 """<p>Draw a filled circle.</p>""" 595 """<p>Draw a filled circle.</p>"""
601 )) 596 ))
602 self.drawFilledCircleAct.setCheckable(True) 597 self.drawFilledCircleAct.setCheckable(True)
603 self.esm.setMapping(self.drawFilledCircleAct, IconEditorGrid.FilledCircle) 598 self.esm.setMapping(self.drawFilledCircleAct, IconEditorGrid.FilledCircle)
604 self.connect(self.drawFilledCircleAct, SIGNAL('triggered()'), 599 self.drawFilledCircleAct.triggered.connect(self.esm.map)
605 self.esm, SLOT('map()'))
606 self.__actions.append(self.drawFilledCircleAct) 600 self.__actions.append(self.drawFilledCircleAct)
607 601
608 self.drawEllipseAct = E5Action(self.trUtf8('Ellipse'), 602 self.drawEllipseAct = E5Action(self.trUtf8('Ellipse'),
609 UI.PixmapCache.getIcon("drawEllipse.png"), 603 UI.PixmapCache.getIcon("drawEllipse.png"),
610 self.trUtf8('&Ellipse'), 604 self.trUtf8('&Ellipse'),
614 """<b>Ellipse</b>""" 608 """<b>Ellipse</b>"""
615 """<p>Draw an ellipse.</p>""" 609 """<p>Draw an ellipse.</p>"""
616 )) 610 ))
617 self.drawEllipseAct.setCheckable(True) 611 self.drawEllipseAct.setCheckable(True)
618 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse) 612 self.esm.setMapping(self.drawEllipseAct, IconEditorGrid.Ellipse)
619 self.connect(self.drawEllipseAct, SIGNAL('triggered()'), 613 self.drawEllipseAct.triggered.connect(self.esm.map)
620 self.esm, SLOT('map()'))
621 self.__actions.append(self.drawEllipseAct) 614 self.__actions.append(self.drawEllipseAct)
622 615
623 self.drawFilledEllipseAct = E5Action(self.trUtf8('Filled Ellipse'), 616 self.drawFilledEllipseAct = E5Action(self.trUtf8('Filled Ellipse'),
624 UI.PixmapCache.getIcon("drawEllipseFilled.png"), 617 UI.PixmapCache.getIcon("drawEllipseFilled.png"),
625 self.trUtf8('Fille&d Elli&pse'), 618 self.trUtf8('Fille&d Elli&pse'),
629 """<b>Filled Ellipse</b>""" 622 """<b>Filled Ellipse</b>"""
630 """<p>Draw a filled ellipse.</p>""" 623 """<p>Draw a filled ellipse.</p>"""
631 )) 624 ))
632 self.drawFilledEllipseAct.setCheckable(True) 625 self.drawFilledEllipseAct.setCheckable(True)
633 self.esm.setMapping(self.drawFilledEllipseAct, IconEditorGrid.FilledEllipse) 626 self.esm.setMapping(self.drawFilledEllipseAct, IconEditorGrid.FilledEllipse)
634 self.connect(self.drawFilledEllipseAct, SIGNAL('triggered()'), 627 self.drawFilledEllipseAct.triggered.connect(self.esm.map)
635 self.esm, SLOT('map()'))
636 self.__actions.append(self.drawFilledEllipseAct) 628 self.__actions.append(self.drawFilledEllipseAct)
637 629
638 self.drawFloodFillAct = E5Action(self.trUtf8('Flood Fill'), 630 self.drawFloodFillAct = E5Action(self.trUtf8('Flood Fill'),
639 UI.PixmapCache.getIcon("drawFill.png"), 631 UI.PixmapCache.getIcon("drawFill.png"),
640 self.trUtf8('Fl&ood Fill'), 632 self.trUtf8('Fl&ood Fill'),
645 """<p>Fill adjoining pixels with the same color with """ 637 """<p>Fill adjoining pixels with the same color with """
646 """the current color.</p>""" 638 """the current color.</p>"""
647 )) 639 ))
648 self.drawFloodFillAct.setCheckable(True) 640 self.drawFloodFillAct.setCheckable(True)
649 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill) 641 self.esm.setMapping(self.drawFloodFillAct, IconEditorGrid.Fill)
650 self.connect(self.drawFloodFillAct, SIGNAL('triggered()'), 642 self.drawFloodFillAct.triggered.connect(self.esm.map)
651 self.esm, SLOT('map()'))
652 self.__actions.append(self.drawFloodFillAct) 643 self.__actions.append(self.drawFloodFillAct)
653 644
654 self.drawLineAct = E5Action(self.trUtf8('Line'), 645 self.drawLineAct = E5Action(self.trUtf8('Line'),
655 UI.PixmapCache.getIcon("drawLine.png"), 646 UI.PixmapCache.getIcon("drawLine.png"),
656 self.trUtf8('&Line'), 647 self.trUtf8('&Line'),
660 """<b>Line</b>""" 651 """<b>Line</b>"""
661 """<p>Draw a line.</p>""" 652 """<p>Draw a line.</p>"""
662 )) 653 ))
663 self.drawLineAct.setCheckable(True) 654 self.drawLineAct.setCheckable(True)
664 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line) 655 self.esm.setMapping(self.drawLineAct, IconEditorGrid.Line)
665 self.connect(self.drawLineAct, SIGNAL('triggered()'), 656 self.drawLineAct.triggered.connect(self.esm.map)
666 self.esm, SLOT('map()'))
667 self.__actions.append(self.drawLineAct) 657 self.__actions.append(self.drawLineAct)
668 658
669 self.drawEraserAct = E5Action(self.trUtf8('Eraser (Transparent)'), 659 self.drawEraserAct = E5Action(self.trUtf8('Eraser (Transparent)'),
670 UI.PixmapCache.getIcon("drawEraser.png"), 660 UI.PixmapCache.getIcon("drawEraser.png"),
671 self.trUtf8('Eraser (&Transparent)'), 661 self.trUtf8('Eraser (&Transparent)'),
675 """<b>Eraser (Transparent)</b>""" 665 """<b>Eraser (Transparent)</b>"""
676 """<p>Erase pixels by setting them to transparent.</p>""" 666 """<p>Erase pixels by setting them to transparent.</p>"""
677 )) 667 ))
678 self.drawEraserAct.setCheckable(True) 668 self.drawEraserAct.setCheckable(True)
679 self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber) 669 self.esm.setMapping(self.drawEraserAct, IconEditorGrid.Rubber)
680 self.connect(self.drawEraserAct, SIGNAL('triggered()'), 670 self.drawEraserAct.triggered.connect(self.esm.map)
681 self.esm, SLOT('map()'))
682 self.__actions.append(self.drawEraserAct) 671 self.__actions.append(self.drawEraserAct)
683 672
684 self.drawRectangleSelectionAct = E5Action(self.trUtf8('Rectangular Selection'), 673 self.drawRectangleSelectionAct = E5Action(self.trUtf8('Rectangular Selection'),
685 UI.PixmapCache.getIcon("selectRectangle.png"), 674 UI.PixmapCache.getIcon("selectRectangle.png"),
686 self.trUtf8('Rect&angular Selection'), 675 self.trUtf8('Rect&angular Selection'),
691 """<p>Select a rectangular section of the icon using the mouse.</p>""" 680 """<p>Select a rectangular section of the icon using the mouse.</p>"""
692 )) 681 ))
693 self.drawRectangleSelectionAct.setCheckable(True) 682 self.drawRectangleSelectionAct.setCheckable(True)
694 self.esm.setMapping(self.drawRectangleSelectionAct, 683 self.esm.setMapping(self.drawRectangleSelectionAct,
695 IconEditorGrid.RectangleSelection) 684 IconEditorGrid.RectangleSelection)
696 self.connect(self.drawRectangleSelectionAct, SIGNAL('triggered()'), 685 self.drawRectangleSelectionAct.triggered.connect(self.esm.map)
697 self.esm, SLOT('map()'))
698 self.__actions.append(self.drawRectangleSelectionAct) 686 self.__actions.append(self.drawRectangleSelectionAct)
699 687
700 self.drawCircleSelectionAct = E5Action(self.trUtf8('Circular Selection'), 688 self.drawCircleSelectionAct = E5Action(self.trUtf8('Circular Selection'),
701 UI.PixmapCache.getIcon("selectCircle.png"), 689 UI.PixmapCache.getIcon("selectCircle.png"),
702 self.trUtf8('Rect&angular Selection'), 690 self.trUtf8('Rect&angular Selection'),
707 """<p>Select a circular section of the icon using the mouse.</p>""" 695 """<p>Select a circular section of the icon using the mouse.</p>"""
708 )) 696 ))
709 self.drawCircleSelectionAct.setCheckable(True) 697 self.drawCircleSelectionAct.setCheckable(True)
710 self.esm.setMapping(self.drawCircleSelectionAct, 698 self.esm.setMapping(self.drawCircleSelectionAct,
711 IconEditorGrid.CircleSelection) 699 IconEditorGrid.CircleSelection)
712 self.connect(self.drawCircleSelectionAct, SIGNAL('triggered()'), 700 self.drawCircleSelectionAct.triggered.connect(self.esm.map)
713 self.esm, SLOT('map()'))
714 self.__actions.append(self.drawCircleSelectionAct) 701 self.__actions.append(self.drawCircleSelectionAct)
715 702
716 self.drawPencilAct.setChecked(True) 703 self.drawPencilAct.setChecked(True)
717 704
718 def __initHelpActions(self): 705 def __initHelpActions(self):
724 0, 0, self, 'iconEditor_help_about') 711 0, 0, self, 'iconEditor_help_about')
725 self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) 712 self.aboutAct.setStatusTip(self.trUtf8('Display information about this software'))
726 self.aboutAct.setWhatsThis(self.trUtf8( 713 self.aboutAct.setWhatsThis(self.trUtf8(
727 """<b>About</b>""" 714 """<b>About</b>"""
728 """<p>Display some information about this software.</p>""")) 715 """<p>Display some information about this software.</p>"""))
729 self.connect(self.aboutAct, SIGNAL('triggered()'), self.__about) 716 self.aboutAct.triggered.connect(self.__about)
730 self.__actions.append(self.aboutAct) 717 self.__actions.append(self.aboutAct)
731 718
732 self.aboutQtAct = E5Action(self.trUtf8('About Qt'), 719 self.aboutQtAct = E5Action(self.trUtf8('About Qt'),
733 self.trUtf8('About &Qt'), 720 self.trUtf8('About &Qt'),
734 0, 0, self, 'iconEditor_help_about_qt') 721 0, 0, self, 'iconEditor_help_about_qt')
736 self.trUtf8('Display information about the Qt toolkit')) 723 self.trUtf8('Display information about the Qt toolkit'))
737 self.aboutQtAct.setWhatsThis(self.trUtf8( 724 self.aboutQtAct.setWhatsThis(self.trUtf8(
738 """<b>About Qt</b>""" 725 """<b>About Qt</b>"""
739 """<p>Display some information about the Qt toolkit.</p>""" 726 """<p>Display some information about the Qt toolkit.</p>"""
740 )) 727 ))
741 self.connect(self.aboutQtAct, SIGNAL('triggered()'), self.__aboutQt) 728 self.aboutQtAct.triggered.connect(self.__aboutQt)
742 self.__actions.append(self.aboutQtAct) 729 self.__actions.append(self.aboutQtAct)
743 730
744 self.whatsThisAct = E5Action(self.trUtf8('What\'s This?'), 731 self.whatsThisAct = E5Action(self.trUtf8('What\'s This?'),
745 UI.PixmapCache.getIcon("whatsThis.png"), 732 UI.PixmapCache.getIcon("whatsThis.png"),
746 self.trUtf8('&What\'s This?'), 733 self.trUtf8('&What\'s This?'),
753 """ question mark, and you can click on the interface elements to get""" 740 """ question mark, and you can click on the interface elements to get"""
754 """ a short description of what they do and how to use them. In""" 741 """ a short description of what they do and how to use them. In"""
755 """ dialogs, this feature can be accessed using the context help button""" 742 """ dialogs, this feature can be accessed using the context help button"""
756 """ in the titlebar.</p>""" 743 """ in the titlebar.</p>"""
757 )) 744 ))
758 self.connect(self.whatsThisAct, SIGNAL('triggered()'), self.__whatsThis) 745 self.whatsThisAct.triggered.connect(self.__whatsThis)
759 self.__actions.append(self.whatsThisAct) 746 self.__actions.append(self.whatsThisAct)
760 747
761 def __initMenus(self): 748 def __initMenus(self):
762 """ 749 """
763 Private method to create the menus. 750 Private method to create the menus.

eric ide

mercurial