HexEdit/HexEditMainWindow.py

changeset 4655
f2f0abd5bc94
parent 4652
a88a2ba7a48a
child 4658
d760763dcc4a
equal deleted inserted replaced
4654:9dafe6905667 4655:f2f0abd5bc94
86 self.__initToolbars() 86 self.__initToolbars()
87 self.__createStatusBar() 87 self.__createStatusBar()
88 88
89 self.__class__.windows.append(self) 89 self.__class__.windows.append(self)
90 90
91 state = Preferences.getHexEditor("HexEditorState")
92 self.restoreState(state)
93
91 self.__editor.currentAddressChanged.connect(self.__showAddress) 94 self.__editor.currentAddressChanged.connect(self.__showAddress)
92 self.__editor.currentSizeChanged.connect(self.__showSize) 95 self.__editor.currentSizeChanged.connect(self.__showSize)
93 self.__editor.dataChanged.connect(self.__modificationChanged) 96 self.__editor.dataChanged.connect(self.__modificationChanged)
94 self.__editor.overwriteModeChanged.connect(self.__showEditMode) 97 self.__editor.overwriteModeChanged.connect(self.__showEditMode)
95 self.__editor.readOnlyChanged.connect(self.__showReadOnlyMode) 98 self.__editor.readOnlyChanged.connect(self.__showReadOnlyMode)
99 self.__editor.readOnlyChanged.connect(self.__modificationChanged)
96 100
97 self.__project = project 101 self.__project = project
98 self.__lastOpenPath = "" 102 self.__lastOpenPath = ""
99 self.__lastSavePath = "" 103 self.__lastSavePath = ""
100 104
413 """<p>This changes the edit mode to read only (i.e. to view""" 417 """<p>This changes the edit mode to read only (i.e. to view"""
414 """ mode).</p>""" 418 """ mode).</p>"""
415 )) 419 ))
416 self.readonlyAct.setChecked(False) 420 self.readonlyAct.setChecked(False)
417 self.readonlyAct.toggled[bool].connect(self.__editor.setReadOnly) 421 self.readonlyAct.toggled[bool].connect(self.__editor.setReadOnly)
422 self.__editor.readOnlyChanged.connect(self.readonlyAct.setChecked)
418 self.__actions.append(self.readonlyAct) 423 self.__actions.append(self.readonlyAct)
419 424
420 self.searchAct = E5Action( 425 self.searchAct = E5Action(
421 self.tr('Search'), 426 self.tr('Search'),
422 UI.PixmapCache.getIcon("find.png"), 427 UI.PixmapCache.getIcon("find.png"),
729 <br />This event is simply accepted after the history has been 734 <br />This event is simply accepted after the history has been
730 saved and all window references have been deleted. 735 saved and all window references have been deleted.
731 @type QCloseEvent 736 @type QCloseEvent
732 """ 737 """
733 if self.__maybeSave(): 738 if self.__maybeSave():
739 state = self.saveState()
740 Preferences.setHexEditor("HexEditorState", state)
741
734 Preferences.setGeometry("HexEditorGeometry", self.saveGeometry()) 742 Preferences.setGeometry("HexEditorGeometry", self.saveGeometry())
735 743
736 try: 744 try:
737 if self.fromEric or len(self.__class__.windows) > 1: 745 if self.fromEric or len(self.__class__.windows) > 1:
738 del self.__class__.windows[ 746 del self.__class__.windows[
1073 self.saveAct.setEnabled(self.__editor.isModified()) 1081 self.saveAct.setEnabled(self.__editor.isModified())
1074 1082
1075 self.cutAct.setEnabled(not self.__editor.isReadOnly() and 1083 self.cutAct.setEnabled(not self.__editor.isReadOnly() and
1076 self.__editor.hasSelection()) 1084 self.__editor.hasSelection())
1077 self.pasteAct.setEnabled(not self.__editor.isReadOnly()) 1085 self.pasteAct.setEnabled(not self.__editor.isReadOnly())
1086 self.replaceAct.setEnabled(not self.__editor.isReadOnly())
1078 1087
1079 @pyqtSlot(bool) 1088 @pyqtSlot(bool)
1080 def __modificationChanged(self, m): 1089 def __modificationChanged(self, m):
1081 """ 1090 """
1082 Private slot to handle the dataChanged signal. 1091 Private slot to handle the dataChanged signal.

eric ide

mercurial