HexEdit/HexEditGotoWidget.py

changeset 5587
ea526b78ee6c
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
equal deleted inserted replaced
5586:0e5421d679e7 5587:ea526b78ee6c
46 46
47 self.__currentFormat = "" 47 self.__currentFormat = ""
48 48
49 self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png")) 49 self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
50 50
51 for format in formatOrder: 51 for dataFormat in formatOrder:
52 formatStr, validator = self.__formatAndValidators[format] 52 formatStr, validator = self.__formatAndValidators[dataFormat]
53 self.formatCombo.addItem(formatStr, format) 53 self.formatCombo.addItem(formatStr, dataFormat)
54 54
55 self.formatCombo.setCurrentIndex(0) 55 self.formatCombo.setCurrentIndex(0)
56 56
57 @pyqtSlot() 57 @pyqtSlot()
58 def on_closeButton_clicked(self): 58 def on_closeButton_clicked(self):
69 69
70 @param idx index of the selected entry 70 @param idx index of the selected entry
71 @type int 71 @type int
72 """ 72 """
73 if idx >= 0: 73 if idx >= 0:
74 format = self.formatCombo.itemData(idx) 74 dataFormat = self.formatCombo.itemData(idx)
75 75
76 if format != self.__currentFormat: 76 if dataFormat != self.__currentFormat:
77 txt = self.offsetEdit.text() 77 txt = self.offsetEdit.text()
78 newTxt = self.__convertText( 78 newTxt = self.__convertText(
79 txt, self.__currentFormat, format) 79 txt, self.__currentFormat, dataFormat)
80 self.__currentFormat = format 80 self.__currentFormat = dataFormat
81 81
82 self.offsetEdit.setValidator( 82 self.offsetEdit.setValidator(
83 self.__formatAndValidators[format][1]) 83 self.__formatAndValidators[dataFormat][1])
84 84
85 self.offsetEdit.setText(newTxt) 85 self.offsetEdit.setText(newTxt)
86 86
87 @pyqtSlot(str) 87 @pyqtSlot(str)
88 def on_offsetEdit_textChanged(self, offset): 88 def on_offsetEdit_textChanged(self, offset):
97 @pyqtSlot() 97 @pyqtSlot()
98 def on_gotoButton_clicked(self): 98 def on_gotoButton_clicked(self):
99 """ 99 """
100 Private slot to move the cursor and extend the selection. 100 Private slot to move the cursor and extend the selection.
101 """ 101 """
102 format = self.formatCombo.itemData(self.formatCombo.currentIndex()) 102 dataFormat = self.formatCombo.itemData(self.formatCombo.currentIndex())
103 if format == "hex": 103 if dataFormat == "hex":
104 offset = self.offsetEdit.text().replace(":", "") 104 offset = self.offsetEdit.text().replace(":", "")
105 # get rid of ':' address separators 105 # get rid of ':' address separators
106 offset = int(offset, 16) 106 offset = int(offset, 16)
107 else: 107 else:
108 offset = int(self.offsetEdit.text(), 10) 108 offset = int(self.offsetEdit.text(), 10)

eric ide

mercurial