Class: CustomItem
- Inherits:
-
Qt::GraphicsTextItem
- Object
- Qt::GraphicsTextItem
- CustomItem
- Defined in:
- lib/class/Wire_helper.rb
Overview
Custom Item - To trigger events on the graphics text items
Instance Method Summary collapse
- #boundingRect ⇒ Object
- #mouseDoubleClickEvent(event) ⇒ Object
- #mousePressEvent(event) ⇒ Object
- #setPin(upin, api_value) ⇒ Object
Instance Method Details
#boundingRect ⇒ Object
148 149 150 151 152 153 154 |
# File 'lib/class/Wire_helper.rb', line 148 def boundingRect rect = Qt::RectF.new rect.setHeight(20) rect.setWidth(65) rect.setTop(5) return rect end |
#mouseDoubleClickEvent(event) ⇒ Object
178 179 180 181 182 |
# File 'lib/class/Wire_helper.rb', line 178 def mouseDoubleClickEvent(event) pin = self.instance_variable_get('@UPin') pin.instance_variable_get('@signalTxt').clearFocus pin.instance_variable_get('@nbrTxt').clearFocus end |
#mousePressEvent(event) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/class/Wire_helper.rb', line 156 def mousePressEvent(event) pin = self.instance_variable_get('@UPin') pin.setColor pin.instance_variable_get('@signalTxt').clearFocus pin.instance_variable_get('@nbrTxt').clearFocus if @api_value.name == 'NA' HardsploitAPI.instance.setWiringLeds(value: 0x0000000000000000) return false end pin_group = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] hardsploit_pin_number = pin_group.index(@api_value.pin[0]) * 8 + @api_value.pin[1].to_i HardsploitAPI.instance.setWiringLeds(value: 2**hardsploit_pin_number) rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND ErrorMsg.new.hardsploit_not_found rescue HardsploitAPI::ERROR::USB_ERROR ErrorMsg.new.usb_error rescue Exception => msg HardsploitAPI.instance.setWiringLeds(value: 0x0000000000000000) pin.instance_variable_get('@signalTxt').clearFocus pin.instance_variable_get('@nbrTxt').clearFocus end |
#setPin(upin, api_value) ⇒ Object
143 144 145 146 |
# File 'lib/class/Wire_helper.rb', line 143 def setPin(upin, api_value) @UPin = upin @api_value = api_value end |