Class: Wire_helper

Inherits:
Qt::Widget
  • Object
show all
Defined in:
lib/class/Wire_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(chip) ⇒ Wire_helper

Returns a new instance of Wire_helper.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/class/Wire_helper.rb', line 14

def initialize(chip)
  super()
  @wire_helper_gui = Ui_Wire_helper.new
  centerWindow(self)
  @wire_helper_gui.setupUi(self)
  @chip = chip
  HardsploitAPI.instance.setWiringLeds(value: 0x0000000000000000)
  @scene = Qt::GraphicsScene.new
  @wire_helper_gui.lbl_chip.setText("Your chip (#{chip.reference}):")
  Package.find_by(id: chip.package_id).shape.zero? ? draw_square : draw_rect
  @wire_helper_gui.gView.setScene(@scene)
rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
  ErrorMsg.new.hardsploit_not_found
rescue HardsploitAPI::ERROR::USB_ERROR
  ErrorMsg.new.usb_error
rescue Exception => msg
  ErrorMsg.new.unknown(msg)
end

Instance Method Details

#closeEvent(event) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/class/Wire_helper.rb', line 33

def closeEvent(event)
  HardsploitAPI.instance.setWiringLeds(value: 0xFF00FF00FF00FF00)
rescue HardsploitAPI::ERROR::HARDSPLOIT_NOT_FOUND
  ErrorMsg.new.hardsploit_not_found
rescue HardsploitAPI::ERROR::USB_ERROR
  ErrorMsg.new.usb_error
rescue Exception => msg
  ErrorMsg.new.unknown(msg)
end

#rotate_sceneObject



43
44
45
# File 'lib/class/Wire_helper.rb', line 43

def rotate_scene
  @wire_helper_gui.gView.rotate(90)
end