69 # list of recent replaces (tuple of format type index and |
69 # list of recent replaces (tuple of format type index and |
70 # replace term |
70 # replace term |
71 } |
71 } |
72 |
72 |
73 self.__fromEric = fromEric |
73 self.__fromEric = fromEric |
74 self.setWindowIcon(UI.PixmapCache.getIcon("hexEditor.png")) |
74 self.setWindowIcon(UI.PixmapCache.getIcon("hexEditor")) |
75 |
75 |
76 if not self.__fromEric: |
76 if not self.__fromEric: |
77 self.setStyle(Preferences.getUI("Style"), |
77 self.setStyle(Preferences.getUI("Style"), |
78 Preferences.getUI("StyleSheet")) |
78 Preferences.getUI("StyleSheet")) |
79 |
79 |
156 """ |
156 """ |
157 Private method to define the file related user interface actions. |
157 Private method to define the file related user interface actions. |
158 """ |
158 """ |
159 self.newWindowAct = E5Action( |
159 self.newWindowAct = E5Action( |
160 self.tr('New Window'), |
160 self.tr('New Window'), |
161 UI.PixmapCache.getIcon("newWindow.png"), |
161 UI.PixmapCache.getIcon("newWindow"), |
162 self.tr('New &Window'), |
162 self.tr('New &Window'), |
163 0, 0, self, 'hexEditor_file_new_window') |
163 0, 0, self, 'hexEditor_file_new_window') |
164 self.newWindowAct.setStatusTip(self.tr( |
164 self.newWindowAct.setStatusTip(self.tr( |
165 'Open a binary file for editing in a new hex editor window')) |
165 'Open a binary file for editing in a new hex editor window')) |
166 self.newWindowAct.setWhatsThis(self.tr( |
166 self.newWindowAct.setWhatsThis(self.tr( |
172 self.__actions.append(self.newWindowAct) |
172 self.__actions.append(self.newWindowAct) |
173 |
173 |
174 # correct texts will be set later |
174 # correct texts will be set later |
175 self.openAct = E5Action( |
175 self.openAct = E5Action( |
176 self.tr('Open'), |
176 self.tr('Open'), |
177 UI.PixmapCache.getIcon("open.png"), |
177 UI.PixmapCache.getIcon("open"), |
178 self.tr('&Open...'), |
178 self.tr('&Open...'), |
179 QKeySequence(self.tr("Ctrl+O", "File|Open")), |
179 QKeySequence(self.tr("Ctrl+O", "File|Open")), |
180 0, self, 'hexEditor_file_open') |
180 0, self, 'hexEditor_file_open') |
181 self.openAct.triggered.connect(self.__openHexFile) |
181 self.openAct.triggered.connect(self.__openHexFile) |
182 self.__actions.append(self.openAct) |
182 self.__actions.append(self.openAct) |
188 self.openReadOnlyAct.triggered.connect(self.__openHexFileReadOnly) |
188 self.openReadOnlyAct.triggered.connect(self.__openHexFileReadOnly) |
189 self.__actions.append(self.openReadOnlyAct) |
189 self.__actions.append(self.openReadOnlyAct) |
190 |
190 |
191 self.saveAct = E5Action( |
191 self.saveAct = E5Action( |
192 self.tr('Save'), |
192 self.tr('Save'), |
193 UI.PixmapCache.getIcon("fileSave.png"), |
193 UI.PixmapCache.getIcon("fileSave"), |
194 self.tr('&Save'), |
194 self.tr('&Save'), |
195 QKeySequence(self.tr("Ctrl+S", "File|Save")), |
195 QKeySequence(self.tr("Ctrl+S", "File|Save")), |
196 0, self, 'hexEditor_file_save') |
196 0, self, 'hexEditor_file_save') |
197 self.saveAct.setStatusTip(self.tr('Save the current binary file')) |
197 self.saveAct.setStatusTip(self.tr('Save the current binary file')) |
198 self.saveAct.setWhatsThis(self.tr( |
198 self.saveAct.setWhatsThis(self.tr( |
202 self.saveAct.triggered.connect(self.__saveHexFile) |
202 self.saveAct.triggered.connect(self.__saveHexFile) |
203 self.__actions.append(self.saveAct) |
203 self.__actions.append(self.saveAct) |
204 |
204 |
205 self.saveAsAct = E5Action( |
205 self.saveAsAct = E5Action( |
206 self.tr('Save As'), |
206 self.tr('Save As'), |
207 UI.PixmapCache.getIcon("fileSaveAs.png"), |
207 UI.PixmapCache.getIcon("fileSaveAs"), |
208 self.tr('Save &As...'), |
208 self.tr('Save &As...'), |
209 QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
209 QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
210 0, self, 'hexEditor_file_save_as') |
210 0, self, 'hexEditor_file_save_as') |
211 self.saveAsAct.setStatusTip( |
211 self.saveAsAct.setStatusTip( |
212 self.tr('Save the current binary data to a new file')) |
212 self.tr('Save the current binary data to a new file')) |
232 self.saveReadableAct.triggered.connect(self.__saveHexFileReadable) |
232 self.saveReadableAct.triggered.connect(self.__saveHexFileReadable) |
233 self.__actions.append(self.saveReadableAct) |
233 self.__actions.append(self.saveReadableAct) |
234 |
234 |
235 self.closeAct = E5Action( |
235 self.closeAct = E5Action( |
236 self.tr('Close'), |
236 self.tr('Close'), |
237 UI.PixmapCache.getIcon("close.png"), |
237 UI.PixmapCache.getIcon("close"), |
238 self.tr('&Close'), |
238 self.tr('&Close'), |
239 QKeySequence(self.tr("Ctrl+W", "File|Close")), |
239 QKeySequence(self.tr("Ctrl+W", "File|Close")), |
240 0, self, 'hexEditor_file_close') |
240 0, self, 'hexEditor_file_close') |
241 self.closeAct.setStatusTip(self.tr( |
241 self.closeAct.setStatusTip(self.tr( |
242 'Close the current hex editor window')) |
242 'Close the current hex editor window')) |
273 self.closeOthersAct.triggered.connect(self.__closeOthers) |
273 self.closeOthersAct.triggered.connect(self.__closeOthers) |
274 self.__actions.append(self.closeOthersAct) |
274 self.__actions.append(self.closeOthersAct) |
275 |
275 |
276 self.exitAct = E5Action( |
276 self.exitAct = E5Action( |
277 self.tr('Quit'), |
277 self.tr('Quit'), |
278 UI.PixmapCache.getIcon("exit.png"), |
278 UI.PixmapCache.getIcon("exit"), |
279 self.tr('&Quit'), |
279 self.tr('&Quit'), |
280 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
280 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
281 0, self, 'hexEditor_file_quit') |
281 0, self, 'hexEditor_file_quit') |
282 self.exitAct.setStatusTip(self.tr('Quit the hex editor')) |
282 self.exitAct.setStatusTip(self.tr('Quit the hex editor')) |
283 self.exitAct.setWhatsThis(self.tr( |
283 self.exitAct.setWhatsThis(self.tr( |
292 """ |
292 """ |
293 Private method to create the Edit actions. |
293 Private method to create the Edit actions. |
294 """ |
294 """ |
295 self.undoAct = E5Action( |
295 self.undoAct = E5Action( |
296 self.tr('Undo'), |
296 self.tr('Undo'), |
297 UI.PixmapCache.getIcon("editUndo.png"), |
297 UI.PixmapCache.getIcon("editUndo"), |
298 self.tr('&Undo'), |
298 self.tr('&Undo'), |
299 QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")), |
299 QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")), |
300 QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
300 QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
301 self, 'hexEditor_edit_undo') |
301 self, 'hexEditor_edit_undo') |
302 self.undoAct.setStatusTip(self.tr('Undo the last change')) |
302 self.undoAct.setStatusTip(self.tr('Undo the last change')) |
307 self.undoAct.triggered.connect(self.__editor.undo) |
307 self.undoAct.triggered.connect(self.__editor.undo) |
308 self.__actions.append(self.undoAct) |
308 self.__actions.append(self.undoAct) |
309 |
309 |
310 self.redoAct = E5Action( |
310 self.redoAct = E5Action( |
311 self.tr('Redo'), |
311 self.tr('Redo'), |
312 UI.PixmapCache.getIcon("editRedo.png"), |
312 UI.PixmapCache.getIcon("editRedo"), |
313 self.tr('&Redo'), |
313 self.tr('&Redo'), |
314 QKeySequence(self.tr("Ctrl+Shift+Z", "Edit|Redo")), |
314 QKeySequence(self.tr("Ctrl+Shift+Z", "Edit|Redo")), |
315 0, self, 'hexEditor_edit_redo') |
315 0, self, 'hexEditor_edit_redo') |
316 self.redoAct.setStatusTip(self.tr('Redo the last change')) |
316 self.redoAct.setStatusTip(self.tr('Redo the last change')) |
317 self.redoAct.setWhatsThis(self.tr( |
317 self.redoAct.setWhatsThis(self.tr( |
336 self.revertAct.triggered.connect(self.__editor.revertToUnmodified) |
336 self.revertAct.triggered.connect(self.__editor.revertToUnmodified) |
337 self.__actions.append(self.revertAct) |
337 self.__actions.append(self.revertAct) |
338 |
338 |
339 self.cutAct = E5Action( |
339 self.cutAct = E5Action( |
340 self.tr('Cut'), |
340 self.tr('Cut'), |
341 UI.PixmapCache.getIcon("editCut.png"), |
341 UI.PixmapCache.getIcon("editCut"), |
342 self.tr('Cu&t'), |
342 self.tr('Cu&t'), |
343 QKeySequence(self.tr("Ctrl+X", "Edit|Cut")), |
343 QKeySequence(self.tr("Ctrl+X", "Edit|Cut")), |
344 QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
344 QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
345 self, 'hexEditor_edit_cut') |
345 self, 'hexEditor_edit_cut') |
346 self.cutAct.setStatusTip(self.tr('Cut the selection')) |
346 self.cutAct.setStatusTip(self.tr('Cut the selection')) |
351 self.cutAct.triggered.connect(self.__editor.cut) |
351 self.cutAct.triggered.connect(self.__editor.cut) |
352 self.__actions.append(self.cutAct) |
352 self.__actions.append(self.cutAct) |
353 |
353 |
354 self.copyAct = E5Action( |
354 self.copyAct = E5Action( |
355 self.tr('Copy'), |
355 self.tr('Copy'), |
356 UI.PixmapCache.getIcon("editCopy.png"), |
356 UI.PixmapCache.getIcon("editCopy"), |
357 self.tr('&Copy'), |
357 self.tr('&Copy'), |
358 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")), |
358 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")), |
359 QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
359 QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
360 self, 'hexEditor_edit_copy') |
360 self, 'hexEditor_edit_copy') |
361 self.copyAct.setStatusTip(self.tr('Copy the selection')) |
361 self.copyAct.setStatusTip(self.tr('Copy the selection')) |
366 self.copyAct.triggered.connect(self.__editor.copy) |
366 self.copyAct.triggered.connect(self.__editor.copy) |
367 self.__actions.append(self.copyAct) |
367 self.__actions.append(self.copyAct) |
368 |
368 |
369 self.pasteAct = E5Action( |
369 self.pasteAct = E5Action( |
370 self.tr('Paste'), |
370 self.tr('Paste'), |
371 UI.PixmapCache.getIcon("editPaste.png"), |
371 UI.PixmapCache.getIcon("editPaste"), |
372 self.tr('&Paste'), |
372 self.tr('&Paste'), |
373 QKeySequence(self.tr("Ctrl+V", "Edit|Paste")), |
373 QKeySequence(self.tr("Ctrl+V", "Edit|Paste")), |
374 QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
374 QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
375 self, 'hexEditor_edit_paste') |
375 self, 'hexEditor_edit_paste') |
376 self.pasteAct.setStatusTip(self.tr('Paste the clipboard contents')) |
376 self.pasteAct.setStatusTip(self.tr('Paste the clipboard contents')) |
381 self.pasteAct.triggered.connect(self.__editor.paste) |
381 self.pasteAct.triggered.connect(self.__editor.paste) |
382 self.__actions.append(self.pasteAct) |
382 self.__actions.append(self.pasteAct) |
383 |
383 |
384 self.selectAllAct = E5Action( |
384 self.selectAllAct = E5Action( |
385 self.tr('Select All'), |
385 self.tr('Select All'), |
386 UI.PixmapCache.getIcon("editSelectAll.png"), |
386 UI.PixmapCache.getIcon("editSelectAll"), |
387 self.tr('&Select All'), |
387 self.tr('&Select All'), |
388 QKeySequence(self.tr("Ctrl+A", "Edit|Select All")), |
388 QKeySequence(self.tr("Ctrl+A", "Edit|Select All")), |
389 0, |
389 0, |
390 self, 'hexEditor_edit_select_all') |
390 self, 'hexEditor_edit_select_all') |
391 self.selectAllAct.setStatusTip(self.tr( |
391 self.selectAllAct.setStatusTip(self.tr( |
443 self.__editor.readOnlyChanged.connect(self.readonlyAct.setChecked) |
443 self.__editor.readOnlyChanged.connect(self.readonlyAct.setChecked) |
444 self.__actions.append(self.readonlyAct) |
444 self.__actions.append(self.readonlyAct) |
445 |
445 |
446 self.searchAct = E5Action( |
446 self.searchAct = E5Action( |
447 self.tr('Search'), |
447 self.tr('Search'), |
448 UI.PixmapCache.getIcon("find.png"), |
448 UI.PixmapCache.getIcon("find"), |
449 self.tr('&Search...'), |
449 self.tr('&Search...'), |
450 QKeySequence(self.tr("Ctrl+F", "Search|Search")), |
450 QKeySequence(self.tr("Ctrl+F", "Search|Search")), |
451 0, |
451 0, |
452 self, 'hexEditor_edit_search') |
452 self, 'hexEditor_edit_search') |
453 self.searchAct.setStatusTip(self.tr('Search for data')) |
453 self.searchAct.setStatusTip(self.tr('Search for data')) |
459 self.searchAct.triggered.connect(self.__search) |
459 self.searchAct.triggered.connect(self.__search) |
460 self.__actions.append(self.searchAct) |
460 self.__actions.append(self.searchAct) |
461 |
461 |
462 self.searchNextAct = E5Action( |
462 self.searchNextAct = E5Action( |
463 self.tr('Search next'), |
463 self.tr('Search next'), |
464 UI.PixmapCache.getIcon("findNext.png"), |
464 UI.PixmapCache.getIcon("findNext"), |
465 self.tr('Search &next'), |
465 self.tr('Search &next'), |
466 QKeySequence(self.tr("F3", "Search|Search next")), |
466 QKeySequence(self.tr("F3", "Search|Search next")), |
467 0, |
467 0, |
468 self, 'hexEditor_edit_search_next') |
468 self, 'hexEditor_edit_search_next') |
469 self.searchNextAct.setStatusTip(self.tr( |
469 self.searchNextAct.setStatusTip(self.tr( |
476 self.searchNextAct.triggered.connect(self.__searchWidget.findPrevNext) |
476 self.searchNextAct.triggered.connect(self.__searchWidget.findPrevNext) |
477 self.__actions.append(self.searchNextAct) |
477 self.__actions.append(self.searchNextAct) |
478 |
478 |
479 self.searchPrevAct = E5Action( |
479 self.searchPrevAct = E5Action( |
480 self.tr('Search previous'), |
480 self.tr('Search previous'), |
481 UI.PixmapCache.getIcon("findPrev.png"), |
481 UI.PixmapCache.getIcon("findPrev"), |
482 self.tr('Search &previous'), |
482 self.tr('Search &previous'), |
483 QKeySequence(self.tr("Shift+F3", "Search|Search previous")), |
483 QKeySequence(self.tr("Shift+F3", "Search|Search previous")), |
484 0, |
484 0, |
485 self, 'hexEditor_edit_search_previous') |
485 self, 'hexEditor_edit_search_previous') |
486 self.searchPrevAct.setStatusTip(self.tr( |
486 self.searchPrevAct.setStatusTip(self.tr( |
510 self.replaceAct.triggered.connect(self.__replace) |
510 self.replaceAct.triggered.connect(self.__replace) |
511 self.__actions.append(self.replaceAct) |
511 self.__actions.append(self.replaceAct) |
512 |
512 |
513 self.gotoAct = E5Action( |
513 self.gotoAct = E5Action( |
514 self.tr('Goto Offset'), |
514 self.tr('Goto Offset'), |
515 UI.PixmapCache.getIcon("goto.png"), |
515 UI.PixmapCache.getIcon("goto"), |
516 self.tr('&Goto Offset...'), |
516 self.tr('&Goto Offset...'), |
517 QKeySequence(QCoreApplication.translate( |
517 QKeySequence(QCoreApplication.translate( |
518 'ViewManager', "Ctrl+G", "Search|Goto Offset")), |
518 'ViewManager', "Ctrl+G", "Search|Goto Offset")), |
519 0, |
519 0, |
520 self, 'hexEditor_edit_goto') |
520 self, 'hexEditor_edit_goto') |
573 self.aboutQtAct.triggered.connect(self.__aboutQt) |
573 self.aboutQtAct.triggered.connect(self.__aboutQt) |
574 self.__actions.append(self.aboutQtAct) |
574 self.__actions.append(self.aboutQtAct) |
575 |
575 |
576 self.whatsThisAct = E5Action( |
576 self.whatsThisAct = E5Action( |
577 self.tr('What\'s This?'), |
577 self.tr('What\'s This?'), |
578 UI.PixmapCache.getIcon("whatsThis.png"), |
578 UI.PixmapCache.getIcon("whatsThis"), |
579 self.tr('&What\'s This?'), |
579 self.tr('&What\'s This?'), |
580 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
580 QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
581 0, self, 'hexEditor_help_whats_this') |
581 0, self, 'hexEditor_help_whats_this') |
582 self.whatsThisAct.setStatusTip(self.tr('Context sensitive help')) |
582 self.whatsThisAct.setStatusTip(self.tr('Context sensitive help')) |
583 self.whatsThisAct.setWhatsThis(self.tr( |
583 self.whatsThisAct.setWhatsThis(self.tr( |
595 """ |
595 """ |
596 Private method to create the Settings actions. |
596 Private method to create the Settings actions. |
597 """ |
597 """ |
598 self.prefAct = E5Action( |
598 self.prefAct = E5Action( |
599 self.tr('Preferences'), |
599 self.tr('Preferences'), |
600 UI.PixmapCache.getIcon("configure.png"), |
600 UI.PixmapCache.getIcon("configure"), |
601 self.tr('&Preferences...'), |
601 self.tr('&Preferences...'), |
602 0, 0, self, 'hexEditor_settings_preferences') |
602 0, 0, self, 'hexEditor_settings_preferences') |
603 self.prefAct.setStatusTip(self.tr( |
603 self.prefAct.setStatusTip(self.tr( |
604 'Set the prefered configuration')) |
604 'Set the prefered configuration')) |
605 self.prefAct.setWhatsThis(self.tr( |
605 self.prefAct.setWhatsThis(self.tr( |