Class: SubProcessWidget
- Inherits:
-
TkFrame
- Object
- TkFrame
- SubProcessWidget
- Defined in:
- ext/ae-subprocess-inspector/ae-subprocess-inspector.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Instance Method Summary collapse
-
#initialize(_parent = nil, _event = nil, *args) ⇒ SubProcessWidget
constructor
A new instance of SubProcessWidget.
- #start_check ⇒ Object
Constructor Details
#initialize(_parent = nil, _event = nil, *args) ⇒ SubProcessWidget
Returns a new instance of SubProcessWidget.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'ext/ae-subprocess-inspector/ae-subprocess-inspector.rb', line 49 def initialize(_parent=nil, _event=nil, *args) super(_parent.frame.hinner_frame, Arcadia.style('panel')) @parent = _parent @event = _event @progress = TkVariable.new @pb = Tk::BWidget::ProgressBar.new( self, Arcadia.style('progress').update({ :variable=>@progress, :type=>'infinite', :maximum=>500})).place('width'=>-30,'relwidth' => '1','x' => 0,'y' => 2,'height' => 18) #.pack('side' =>'left','fill'=>'x') = TkButton.new(@pb){ background Arcadia.style('panel')['background'] relief 'flat' image Arcadia.file_icon(_event.name) }.pack b_command = proc{ = "Really kill pid #{_event.pid} #{_event.name} ?" r=Arcadia.dialog(self, 'type'=>'yes_no', 'level'=>'warning', 'title'=> 'Confirm kill', 'msg'=>) if r=="yes" _event.abort_action.call end } _b = Tk::BWidget::Button.new(self, #_b = TkButton.new(self, 'command'=>b_command, 'borderwidth'=>0, 'background'=>Arcadia.conf('background'), 'helptext'=>"#{_event.name} [pid #{_event.pid}]", 'image'=> TkPhotoImage.new('data' => PROCESS_KILL_GIF), 'relief'=>'flat').pack('side' =>'right','padx'=>0) #.pack('side' =>'left','padx'=>5) #.place('x' => 2, 'width'=>20) pack('side' =>'top','anchor'=>'nw','fill'=>'x','padx'=>5, 'pady'=>5) #place('relwidth' => '1') start_check end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
48 49 50 |
# File 'ext/ae-subprocess-inspector/ae-subprocess-inspector.rb', line 48 def event @event end |
Instance Method Details
#start_check ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'ext/ae-subprocess-inspector/ae-subprocess-inspector.rb', line 95 def start_check @progress.numeric=0 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 @progress.numeric += 1 } @timer.set_procs(timecheck,-1,proc_check) @timer.start end |