src/eric7/Preferences/ConfigurationPages/HexEditorPage.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
19 19
20 class HexEditorPage(ConfigurationPageBase, Ui_HexEditorPage): 20 class HexEditorPage(ConfigurationPageBase, Ui_HexEditorPage):
21 """ 21 """
22 Class implementing the Hex Editor configuration page. 22 Class implementing the Hex Editor configuration page.
23 """ 23 """
24
24 def __init__(self): 25 def __init__(self):
25 """ 26 """
26 Constructor 27 Constructor
27 """ 28 """
28 super().__init__() 29 super().__init__()
29 self.setupUi(self) 30 self.setupUi(self)
30 self.setObjectName("HexEditorPage") 31 self.setObjectName("HexEditorPage")
31 32
32 # set initial values 33 # set initial values
33 self.readOnlyCheckBox.setChecked(Preferences.getHexEditor( 34 self.readOnlyCheckBox.setChecked(Preferences.getHexEditor("OpenReadOnly"))
34 "OpenReadOnly")) 35 self.overwriteCheckBox.setChecked(
35 self.overwriteCheckBox.setChecked(Preferences.getHexEditor( 36 Preferences.getHexEditor("OpenInOverwriteMode")
36 "OpenInOverwriteMode")) 37 )
37 self.addressAreaCheckBox.setChecked(Preferences.getHexEditor( 38 self.addressAreaCheckBox.setChecked(Preferences.getHexEditor("ShowAddressArea"))
38 "ShowAddressArea")) 39 self.addressAreaWidthSpinBox.setValue(
39 self.addressAreaWidthSpinBox.setValue(Preferences.getHexEditor( 40 Preferences.getHexEditor("AddressAreaWidth")
40 "AddressAreaWidth")) 41 )
41 self.asciiAreaCheckBox.setChecked(Preferences.getHexEditor( 42 self.asciiAreaCheckBox.setChecked(Preferences.getHexEditor("ShowAsciiArea"))
42 "ShowAsciiArea")) 43 self.highlightingCheckBox.setChecked(
43 self.highlightingCheckBox.setChecked(Preferences.getHexEditor( 44 Preferences.getHexEditor("HighlightChanges")
44 "HighlightChanges")) 45 )
45 self.recentFilesSpinBox.setValue(Preferences.getHexEditor( 46 self.recentFilesSpinBox.setValue(Preferences.getHexEditor("RecentNumber"))
46 "RecentNumber")) 47
47
48 # font 48 # font
49 self.monospacedFont = Preferences.getHexEditor("Font") 49 self.monospacedFont = Preferences.getHexEditor("Font")
50 self.monospacedFontSample.setFont(self.monospacedFont) 50 self.monospacedFontSample.setFont(self.monospacedFont)
51 51
52 def save(self): 52 def save(self):
53 """ 53 """
54 Public slot to save the IRC configuration. 54 Public slot to save the IRC configuration.
55 """ 55 """
56 Preferences.setHexEditor("OpenReadOnly", self.readOnlyCheckBox.isChecked())
56 Preferences.setHexEditor( 57 Preferences.setHexEditor(
57 "OpenReadOnly", self.readOnlyCheckBox.isChecked()) 58 "OpenInOverwriteMode", self.overwriteCheckBox.isChecked()
59 )
58 Preferences.setHexEditor( 60 Preferences.setHexEditor(
59 "OpenInOverwriteMode", self.overwriteCheckBox.isChecked()) 61 "ShowAddressArea", self.addressAreaCheckBox.isChecked()
62 )
60 Preferences.setHexEditor( 63 Preferences.setHexEditor(
61 "ShowAddressArea", self.addressAreaCheckBox.isChecked()) 64 "AddressAreaWidth", self.addressAreaWidthSpinBox.value()
65 )
66 Preferences.setHexEditor("ShowAsciiArea", self.asciiAreaCheckBox.isChecked())
62 Preferences.setHexEditor( 67 Preferences.setHexEditor(
63 "AddressAreaWidth", self.addressAreaWidthSpinBox.value()) 68 "HighlightChanges", self.highlightingCheckBox.isChecked()
64 Preferences.setHexEditor( 69 )
65 "ShowAsciiArea", self.asciiAreaCheckBox.isChecked()) 70 Preferences.setHexEditor("Font", self.monospacedFont)
66 Preferences.setHexEditor( 71 Preferences.setHexEditor("RecentNumber", self.recentFilesSpinBox.value())
67 "HighlightChanges", self.highlightingCheckBox.isChecked()) 72
68 Preferences.setHexEditor(
69 "Font", self.monospacedFont)
70 Preferences.setHexEditor(
71 "RecentNumber", self.recentFilesSpinBox.value())
72
73 @pyqtSlot() 73 @pyqtSlot()
74 def on_monospacedFontButton_clicked(self): 74 def on_monospacedFontButton_clicked(self):
75 """ 75 """
76 Private method used to select the font to be used. 76 Private method used to select the font to be used.
77 """ 77 """
78 self.monospacedFont = self.selectFont( 78 self.monospacedFont = self.selectFont(
79 self.monospacedFontSample, self.monospacedFont, 79 self.monospacedFontSample,
80 options=QFontDialog.FontDialogOption.MonospacedFonts) 80 self.monospacedFont,
81 81 options=QFontDialog.FontDialogOption.MonospacedFonts,
82 )
83
82 def polishPage(self): 84 def polishPage(self):
83 """ 85 """
84 Public slot to perform some polishing actions. 86 Public slot to perform some polishing actions.
85 """ 87 """
86 self.monospacedFontSample.setFont(self.monospacedFont) 88 self.monospacedFontSample.setFont(self.monospacedFont)
87 89
88 90
89 def create(dlg): 91 def create(dlg):
90 """ 92 """
91 Module function to create the configuration page. 93 Module function to create the configuration page.
92 94
93 @param dlg reference to the configuration dialog 95 @param dlg reference to the configuration dialog
94 @return reference to the instantiated page (ConfigurationPageBase) 96 @return reference to the instantiated page (ConfigurationPageBase)
95 """ 97 """
96 page = HexEditorPage() 98 page = HexEditorPage()
97 return page 99 return page

eric ide

mercurial