Class: SubProcessWidget

Inherits:
Tk::BWidget::Button
  • Object
show all
Defined in:
ext/ae-subprocess-inspector/ae-subprocess-inspector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_parent = nil, _event = nil, *args) ⇒ SubProcessWidget

Returns a new instance of SubProcessWidget.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'ext/ae-subprocess-inspector/ae-subprocess-inspector.rb', line 56

def initialize(_parent=nil, _event=nil, *args)
  super(Arcadia['toolbar'].frame, Arcadia.style('button').update("background"=>'black',"activebackground"=>'black', 'relief'=>'groove'))
  @parent = _parent
  @event = _event
  b_command = proc{
    
    message = Arcadia.text('ext.spi.d.kill.msg', [_event.pid, _event.name])
    r=Arcadia.dialog(self,
        'type'=>'yes_no', 
        'level'=>'warning',
        'title'=> Arcadia.text('ext.spi.d.kill.title'), 
        'msg'=>message)
    if r=="yes"
      _event.abort_action.call
    end
  }
  command b_command  
  helptext "#{_event.name} [pid #{_event.pid}]"
  pack('side' =>'left', :padx=>2, :pady=>0)
  Tk::Anigif.image(self, "#{Dir.pwd}/ext/ae-subprocess-inspector/process.res")
  start_check  
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



55
56
57
# File 'ext/ae-subprocess-inspector/ae-subprocess-inspector.rb', line 55

def event
  @event
end

Instance Method Details

#start_checkObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'ext/ae-subprocess-inspector/ae-subprocess-inspector.rb', line 79

def start_check
  if @event.timecheck
    timecheck = @event.timecheck
  else
    timecheck = 1000
  end
  @timer = TkAfter.new
  proc_check = proc{
    alive = @event.alive_check.call
    #p "ALIVE=#{alive}"
    if !alive
      @timer.stop
      @parent.do_delete_process(self)
      self.destroy
    end
  }
  @timer.set_procs(timecheck,-1,proc_check)
  @timer.start
end