Sun, 17 Jan 2016 12:57:23 +0100
Finalized the hex editor.
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2016 Detlev Offenbach <detlev@die-offenbachs.de> |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the hex editor main window. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | from __future__ import unicode_literals |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | import os |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
14 | from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFile, QFileInfo, QSize, \ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
15 | QCoreApplication |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | from PyQt5.QtGui import QKeySequence |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
17 | from PyQt5.QtWidgets import QWhatsThis, QLabel, QWidget, QVBoxLayout, \ |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
18 | QDialog, QAction, QFrame |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | from E5Gui.E5Action import E5Action |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | from E5Gui.E5MainWindow import E5MainWindow |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | from E5Gui import E5FileDialog, E5MessageBox |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
23 | from E5Gui.E5ClickableLabel import E5ClickableLabel |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | from .HexEditWidget import HexEditWidget |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
26 | from .HexEditSearchReplaceWidget import HexEditSearchReplaceWidget |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
27 | from .HexEditGotoWidget import HexEditGotoWidget |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | import UI.PixmapCache |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | import UI.Config |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | import Preferences |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | class HexEditMainWindow(E5MainWindow): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | Class implementing the web browser main window. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | @signal editorClosed() emitted after the window was requested to close down |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | editorClosed = pyqtSignal() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | windows = [] |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | def __init__(self, fileName="", parent=None, fromEric=False, project=None): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | Constructor |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | @param fileName name of a file to load on startup (string) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | @param parent parent widget of this window (QWidget) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | @keyparam fromEric flag indicating whether it was called from within |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | eric6 (boolean) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | @keyparam project reference to the project object (Project) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | super(HexEditMainWindow, self).__init__(parent) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | self.setObjectName("eric6_hex_editor") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | |
4659
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
58 | self.__srHistory = { |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
59 | "search": [], |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
60 | # list of recent searches (tuple of format type index and |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
61 | # search term) |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
62 | "replace": [], |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
63 | # list of recent replaces (tuple of format type index and |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
64 | # replace term |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
65 | } |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
66 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
67 | self.__fromEric = fromEric |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | self.setWindowIcon(UI.PixmapCache.getIcon("hexEditor.png")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
70 | if not self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | self.setStyle(Preferences.getUI("Style"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | Preferences.getUI("StyleSheet")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | self.__editor = HexEditWidget() |
4659
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
75 | self.__searchWidget = HexEditSearchReplaceWidget( |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
76 | self.__editor, self, False) |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
77 | self.__replaceWidget = HexEditSearchReplaceWidget( |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
78 | self.__editor, self, True) |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
79 | self.__gotoWidget = HexEditGotoWidget(self.__editor) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
80 | cw = QWidget() |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
81 | layout = QVBoxLayout(cw) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
82 | layout.setContentsMargins(1, 1, 1, 1) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
83 | layout.setSpacing(1) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
84 | layout.addWidget(self.__editor) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
85 | layout.addWidget(self.__searchWidget) |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
86 | layout.addWidget(self.__gotoWidget) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
87 | cw.setLayout(layout) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
88 | layout.addWidget(self.__replaceWidget) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
89 | self.__searchWidget.hide() |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
90 | self.__replaceWidget.hide() |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
91 | self.__gotoWidget.hide() |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
92 | self.setCentralWidget(cw) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | g = Preferences.getGeometry("HexEditorGeometry") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | if g.isEmpty(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | s = QSize(600, 500) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | self.resize(s) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | self.restoreGeometry(g) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | self.__initActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | self.__initMenus() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | self.__initToolbars() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | self.__createStatusBar() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | self.__class__.windows.append(self) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | |
4655
f2f0abd5bc94
Fixed a few bugs in the hex editor and added capability to save/restore the main window state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4652
diff
changeset
|
108 | state = Preferences.getHexEditor("HexEditorState") |
f2f0abd5bc94
Fixed a few bugs in the hex editor and added capability to save/restore the main window state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4652
diff
changeset
|
109 | self.restoreState(state) |
f2f0abd5bc94
Fixed a few bugs in the hex editor and added capability to save/restore the main window state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4652
diff
changeset
|
110 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | self.__editor.currentAddressChanged.connect(self.__showAddress) |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
112 | self.__editor.selectionAvailable.connect(self.__showSelectionInfo) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | self.__editor.currentSizeChanged.connect(self.__showSize) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | self.__editor.dataChanged.connect(self.__modificationChanged) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | self.__editor.overwriteModeChanged.connect(self.__showEditMode) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | self.__editor.readOnlyChanged.connect(self.__showReadOnlyMode) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
117 | self.__editor.readOnlyChanged.connect(self.__checkActions) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
118 | |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
119 | self.preferencesChanged() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
120 | self.__editor.setOverwriteMode( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
121 | Preferences.getHexEditor("OpenInOverwriteMode")) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | self.__project = project |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.__lastOpenPath = "" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | self.__lastSavePath = "" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | self.__setCurrentFile("") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | if fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | self.__loadHexFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | self.__checkActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | def __initActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | Private method to define the user interface actions. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | # list of all actions |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | self.__actions = [] |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | self.__initFileActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | self.__initEditActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | self.__initHelpActions() |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
143 | if not self.__fromEric: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
144 | self.__initConfigActions() |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | def __initFileActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | Private method to define the file related user interface actions. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | self.newWindowAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | self.tr('New Window'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | UI.PixmapCache.getIcon("newWindow.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | self.tr('New &Window'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | 0, 0, self, 'hexEditor_file_new_window') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | self.newWindowAct.setStatusTip(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | 'Open a binary file for editing in a new hex editor window')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | self.newWindowAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | """<b>New Window</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | """<p>This opens a binary file for editing in a new hex editor""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | """ window.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | self.newWindowAct.triggered.connect(self.__openHexFileNewWindow) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | self.__actions.append(self.newWindowAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
165 | # correct texts will be set later |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | self.openAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | self.tr('Open'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | UI.PixmapCache.getIcon("open.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | self.tr('&Open...'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | QKeySequence(self.tr("Ctrl+O", "File|Open")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | 0, self, 'hexEditor_file_open') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | self.openAct.triggered.connect(self.__openHexFile) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | self.__actions.append(self.openAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
175 | # correct texts will be set later |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | self.openReadOnlyAct = E5Action( |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
177 | "", "", |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | 0, 0, self, 'hexEditor_file_open_read_only') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | self.openReadOnlyAct.triggered.connect(self.__openHexFileReadOnly) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | self.__actions.append(self.openReadOnlyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | self.saveAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
183 | self.tr('Save'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
184 | UI.PixmapCache.getIcon("fileSave.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
185 | self.tr('&Save'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | QKeySequence(self.tr("Ctrl+S", "File|Save")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
187 | 0, self, 'hexEditor_file_save') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | self.saveAct.setStatusTip(self.tr('Save the current binary file')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | self.saveAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
190 | """<b>Save File</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | """<p>Save the contents of the hex editor window.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | self.saveAct.triggered.connect(self.__saveHexFile) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | self.__actions.append(self.saveAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | self.saveAsAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | self.tr('Save As'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | UI.PixmapCache.getIcon("fileSaveAs.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | self.tr('Save &As...'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
200 | QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | 0, self, 'hexEditor_file_save_as') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | self.saveAsAct.setStatusTip( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | self.tr('Save the current binary data to a new file')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | self.saveAsAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | """<b>Save As...</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | """<p>Saves the current binary data to a new file.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | self.saveAsAct.triggered.connect(self.__saveHexFileAs) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | self.__actions.append(self.saveAsAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | self.saveReadableAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | self.tr('Save As Readable'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | self.tr('Save As &Readable...'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | 0, 0, self, 'hexEditor_file_save_readable') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | self.saveReadableAct.setStatusTip( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | self.tr('Save the current binary data to a new file in a readable' |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | ' format')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | self.saveReadableAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | """<b>Save As Readable...</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | """<p>Saves the current binary data to a new file in a readable""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | """ format.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | self.saveReadableAct.triggered.connect(self.__saveHexFileReadable) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
224 | self.__actions.append(self.saveReadableAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
226 | self.closeAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | self.tr('Close'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
228 | UI.PixmapCache.getIcon("close.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | self.tr('&Close'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | QKeySequence(self.tr("Ctrl+W", "File|Close")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | 0, self, 'hexEditor_file_close') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | self.closeAct.setStatusTip(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
233 | 'Close the current hex editor window')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
234 | self.closeAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | """<b>Close</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | """<p>Closes the current hex editor window.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | self.closeAct.triggered.connect(self.close) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | self.__actions.append(self.closeAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
240 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
241 | self.closeAllAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
242 | self.tr('Close All'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | self.tr('Close &All'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
244 | 0, 0, self, 'hexEditor_file_close_all') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | self.closeAllAct.setStatusTip(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | 'Close all hex editor windows')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | self.closeAllAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | """<b>Close All</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | """<p>Closes all hex editor windows.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | self.closeAllAct.triggered.connect(self.__closeAll) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
252 | self.__actions.append(self.closeAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
253 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | self.closeOthersAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | self.tr('Close Others'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
256 | self.tr('Close Others'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
257 | 0, 0, self, 'hexEditor_file_close_others') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | self.closeOthersAct.setStatusTip(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
259 | 'Close all hex other editor windows')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | self.closeOthersAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | """<b>Close Others</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | """<p>Closes all other hex editor windows.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | self.closeOthersAct.triggered.connect(self.__closeOthers) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | self.__actions.append(self.closeOthersAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
267 | self.exitAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
268 | self.tr('Quit'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
269 | UI.PixmapCache.getIcon("exit.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
270 | self.tr('&Quit'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
272 | 0, self, 'hexEditor_file_quit') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | self.exitAct.setStatusTip(self.tr('Quit the hex editor')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | self.exitAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
275 | """<b>Quit</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | """<p>Quit the hex editor.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
277 | )) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
278 | if not self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | self.exitAct.triggered.connect(self.__closeAll) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | self.__actions.append(self.exitAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
281 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | def __initEditActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
283 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
284 | Private method to create the Edit actions. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
286 | self.undoAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
287 | self.tr('Undo'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | UI.PixmapCache.getIcon("editUndo.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | self.tr('&Undo'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | QKeySequence(self.tr("Ctrl+Z", "Edit|Undo")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | self, 'hexEditor_edit_undo') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | self.undoAct.setStatusTip(self.tr('Undo the last change')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | self.undoAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | """<b>Undo</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
296 | """<p>Undo the last change done.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
297 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
298 | self.undoAct.triggered.connect(self.__editor.undo) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
299 | self.__actions.append(self.undoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | self.redoAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | self.tr('Redo'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | UI.PixmapCache.getIcon("editRedo.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | self.tr('&Redo'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | QKeySequence(self.tr("Ctrl+Shift+Z", "Edit|Redo")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | 0, self, 'hexEditor_edit_redo') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | self.redoAct.setStatusTip(self.tr('Redo the last change')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | self.redoAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
309 | """<b>Redo</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
310 | """<p>Redo the last change done.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
311 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
312 | self.redoAct.triggered.connect(self.__editor.redo) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
313 | self.__actions.append(self.redoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
314 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | self.revertAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
316 | self.tr('Revert to last saved state'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | self.tr('Re&vert to last saved state'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
318 | QKeySequence(self.tr("Ctrl+Y", "Edit|Revert")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
319 | 0, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
320 | self, 'hexEditor_edit_revert') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | self.revertAct.setStatusTip(self.tr('Revert to last saved state')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | self.revertAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | """<b>Revert to last saved state</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | """<p>Undo all changes up to the last saved state of the""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | """ editor.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | self.revertAct.triggered.connect(self.__editor.revertToUnmodified) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | self.__actions.append(self.revertAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | self.cutAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | self.tr('Cut'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | UI.PixmapCache.getIcon("editCut.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | self.tr('Cu&t'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | QKeySequence(self.tr("Ctrl+X", "Edit|Cut")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
335 | QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
336 | self, 'hexEditor_edit_cut') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | self.cutAct.setStatusTip(self.tr('Cut the selection')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | self.cutAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
339 | """<b>Cut</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | """<p>Cut the selected binary area to the clipboard.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
342 | self.cutAct.triggered.connect(self.__editor.cut) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
343 | self.__actions.append(self.cutAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
344 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
345 | self.copyAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | self.tr('Copy'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
347 | UI.PixmapCache.getIcon("editCopy.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
348 | self.tr('&Copy'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | QKeySequence(self.tr("Ctrl+C", "Edit|Copy")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
350 | QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
351 | self, 'hexEditor_edit_copy') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
352 | self.copyAct.setStatusTip(self.tr('Copy the selection')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | self.copyAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
354 | """<b>Copy</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
355 | """<p>Copy the selected binary area to the clipboard.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
356 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | self.copyAct.triggered.connect(self.__editor.copy) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
358 | self.__actions.append(self.copyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
359 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
360 | self.pasteAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
361 | self.tr('Paste'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
362 | UI.PixmapCache.getIcon("editPaste.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
363 | self.tr('&Paste'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
364 | QKeySequence(self.tr("Ctrl+V", "Edit|Paste")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
365 | QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
366 | self, 'hexEditor_edit_paste') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
367 | self.pasteAct.setStatusTip(self.tr('Paste the clipboard contents')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
368 | self.pasteAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
369 | """<b>Paste</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
370 | """<p>Paste the clipboard contents.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
371 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
372 | self.pasteAct.triggered.connect(self.__editor.paste) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
373 | self.__actions.append(self.pasteAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
374 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | self.selectAllAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | self.tr('Select All'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
377 | UI.PixmapCache.getIcon("editSelectAll.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
378 | self.tr('&Select All'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
379 | QKeySequence(self.tr("Ctrl+A", "Edit|Select All")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
380 | 0, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | self, 'hexEditor_edit_select_all') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
382 | self.selectAllAct.setStatusTip(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
383 | 'Select the complete binary data')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
384 | self.selectAllAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
385 | """<b>Select All</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | """<p>Selects the complete binary data.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
387 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
388 | self.selectAllAct.triggered.connect(self.__editor.selectAll) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | self.__actions.append(self.selectAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
391 | self.deselectAllAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | self.tr('Deselect all'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
393 | self.tr('&Deselect all'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | QKeySequence(self.tr("Alt+Ctrl+A", "Edit|Deselect all")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
395 | 0, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | self, 'hexEditor_edit_deselect_all') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
397 | self.deselectAllAct.setStatusTip(self.tr('Deselect all binary data')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | self.deselectAllAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | """<b>Deselect All</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
400 | """<p>Deselect all all binary data.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
401 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
402 | self.deselectAllAct.triggered.connect(self.__editor.deselectAll) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
403 | self.__actions.append(self.deselectAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
404 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
405 | self.saveSelectionReadableAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
406 | self.tr('Save Selection Readable'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | self.tr('Save Selection Readable...'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | 0, 0, self, 'hexEditor_edit_selection_save_readable') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
409 | self.saveSelectionReadableAct.setStatusTip( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
410 | self.tr('Save the binary data of the current selection to a file' |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | ' in a readable format')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
412 | self.saveSelectionReadableAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
413 | """<b>Save Selection Readable...</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
414 | """<p>Saves the binary data of the current selection to a file""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
415 | """ in a readable format.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | self.saveSelectionReadableAct.triggered.connect( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
418 | self.__saveSelectionReadable) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | self.__actions.append(self.saveSelectionReadableAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
420 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | self.readonlyAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
422 | self.tr('Set Read Only'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
423 | self.tr('Set Read Only'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
424 | 0, 0, self, 'hexEditor_edit_readonly', True) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | self.readonlyAct.setStatusTip(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
426 | 'Change the edit mode to read only')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
427 | self.readonlyAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | """<b>Set Read Only</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | """<p>This changes the edit mode to read only (i.e. to view""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
430 | """ mode).</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
431 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | self.readonlyAct.setChecked(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | self.readonlyAct.toggled[bool].connect(self.__editor.setReadOnly) |
4655
f2f0abd5bc94
Fixed a few bugs in the hex editor and added capability to save/restore the main window state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4652
diff
changeset
|
434 | self.__editor.readOnlyChanged.connect(self.readonlyAct.setChecked) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | self.__actions.append(self.readonlyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
436 | |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
437 | self.searchAct = E5Action( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
438 | self.tr('Search'), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
439 | UI.PixmapCache.getIcon("find.png"), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
440 | self.tr('&Search...'), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
441 | QKeySequence(self.tr("Ctrl+F", "Search|Search")), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
442 | 0, |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
443 | self, 'hexEditor_edit_search') |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
444 | self.searchAct.setStatusTip(self.tr('Search for data')) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
445 | self.searchAct.setWhatsThis(self.tr( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
446 | """<b>Search</b>""" |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
447 | """<p>Search for some data. A dialog is shown to enter the""" |
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
448 | """ data to search for in various formats.</p>""" |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
449 | )) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
450 | self.searchAct.triggered.connect(self.__search) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
451 | self.__actions.append(self.searchAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
452 | |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
453 | self.searchNextAct = E5Action( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
454 | self.tr('Search next'), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
455 | UI.PixmapCache.getIcon("findNext.png"), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
456 | self.tr('Search &next'), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
457 | QKeySequence(self.tr("F3", "Search|Search next")), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
458 | 0, |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
459 | self, 'hexEditor_edit_search_next') |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
460 | self.searchNextAct.setStatusTip(self.tr( |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
461 | 'Search next occurrence')) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
462 | self.searchNextAct.setWhatsThis(self.tr( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
463 | """<b>Search next</b>""" |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
464 | """<p>Search the next occurrence of some data. The previously""" |
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
465 | """ entered search data are reused.</p>""" |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
466 | )) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
467 | self.searchNextAct.triggered.connect(self.__searchWidget.findPrevNext) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
468 | self.__actions.append(self.searchNextAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
469 | |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
470 | self.searchPrevAct = E5Action( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
471 | self.tr('Search previous'), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
472 | UI.PixmapCache.getIcon("findPrev.png"), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
473 | self.tr('Search &previous'), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
474 | QKeySequence(self.tr("Shift+F3", "Search|Search previous")), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
475 | 0, |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
476 | self, 'hexEditor_edit_search_previous') |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
477 | self.searchPrevAct.setStatusTip(self.tr( |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
478 | 'Search previous occurrence')) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
479 | self.searchPrevAct.setWhatsThis(self.tr( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
480 | """<b>Search previous</b>""" |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
481 | """<p>Search the previous occurrence of some data. The""" |
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
482 | """ previously entered search data are reused.</p>""" |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
483 | )) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
484 | self.searchPrevAct.triggered.connect( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
485 | lambda: self.__searchWidget.findPrevNext(True)) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
486 | self.__actions.append(self.searchPrevAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
487 | |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
488 | self.replaceAct = E5Action( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
489 | self.tr('Replace'), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
490 | self.tr('&Replace...'), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
491 | QKeySequence(self.tr("Ctrl+R", "Search|Replace")), |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
492 | 0, |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
493 | self, 'hexEditor_edit_search_replace') |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
494 | self.replaceAct.setStatusTip(self.tr('Replace data')) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
495 | self.replaceAct.setWhatsThis(self.tr( |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
496 | """<b>Replace</b>""" |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
497 | """<p>Search for some data and replace it.""" |
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
498 | """ A dialog is shown to enter the data to search for and the""" |
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
499 | """ replacement data in various formats.</p>""" |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
500 | )) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
501 | self.replaceAct.triggered.connect(self.__replace) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
502 | self.__actions.append(self.replaceAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
503 | |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
504 | self.gotoAct = E5Action( |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
505 | self.tr('Goto Offset'), |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
506 | UI.PixmapCache.getIcon("goto.png"), |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
507 | self.tr('&Goto Offset...'), |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
508 | QKeySequence(QCoreApplication.translate( |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
509 | 'ViewManager', "Ctrl+G", "Search|Goto Offset")), |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
510 | 0, |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
511 | self, 'hexEditor_edit_goto') |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
512 | self.gotoAct.setStatusTip(self.tr('Goto Offset')) |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
513 | self.gotoAct.setWhatsThis(self.tr( |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
514 | """<b>Goto Offset</b>""" |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
515 | """<p>Go to a specific address. A dialog is shown to enter""" |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
516 | """ the movement data.</p>""" |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
517 | )) |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
518 | self.gotoAct.triggered.connect(self.__goto) |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
519 | self.__actions.append(self.gotoAct) |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
520 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | self.redoAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | self.__editor.canRedoChanged.connect(self.redoAct.setEnabled) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
524 | self.undoAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
525 | self.__editor.canUndoChanged.connect(self.undoAct.setEnabled) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
526 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
527 | self.revertAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
528 | self.__editor.dataChanged.connect(self.revertAct.setEnabled) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
529 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
530 | self.cutAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
531 | self.copyAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
532 | self.saveSelectionReadableAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
533 | self.__editor.selectionAvailable.connect(self.__checkActions) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
534 | self.__editor.selectionAvailable.connect(self.copyAct.setEnabled) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
535 | self.__editor.selectionAvailable.connect( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
536 | self.saveSelectionReadableAct.setEnabled) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
537 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
538 | def __initHelpActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
539 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
540 | Private method to create the Help actions. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
541 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
542 | self.aboutAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
543 | self.tr('About'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
544 | self.tr('&About'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
545 | 0, 0, self, 'hexEditor_help_about') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
546 | self.aboutAct.setStatusTip(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
547 | 'Display information about this software')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
548 | self.aboutAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
549 | """<b>About</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
550 | """<p>Display some information about this software.</p>""")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
551 | self.aboutAct.triggered.connect(self.__about) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
552 | self.__actions.append(self.aboutAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
553 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
554 | self.aboutQtAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
555 | self.tr('About Qt'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
556 | self.tr('About &Qt'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
557 | 0, 0, self, 'hexEditor_help_about_qt') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
558 | self.aboutQtAct.setStatusTip( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
559 | self.tr('Display information about the Qt toolkit')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
560 | self.aboutQtAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
561 | """<b>About Qt</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
562 | """<p>Display some information about the Qt toolkit.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
563 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
564 | self.aboutQtAct.triggered.connect(self.__aboutQt) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
565 | self.__actions.append(self.aboutQtAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
566 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
567 | self.whatsThisAct = E5Action( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
568 | self.tr('What\'s This?'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
569 | UI.PixmapCache.getIcon("whatsThis.png"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
570 | self.tr('&What\'s This?'), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
571 | QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
572 | 0, self, 'hexEditor_help_whats_this') |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
573 | self.whatsThisAct.setStatusTip(self.tr('Context sensitive help')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
574 | self.whatsThisAct.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
575 | """<b>Display context sensitive help</b>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
576 | """<p>In What's This? mode, the mouse cursor shows an arrow""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
577 | """ with a question mark, and you can click on the interface""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
578 | """ elements to get a short description of what they do and""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
579 | """ how to use them. In dialogs, this feature can be accessed""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
580 | """ using the context help button in the titlebar.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
581 | )) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
582 | self.whatsThisAct.triggered.connect(self.__whatsThis) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
583 | self.__actions.append(self.whatsThisAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
584 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
585 | def __initConfigActions(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
586 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
587 | Private method to create the Settings actions. |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
588 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
589 | self.prefAct = E5Action( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
590 | self.tr('Preferences'), |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
591 | UI.PixmapCache.getIcon("configure.png"), |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
592 | self.tr('&Preferences...'), |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
593 | 0, 0, self, 'hexEditor_settings_preferences') |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
594 | self.prefAct.setStatusTip(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
595 | 'Set the prefered configuration')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
596 | self.prefAct.setWhatsThis(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
597 | """<b>Preferences</b>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
598 | """<p>Set the configuration items of the application""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
599 | """ with your prefered values.</p>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
600 | )) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
601 | self.prefAct.triggered.connect(self.__showPreferences) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
602 | self.prefAct.setMenuRole(QAction.PreferencesRole) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
603 | self.__actions.append(self.prefAct) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
604 | |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
605 | def __setReadOnlyActionTexts(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
606 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
607 | Private method to switch the 'Open Read Only' action between |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
608 | 'read only' and 'read write'. |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
609 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
610 | if Preferences.getHexEditor("OpenReadOnly"): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
611 | self.openAct.setStatusTip(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
612 | 'Open a binary file for viewing')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
613 | self.openAct.setWhatsThis(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
614 | """<b>Open File</b>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
615 | """<p>This opens a binary file for viewing (i.e. in read""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
616 | """ only mode). It pops up a file selection dialog.</p>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
617 | )) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
618 | |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
619 | self.openReadOnlyAct.setText(self.tr('Open for Editing...')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
620 | self.openReadOnlyAct.setIconText(self.tr('Open for Editing')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
621 | self.openReadOnlyAct.setStatusTip(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
622 | 'Open a binary file for editing')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
623 | self.openReadOnlyAct.setWhatsThis(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
624 | """<b>Open for Editing</b>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
625 | """<p>This opens a binary file for editing.""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
626 | """ It pops up a file selection dialog.</p>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
627 | )) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
628 | else: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
629 | self.openAct.setStatusTip(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
630 | 'Open a binary file for editing')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
631 | self.openAct.setWhatsThis(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
632 | """<b>Open File</b>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
633 | """<p>This opens a binary file for editing.""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
634 | """ It pops up a file selection dialog.</p>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
635 | )) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
636 | |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
637 | self.openReadOnlyAct.setText(self.tr('Open Read Only...')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
638 | self.openReadOnlyAct.setIconText(self.tr('Open Read Only')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
639 | self.openReadOnlyAct.setStatusTip(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
640 | 'Open a binary file for viewing')) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
641 | self.openReadOnlyAct.setWhatsThis(self.tr( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
642 | """<b>Open Read Only</b>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
643 | """<p>This opens a binary file for viewing (i.e. in read""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
644 | """ only mode). It pops up a file selection dialog.</p>""" |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
645 | )) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
646 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
647 | def __initMenus(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
648 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
649 | Private method to create the menus. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
650 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
651 | mb = self.menuBar() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
652 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
653 | menu = mb.addMenu(self.tr('&File')) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
654 | menu.setTearOffEnabled(True) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
655 | menu.addAction(self.newWindowAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
656 | menu.addAction(self.openAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
657 | menu.addAction(self.openReadOnlyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
658 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
659 | menu.addAction(self.saveAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
660 | menu.addAction(self.saveAsAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
661 | menu.addAction(self.saveReadableAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
662 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
663 | menu.addAction(self.closeAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
664 | menu.addAction(self.closeOthersAct) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
665 | if self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
666 | menu.addAction(self.closeAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
667 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
668 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
669 | menu.addAction(self.exitAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
670 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
671 | menu = mb.addMenu(self.tr("&Edit")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
672 | menu.setTearOffEnabled(True) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
673 | menu.addAction(self.undoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
674 | menu.addAction(self.redoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
675 | menu.addAction(self.revertAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
676 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
677 | menu.addAction(self.cutAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
678 | menu.addAction(self.copyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
679 | menu.addAction(self.pasteAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
680 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
681 | menu.addAction(self.selectAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
682 | menu.addAction(self.deselectAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
683 | menu.addAction(self.saveSelectionReadableAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
684 | menu.addSeparator() |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
685 | menu.addAction(self.searchAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
686 | menu.addAction(self.searchNextAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
687 | menu.addAction(self.searchPrevAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
688 | menu.addAction(self.replaceAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
689 | menu.addSeparator() |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
690 | menu.addAction(self.gotoAct) |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
691 | menu.addSeparator() |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
692 | menu.addAction(self.readonlyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
693 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
694 | if not self.__fromEric: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
695 | menu = mb.addMenu(self.tr("Se&ttings")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
696 | menu.setTearOffEnabled(True) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
697 | menu.addAction(self.prefAct) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
698 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
699 | mb.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
700 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
701 | menu = mb.addMenu(self.tr("&Help")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
702 | menu.addAction(self.aboutAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
703 | menu.addAction(self.aboutQtAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
704 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
705 | menu.addAction(self.whatsThisAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
706 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
707 | def __initToolbars(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
708 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
709 | Private method to create the toolbars. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
710 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
711 | filetb = self.addToolBar(self.tr("File")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
712 | filetb.setObjectName("FileToolBar") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
713 | filetb.setIconSize(UI.Config.ToolBarIconSize) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
714 | filetb.addAction(self.newWindowAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
715 | filetb.addAction(self.openAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
716 | filetb.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
717 | filetb.addAction(self.saveAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
718 | filetb.addAction(self.saveAsAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
719 | filetb.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
720 | filetb.addAction(self.closeAct) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
721 | if not self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
722 | filetb.addAction(self.exitAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
723 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
724 | edittb = self.addToolBar(self.tr("Edit")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
725 | edittb.setObjectName("EditToolBar") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
726 | edittb.setIconSize(UI.Config.ToolBarIconSize) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
727 | edittb.addAction(self.undoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
728 | edittb.addAction(self.redoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
729 | edittb.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
730 | edittb.addAction(self.cutAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
731 | edittb.addAction(self.copyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
732 | edittb.addAction(self.pasteAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
733 | |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
734 | searchtb = self.addToolBar(self.tr("Find")) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
735 | searchtb.setObjectName("SearchToolBar") |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
736 | searchtb.setIconSize(UI.Config.ToolBarIconSize) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
737 | searchtb.addAction(self.searchAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
738 | searchtb.addAction(self.searchNextAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
739 | searchtb.addAction(self.searchPrevAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
740 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
741 | if not self.__fromEric: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
742 | settingstb = self.addToolBar(self.tr("Settings")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
743 | settingstb.setObjectName("SettingsToolBar") |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
744 | settingstb.setIconSize(UI.Config.ToolBarIconSize) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
745 | settingstb.addAction(self.prefAct) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
746 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
747 | helptb = self.addToolBar(self.tr("Help")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
748 | helptb.setObjectName("HelpToolBar") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
749 | helptb.setIconSize(UI.Config.ToolBarIconSize) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
750 | helptb.addAction(self.whatsThisAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
751 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
752 | def __createStatusBar(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
753 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
754 | Private method to initialize the status bar. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
755 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
756 | self.__statusBar = self.statusBar() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
757 | self.__statusBar.setSizeGripEnabled(True) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
758 | |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
759 | self.__sbAddress = QLabel(self.__statusBar) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
760 | self.__statusBar.addPermanentWidget(self.__sbAddress) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
761 | self.__sbAddress.setWhatsThis(self.tr( |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
762 | """<p>This part of the status bar displays the cursor""" |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
763 | """ address.</p>""" |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
764 | )) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
765 | self.__sbAddress.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
766 | |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
767 | self.__sbSelection = QLabel(self.__statusBar) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
768 | self.__statusBar.addPermanentWidget(self.__sbSelection) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
769 | self.__sbSelection.setWhatsThis(self.tr( |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
770 | """<p>This part of the status bar displays some selection""" |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
771 | """ information.</p>""" |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
772 | )) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
773 | self.__sbSelection.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
774 | |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
775 | self.__sbSize = QLabel(self.__statusBar) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
776 | self.__statusBar.addPermanentWidget(self.__sbSize) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
777 | self.__sbSize.setWhatsThis(self.tr( |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
778 | """<p>This part of the status bar displays the size of the""" |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
779 | """ binary data.</p>""" |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
780 | )) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
781 | self.__sbSize.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
782 | |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
783 | self.__sbEditMode = E5ClickableLabel(self.__statusBar) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
784 | self.__statusBar.addPermanentWidget(self.__sbEditMode) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
785 | self.__sbEditMode.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
786 | """<p>This part of the status bar displays the edit mode.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
787 | )) |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
788 | self.__sbEditMode.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
789 | self.__sbEditMode.clicked.connect(self.__toggleEditMode) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
790 | |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
791 | self.__sbReadOnly = E5ClickableLabel(self.__statusBar) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
792 | self.__statusBar.addPermanentWidget(self.__sbReadOnly) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
793 | self.__sbReadOnly.setWhatsThis(self.tr( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
794 | """<p>This part of the status bar displays the read""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
795 | """ only mode.</p>""" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
796 | )) |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
797 | self.__sbReadOnly.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
798 | self.__sbReadOnly.clicked.connect(self.__toggleReadOnlyMode) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
799 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
800 | self.__showEditMode(self.__editor.overwriteMode()) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
801 | self.__showReadOnlyMode(self.__editor.isReadOnly()) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
802 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
803 | @pyqtSlot(int) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
804 | def __showAddress(self, address): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
805 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
806 | Private slot to show the address of the cursor position. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
807 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
808 | @param address address of the cursor |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
809 | @type int |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
810 | """ |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
811 | self.__sbAddress.setText(self.tr("Address: 0x{0:0{1}x}").format( |
4665
30d4972ab403
Translated the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4659
diff
changeset
|
812 | address, self.__editor.addressWidth())) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
813 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
814 | @pyqtSlot(bool) |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
815 | def __showSelectionInfo(self, avail): |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
816 | """ |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
817 | Private slot to show selection information. |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
818 | |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
819 | @param avail flag indicating the availability of a selection. |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
820 | @type bool |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
821 | """ |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
822 | if avail: |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
823 | start = self.__editor.getSelectionBegin() |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
824 | end = self.__editor.getSelectionEnd() |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
825 | slen = self.__editor.getSelectionLength() |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
826 | self.__sbSelection.setText( |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
827 | self.tr("Selection: 0x{0:0{2}x} - 0x{1:0{2}x} ({3:n} Bytes)", |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
828 | "0: start, 1: end, 2: address width," |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
829 | " 3: selection length") |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
830 | .format(start, end, self.__editor.addressWidth(), slen) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
831 | ) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
832 | else: |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
833 | self.__sbSelection.setText( |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
834 | self.tr("Selection: -", "no selection available")) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
835 | |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
836 | @pyqtSlot(bool) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
837 | def __showReadOnlyMode(self, on): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
838 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
839 | Private slot to show the read only mode. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
840 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
841 | @param on flag indicating the read only state |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
842 | @type bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
843 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
844 | self.__sbReadOnly.setText(self.tr("ro") if on else self.tr("rw")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
845 | |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
846 | @pyqtSlot() |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
847 | def __toggleReadOnlyMode(self): |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
848 | """ |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
849 | Private slot to toggle the read only mode upon a click on the status |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
850 | bar label. |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
851 | """ |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
852 | self.__editor.setReadOnly(not self.__editor.isReadOnly()) |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
853 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
854 | @pyqtSlot(bool) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
855 | def __showEditMode(self, overwrite): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
856 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
857 | Private slot to show the edit mode. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
858 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
859 | @param overwrite flag indicating overwrite mode |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
860 | @type bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
861 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
862 | self.__sbEditMode.setText( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
863 | self.tr("Overwrite") if overwrite else self.tr("Insert")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
864 | |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
865 | @pyqtSlot() |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
866 | def __toggleEditMode(self): |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
867 | """ |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
868 | Private slot to toggle the edit mode upon a click on the status bar |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
869 | label. |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
870 | """ |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
871 | self.__editor.setOverwriteMode(not self.__editor.overwriteMode()) |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
872 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
873 | @pyqtSlot(int) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
874 | def __showSize(self, size): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
875 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
876 | Private slot to show the binary data size. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
877 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
878 | @param size size of the binary data |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
879 | @type int |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
880 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
881 | self.__sbSize.setText(self.tr("Size: {0:n}").format(size)) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
882 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
883 | def closeEvent(self, evt): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
884 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
885 | Protected event handler for the close event. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
886 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
887 | @param evt reference to the close event |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
888 | <br />This event is simply accepted after the history has been |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
889 | saved and all window references have been deleted. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
890 | @type QCloseEvent |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
891 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
892 | if self.__maybeSave(): |
4655
f2f0abd5bc94
Fixed a few bugs in the hex editor and added capability to save/restore the main window state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4652
diff
changeset
|
893 | state = self.saveState() |
f2f0abd5bc94
Fixed a few bugs in the hex editor and added capability to save/restore the main window state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4652
diff
changeset
|
894 | Preferences.setHexEditor("HexEditorState", state) |
f2f0abd5bc94
Fixed a few bugs in the hex editor and added capability to save/restore the main window state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4652
diff
changeset
|
895 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
896 | Preferences.setGeometry("HexEditorGeometry", self.saveGeometry()) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
897 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
898 | try: |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
899 | if self.__fromEric or len(self.__class__.windows) > 1: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
900 | del self.__class__.windows[ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
901 | self.__class__.windows.index(self)] |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
902 | except ValueError: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
903 | pass |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
904 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
905 | if not self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
906 | Preferences.syncPreferences() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
907 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
908 | evt.accept() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
909 | self.editorClosed.emit() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
910 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
911 | evt.ignore() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
912 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
913 | def __openHexFileNewWindow(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
914 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
915 | Private slot called to open a binary file in new hex editor window. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
916 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
917 | if not self.__lastOpenPath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
918 | if self.__project and self.__project.isOpen(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
919 | self.__lastOpenPath = self.__project.getProjectPath() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
920 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
921 | fileName = E5FileDialog.getOpenFileName( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
922 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
923 | self.tr("Open binary file in new window"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
924 | self.__lastOpenPath, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
925 | self.tr("All Files (*)")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
926 | if fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
927 | he = HexEditMainWindow(fileName=fileName, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
928 | parent=self.parent(), |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
929 | fromEric=self.__fromEric, |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
930 | project=self.__project) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
931 | he.setRecentPaths("", self.__lastSavePath) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
932 | he.show() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
933 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
934 | def __maybeSave(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
935 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
936 | Private method to ask the user to save the file, if it was modified. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
937 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
938 | @return flag indicating, if it is ok to continue |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
939 | @rtype bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
940 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
941 | if self.__editor.isModified(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
942 | ret = E5MessageBox.okToClearData( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
943 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
944 | self.tr("eric6 Hex Editor"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
945 | self.tr("""The loaded file has unsaved changes."""), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
946 | self.__saveHexFile) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
947 | if not ret: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
948 | return False |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
949 | return True |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
950 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
951 | def __loadHexFile(self, fileName): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
952 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
953 | Private method to load a binary file. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
954 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
955 | @param fileName name of the binary file to load |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
956 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
957 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
958 | file = QFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
959 | if not file.exists(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
960 | E5MessageBox.warning( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
961 | self, self.tr("eric6 Hex Editor"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
962 | self.tr("The file '{0}' does not exist.") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
963 | .format(fileName)) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
964 | return |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
965 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
966 | if not file.open(QFile.ReadOnly): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
967 | E5MessageBox.warning( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
968 | self, self.tr("eric6 Hex Editor"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
969 | self.tr("Cannot read file '{0}:\n{1}.") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
970 | .format(fileName, file.errorString())) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
971 | return |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
972 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
973 | data = file.readAll() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
974 | file.close() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
975 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
976 | self.__lastOpenPath = os.path.dirname(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
977 | self.__editor.setData(data) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
978 | self.__setCurrentFile(fileName) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
979 | |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
980 | self.__editor.setReadOnly(Preferences.getHexEditor("OpenReadOnly")) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
981 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
982 | def __openHexFile(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
983 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
984 | Private slot to open a binary file. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
985 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
986 | if self.__maybeSave(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
987 | if not self.__lastOpenPath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
988 | if self.__project and self.__project.isOpen(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
989 | self.__lastOpenPath = self.__project.getProjectPath() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
990 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
991 | fileName = E5FileDialog.getOpenFileName( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
992 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
993 | self.tr("Open binary file"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
994 | self.__lastOpenPath, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
995 | self.tr("All Files (*)")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
996 | if fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
997 | self.__loadHexFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
998 | self.__checkActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
999 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1000 | def __openHexFileReadOnly(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1001 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1002 | Private slot to open a binary file in read only mode. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1003 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1004 | self.__openHexFile() |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1005 | self.__editor.setReadOnly(not Preferences.getHexEditor("OpenReadOnly")) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1006 | self.__checkActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1007 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1008 | def __saveHexFile(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1009 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1010 | Private method to save a binary file. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1011 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1012 | @return flag indicating success |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1013 | @rtype bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1014 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1015 | if not self.__fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1016 | ok = self.__saveHexFileAs() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1017 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1018 | ok = self.__saveHexDataFile(self.__fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1019 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1020 | if ok: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1021 | self.__editor.undoStack().setClean() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1022 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1023 | return ok |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1024 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1025 | def __saveHexFileAs(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1026 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1027 | Private method to save the data to a new file. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1028 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1029 | @return flag indicating success |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1030 | @rtype bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1031 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1032 | if not self.__lastSavePath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1033 | if self.__project and self.__project.isOpen(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1034 | self.__lastSavePath = self.__project.getProjectPath() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1035 | if not self.__lastSavePath and self.__lastOpenPath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1036 | self.__lastSavePath = self.__lastOpenPath |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1037 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1038 | fileName = E5FileDialog.getSaveFileName( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1039 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1040 | self.tr("Save binary file"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1041 | self.__lastSavePath, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1042 | self.tr("All Files (*)"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1043 | E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1044 | if not fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1045 | return False |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1046 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1047 | if QFileInfo(fileName).exists(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1048 | res = E5MessageBox.yesNo( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1049 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1050 | self.tr("Save binary file"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1051 | self.tr("<p>The file <b>{0}</b> already exists." |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1052 | " Overwrite it?</p>").format(fileName), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1053 | icon=E5MessageBox.Warning) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1054 | if not res: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1055 | return False |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1056 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1057 | self.__lastSavePath = os.path.dirname(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1058 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1059 | return self.__saveHexDataFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1060 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1061 | def __saveHexDataFile(self, fileName): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1062 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1063 | Private method to save the binary data to a file. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1064 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1065 | @param fileName name of the file to write to |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1066 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1067 | @return flag indicating success |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1068 | @rtype bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1069 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1070 | file = QFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1071 | if not file.open(QFile.WriteOnly): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1072 | E5MessageBox.warning( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1073 | self, self.tr("eric6 Hex Editor"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1074 | self.tr("Cannot write file '{0}:\n{1}.") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1075 | .format(fileName, file.errorString())) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1076 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1077 | self.__checkActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1078 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1079 | return False |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1080 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1081 | res = file.write(self.__editor.data()) != -1 |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1082 | file.close() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1083 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1084 | if not res: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1085 | E5MessageBox.warning( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1086 | self, self.tr("eric6 Hex Editor"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1087 | self.tr("Cannot write file '{0}:\n{1}.") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1088 | .format(fileName, file.errorString())) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1089 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1090 | self.__checkActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1091 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1092 | return False |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1093 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1094 | self.__editor.setModified(False, setCleanState=True) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1095 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1096 | self.__setCurrentFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1097 | self.__statusBar.showMessage(self.tr("File saved"), 2000) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1098 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1099 | self.__checkActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1100 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1101 | return True |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1102 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1103 | def __saveHexFileReadable(self, selectionOnly=False): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1104 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1105 | Private method to save the binary data in readable format. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1106 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1107 | @param selectionOnly flag indicating to save the selection only |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1108 | @type bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1109 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1110 | savePath = self.__lastSavePath |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1111 | if not savePath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1112 | if self.__project and self.__project.isOpen(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1113 | savePath = self.__project.getProjectPath() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1114 | if not savePath and self.__lastOpenPath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1115 | savePath = self.__lastOpenPath |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1116 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1117 | fileName, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1118 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1119 | self.tr("Save to readable file"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1120 | savePath, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1121 | self.tr("Text Files (*.txt);;All Files (*)"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1122 | self.tr("Text Files (*.txt)"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1123 | E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1124 | if not fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1125 | return |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1126 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1127 | ext = QFileInfo(fileName).suffix() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1128 | if not ext: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1129 | ex = selectedFilter.split("(*")[1].split(")")[0] |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1130 | if ex: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1131 | fileName += ex |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1132 | if QFileInfo(fileName).exists(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1133 | res = E5MessageBox.yesNo( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1134 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1135 | self.tr("Save to readable file"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1136 | self.tr("<p>The file <b>{0}</b> already exists." |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1137 | " Overwrite it?</p>").format(fileName), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1138 | icon=E5MessageBox.Warning) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1139 | if not res: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1140 | return |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1141 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1142 | file = QFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1143 | if not file.open(QFile.WriteOnly): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1144 | E5MessageBox.warning( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1145 | self, self.tr("eric6 Hex Editor"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1146 | self.tr("Cannot write file '{0}:\n{1}.") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1147 | .format(fileName, file.errorString())) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1148 | return |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1149 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1150 | if selectionOnly: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1151 | readableData = self.__editor.selectionToReadableString() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1152 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1153 | readableData = self.__editor.toReadableString() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1154 | res = file.write(readableData.encode("latin1")) != -1 |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1155 | file.close() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1156 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1157 | if not res: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1158 | E5MessageBox.warning( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1159 | self, self.tr("eric6 Hex Editor"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1160 | self.tr("Cannot write file '{0}:\n{1}.") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1161 | .format(fileName, file.errorString())) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1162 | return |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1163 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1164 | self.__statusBar.showMessage(self.tr("File saved"), 2000) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1165 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1166 | def __saveSelectionReadable(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1167 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1168 | Private method to save the data of the current selection in readable |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1169 | format. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1170 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1171 | self.__saveHexFileReadable(selectionOnly=True) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1172 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1173 | def __closeAll(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1174 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1175 | Private slot to close all windows. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1176 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1177 | self.__closeOthers() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1178 | self.close() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1179 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1180 | def __closeOthers(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1181 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1182 | Private slot to close all other windows. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1183 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1184 | for win in self.__class__.windows[:]: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1185 | if win != self: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1186 | win.close() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1187 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1188 | def __setCurrentFile(self, fileName): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1189 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1190 | Private method to register the file name of the current file. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1191 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1192 | @param fileName name of the file to register |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1193 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1194 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1195 | self.__fileName = fileName |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1196 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1197 | if not self.__fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1198 | shownName = self.tr("Untitled") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1199 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1200 | shownName = self.__strippedName(self.__fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1201 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1202 | self.setWindowTitle(self.tr("{0}[*] - {1}") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1203 | .format(shownName, self.tr("Hex Editor"))) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1204 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1205 | self.setWindowModified(self.__editor.isModified()) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1206 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1207 | def __strippedName(self, fullFileName): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1208 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1209 | Private method to return the filename part of the given path. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1210 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1211 | @param fullFileName full pathname of the given file |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1212 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1213 | @return filename part |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1214 | @rtype str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1215 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1216 | return QFileInfo(fullFileName).fileName() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1217 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1218 | def setRecentPaths(self, openPath, savePath): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1219 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1220 | Public method to set the last open and save paths. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1221 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1222 | @param openPath least recently used open path |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1223 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1224 | @param savePath least recently used save path |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1225 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1226 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1227 | if openPath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1228 | self.__lastOpenPath = openPath |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1229 | if savePath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1230 | self.__lastSavePath = savePath |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1231 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1232 | @pyqtSlot() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1233 | def __checkActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1234 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1235 | Private slot to check some actions for their enable/disable status. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1236 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1237 | self.saveAct.setEnabled(self.__editor.isModified()) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1238 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1239 | self.cutAct.setEnabled(not self.__editor.isReadOnly() and |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1240 | self.__editor.hasSelection()) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1241 | self.pasteAct.setEnabled(not self.__editor.isReadOnly()) |
4655
f2f0abd5bc94
Fixed a few bugs in the hex editor and added capability to save/restore the main window state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4652
diff
changeset
|
1242 | self.replaceAct.setEnabled(not self.__editor.isReadOnly()) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1243 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1244 | @pyqtSlot(bool) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1245 | def __modificationChanged(self, m): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1246 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1247 | Private slot to handle the dataChanged signal. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1248 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1249 | @param m modification status |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1250 | @type bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1251 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1252 | self.setWindowModified(m) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1253 | self.__checkActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1254 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1255 | def __about(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1256 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1257 | Private slot to show a little About message. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1258 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1259 | E5MessageBox.about( |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1260 | self, self.tr("About eric6 Hex Editor"), |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1261 | self.tr("The eric6 Hex Editor is a simple editor component" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1262 | " to edit binary files.")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1263 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1264 | def __aboutQt(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1265 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1266 | Private slot to handle the About Qt dialog. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1267 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1268 | E5MessageBox.aboutQt(self, "eric6 Hex Editor") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1269 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1270 | def __whatsThis(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1271 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1272 | Private slot called in to enter Whats This mode. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1273 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1274 | QWhatsThis.enterWhatsThisMode() |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1275 | |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1276 | def __search(self): |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1277 | """ |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1278 | Private method to handle the search action. |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1279 | """ |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1280 | self.__replaceWidget.hide() |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1281 | self.__gotoWidget.hide() |
4659
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1282 | if self.__editor.hasSelection(): |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1283 | txt = self.__editor.selectionToHexString() |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1284 | else: |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1285 | txt = "" |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1286 | self.__searchWidget.show(txt) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1287 | |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1288 | def __replace(self): |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1289 | """ |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1290 | Private method to handle the replace action. |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1291 | """ |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1292 | self.__searchWidget.hide() |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1293 | self.__gotoWidget.hide() |
4659
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1294 | if self.__editor.hasSelection(): |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1295 | txt = self.__editor.selectionToHexString() |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1296 | else: |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1297 | txt = "" |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1298 | self.__replaceWidget.show(txt) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1299 | |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1300 | def __goto(self): |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1301 | """ |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1302 | Private method to handle the goto action. |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1303 | """ |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1304 | self.__searchWidget.hide() |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1305 | self.__replaceWidget.hide() |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1306 | self.__gotoWidget.show() |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1307 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1308 | def preferencesChanged(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1309 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1310 | Public method to (re-)read the various settings. |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1311 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1312 | self.__editor.setAddressWidth( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1313 | Preferences.getHexEditor("AddressAreaWidth")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1314 | self.__editor.setAddressArea( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1315 | Preferences.getHexEditor("ShowAddressArea")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1316 | self.__editor.setAsciiArea( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1317 | Preferences.getHexEditor("ShowAsciiArea")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1318 | self.__editor.setHighlighting( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1319 | Preferences.getHexEditor("HighlightChanges")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1320 | self.__editor.setHighlightColors( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1321 | Preferences.getHexEditor("HighlightingForeGround"), |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1322 | Preferences.getHexEditor("HighlightingBackGround")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1323 | self.__editor.setSelectionColors( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1324 | Preferences.getHexEditor("SelectionForeGround"), |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1325 | Preferences.getHexEditor("SelectionBackGround")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1326 | self.__editor.setAddressAreaColors( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1327 | Preferences.getHexEditor("AddressAreaForeGround"), |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1328 | Preferences.getHexEditor("AddressAreaBackGround")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1329 | self.__editor.setFont( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1330 | Preferences.getHexEditor("Font")) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1331 | |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1332 | self.__setReadOnlyActionTexts() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1333 | |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1334 | def __showPreferences(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1335 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1336 | Private slot to set the preferences. |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1337 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1338 | from Preferences.ConfigurationDialog import ConfigurationDialog |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1339 | dlg = ConfigurationDialog( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1340 | None, 'Configuration', True, fromEric=True, |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1341 | displayMode=ConfigurationDialog.HexEditorMode) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1342 | dlg.preferencesChanged.connect( |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1343 | self.__preferencesChangedByLocalPreferencesDialog) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1344 | dlg.show() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1345 | dlg.showConfigurationPageByName("hexEditorPage") |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1346 | dlg.exec_() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1347 | QCoreApplication.processEvents() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1348 | if dlg.result() == QDialog.Accepted: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1349 | dlg.setPreferences() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1350 | Preferences.syncPreferences() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1351 | self.__preferencesChangedByLocalPreferencesDialog() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1352 | |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1353 | def __preferencesChangedByLocalPreferencesDialog(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1354 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1355 | Private slot to handle preferences changes by our local dialog. |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1356 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1357 | for hexEditor in HexEditMainWindow.windows: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1358 | hexEditor.preferencesChanged() |
4659
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1359 | |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1360 | def getSRHistory(self, key): |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1361 | """ |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1362 | Public method to get the search or replace history list. |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1363 | |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1364 | @param key name of list to return |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1365 | @type str (must be 'search' or 'replace') |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1366 | @return the requested history list |
4666
bc52ef526e11
Generated the source docu for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4665
diff
changeset
|
1367 | @rtype list of tuples of (int, str) |
4659
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1368 | """ |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1369 | assert key in ['search', 'replace'] |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1370 | |
2863d05e83c6
Improved the search/replace history handling of the hex editor and added input validators.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4658
diff
changeset
|
1371 | return self.__srHistory[key] |