Sat, 26 Apr 2025 12:34:32 +0200
MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.
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 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11006
diff
changeset
|
3 | # Copyright (c) 2016 - 2025 Detlev Offenbach <detlev@die-offenbachs.de> |
4650
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 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
10 | import contextlib |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | import os |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
12 | import pathlib |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
14 | from PyQt6.QtCore import QCoreApplication, QLocale, QSize, pyqtSignal, pyqtSlot |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
15 | from PyQt6.QtGui import QAction, QKeySequence |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8314
diff
changeset
|
16 | from PyQt6.QtWidgets import ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
17 | QDialog, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
18 | QFrame, |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
19 | QLabel, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
20 | QMenu, |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
21 | QVBoxLayout, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
22 | QWhatsThis, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
23 | QWidget, |
7254
f00d825fbdb3
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
24 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10759
diff
changeset
|
26 | from eric7 import EricUtilities, Preferences |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
27 | from eric7.EricGui import EricPixmapCache |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
28 | from eric7.EricGui.EricAction import EricAction |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
29 | from eric7.EricWidgets import EricFileDialog, EricMessageBox |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
30 | from eric7.EricWidgets.EricApplication import ericApp |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
31 | from eric7.EricWidgets.EricClickableLabel import EricClickableLabel |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
32 | from eric7.EricWidgets.EricMainWindow import EricMainWindow |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
33 | from eric7.Globals import recentNameHexFiles, strGroup |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
34 | from eric7.RemoteServerInterface import EricServerFileDialog |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
35 | from eric7.SystemUtilities import FileSystemUtilities |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
37 | from .HexEditGotoWidget import HexEditGotoWidget |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
38 | from .HexEditSearchReplaceWidget import HexEditSearchReplaceWidget |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
39 | from .HexEditWidget import HexEditWidget |
4650
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 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
42 | class HexEditMainWindow(EricMainWindow): |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | """ |
9697
cdaa3cc805f7
Started implementing a PDF viewer tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9695
diff
changeset
|
44 | Class implementing the hex editor main window. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
45 | |
9698
69e183e4db6f
Continued implementing a PDF viewer tool (page navigation).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9697
diff
changeset
|
46 | @signal editorClosed() emitted after the window was requested to close |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
48 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | editorClosed = pyqtSignal() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
50 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | windows = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
52 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
53 | maxMenuFilePathLen = 75 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
54 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | 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
|
56 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
58 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
59 | @param fileName name of a file to load on startup |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
60 | @type str |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
61 | @param parent parent widget of this window |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
62 | @type QWidget |
7900
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
63 | @param fromEric flag indicating whether it was called from within |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
64 | eric |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
65 | @type bool |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
66 | @param project reference to the project object |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
67 | @type Project |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
69 | super().__init__(parent) |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
70 | self.setObjectName("eric7_hex_editor") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
71 | |
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
|
72 | 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
|
73 | "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
|
74 | # 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
|
75 | # 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
|
76 | "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
|
77 | # 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
|
78 | # 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
|
79 | } |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
81 | self.__fromEric = fromEric |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
82 | self.setWindowIcon(EricPixmapCache.getIcon("hexEditor")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
84 | if not self.__fromEric: |
10933
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
85 | self.setStyle( |
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
86 | styleName=Preferences.getUI("Style"), |
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
87 | styleSheetFile=Preferences.getUI("StyleSheet"), |
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
88 | itemClickBehavior=Preferences.getUI("ActivateItemOnSingleClick"), |
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
89 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
90 | |
10633
dda7e43934dc
Corrected some code formatting and coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10631
diff
changeset
|
91 | self.__remotefsInterface = ( |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
92 | ericApp().getObject("EricServer").getServiceInterface("FileSystem") |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
93 | if self.__fromEric |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
94 | else None |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
95 | ) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
96 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | self.__editor = HexEditWidget() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
98 | self.__searchWidget = HexEditSearchReplaceWidget(self.__editor, self, False) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
99 | self.__replaceWidget = HexEditSearchReplaceWidget(self.__editor, self, True) |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
100 | 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
|
101 | cw = QWidget() |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
102 | layout = QVBoxLayout(cw) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
103 | 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
|
104 | layout.setSpacing(1) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
105 | layout.addWidget(self.__editor) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
106 | layout.addWidget(self.__searchWidget) |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
107 | 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
|
108 | cw.setLayout(layout) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
109 | layout.addWidget(self.__replaceWidget) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
110 | self.__searchWidget.hide() |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
111 | self.__replaceWidget.hide() |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
112 | self.__gotoWidget.hide() |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
113 | self.setCentralWidget(cw) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
114 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | g = Preferences.getGeometry("HexEditorGeometry") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | if g.isEmpty(): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | s = QSize(600, 500) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | self.resize(s) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | self.restoreGeometry(g) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
121 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | self.__initActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | self.__initMenus() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.__initToolbars() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | self.__createStatusBar() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
126 | |
9698
69e183e4db6f
Continued implementing a PDF viewer tool (page navigation).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9697
diff
changeset
|
127 | HexEditMainWindow.windows.append(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
128 | |
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
|
129 | 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
|
130 | self.restoreState(state) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
131 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | 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
|
133 | 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
|
134 | self.__editor.currentSizeChanged.connect(self.__showSize) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | self.__editor.dataChanged.connect(self.__modificationChanged) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | self.__editor.overwriteModeChanged.connect(self.__showEditMode) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | 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
|
138 | self.__editor.readOnlyChanged.connect(self.__checkActions) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
139 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
140 | self.preferencesChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
141 | self.__editor.setOverwriteMode(Preferences.getHexEditor("OpenInOverwriteMode")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
142 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | self.__project = project |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | self.__lastOpenPath = "" |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | self.__lastSavePath = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
146 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
147 | self.__recent = [] |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
148 | self.__loadRecent() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
149 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | self.__setCurrentFile("") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | if fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | self.__loadHexFile(fileName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
153 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | self.__checkActions() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
155 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | def __initActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | 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
|
159 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | # list of all actions |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | self.__actions = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
162 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | self.__initFileActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | self.__initEditActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | self.__initHelpActions() |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
166 | if not self.__fromEric: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
167 | self.__initConfigActions() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
168 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | def __initFileActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | 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
|
172 | """ |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
173 | self.newWindowAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
174 | self.tr("New Window"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
175 | EricPixmapCache.getIcon("newWindow"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
176 | self.tr("New &Window"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
177 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
178 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
179 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
180 | "hexEditor_file_new_window", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
181 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
182 | self.newWindowAct.setStatusTip( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
183 | self.tr("Open a binary file for editing in a new hex editor window") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
184 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
185 | self.newWindowAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
186 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
187 | """<b>New Window</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
188 | """<p>This opens a binary file for editing in a new hex editor""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
189 | """ window.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
190 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
191 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | self.newWindowAct.triggered.connect(self.__openHexFileNewWindow) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | self.__actions.append(self.newWindowAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
194 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
195 | # correct texts will be set later |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
196 | self.openAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
197 | self.tr("Open"), |
10758
1fd5ea95c0e3
Added icon for the recent sub-menus of the Project and Multiproject menus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10757
diff
changeset
|
198 | EricPixmapCache.getIcon("open"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
199 | self.tr("&Open..."), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
200 | QKeySequence(self.tr("Ctrl+O", "File|Open")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
201 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
202 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
203 | "hexEditor_file_open", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
204 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | self.openAct.triggered.connect(self.__openHexFile) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | self.__actions.append(self.openAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
207 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
208 | # correct texts will be set later |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
209 | self.openReadOnlyAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
210 | "", "", 0, 0, self, "hexEditor_file_open_read_only" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
211 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | self.openReadOnlyAct.triggered.connect(self.__openHexFileReadOnly) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | self.__actions.append(self.openReadOnlyAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
214 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
215 | self.saveAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
216 | self.tr("Save"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
217 | EricPixmapCache.getIcon("fileSave"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
218 | self.tr("&Save"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | QKeySequence(self.tr("Ctrl+S", "File|Save")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
220 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
221 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
222 | "hexEditor_file_save", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
223 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
224 | self.saveAct.setStatusTip(self.tr("Save the current binary file")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
225 | self.saveAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
226 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
227 | """<b>Save File</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
228 | """<p>Save the contents of the hex editor window.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
229 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
230 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | self.saveAct.triggered.connect(self.__saveHexFile) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | self.__actions.append(self.saveAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
233 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
234 | self.saveAsAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
235 | self.tr("Save As"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
236 | EricPixmapCache.getIcon("fileSaveAs"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
237 | self.tr("Save &As..."), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | QKeySequence(self.tr("Shift+Ctrl+S", "File|Save As")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
239 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
240 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
241 | "hexEditor_file_save_as", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
242 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | self.saveAsAct.setStatusTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
244 | self.tr("Save the current binary data to a new file") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
245 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
246 | self.saveAsAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
247 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
248 | """<b>Save As...</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
249 | """<p>Saves the current binary data to a new file.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
250 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
251 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
252 | self.saveAsAct.triggered.connect(self.__saveHexFileAs) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
253 | self.__actions.append(self.saveAsAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
254 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
255 | self.saveReadableAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
256 | self.tr("Save As Readable"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
257 | self.tr("Save As &Readable..."), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
258 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
259 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
260 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
261 | "hexEditor_file_save_readable", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
262 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | self.saveReadableAct.setStatusTip( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
264 | self.tr("Save the current binary data to a new file in a readable format") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
265 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
266 | self.saveReadableAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
268 | """<b>Save As Readable...</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
269 | """<p>Saves the current binary data to a new file in a readable""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
270 | """ format.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
271 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
272 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | self.saveReadableAct.triggered.connect(self.__saveHexFileReadable) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | self.__actions.append(self.saveReadableAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
275 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
276 | self.closeAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
277 | self.tr("Close"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
278 | EricPixmapCache.getIcon("close"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
279 | self.tr("&Close"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | QKeySequence(self.tr("Ctrl+W", "File|Close")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
281 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
282 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
283 | "hexEditor_file_close", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
284 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
285 | self.closeAct.setStatusTip(self.tr("Close the current hex editor window")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
286 | self.closeAct.setWhatsThis( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
287 | self.tr("""<b>Close</b><p>Closes the current hex editor window.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
288 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | self.closeAct.triggered.connect(self.close) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | self.__actions.append(self.closeAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
291 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
292 | self.closeAllAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
293 | self.tr("Close All"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
294 | self.tr("Close &All"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
295 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
296 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
297 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
298 | "hexEditor_file_close_all", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
299 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
300 | self.closeAllAct.setStatusTip(self.tr("Close all hex editor windows")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
301 | self.closeAllAct.setWhatsThis( |
9573
9960d19d66b5
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
302 | self.tr("""<b>Close All</b><p>Closes all hex editor windows.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
303 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | self.closeAllAct.triggered.connect(self.__closeAll) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | self.__actions.append(self.closeAllAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
306 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
307 | self.closeOthersAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
308 | self.tr("Close Others"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
309 | self.tr("Close Others"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
310 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
311 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
312 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
313 | "hexEditor_file_close_others", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
314 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
315 | self.closeOthersAct.setStatusTip(self.tr("Close all other hex editor windows")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
316 | self.closeOthersAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
317 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
318 | """<b>Close Others</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
319 | """<p>Closes all other hex editor windows.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
320 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
321 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | self.closeOthersAct.triggered.connect(self.__closeOthers) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | self.__actions.append(self.closeOthersAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
324 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
325 | self.exitAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
326 | self.tr("Quit"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
327 | EricPixmapCache.getIcon("exit"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
328 | self.tr("&Quit"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
330 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
331 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
332 | "hexEditor_file_quit", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
333 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
334 | self.exitAct.setStatusTip(self.tr("Quit the hex editor")) |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
335 | self.exitAct.setWhatsThis(self.tr("""<b>Quit</b><p>Quit the hex editor.</p>""")) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
336 | if not self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | self.exitAct.triggered.connect(self.__closeAll) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | self.__actions.append(self.exitAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
339 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | def __initEditActions(self): |
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 | 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
|
343 | """ |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
344 | self.undoAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
345 | self.tr("Undo"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
346 | EricPixmapCache.getIcon("editUndo"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
347 | self.tr("&Undo"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
348 | 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
|
349 | QKeySequence(self.tr("Alt+Backspace", "Edit|Undo")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
350 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
351 | "hexEditor_edit_undo", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
352 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
353 | self.undoAct.setStatusTip(self.tr("Undo the last change")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
354 | self.undoAct.setWhatsThis( |
9573
9960d19d66b5
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
355 | self.tr("""<b>Undo</b><p>Undo the last change done.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
356 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | 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
|
358 | self.__actions.append(self.undoAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
359 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
360 | self.redoAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
361 | self.tr("Redo"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
362 | EricPixmapCache.getIcon("editRedo"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
363 | self.tr("&Redo"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
364 | QKeySequence(self.tr("Ctrl+Shift+Z", "Edit|Redo")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
365 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
366 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
367 | "hexEditor_edit_redo", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
368 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
369 | self.redoAct.setStatusTip(self.tr("Redo the last change")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
370 | self.redoAct.setWhatsThis( |
9573
9960d19d66b5
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
371 | self.tr("""<b>Redo</b><p>Redo the last change done.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
372 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
373 | 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
|
374 | self.__actions.append(self.redoAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
375 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
376 | self.revertAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
377 | self.tr("Revert to last saved state"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
378 | self.tr("Re&vert to last saved state"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
379 | 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
|
380 | 0, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
381 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
382 | "hexEditor_edit_revert", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
383 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
384 | self.revertAct.setStatusTip(self.tr("Revert to last saved state")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
385 | self.revertAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
386 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
387 | """<b>Revert to last saved state</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
388 | """<p>Undo all changes up to the last saved state of the""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
389 | """ editor.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
390 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
391 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | 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
|
393 | self.__actions.append(self.revertAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
394 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
395 | self.cutAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
396 | self.tr("Cut"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
397 | EricPixmapCache.getIcon("editCut"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
398 | self.tr("Cu&t"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | 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
|
400 | QKeySequence(self.tr("Shift+Del", "Edit|Cut")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
401 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
402 | "hexEditor_edit_cut", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
403 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
404 | self.cutAct.setStatusTip(self.tr("Cut the selection")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
405 | self.cutAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
406 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
407 | """<b>Cut</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
408 | """<p>Cut the selected binary area to the clipboard.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
409 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
410 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | 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
|
412 | self.__actions.append(self.cutAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
413 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
414 | self.copyAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
415 | self.tr("Copy"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
416 | EricPixmapCache.getIcon("editCopy"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
417 | self.tr("&Copy"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
418 | 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
|
419 | QKeySequence(self.tr("Ctrl+Ins", "Edit|Copy")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
420 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
421 | "hexEditor_edit_copy", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
422 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
423 | self.copyAct.setStatusTip(self.tr("Copy the selection")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
424 | self.copyAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
425 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
426 | """<b>Copy</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
427 | """<p>Copy the selected binary area to the clipboard.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
428 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
429 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
430 | 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
|
431 | self.__actions.append(self.copyAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
432 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
433 | self.pasteAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
434 | self.tr("Paste"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
435 | EricPixmapCache.getIcon("editPaste"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
436 | self.tr("&Paste"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
437 | 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
|
438 | QKeySequence(self.tr("Shift+Ins", "Edit|Paste")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
439 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
440 | "hexEditor_edit_paste", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
441 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
442 | self.pasteAct.setStatusTip(self.tr("Paste the clipboard contents")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
443 | self.pasteAct.setWhatsThis( |
9573
9960d19d66b5
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
444 | self.tr("""<b>Paste</b><p>Paste the clipboard contents.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
445 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
446 | 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
|
447 | self.__actions.append(self.pasteAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
448 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
449 | self.selectAllAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
450 | self.tr("Select All"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
451 | EricPixmapCache.getIcon("editSelectAll"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
452 | self.tr("&Select All"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | 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
|
454 | 0, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
455 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
456 | "hexEditor_edit_select_all", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
457 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
458 | self.selectAllAct.setStatusTip(self.tr("Select the complete binary data")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
459 | self.selectAllAct.setWhatsThis( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
460 | self.tr("""<b>Select All</b><p>Selects the complete binary data.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
461 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | 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
|
463 | self.__actions.append(self.selectAllAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
464 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
465 | self.deselectAllAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
466 | self.tr("Deselect all"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
467 | self.tr("&Deselect all"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
468 | 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
|
469 | 0, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
470 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
471 | "hexEditor_edit_deselect_all", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
472 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
473 | self.deselectAllAct.setStatusTip(self.tr("Deselect all binary data")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
474 | self.deselectAllAct.setWhatsThis( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
475 | self.tr("""<b>Deselect All</b><p>Deselect all all binary data.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
476 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
477 | 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
|
478 | self.__actions.append(self.deselectAllAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
479 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
480 | self.saveSelectionReadableAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
481 | self.tr("Save Selection Readable"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
482 | self.tr("Save Selection Readable..."), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
483 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
484 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
485 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
486 | "hexEditor_edit_selection_save_readable", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
487 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | self.saveSelectionReadableAct.setStatusTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
489 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
490 | "Save the binary data of the current selection to a file" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
491 | " in a readable format" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
492 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
493 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
494 | self.saveSelectionReadableAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
495 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
496 | """<b>Save Selection Readable...</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
497 | """<p>Saves the binary data of the current selection to a file""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
498 | """ in a readable format.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
499 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
500 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
501 | self.saveSelectionReadableAct.triggered.connect(self.__saveSelectionReadable) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | self.__actions.append(self.saveSelectionReadableAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
503 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
504 | self.readonlyAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
505 | self.tr("Set Read Only"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
506 | self.tr("Set Read Only"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
507 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
508 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
509 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
510 | "hexEditor_edit_readonly", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
511 | True, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
512 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
513 | self.readonlyAct.setStatusTip(self.tr("Change the edit mode to read only")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
514 | self.readonlyAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
515 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
516 | """<b>Set Read Only</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
517 | """<p>This changes the edit mode to read only (i.e. to view""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
518 | """ mode).</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
519 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
520 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | self.readonlyAct.setChecked(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | 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
|
523 | 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
|
524 | self.__actions.append(self.readonlyAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
525 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
526 | self.searchAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
527 | self.tr("Search"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
528 | EricPixmapCache.getIcon("find"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
529 | self.tr("&Search..."), |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
530 | 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
|
531 | 0, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
532 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
533 | "hexEditor_edit_search", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
534 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
535 | self.searchAct.setStatusTip(self.tr("Search for data")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
536 | self.searchAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
537 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
538 | """<b>Search</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
539 | """<p>Search for some data. A dialog is shown to enter the""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
540 | """ data to search for in various formats.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
541 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
542 | ) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
543 | 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
|
544 | self.__actions.append(self.searchAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
545 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
546 | self.searchNextAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
547 | self.tr("Search next"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
548 | EricPixmapCache.getIcon("findNext"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
549 | self.tr("Search &next"), |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
550 | 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
|
551 | 0, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
552 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
553 | "hexEditor_edit_search_next", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
554 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
555 | self.searchNextAct.setStatusTip(self.tr("Search next occurrence")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
556 | self.searchNextAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
557 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
558 | """<b>Search next</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
559 | """<p>Search the next occurrence of some data. The previously""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
560 | """ entered search data are reused.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
561 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
562 | ) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
563 | 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
|
564 | self.__actions.append(self.searchNextAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
565 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
566 | self.searchPrevAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
567 | self.tr("Search previous"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
568 | EricPixmapCache.getIcon("findPrev"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
569 | self.tr("Search &previous"), |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
570 | 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
|
571 | 0, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
572 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
573 | "hexEditor_edit_search_previous", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
574 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
575 | self.searchPrevAct.setStatusTip(self.tr("Search previous occurrence")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
576 | self.searchPrevAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
577 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
578 | """<b>Search previous</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
579 | """<p>Search the previous occurrence of some data. The""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
580 | """ previously entered search data are reused.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
581 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
582 | ) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
583 | self.searchPrevAct.triggered.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
584 | lambda: self.__searchWidget.findPrevNext(True) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
585 | ) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
586 | self.__actions.append(self.searchPrevAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
587 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
588 | self.replaceAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
589 | self.tr("Replace"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
590 | self.tr("&Replace..."), |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
591 | 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
|
592 | 0, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
593 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
594 | "hexEditor_edit_search_replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
595 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
596 | self.replaceAct.setStatusTip(self.tr("Replace data")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
597 | self.replaceAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
598 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
599 | """<b>Replace</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
600 | """<p>Search for some data and replace it.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
601 | """ A dialog is shown to enter the data to search for and the""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
602 | """ replacement data in various formats.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
603 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
604 | ) |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
605 | 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
|
606 | self.__actions.append(self.replaceAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
607 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
608 | self.gotoAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
609 | self.tr("Goto Offset"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
610 | EricPixmapCache.getIcon("goto"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
611 | self.tr("&Goto Offset..."), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
612 | QKeySequence( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
613 | QCoreApplication.translate( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
614 | "ViewManager", "Ctrl+G", "Search|Goto Offset" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
615 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
616 | ), |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
617 | 0, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
618 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
619 | "hexEditor_edit_goto", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
620 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
621 | self.gotoAct.setStatusTip(self.tr("Goto Offset")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
622 | self.gotoAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
623 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
624 | """<b>Goto Offset</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
625 | """<p>Go to a specific address. A dialog is shown to enter""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
626 | """ the movement data.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
627 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
628 | ) |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
629 | self.gotoAct.triggered.connect(self.__goto) |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
630 | self.__actions.append(self.gotoAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
631 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
632 | self.redoAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
633 | self.__editor.canRedoChanged.connect(self.redoAct.setEnabled) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
634 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
635 | self.undoAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
636 | self.__editor.canUndoChanged.connect(self.undoAct.setEnabled) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
637 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
638 | self.revertAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
639 | self.__editor.dataChanged.connect(self.revertAct.setEnabled) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
640 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
641 | self.cutAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
642 | self.copyAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
643 | self.saveSelectionReadableAct.setEnabled(False) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
644 | self.__editor.selectionAvailable.connect(self.__checkActions) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
645 | 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
|
646 | self.__editor.selectionAvailable.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
647 | self.saveSelectionReadableAct.setEnabled |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
648 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
649 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
650 | def __initHelpActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
651 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
652 | 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
|
653 | """ |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
654 | self.aboutAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
655 | self.tr("About"), self.tr("&About"), 0, 0, self, "hexEditor_help_about" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
656 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
657 | self.aboutAct.setStatusTip(self.tr("Display information about this software")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
658 | self.aboutAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
659 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
660 | """<b>About</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
661 | """<p>Display some information about this software.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
662 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
663 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
664 | self.aboutAct.triggered.connect(self.__about) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
665 | self.__actions.append(self.aboutAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
666 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
667 | self.aboutQtAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
668 | self.tr("About Qt"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
669 | self.tr("About &Qt"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
670 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
671 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
672 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
673 | "hexEditor_help_about_qt", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
674 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
675 | self.aboutQtAct.setStatusTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
676 | self.tr("Display information about the Qt toolkit") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
677 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
678 | self.aboutQtAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
679 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
680 | """<b>About Qt</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
681 | """<p>Display some information about the Qt toolkit.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
682 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
683 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
684 | self.aboutQtAct.triggered.connect(self.__aboutQt) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
685 | self.__actions.append(self.aboutQtAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
686 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
687 | self.whatsThisAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
688 | self.tr("What's This?"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
689 | EricPixmapCache.getIcon("whatsThis"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
690 | self.tr("&What's This?"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
691 | QKeySequence(self.tr("Shift+F1", "Help|What's This?'")), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
692 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
693 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
694 | "hexEditor_help_whats_this", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
695 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
696 | self.whatsThisAct.setStatusTip(self.tr("Context sensitive help")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
697 | self.whatsThisAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
698 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
699 | """<b>Display context sensitive help</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
700 | """<p>In What's This? mode, the mouse cursor shows an arrow""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
701 | """ with a question mark, and you can click on the interface""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
702 | """ elements to get a short description of what they do and""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
703 | """ how to use them. In dialogs, this feature can be accessed""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
704 | """ using the context help button in the titlebar.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
705 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
706 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
707 | self.whatsThisAct.triggered.connect(self.__whatsThis) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
708 | self.__actions.append(self.whatsThisAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
709 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
710 | def __initConfigActions(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
711 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
712 | 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
|
713 | """ |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
714 | self.prefAct = EricAction( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
715 | self.tr("Preferences"), |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
716 | EricPixmapCache.getIcon("configure"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
717 | self.tr("&Preferences..."), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
718 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
719 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
720 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
721 | "hexEditor_settings_preferences", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
722 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
723 | self.prefAct.setStatusTip(self.tr("Set the prefered configuration")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
724 | self.prefAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
725 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
726 | """<b>Preferences</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
727 | """<p>Set the configuration items of the application""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
728 | """ with your prefered values.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
729 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
730 | ) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
731 | self.prefAct.triggered.connect(self.__showPreferences) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7960
diff
changeset
|
732 | self.prefAct.setMenuRole(QAction.MenuRole.PreferencesRole) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
733 | self.__actions.append(self.prefAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
734 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
735 | def __setReadOnlyActionTexts(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
736 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
737 | 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
|
738 | 'read only' and 'read write'. |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
739 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
740 | if Preferences.getHexEditor("OpenReadOnly"): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
741 | self.openAct.setStatusTip(self.tr("Open a binary file for viewing")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
742 | self.openAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
743 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
744 | """<b>Open File</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
745 | """<p>This opens a binary file for viewing (i.e. in read""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
746 | """ only mode). It pops up a file selection dialog.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
747 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
748 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
749 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
750 | self.openReadOnlyAct.setText(self.tr("Open for Editing...")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
751 | self.openReadOnlyAct.setIconText(self.tr("Open for Editing")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
752 | self.openReadOnlyAct.setStatusTip(self.tr("Open a binary file for editing")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
753 | self.openReadOnlyAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
754 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
755 | """<b>Open for Editing</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
756 | """<p>This opens a binary file for editing.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
757 | """ It pops up a file selection dialog.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
758 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
759 | ) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
760 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
761 | self.openAct.setStatusTip(self.tr("Open a binary file for editing")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
762 | self.openAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
763 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
764 | """<b>Open File</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
765 | """<p>This opens a binary file for editing.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
766 | """ It pops up a file selection dialog.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
767 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
768 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
769 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
770 | self.openReadOnlyAct.setText(self.tr("Open Read Only...")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
771 | self.openReadOnlyAct.setIconText(self.tr("Open Read Only")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
772 | self.openReadOnlyAct.setStatusTip(self.tr("Open a binary file for viewing")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
773 | self.openReadOnlyAct.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
774 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
775 | """<b>Open Read Only</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
776 | """<p>This opens a binary file for viewing (i.e. in read""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
777 | """ only mode). It pops up a file selection dialog.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
778 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
779 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
780 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
781 | def __initMenus(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
782 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
783 | Private method to create the menus. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
784 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
785 | mb = self.menuBar() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
786 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
787 | menu = mb.addMenu(self.tr("&File")) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
788 | menu.setTearOffEnabled(True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
789 | self.__recentMenu = QMenu(self.tr("Open &Recent Files"), menu) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
790 | menu.addAction(self.newWindowAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
791 | menu.addAction(self.openAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
792 | menu.addAction(self.openReadOnlyAct) |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
793 | self.__menuRecentAct = menu.addMenu(self.__recentMenu) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
794 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
795 | menu.addAction(self.saveAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
796 | menu.addAction(self.saveAsAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
797 | menu.addAction(self.saveReadableAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
798 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
799 | menu.addAction(self.closeAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
800 | menu.addAction(self.closeOthersAct) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
801 | if self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
802 | menu.addAction(self.closeAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
803 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
804 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
805 | menu.addAction(self.exitAct) |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
806 | menu.aboutToShow.connect(self.__showFileMenu) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
807 | self.__recentMenu.aboutToShow.connect(self.__showRecentMenu) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
808 | self.__recentMenu.triggered.connect(self.__openRecentHexFile) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
809 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
810 | menu = mb.addMenu(self.tr("&Edit")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
811 | menu.setTearOffEnabled(True) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
812 | menu.addAction(self.undoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
813 | menu.addAction(self.redoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
814 | menu.addAction(self.revertAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
815 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
816 | menu.addAction(self.cutAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
817 | menu.addAction(self.copyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
818 | menu.addAction(self.pasteAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
819 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
820 | menu.addAction(self.selectAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
821 | menu.addAction(self.deselectAllAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
822 | menu.addAction(self.saveSelectionReadableAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
823 | menu.addSeparator() |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
824 | menu.addAction(self.searchAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
825 | menu.addAction(self.searchNextAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
826 | menu.addAction(self.searchPrevAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
827 | menu.addAction(self.replaceAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
828 | menu.addSeparator() |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
829 | menu.addAction(self.gotoAct) |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
830 | menu.addSeparator() |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
831 | menu.addAction(self.readonlyAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
832 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
833 | if not self.__fromEric: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
834 | 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
|
835 | menu.setTearOffEnabled(True) |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
836 | menu.addAction(self.prefAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
837 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
838 | mb.addSeparator() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
839 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
840 | menu = mb.addMenu(self.tr("&Help")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
841 | menu.addAction(self.aboutAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
842 | menu.addAction(self.aboutQtAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
843 | menu.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
844 | menu.addAction(self.whatsThisAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
845 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
846 | def __initToolbars(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
847 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
848 | Private method to create the toolbars. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
849 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
850 | filetb = self.addToolBar(self.tr("File")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
851 | filetb.setObjectName("FileToolBar") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
852 | filetb.addAction(self.newWindowAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
853 | filetb.addAction(self.openAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
854 | filetb.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
855 | filetb.addAction(self.saveAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
856 | filetb.addAction(self.saveAsAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
857 | filetb.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
858 | filetb.addAction(self.closeAct) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
859 | if not self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
860 | filetb.addAction(self.exitAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
861 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
862 | edittb = self.addToolBar(self.tr("Edit")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
863 | edittb.setObjectName("EditToolBar") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
864 | edittb.addAction(self.undoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
865 | edittb.addAction(self.redoAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
866 | edittb.addSeparator() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
867 | edittb.addAction(self.cutAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
868 | edittb.addAction(self.copyAct) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
869 | edittb.addAction(self.pasteAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
870 | |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
871 | 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
|
872 | searchtb.setObjectName("SearchToolBar") |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
873 | searchtb.addAction(self.searchAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
874 | searchtb.addAction(self.searchNextAct) |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
875 | searchtb.addAction(self.searchPrevAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
876 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
877 | if not self.__fromEric: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
878 | 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
|
879 | settingstb.setObjectName("SettingsToolBar") |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
880 | settingstb.addAction(self.prefAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
881 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
882 | helptb = self.addToolBar(self.tr("Help")) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
883 | helptb.setObjectName("HelpToolBar") |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
884 | helptb.addAction(self.whatsThisAct) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
885 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
886 | def __createStatusBar(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
887 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
888 | 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
|
889 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
890 | self.__statusBar = self.statusBar() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
891 | self.__statusBar.setSizeGripEnabled(True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
892 | |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
893 | 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
|
894 | self.__statusBar.addPermanentWidget(self.__sbAddress) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
895 | self.__sbAddress.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
896 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
897 | """<p>This part of the status bar displays the cursor""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
898 | """ address.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
899 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
900 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
901 | self.__sbAddress.setFrameStyle(QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
902 | |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
903 | 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
|
904 | self.__statusBar.addPermanentWidget(self.__sbSelection) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
905 | self.__sbSelection.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
906 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
907 | """<p>This part of the status bar displays some selection""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
908 | """ information.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
909 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
910 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
911 | self.__sbSelection.setFrameStyle(QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
912 | |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
913 | 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
|
914 | self.__statusBar.addPermanentWidget(self.__sbSize) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
915 | self.__sbSize.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
916 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
917 | """<p>This part of the status bar displays the size of the""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
918 | """ binary data.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
919 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
920 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
921 | self.__sbSize.setFrameStyle(QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
922 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
923 | self.__sbEditMode = EricClickableLabel(self.__statusBar) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
924 | self.__statusBar.addPermanentWidget(self.__sbEditMode) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
925 | self.__sbEditMode.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
926 | self.tr("""<p>This part of the status bar displays the edit mode.</p>""") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
927 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
928 | self.__sbEditMode.setFrameStyle(QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
929 | self.__sbEditMode.clicked.connect(self.__toggleEditMode) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
930 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
931 | self.__sbReadOnly = EricClickableLabel(self.__statusBar) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
932 | self.__statusBar.addPermanentWidget(self.__sbReadOnly) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
933 | self.__sbReadOnly.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
934 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
935 | """<p>This part of the status bar displays the read""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
936 | """ only mode.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
937 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
938 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
939 | self.__sbReadOnly.setFrameStyle(QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
940 | 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
|
941 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
942 | self.__showEditMode(self.__editor.overwriteMode()) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
943 | self.__showReadOnlyMode(self.__editor.isReadOnly()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
944 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
945 | @pyqtSlot(int) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
946 | def __showAddress(self, address): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
947 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
948 | Private slot to show the address of the cursor position. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
949 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
950 | @param address address of the cursor |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
951 | @type int |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
952 | """ |
4686
5f8a5c568230
Improved the display of addresses and sizes in the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4673
diff
changeset
|
953 | txt = "{0:0{1}x}".format(address, self.__editor.addressWidth()) |
5f8a5c568230
Improved the display of addresses and sizes in the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4673
diff
changeset
|
954 | txt = strGroup(txt, ":", 4) |
5f8a5c568230
Improved the display of addresses and sizes in the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4673
diff
changeset
|
955 | self.__sbAddress.setText(self.tr("Address: {0}").format(txt)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
956 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
957 | @pyqtSlot(bool) |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
958 | 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
|
959 | """ |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
960 | Private slot to show selection information. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
961 | |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
962 | @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
|
963 | @type bool |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
964 | """ |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
965 | if avail: |
4686
5f8a5c568230
Improved the display of addresses and sizes in the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4673
diff
changeset
|
966 | addrWidth = self.__editor.addressWidth() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
967 | start = "{0:0{1}x}".format(self.__editor.getSelectionBegin(), addrWidth) |
4686
5f8a5c568230
Improved the display of addresses and sizes in the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4673
diff
changeset
|
968 | start = strGroup(start, ":", 4) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
969 | end = "{0:0{1}x}".format(self.__editor.getSelectionEnd(), addrWidth) |
4686
5f8a5c568230
Improved the display of addresses and sizes in the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4673
diff
changeset
|
970 | end = strGroup(end, ":", 4) |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
971 | 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
|
972 | self.__sbSelection.setText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
973 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
974 | "Selection: {0} - {1} ({2} Bytes)", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
975 | "0: start, 1: end, 2: selection length", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
976 | ).format(start, end, QLocale().toString(slen)) |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
977 | ) |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
978 | else: |
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
979 | self.__sbSelection.setText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
980 | self.tr("Selection: -", "no selection available") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
981 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
982 | |
4669
d37bfc9ca3b9
Added selection information to the statusbar of the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4666
diff
changeset
|
983 | @pyqtSlot(bool) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
984 | def __showReadOnlyMode(self, on): |
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 | Private slot to show the read only mode. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
987 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
988 | @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
|
989 | @type bool |
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 | self.__sbReadOnly.setText(self.tr("ro") if on else self.tr("rw")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
992 | |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
993 | @pyqtSlot() |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
994 | def __toggleReadOnlyMode(self): |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
995 | """ |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
996 | 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
|
997 | bar label. |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
998 | """ |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
999 | self.__editor.setReadOnly(not self.__editor.isReadOnly()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1000 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1001 | @pyqtSlot(bool) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1002 | def __showEditMode(self, overwrite): |
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 | Private slot to show the edit mode. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1005 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1006 | @param overwrite flag indicating overwrite mode |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1007 | @type bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1008 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1009 | self.__sbEditMode.setText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1010 | self.tr("Overwrite") if overwrite else self.tr("Insert") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1011 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1012 | |
4673
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
1013 | @pyqtSlot() |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
1014 | def __toggleEditMode(self): |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
1015 | """ |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
1016 | 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
|
1017 | label. |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
1018 | """ |
6fa2418f010c
Finalized the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4670
diff
changeset
|
1019 | self.__editor.setOverwriteMode(not self.__editor.overwriteMode()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1020 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1021 | @pyqtSlot(int) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1022 | def __showSize(self, size): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1023 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1024 | Private slot to show the binary data size. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1025 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1026 | @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
|
1027 | @type int |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1028 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1029 | self.__sbSize.setText(self.tr("Size: {0}").format(QLocale().toString(size))) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1030 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1031 | def closeEvent(self, evt): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1032 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1033 | Protected event handler for the close event. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1034 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1035 | @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
|
1036 | <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
|
1037 | 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
|
1038 | @type QCloseEvent |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1039 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1040 | 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
|
1041 | 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
|
1042 | 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
|
1043 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1044 | Preferences.setGeometry("HexEditorGeometry", self.saveGeometry()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1045 | |
8240
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8222
diff
changeset
|
1046 | with contextlib.suppress(ValueError): |
9698
69e183e4db6f
Continued implementing a PDF viewer tool (page navigation).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9697
diff
changeset
|
1047 | if self.__fromEric or len(HexEditMainWindow.windows) > 1: |
69e183e4db6f
Continued implementing a PDF viewer tool (page navigation).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9697
diff
changeset
|
1048 | HexEditMainWindow.windows.remove(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1049 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1050 | if not self.__fromEric: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1051 | Preferences.syncPreferences() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1052 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1053 | self.__saveRecent() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1054 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1055 | evt.accept() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1056 | self.editorClosed.emit() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1057 | else: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1058 | evt.ignore() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1059 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1060 | def __openHexFileNewWindow(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1061 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1062 | 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
|
1063 | """ |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1064 | if ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1065 | not self.__lastOpenPath |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1066 | and self.__project is not None |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1067 | and self.__project.isOpen() |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1068 | ): |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1069 | self.__lastOpenPath = self.__project.getProjectPath() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1070 | |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1071 | fileName = ( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1072 | EricServerFileDialog.getOpenFileName( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1073 | self, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1074 | self.tr("Open binary file"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1075 | self.__lastOpenPath, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1076 | self.tr("All Files (*)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1077 | ) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1078 | if FileSystemUtilities.isRemoteFileName(self.__lastOpenPath) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1079 | else EricFileDialog.getOpenFileName( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1080 | self, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1081 | self.tr("Open binary file in new window"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1082 | self.__lastOpenPath, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1083 | self.tr("All Files (*)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1084 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1085 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1086 | if fileName: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1087 | he = HexEditMainWindow( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1088 | fileName=fileName, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1089 | parent=self.parent(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1090 | fromEric=self.__fromEric, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1091 | project=self.__project, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1092 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1093 | he.setRecentPaths("", self.__lastSavePath) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1094 | he.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1095 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1096 | def __maybeSave(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1097 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1098 | Private method to ask the user to save the file, if it was modified. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1099 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1100 | @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
|
1101 | @rtype bool |
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 | if self.__editor.isModified(): |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1104 | ret = EricMessageBox.okToClearData( |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1105 | self, |
7960
e8fc383322f7
Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1106 | self.tr("eric Hex Editor"), |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1107 | self.tr("""The loaded file has unsaved changes."""), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1108 | self.__saveHexFile, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1109 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1110 | if not ret: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1111 | return False |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1112 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1113 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1114 | def __loadHexFile(self, fileName): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1115 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1116 | Private method to load a binary file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1117 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1118 | @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
|
1119 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1120 | """ |
9162
8b75b1668583
Changed some use of QFile() to a more pythonic solution and fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9153
diff
changeset
|
1121 | try: |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1122 | if FileSystemUtilities.isRemoteFileName(fileName): |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1123 | data = self.__remotefsInterface.readFile(fileName) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1124 | else: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1125 | with open(fileName, "rb") as f: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1126 | data = f.read() |
9162
8b75b1668583
Changed some use of QFile() to a more pythonic solution and fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9153
diff
changeset
|
1127 | except OSError as err: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1128 | EricMessageBox.warning( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1129 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1130 | self.tr("eric Hex Editor"), |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
1131 | self.tr("<p>Cannot read file <b>{0}</b>.</p><p>Reason: {1}</p>").format( |
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
1132 | fileName, str(err) |
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
1133 | ), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1134 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1135 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1136 | |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1137 | self.__lastOpenPath = ( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1138 | self.__remotefsInterface.dirname(fileName) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1139 | if FileSystemUtilities.isRemoteFileName(fileName) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1140 | else os.path.dirname(fileName) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1141 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1142 | self.__editor.setData(data) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1143 | self.__setCurrentFile(fileName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1144 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1145 | self.__editor.setReadOnly(Preferences.getHexEditor("OpenReadOnly")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1146 | |
4687
f1d921533cc5
Little improvements to the hex editor goto widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4686
diff
changeset
|
1147 | self.__gotoWidget.reset() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1148 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1149 | def __openHexFile(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1150 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1151 | 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
|
1152 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1153 | if self.__maybeSave(): |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1154 | if ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1155 | not self.__lastOpenPath |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1156 | and self.__project is not None |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1157 | and self.__project.isOpen() |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1158 | ): |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1159 | self.__lastOpenPath = self.__project.getProjectPath() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1160 | |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1161 | fileName = ( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1162 | EricServerFileDialog.getOpenFileName( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1163 | self, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1164 | self.tr("Open binary file"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1165 | self.__lastOpenPath, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1166 | self.tr("All Files (*)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1167 | ) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1168 | if FileSystemUtilities.isRemoteFileName(self.__lastOpenPath) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1169 | else EricFileDialog.getOpenFileName( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1170 | self, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1171 | self.tr("Open binary file"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1172 | self.__lastOpenPath, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1173 | self.tr("All Files (*)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1174 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1175 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1176 | if fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1177 | self.__loadHexFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1178 | self.__checkActions() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1179 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1180 | def __openHexFileReadOnly(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 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
|
1183 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1184 | self.__openHexFile() |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1185 | 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
|
1186 | self.__checkActions() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1187 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1188 | def __saveHexFile(self): |
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 save a binary file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1191 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1192 | @return flag indicating success |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1193 | @rtype bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1194 | """ |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1195 | ok = ( |
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1196 | self.__saveHexDataFile(self.__fileName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1197 | if self.__fileName |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1198 | else self.__saveHexFileAs() |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1199 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1200 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1201 | if ok: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1202 | self.__editor.undoStack().setClean() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1203 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1204 | return ok |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1205 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1206 | def __saveHexFileAs(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1207 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1208 | Private method to save the data to a new file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1209 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1210 | @return flag indicating success |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1211 | @rtype bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1212 | """ |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1213 | if ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1214 | not self.__lastSavePath |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1215 | and self.__project is not None |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1216 | and self.__project.isOpen() |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1217 | ): |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1218 | self.__lastSavePath = self.__project.getProjectPath() |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1219 | 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
|
1220 | self.__lastSavePath = self.__lastOpenPath |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1221 | |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1222 | fileName = ( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1223 | EricServerFileDialog.getSaveFileName( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1224 | self, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1225 | self.tr("Save binary file"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1226 | self.__lastSavePath, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1227 | self.tr("All Files (*)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1228 | ) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1229 | if FileSystemUtilities.isRemoteFileName(self.__lastSavePath) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1230 | else EricFileDialog.getSaveFileName( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1231 | self, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1232 | self.tr("Save binary file"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1233 | self.__lastSavePath, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1234 | self.tr("All Files (*)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1235 | options=EricFileDialog.DontConfirmOverwrite, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1236 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1237 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1238 | if not fileName: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1239 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1240 | |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1241 | if ( |
10633
dda7e43934dc
Corrected some code formatting and coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10631
diff
changeset
|
1242 | FileSystemUtilities.isRemoteFileName(fileName) |
dda7e43934dc
Corrected some code formatting and coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10631
diff
changeset
|
1243 | and self.__remotefsInterface.exists(fileName) |
dda7e43934dc
Corrected some code formatting and coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10631
diff
changeset
|
1244 | ) or ( |
dda7e43934dc
Corrected some code formatting and coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10631
diff
changeset
|
1245 | FileSystemUtilities.isPlainFileName(fileName) |
dda7e43934dc
Corrected some code formatting and coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10631
diff
changeset
|
1246 | and pathlib.Path(fileName).exists() |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1247 | ): |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1248 | res = EricMessageBox.yesNo( |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1249 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1250 | self.tr("Save binary file"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1251 | self.tr( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
1252 | "<p>The file <b>{0}</b> already exists. Overwrite it?</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1253 | ).format(fileName), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1254 | icon=EricMessageBox.Warning, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1255 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1256 | if not res: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1257 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1258 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1259 | self.__lastSavePath = os.path.dirname(fileName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1260 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1261 | return self.__saveHexDataFile(fileName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1262 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1263 | def __saveHexDataFile(self, fileName): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1264 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1265 | Private method to save the binary data to a file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1266 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1267 | @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
|
1268 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1269 | @return flag indicating success |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1270 | @rtype bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1271 | """ |
9162
8b75b1668583
Changed some use of QFile() to a more pythonic solution and fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9153
diff
changeset
|
1272 | try: |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1273 | data = self.__editor.data() |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1274 | if FileSystemUtilities.isRemoteFileName(fileName): |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1275 | self.__remotefsInterface.writeFile(fileName, data) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1276 | else: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1277 | with open(fileName, "wb") as f: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1278 | f.write(data) |
9162
8b75b1668583
Changed some use of QFile() to a more pythonic solution and fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9153
diff
changeset
|
1279 | except OSError as err: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1280 | EricMessageBox.warning( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1281 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1282 | self.tr("eric Hex Editor"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1283 | self.tr( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
1284 | "<p>Cannot write file <b>{0}</b>.</p><p>Reason: {1}</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1285 | ).format(fileName, str(err)), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1286 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1287 | self.__checkActions() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1288 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1289 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1290 | self.__editor.setModified(False, setCleanState=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1291 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1292 | self.__setCurrentFile(fileName) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1293 | self.__statusBar.showMessage(self.tr("File saved"), 2000) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1294 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1295 | self.__checkActions() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1296 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1297 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1298 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1299 | def __saveHexFileReadable(self, selectionOnly=False): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1300 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1301 | Private method to save the binary data in readable format. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1302 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1303 | @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
|
1304 | @type bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1305 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1306 | savePath = self.__lastSavePath |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1307 | if not savePath and self.__project is not None and self.__project.isOpen(): |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
1308 | savePath = self.__project.getProjectPath() |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1309 | if not savePath and self.__lastOpenPath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1310 | savePath = self.__lastOpenPath |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1311 | |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1312 | if FileSystemUtilities.isRemoteFileName(savePath): |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1313 | fileName, selectedFilter = EricServerFileDialog.getSaveFileNameAndFilter( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1314 | self, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1315 | self.tr("Save to readable file"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1316 | savePath, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1317 | self.tr("Text Files (*.txt);;All Files (*)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1318 | self.tr("Text Files (*.txt)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1319 | ) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1320 | if not fileName: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1321 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1322 | |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1323 | ext = self.__remotefsInterface.splitext(fileName)[1] |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1324 | if not ext: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1325 | ex = selectedFilter.split("(*")[1].split(")")[0] |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1326 | if ex: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1327 | fileName += ex |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1328 | fileExists = self.__remotefsInterface.exists(fileName) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1329 | else: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1330 | fileName, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1331 | self, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1332 | self.tr("Save to readable file"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1333 | savePath, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1334 | self.tr("Text Files (*.txt);;All Files (*)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1335 | self.tr("Text Files (*.txt)"), |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1336 | EricFileDialog.DontConfirmOverwrite, |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1337 | ) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1338 | if not fileName: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1339 | return |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1340 | |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1341 | fpath = pathlib.Path(fileName) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1342 | if not fpath.suffix: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1343 | ex = selectedFilter.split("(*")[1].split(")")[0] |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1344 | if ex: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1345 | fpath = fpath.with_suffix(ex) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1346 | fileExists = fpath.exists() |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1347 | fileName = str(fpath) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1348 | |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1349 | if fileExists: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1350 | res = EricMessageBox.yesNo( |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1351 | self, |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1352 | self.tr("Save to readable file"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1353 | self.tr( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
1354 | "<p>The file <b>{0}</b> already exists. Overwrite it?</p>" |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1355 | ).format(fileName), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1356 | icon=EricMessageBox.Warning, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1357 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1358 | if not res: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1359 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1360 | |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1361 | readableData = ( |
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1362 | self.__editor.selectionToReadableString() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1363 | if selectionOnly |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1364 | else self.__editor.toReadableString() |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1365 | ) |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
1366 | try: |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1367 | if FileSystemUtilities.isRemoteFileName(fileName): |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1368 | self.__remotefsInterface.writeFile( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1369 | fileName, readableData.encode("latin1") |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1370 | ) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1371 | else: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1372 | with open(fileName, "w", encoding="latin1") as f: |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1373 | f.write(readableData) |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
1374 | except OSError as err: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1375 | EricMessageBox.warning( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1376 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1377 | self.tr("eric Hex Editor"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1378 | self.tr( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
1379 | "<p>Cannot write file <b>{0}</b>.</p><p>Reason: {1}</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1380 | ).format(fpath, str(err)), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1381 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1382 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1383 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1384 | self.__statusBar.showMessage(self.tr("File saved"), 2000) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1385 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1386 | def __saveSelectionReadable(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1387 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1388 | 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
|
1389 | format. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1390 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1391 | self.__saveHexFileReadable(selectionOnly=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1392 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1393 | def __closeAll(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1394 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1395 | Private slot to close all windows. |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1396 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1397 | self.__closeOthers() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1398 | self.close() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1399 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1400 | def __closeOthers(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1401 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1402 | 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
|
1403 | """ |
9698
69e183e4db6f
Continued implementing a PDF viewer tool (page navigation).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9697
diff
changeset
|
1404 | for win in HexEditMainWindow.windows[:]: |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1405 | if win != self: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1406 | win.close() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1407 | |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1408 | def __setCurrentFile(self, fileName): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1409 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1410 | Private method to register the file name of the current file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1411 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1412 | @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
|
1413 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1414 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1415 | self.__fileName = fileName |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1416 | # insert filename into list of recently opened files |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1417 | self.__addToRecentList(fileName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1418 | |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1419 | shownName = ( |
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1420 | self.tr("Untitled") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1421 | if not self.__fileName |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1422 | else self.__strippedName(self.__fileName) |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1423 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1424 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1425 | self.setWindowTitle( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1426 | self.tr("{0}[*] - {1}").format(shownName, self.tr("Hex Editor")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1427 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1428 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1429 | self.setWindowModified(self.__editor.isModified()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1430 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1431 | def __strippedName(self, fullFileName): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1432 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1433 | Private method to return the filename part of the given path. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1434 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1435 | @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
|
1436 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1437 | @return filename part |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1438 | @rtype str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1439 | """ |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
1440 | return pathlib.Path(fullFileName).name |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1441 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1442 | def setRecentPaths(self, openPath, savePath): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1443 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1444 | Public method to set the last open and save paths. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1445 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1446 | @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
|
1447 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1448 | @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
|
1449 | @type str |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1450 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1451 | if openPath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1452 | self.__lastOpenPath = openPath |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1453 | if savePath: |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1454 | self.__lastSavePath = savePath |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1455 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1456 | @pyqtSlot() |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1457 | def __checkActions(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1458 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1459 | 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
|
1460 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1461 | self.saveAct.setEnabled(self.__editor.isModified()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1462 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1463 | self.cutAct.setEnabled( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1464 | not self.__editor.isReadOnly() and self.__editor.hasSelection() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1465 | ) |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1466 | 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
|
1467 | self.replaceAct.setEnabled(not self.__editor.isReadOnly()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1468 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1469 | @pyqtSlot(bool) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1470 | def __modificationChanged(self, m): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1471 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1472 | Private slot to handle the dataChanged signal. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1473 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1474 | @param m modification status |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1475 | @type bool |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1476 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1477 | self.setWindowModified(m) |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1478 | self.__checkActions() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1479 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1480 | def __about(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1481 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1482 | 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
|
1483 | """ |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1484 | EricMessageBox.about( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1485 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1486 | self.tr("About eric Hex Editor"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1487 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1488 | "The eric Hex Editor is a simple editor component" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1489 | " to edit binary files." |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1490 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1491 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1492 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1493 | def __aboutQt(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1494 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1495 | 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
|
1496 | """ |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1497 | EricMessageBox.aboutQt(self, "eric Hex Editor") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1498 | |
4650
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1499 | def __whatsThis(self): |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1500 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1501 | 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
|
1502 | """ |
b1ca3bcde70b
First commit for the new hex editor tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1503 | QWhatsThis.enterWhatsThisMode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1504 | |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1505 | def __search(self): |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1506 | """ |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1507 | 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
|
1508 | """ |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1509 | self.__replaceWidget.hide() |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1510 | self.__gotoWidget.hide() |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1511 | txt = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1512 | self.__editor.selectionToHexString() if self.__editor.hasSelection() else "" |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1513 | ) |
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
|
1514 | self.__searchWidget.show(txt) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1515 | |
4652
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1516 | def __replace(self): |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1517 | """ |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1518 | 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
|
1519 | """ |
a88a2ba7a48a
Added search and replace capability to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4651
diff
changeset
|
1520 | self.__searchWidget.hide() |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1521 | self.__gotoWidget.hide() |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1522 | txt = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1523 | self.__editor.selectionToHexString() if self.__editor.hasSelection() else "" |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1524 | ) |
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
|
1525 | self.__replaceWidget.show(txt) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1526 | |
4670
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1527 | def __goto(self): |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1528 | """ |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1529 | 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
|
1530 | """ |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1531 | self.__searchWidget.hide() |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1532 | self.__replaceWidget.hide() |
d401ba329d24
Added 'Goto' functionality to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4669
diff
changeset
|
1533 | self.__gotoWidget.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1534 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1535 | def preferencesChanged(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1536 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1537 | 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
|
1538 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1539 | self.__editor.setAddressWidth(Preferences.getHexEditor("AddressAreaWidth")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1540 | self.__editor.setAddressArea(Preferences.getHexEditor("ShowAddressArea")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1541 | self.__editor.setAsciiArea(Preferences.getHexEditor("ShowAsciiArea")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1542 | self.__editor.setHighlighting(Preferences.getHexEditor("HighlightChanges")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1543 | self.__editor.setFont(Preferences.getHexEditor("Font")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1544 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1545 | self.__setReadOnlyActionTexts() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1546 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1547 | def __showPreferences(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1548 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1549 | 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
|
1550 | """ |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
1551 | from eric7.Preferences.ConfigurationDialog import ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1552 | ConfigurationDialog, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1553 | ConfigurationMode, |
8265
0090cfa83159
Converted enum names to use all uppercase letters (except for E5PathPickerModes to keep plug-ins using this compatible with previous eric releases).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8259
diff
changeset
|
1554 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1555 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1556 | dlg = ConfigurationDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10933
diff
changeset
|
1557 | parent=None, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10933
diff
changeset
|
1558 | name="Configuration", |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10933
diff
changeset
|
1559 | modal=True, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1560 | fromEric=True, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1561 | displayMode=ConfigurationMode.HEXEDITORMODE, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1562 | ) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1563 | dlg.preferencesChanged.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1564 | self.__preferencesChangedByLocalPreferencesDialog |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1565 | ) |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1566 | dlg.show() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1567 | dlg.showConfigurationPageByName("hexEditorPage") |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7628
diff
changeset
|
1568 | dlg.exec() |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1569 | QCoreApplication.processEvents() |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7960
diff
changeset
|
1570 | if dlg.result() == QDialog.DialogCode.Accepted: |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1571 | dlg.setPreferences() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1572 | Preferences.syncPreferences() |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1573 | self.__preferencesChangedByLocalPreferencesDialog() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1574 | |
4658
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1575 | def __preferencesChangedByLocalPreferencesDialog(self): |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1576 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1577 | 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
|
1578 | """ |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1579 | for hexEditor in HexEditMainWindow.windows: |
d760763dcc4a
Created a configuration page for the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4655
diff
changeset
|
1580 | hexEditor.preferencesChanged() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1581 | |
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
|
1582 | 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
|
1583 | """ |
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
|
1584 | Public method to get the search or replace history list. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1585 | |
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
|
1586 | @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
|
1587 | @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
|
1588 | @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
|
1589 | @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
|
1590 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1591 | if key in ["search", "replace"]: |
7628
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
1592 | return self.__srHistory[key] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1593 | |
7628
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
1594 | return [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1595 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1596 | @pyqtSlot() |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1597 | def __showFileMenu(self): |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1598 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1599 | Private slot to modify the file menu before being shown. |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1600 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1601 | self.__menuRecentAct.setEnabled(len(self.__recent) > 0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1602 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1603 | @pyqtSlot() |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1604 | def __showRecentMenu(self): |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1605 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1606 | Private slot to set up the recent files menu. |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1607 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1608 | self.__loadRecent() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1609 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1610 | self.__recentMenu.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1611 | |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1612 | connected = ( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1613 | self.__fromEric and ericApp().getObject("EricServer").isServerConnected() |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1614 | ) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1615 | |
8220
006ee31b4835
Applied some more code simplifications suggested by the new Simplify checker (Y113: use enumerate()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
1616 | for idx, rs in enumerate(self.__recent, start=1): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1617 | formatStr = "&{0:d}. {1}" if idx < 10 else "{0:d}. {1}" |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1618 | act = self.__recentMenu.addAction( |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1619 | formatStr.format( |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1620 | idx, |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1621 | FileSystemUtilities.compactPath( |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1622 | rs, HexEditMainWindow.maxMenuFilePathLen |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1623 | ), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1624 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1625 | ) |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1626 | act.setData(rs) |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1627 | act.setEnabled( |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1628 | (FileSystemUtilities.isRemoteFileName(rs) and connected) |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1629 | or pathlib.Path(rs).exists() |
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1630 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1631 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1632 | self.__recentMenu.addSeparator() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1633 | self.__recentMenu.addAction(self.tr("&Clear"), self.__clearRecent) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1634 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1635 | @pyqtSlot(QAction) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1636 | def __openRecentHexFile(self, act): |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1637 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1638 | Private method to open a file from the list of recently opened files. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1639 | |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
1640 | @param act reference to the action that triggered |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
1641 | @type QAction |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1642 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1643 | fileName = act.data() |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1644 | if fileName and self.__maybeSave(): |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1645 | self.__loadHexFile(fileName) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1646 | self.__editor.setReadOnly(Preferences.getHexEditor("OpenReadOnly")) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1647 | self.__checkActions() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1648 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1649 | @pyqtSlot() |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1650 | def __clearRecent(self): |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1651 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1652 | Private method to clear the list of recently opened files. |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1653 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1654 | self.__recent = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1655 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1656 | def __loadRecent(self): |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1657 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1658 | Private method to load the list of recently opened files. |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1659 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1660 | self.__recent = [] |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1661 | Preferences.Prefs.rsettings.sync() |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1662 | rs = Preferences.Prefs.rsettings.value(recentNameHexFiles) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1663 | if rs is not None: |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10759
diff
changeset
|
1664 | for f in EricUtilities.toList(rs): |
10631
00f5aae565a3
Extended the project support for eric-ide server projects.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10611
diff
changeset
|
1665 | if FileSystemUtilities.isRemoteFileName(f) or pathlib.Path(f).exists(): |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1666 | self.__recent.append(f) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1667 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1668 | def __saveRecent(self): |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1669 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1670 | Private method to save the list of recently opened files. |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1671 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1672 | Preferences.Prefs.rsettings.setValue(recentNameHexFiles, self.__recent) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1673 | Preferences.Prefs.rsettings.sync() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1674 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1675 | def __addToRecentList(self, fileName): |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1676 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1677 | Private method to add a file name to the list of recently opened files. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1678 | |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1679 | @param fileName name of the file to be added |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9698
diff
changeset
|
1680 | @type str |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1681 | """ |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1682 | if fileName: |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1683 | for recent in self.__recent[:]: |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1684 | if FileSystemUtilities.samepath(fileName, recent): |
4695
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1685 | self.__recent.remove(recent) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1686 | self.__recent.insert(0, fileName) |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1687 | maxRecent = Preferences.getHexEditor("RecentNumber") |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1688 | if len(self.__recent) > maxRecent: |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1689 | self.__recent = self.__recent[:maxRecent] |
9dc08852de25
Added a 'Recent Files' menu to the hex editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4687
diff
changeset
|
1690 | self.__saveRecent() |