HexEdit/HexEditMainWindow.py

changeset 4673
6fa2418f010c
parent 4670
d401ba329d24
child 4686
5f8a5c568230
equal deleted inserted replaced
4672:67fa9b25183f 4673:6fa2418f010c
18 QDialog, QAction, QFrame 18 QDialog, QAction, QFrame
19 19
20 from E5Gui.E5Action import E5Action 20 from E5Gui.E5Action import E5Action
21 from E5Gui.E5MainWindow import E5MainWindow 21 from E5Gui.E5MainWindow import E5MainWindow
22 from E5Gui import E5FileDialog, E5MessageBox 22 from E5Gui import E5FileDialog, E5MessageBox
23 from E5Gui.E5ClickableLabel import E5ClickableLabel
23 24
24 from .HexEditWidget import HexEditWidget 25 from .HexEditWidget import HexEditWidget
25 from .HexEditSearchReplaceWidget import HexEditSearchReplaceWidget 26 from .HexEditSearchReplaceWidget import HexEditSearchReplaceWidget
26 from .HexEditGotoWidget import HexEditGotoWidget 27 from .HexEditGotoWidget import HexEditGotoWidget
27 28
777 """<p>This part of the status bar displays the size of the""" 778 """<p>This part of the status bar displays the size of the"""
778 """ binary data.</p>""" 779 """ binary data.</p>"""
779 )) 780 ))
780 self.__sbSize.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) 781 self.__sbSize.setFrameStyle(QFrame.StyledPanel | QFrame.Plain)
781 782
782 self.__sbEditMode = QLabel(self.__statusBar) 783 self.__sbEditMode = E5ClickableLabel(self.__statusBar)
783 self.__statusBar.addPermanentWidget(self.__sbEditMode) 784 self.__statusBar.addPermanentWidget(self.__sbEditMode)
784 self.__sbEditMode.setWhatsThis(self.tr( 785 self.__sbEditMode.setWhatsThis(self.tr(
785 """<p>This part of the status bar displays the edit mode.</p>""" 786 """<p>This part of the status bar displays the edit mode.</p>"""
786 )) 787 ))
787 self.__sbEditMode.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) 788 self.__sbEditMode.setFrameStyle(QFrame.StyledPanel | QFrame.Plain)
788 789 self.__sbEditMode.clicked.connect(self.__toggleEditMode)
789 self.__sbReadOnly = QLabel(self.__statusBar) 790
791 self.__sbReadOnly = E5ClickableLabel(self.__statusBar)
790 self.__statusBar.addPermanentWidget(self.__sbReadOnly) 792 self.__statusBar.addPermanentWidget(self.__sbReadOnly)
791 self.__sbReadOnly.setWhatsThis(self.tr( 793 self.__sbReadOnly.setWhatsThis(self.tr(
792 """<p>This part of the status bar displays the read""" 794 """<p>This part of the status bar displays the read"""
793 """ only mode.</p>""" 795 """ only mode.</p>"""
794 )) 796 ))
795 self.__sbReadOnly.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) 797 self.__sbReadOnly.setFrameStyle(QFrame.StyledPanel | QFrame.Plain)
798 self.__sbReadOnly.clicked.connect(self.__toggleReadOnlyMode)
796 799
797 self.__showEditMode(self.__editor.overwriteMode()) 800 self.__showEditMode(self.__editor.overwriteMode())
798 self.__showReadOnlyMode(self.__editor.isReadOnly()) 801 self.__showReadOnlyMode(self.__editor.isReadOnly())
799 802
800 @pyqtSlot(int) 803 @pyqtSlot(int)
838 @param on flag indicating the read only state 841 @param on flag indicating the read only state
839 @type bool 842 @type bool
840 """ 843 """
841 self.__sbReadOnly.setText(self.tr("ro") if on else self.tr("rw")) 844 self.__sbReadOnly.setText(self.tr("ro") if on else self.tr("rw"))
842 845
846 @pyqtSlot()
847 def __toggleReadOnlyMode(self):
848 """
849 Private slot to toggle the read only mode upon a click on the status
850 bar label.
851 """
852 self.__editor.setReadOnly(not self.__editor.isReadOnly())
853
843 @pyqtSlot(bool) 854 @pyqtSlot(bool)
844 def __showEditMode(self, overwrite): 855 def __showEditMode(self, overwrite):
845 """ 856 """
846 Private slot to show the edit mode. 857 Private slot to show the edit mode.
847 858
848 @param overwrite flag indicating overwrite mode 859 @param overwrite flag indicating overwrite mode
849 @type bool 860 @type bool
850 """ 861 """
851 self.__sbEditMode.setText( 862 self.__sbEditMode.setText(
852 self.tr("Overwrite") if overwrite else self.tr("Insert")) 863 self.tr("Overwrite") if overwrite else self.tr("Insert"))
864
865 @pyqtSlot()
866 def __toggleEditMode(self):
867 """
868 Private slot to toggle the edit mode upon a click on the status bar
869 label.
870 """
871 self.__editor.setOverwriteMode(not self.__editor.overwriteMode())
853 872
854 @pyqtSlot(int) 873 @pyqtSlot(int)
855 def __showSize(self, size): 874 def __showSize(self, size):
856 """ 875 """
857 Private slot to show the binary data size. 876 Private slot to show the binary data size.

eric ide

mercurial