IconEditor/IconEditorWindow.py

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

eric ide

mercurial