HexEdit/HexEditMainWindow.py

changeset 4665
30d4972ab403
parent 4659
2863d05e83c6
child 4666
bc52ef526e11
equal deleted inserted replaced
4664:a40706f44514 4665:30d4972ab403
28 import UI.Config 28 import UI.Config
29 29
30 import Preferences 30 import Preferences
31 31
32 32
33 # TODO: füge Goto Aktion inkl. Eingabewidget hinzu
33 class HexEditMainWindow(E5MainWindow): 34 class HexEditMainWindow(E5MainWindow):
34 """ 35 """
35 Class implementing the web browser main window. 36 Class implementing the web browser main window.
36 37
37 @signal editorClosed() emitted after the window was requested to close down 38 @signal editorClosed() emitted after the window was requested to close down
433 UI.PixmapCache.getIcon("find.png"), 434 UI.PixmapCache.getIcon("find.png"),
434 self.tr('&Search...'), 435 self.tr('&Search...'),
435 QKeySequence(self.tr("Ctrl+F", "Search|Search")), 436 QKeySequence(self.tr("Ctrl+F", "Search|Search")),
436 0, 437 0,
437 self, 'hexEditor_edit_search') 438 self, 'hexEditor_edit_search')
438 self.searchAct.setStatusTip(self.tr('Search for a text')) 439 self.searchAct.setStatusTip(self.tr('Search for data'))
439 self.searchAct.setWhatsThis(self.tr( 440 self.searchAct.setWhatsThis(self.tr(
440 """<b>Search</b>""" 441 """<b>Search</b>"""
441 """<p>Search for some text in the current editor. A""" 442 """<p>Search for some data. A dialog is shown to enter the"""
442 """ dialog is shown to enter the searchtext and options""" 443 """ data to search for in various formats.</p>"""
443 """ for the search.</p>"""
444 )) 444 ))
445 self.searchAct.triggered.connect(self.__search) 445 self.searchAct.triggered.connect(self.__search)
446 self.__actions.append(self.searchAct) 446 self.__actions.append(self.searchAct)
447 447
448 self.searchNextAct = E5Action( 448 self.searchNextAct = E5Action(
451 self.tr('Search &next'), 451 self.tr('Search &next'),
452 QKeySequence(self.tr("F3", "Search|Search next")), 452 QKeySequence(self.tr("F3", "Search|Search next")),
453 0, 453 0,
454 self, 'hexEditor_edit_search_next') 454 self, 'hexEditor_edit_search_next')
455 self.searchNextAct.setStatusTip(self.tr( 455 self.searchNextAct.setStatusTip(self.tr(
456 'Search next occurrence of text')) 456 'Search next occurrence'))
457 self.searchNextAct.setWhatsThis(self.tr( 457 self.searchNextAct.setWhatsThis(self.tr(
458 """<b>Search next</b>""" 458 """<b>Search next</b>"""
459 """<p>Search the next occurrence of some text in the current""" 459 """<p>Search the next occurrence of some data. The previously"""
460 """ editor. The previously entered searchtext and options are""" 460 """ entered search data are reused.</p>"""
461 """ reused.</p>"""
462 )) 461 ))
463 self.searchNextAct.triggered.connect(self.__searchWidget.findPrevNext) 462 self.searchNextAct.triggered.connect(self.__searchWidget.findPrevNext)
464 self.__actions.append(self.searchNextAct) 463 self.__actions.append(self.searchNextAct)
465 464
466 self.searchPrevAct = E5Action( 465 self.searchPrevAct = E5Action(
469 self.tr('Search &previous'), 468 self.tr('Search &previous'),
470 QKeySequence(self.tr("Shift+F3", "Search|Search previous")), 469 QKeySequence(self.tr("Shift+F3", "Search|Search previous")),
471 0, 470 0,
472 self, 'hexEditor_edit_search_previous') 471 self, 'hexEditor_edit_search_previous')
473 self.searchPrevAct.setStatusTip(self.tr( 472 self.searchPrevAct.setStatusTip(self.tr(
474 'Search previous occurrence of text')) 473 'Search previous occurrence'))
475 self.searchPrevAct.setWhatsThis(self.tr( 474 self.searchPrevAct.setWhatsThis(self.tr(
476 """<b>Search previous</b>""" 475 """<b>Search previous</b>"""
477 """<p>Search the previous occurrence of some text in the current""" 476 """<p>Search the previous occurrence of some data. The"""
478 """ editor. The previously entered searchtext and options are""" 477 """ previously entered search data are reused.</p>"""
479 """ reused.</p>"""
480 )) 478 ))
481 self.searchPrevAct.triggered.connect( 479 self.searchPrevAct.triggered.connect(
482 lambda: self.__searchWidget.findPrevNext(True)) 480 lambda: self.__searchWidget.findPrevNext(True))
483 self.__actions.append(self.searchPrevAct) 481 self.__actions.append(self.searchPrevAct)
484 482
486 self.tr('Replace'), 484 self.tr('Replace'),
487 self.tr('&Replace...'), 485 self.tr('&Replace...'),
488 QKeySequence(self.tr("Ctrl+R", "Search|Replace")), 486 QKeySequence(self.tr("Ctrl+R", "Search|Replace")),
489 0, 487 0,
490 self, 'hexEditor_edit_search_replace') 488 self, 'hexEditor_edit_search_replace')
491 self.replaceAct.setStatusTip(self.tr('Replace some text')) 489 self.replaceAct.setStatusTip(self.tr('Replace data'))
492 self.replaceAct.setWhatsThis(self.tr( 490 self.replaceAct.setWhatsThis(self.tr(
493 """<b>Replace</b>""" 491 """<b>Replace</b>"""
494 """<p>Search for some text in the current editor and replace it.""" 492 """<p>Search for some data and replace it."""
495 """ A dialog is shown to enter the searchtext, the replacement""" 493 """ A dialog is shown to enter the data to search for and the"""
496 """ text and options for the search and replace.</p>""" 494 """ replacement data in various formats.</p>"""
497 )) 495 ))
498 self.replaceAct.triggered.connect(self.__replace) 496 self.replaceAct.triggered.connect(self.__replace)
499 self.__actions.append(self.replaceAct) 497 self.__actions.append(self.replaceAct)
500 498
501 self.redoAct.setEnabled(False) 499 self.redoAct.setEnabled(False)
770 Private slot to show the address of the cursor position. 768 Private slot to show the address of the cursor position.
771 769
772 @param address address of the cursor 770 @param address address of the cursor
773 @type int 771 @type int
774 """ 772 """
775 self.__sbAddress.setText(self.tr("Address: {0:#x}").format(address)) 773 self.__sbAddress.setText(self.tr("Address: {0:#{1}x}").format(
774 address, self.__editor.addressWidth()))
776 775
777 @pyqtSlot(bool) 776 @pyqtSlot(bool)
778 def __showReadOnlyMode(self, on): 777 def __showReadOnlyMode(self, on):
779 """ 778 """
780 Private slot to show the read only mode. 779 Private slot to show the read only mode.

eric ide

mercurial