arcadia 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +28 -22
- data/bin/arcadia +3 -3
- data/conf/arcadia.conf +87 -36
- data/conf/arcadia.res.rb +143 -5
- data/conf/theme-dark.conf +94 -0
- data/conf/theme-dark.res.rb +218 -0
- data/ext/ae-breakpoints/ae-breakpoints.rb +1 -0
- data/ext/ae-dir-projects/ae-dir-projects.rb +37 -9
- data/ext/ae-editor/ae-editor.conf +10 -9
- data/ext/ae-editor/ae-editor.rb +306 -127
- data/ext/ae-editor/langs/pers.lang.bind +1 -0
- data/ext/ae-editor/langs/rb.lang +6 -6
- data/ext/ae-editor/langs/tcl.lang +3 -0
- data/ext/ae-file-history/ae-file-history.rb +4 -11
- data/ext/ae-output/ae-output.rb +57 -38
- data/ext/ae-rad/ae-rad-inspector.rb +1 -1
- data/ext/ae-rad/ae-rad-palette.rb +2 -2
- data/ext/ae-rad/ae-rad.rb +7 -7
- data/ext/ae-rad/lib/tk/al-tk.rb +3 -3
- data/ext/ae-rad/lib/tk/al-tkcustom.rb +2 -2
- data/ext/ae-ruby-debug/ae-ruby-debug.conf +20 -1
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +69 -65
- data/ext/ae-search-in-files/ae-search-in-files.rb +2 -17
- data/ext/ae-shell/ae-shell.conf +7 -6
- data/ext/ae-shell/ae-shell.rb +211 -32
- data/ext/ae-subprocess-inspector/ae-subprocess-inspector.conf +11 -0
- data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +109 -0
- data/lib/a-commons.rb +74 -16
- data/lib/a-contracts.rb +18 -1
- data/lib/a-core.rb +410 -77
- data/lib/a-tkcommons.rb +338 -138
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ArrowButton.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/BWidget.html +2 -2
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/Button.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ButtonBox.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ComboBox.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/Dialog.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/DragSite.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/DropSite.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/DynamicHelp.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/Entry.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/Label.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/LabelEntry.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/LabelFrame.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ListBox.html +1 -4
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/MainFrame.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/MessageDlg.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/NoteBook.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/PagesManager.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/PanedWindow.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/PanelFrame.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/PasswdDlg.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ProgressBar.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ProgressDlg.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ScrollView.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ScrollableFrame.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/ScrolledWindow.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/SelectColor.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/SelectFont.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/Separator.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/SpinBox.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/StatusBar.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/TitleFrame.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/Tree.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/Widget.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/contents.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/index.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/navtree.html +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/BWman/options.htm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/CHANGES.txt +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/ChangeLog +70 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/LICENSE.txt +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/README.txt +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/arrow.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/bitmap.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/button.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/buttonbox.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/color.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/combobox.tcl +4 -4
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/basic.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/bwidget.xbm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/demo.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/dnd.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/manager.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/select.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/tmpldlg.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/tree.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/demo/x1.xbm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/dialog.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/dragsite.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/dropsite.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/dynhelp.tcl +25 -18
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/entry.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/font.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/bold.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/copy.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/cut.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/dragfile.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/dragicon.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/error.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/file.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/folder.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/hourglass.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/info.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/italic.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/minus.xbm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/new.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/opcopy.xbm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/open.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/openfold.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/oplink.xbm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/opmove.xbm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/overstrike.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/palette.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/passwd.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/paste.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/plus.xbm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/print.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/question.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/redo.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/save.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/target.xbm +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/underline.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/undo.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/images/warning.gif +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/init.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/label.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/labelentry.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/labelframe.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/lang/da.rc +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/lang/de.rc +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/lang/en.rc +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/lang/es.rc +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/lang/fr.rc +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/lang/hu.rc +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/lang/nl.rc +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/lang/no.rc +0 -0
- data/tcl/BWidget-1.9.2/lang/pl.rc +104 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/listbox.tcl +68 -35
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/mainframe.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/messagedlg.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/notebook.tcl +2 -2
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/pagesmgr.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/panedw.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/panelframe.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/passwddlg.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/pkgIndex.tcl +2 -2
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/progressbar.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/progressdlg.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/scrollframe.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/scrollview.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/scrollw.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/separator.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/spinbox.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/statusbar.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/tests/entry.test +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/titleframe.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/tree.tcl +6 -1
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/utils.tcl +27 -7
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/widget.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/wizard.tcl +0 -0
- data/tcl/{BWidget-1.9.0 → BWidget-1.9.2}/xpm2image.tcl +0 -0
- metadata +162 -153
|
@@ -89,9 +89,8 @@ class SearchInFilesListener
|
|
|
89
89
|
@find.hide
|
|
90
90
|
if !defined?(@search_output)
|
|
91
91
|
@search_output = SearchOutput.new(@service)
|
|
92
|
-
else
|
|
93
|
-
@service.frame.show
|
|
94
92
|
end
|
|
93
|
+
@service.frame.show_anyway
|
|
95
94
|
begin
|
|
96
95
|
|
|
97
96
|
MonitorLastUsedDir.set_last @find.e_dir.text # save it away TODO make it into a message
|
|
@@ -149,21 +148,7 @@ class SearchOutput
|
|
|
149
148
|
selectcommand _open_file
|
|
150
149
|
deltay 15
|
|
151
150
|
}.place('x' => '25','y' => '0','relwidth' => '1', 'relheight' => '1', 'width' => '-40', 'height'=>'-15')
|
|
152
|
-
|
|
153
|
-
_yscrollcommand = proc{|*args| @tree.yview(*args)}
|
|
154
|
-
_yscrollbar = TkScrollbar.new(@ext.frame.hinner_frame, Arcadia.style('scrollbar')){|s|
|
|
155
|
-
#width 8
|
|
156
|
-
command _yscrollcommand
|
|
157
|
-
}.pack('side'=>'right', 'fill'=>'y')
|
|
158
|
-
@tree.yscrollcommand proc{|first,last| _yscrollbar.set(first,last)}
|
|
159
|
-
#---- x scrollbar
|
|
160
|
-
_xscrollcommand = proc{|*args| @tree.xview(*args)}
|
|
161
|
-
_xscrollbar = TkScrollbar.new(@ext.frame.hinner_frame, Arcadia.style('scrollbar')){|s|
|
|
162
|
-
#width 8
|
|
163
|
-
orient 'horizontal'
|
|
164
|
-
command _xscrollcommand
|
|
165
|
-
}.pack('side'=>'bottom', 'fill'=>'x')
|
|
166
|
-
@tree.xscrollcommand proc{|first,last| _xscrollbar.set(first,last)}
|
|
151
|
+
@tree.extend(TkScrollableWidget).show
|
|
167
152
|
|
|
168
153
|
_proc_clear = proc{clear_tree}
|
|
169
154
|
|
data/ext/ae-shell/ae-shell.conf
CHANGED
|
@@ -2,13 +2,14 @@ name=shell
|
|
|
2
2
|
active=yes
|
|
3
3
|
require=ext/ae-shell/ae-shell
|
|
4
4
|
class=Shell
|
|
5
|
-
|
|
5
|
+
stdout_blocking=no
|
|
6
|
+
stderr_blocking=yes
|
|
6
7
|
win32::gems=win32-process,ruby-wmi
|
|
7
8
|
|
|
8
9
|
#:::::::::::::::: output ::::::::::::::::::::::<begin>
|
|
9
|
-
ruby=ruby
|
|
10
|
-
freebsd::ruby=ruby
|
|
11
|
-
win32::ruby=ruby
|
|
12
|
-
win32::rubyw=rubyw
|
|
13
|
-
rubyw=rubyw
|
|
10
|
+
#ruby=ruby
|
|
11
|
+
#freebsd::ruby=ruby
|
|
12
|
+
#win32::ruby=ruby
|
|
13
|
+
#win32::rubyw=rubyw
|
|
14
|
+
#rubyw=rubyw
|
|
14
15
|
#:::::::::::::::: output ::::::::::::::::::::::<end>
|
data/ext/ae-shell/ae-shell.rb
CHANGED
|
@@ -6,26 +6,23 @@
|
|
|
6
6
|
require "tk"
|
|
7
7
|
#require "base/a-utils"
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
class Shell < ArcadiaExt
|
|
10
11
|
|
|
11
12
|
def on_before_build(_event)
|
|
12
13
|
Arcadia.attach_listener(self, SystemExecEvent)
|
|
13
|
-
Arcadia.attach_listener(self, RunRubyFileEvent)
|
|
14
|
+
#Arcadia.attach_listener(self, RunRubyFileEvent)
|
|
15
|
+
Arcadia.attach_listener(self, RunCmdEvent)
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
def on_build(_event)
|
|
17
19
|
@run_threads = Array.new
|
|
20
|
+
@stdout_blocking = self.conf('stdout_blocking') == 'yes'
|
|
21
|
+
@stderr_blocking = self.conf('stderr_blocking') == 'yes'
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
def on_system_exec(_event)
|
|
21
25
|
begin
|
|
22
|
-
# _cmd_ = "|ruby #{File.dirname(__FILE__)}/sh.rb #{_event.command} 2>&1"
|
|
23
|
-
# p _cmd_
|
|
24
|
-
# Thread.new do
|
|
25
|
-
# open(_cmd_,"r"){|f|
|
|
26
|
-
# Arcadia.new_debug_msg(self, f.read)
|
|
27
|
-
# }
|
|
28
|
-
# end
|
|
29
26
|
_cmd_ = "#{_event.command}"
|
|
30
27
|
if is_windows?
|
|
31
28
|
io = IO.popen(_cmd_)
|
|
@@ -34,47 +31,141 @@ class Shell < ArcadiaExt
|
|
|
34
31
|
Process.fork{
|
|
35
32
|
open(_cmd_,"r"){|f|
|
|
36
33
|
Arcadia.console(self,'msg'=>f.read, 'level'=>'debug')
|
|
37
|
-
#Arcadia.new_debug_msg(self, f.read)
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
36
|
end
|
|
41
37
|
rescue Exception => e
|
|
42
38
|
Arcadia.console(self,'msg'=>e, 'level'=>'debug')
|
|
43
|
-
#Arcadia.new_debug_msg(self, e)
|
|
44
39
|
end
|
|
45
40
|
end
|
|
46
41
|
|
|
42
|
+
# @@next_number = 0
|
|
43
|
+
# def on_run_ruby_file(_event)
|
|
44
|
+
# _filename = _event.file
|
|
45
|
+
# _filename = @arcadia['pers']['run.file.last'] if _filename == "*LAST"
|
|
46
|
+
# if _filename && File.exists?(_filename)
|
|
47
|
+
# begin
|
|
48
|
+
# Arcadia.console(self,'msg'=>"Running #{_filename}...", 'level'=>'debug') # info?
|
|
49
|
+
# start_time = Time.now
|
|
50
|
+
# @arcadia['pers']['run.file.last']=_filename if _event.persistent
|
|
51
|
+
# executable = @arcadia['conf']['shell.ruby']
|
|
52
|
+
# executable = @arcadia['conf']['shell.rubyw'] if is_windows?
|
|
53
|
+
# _cmd_ = "#{executable} -C'#{File.dirname(_filename)}' '#{_filename}'"
|
|
54
|
+
#
|
|
55
|
+
# if is_windows?
|
|
56
|
+
# # use win32-process gem to startup a child process [not sure if linux needs something like this, too]
|
|
57
|
+
# require 'win32/process'
|
|
58
|
+
# require 'ruby-wmi'
|
|
59
|
+
# output_file_name = "out_#{@@next_number += 1}_#{Process.pid}.txt"
|
|
60
|
+
# output = File.open(output_file_name, 'wb')
|
|
61
|
+
# child = Process.create :command_line => _cmd_, :startup_info => {:stdout => output, :stderr => output}
|
|
62
|
+
# #----
|
|
63
|
+
# abort_action = proc{
|
|
64
|
+
# Process.kill(9,child.process_id)
|
|
65
|
+
# }
|
|
66
|
+
# alive_check = proc{
|
|
67
|
+
# WMI::Win32_Process.find(:first, :conditions => {:ProcessId => child.process_id})
|
|
68
|
+
# }
|
|
69
|
+
# Arcadia.process_event(SubProcessEvent.new(self,'name'=>_filename,'abort_action'=>abort_action, 'alive_check'=>alive_check))
|
|
70
|
+
# #----
|
|
71
|
+
# timer=nil
|
|
72
|
+
# procy = proc {
|
|
73
|
+
# still_alive = WMI::Win32_Process.find(:first, :conditions => {:ProcessId => child.process_id})
|
|
74
|
+
# if !still_alive #&& File.exists?(output_file_name)
|
|
75
|
+
# output.close
|
|
76
|
+
# timer.stop
|
|
77
|
+
# File.open(output_file_name, 'r') do |f|
|
|
78
|
+
# _readed = f.read
|
|
79
|
+
# _readed.strip!
|
|
80
|
+
# _readed += "\n" + "Done with #{_filename} in #{Time.now - start_time}s"
|
|
81
|
+
# Arcadia.console(self,'msg'=>_readed, 'level'=>'debug')
|
|
82
|
+
# _event.add_result(self, 'output'=>_readed)
|
|
83
|
+
# end
|
|
84
|
+
# File.delete output_file_name
|
|
85
|
+
# end
|
|
86
|
+
# }
|
|
87
|
+
#
|
|
88
|
+
# timer=TkAfter.new(1000,-1,procy) # -1 = repeating every 1000ms...
|
|
89
|
+
# timer.start
|
|
90
|
+
# else
|
|
91
|
+
# _cmd_ = "|#{_cmd_} 2>&1"
|
|
92
|
+
# Thread.new {
|
|
93
|
+
# begin
|
|
94
|
+
# th = Thread.current
|
|
95
|
+
# fi = nil
|
|
96
|
+
# fi_pid = nil
|
|
97
|
+
# abort_action = proc{
|
|
98
|
+
# unix_child_pids(fi_pid).each {|pid|
|
|
99
|
+
# Process.kill(9,pid.to_i)
|
|
100
|
+
# }
|
|
101
|
+
# #Kernel.system("kill -9 #{unix_child_pids(fi_pid).join(' ')} #{fi_pid}") if fi
|
|
102
|
+
# }
|
|
103
|
+
#
|
|
104
|
+
# alive_check = proc{
|
|
105
|
+
# num = `ps -p #{fi_pid}|wc -l`
|
|
106
|
+
# num.to_i > 1
|
|
107
|
+
# }
|
|
108
|
+
#
|
|
109
|
+
# #Arcadia.console(self,'msg'=>"#{th}", 'level'=>'debug', 'abort_action'=>abort_action)
|
|
110
|
+
# open(_cmd_, "r"){|f|
|
|
111
|
+
# fi = f
|
|
112
|
+
# fi_pid = fi.pid
|
|
113
|
+
# Arcadia.process_event(SubProcessEvent.new(self,'name'=>_filename,'abort_action'=>abort_action, 'alive_check'=>alive_check))
|
|
114
|
+
# _readed = f.read
|
|
115
|
+
# output_dump="End running #{_filename}:\n#{_readed}"
|
|
116
|
+
# Arcadia.console(self,'msg'=>output_dump, 'level'=>'debug')
|
|
117
|
+
# _event.add_result(self, 'output'=>_readed)
|
|
118
|
+
# }
|
|
119
|
+
# if _event.persistent == false && _filename[-2..-1] == '~~'
|
|
120
|
+
# File.delete(_filename) if File.exist?(_filename)
|
|
121
|
+
# end
|
|
122
|
+
# rescue Exception => e
|
|
123
|
+
# Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug')
|
|
124
|
+
# end
|
|
125
|
+
# }
|
|
126
|
+
# end
|
|
127
|
+
# rescue Exception => e
|
|
128
|
+
# Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug')
|
|
129
|
+
# end
|
|
130
|
+
# end
|
|
131
|
+
# end
|
|
132
|
+
|
|
133
|
+
|
|
47
134
|
@@next_number = 0
|
|
48
|
-
def
|
|
49
|
-
|
|
50
|
-
_filename = @arcadia['pers']['run.file.last'] if _filename == "*LAST"
|
|
51
|
-
if _filename && File.exists?(_filename)
|
|
135
|
+
def on_run_cmd(_event)
|
|
136
|
+
if _event.cmd
|
|
52
137
|
begin
|
|
53
|
-
Arcadia.console(self,'msg'=>"Running #{
|
|
138
|
+
output_mark = Arcadia.console(self,'msg'=>"Running #{_event.title}...", 'level'=>'debug') # info?
|
|
54
139
|
start_time = Time.now
|
|
55
|
-
@arcadia['pers']['run.file.last']=
|
|
56
|
-
|
|
57
|
-
executable = @arcadia['conf']['shell.rubyw'] if is_windows?
|
|
58
|
-
_cmd_ = "#{executable} -C'#{File.dirname(_filename)}' '#{_filename}'"
|
|
59
|
-
|
|
140
|
+
@arcadia['pers']['run.file.last']=_event.file if _event.persistent
|
|
141
|
+
@arcadia['pers']['run.cmd.last']=_event.cmd if _event.persistent
|
|
60
142
|
if is_windows?
|
|
61
143
|
# use win32-process gem to startup a child process [not sure if linux needs something like this, too]
|
|
62
144
|
require 'win32/process'
|
|
63
145
|
require 'ruby-wmi'
|
|
64
146
|
output_file_name = "out_#{@@next_number += 1}_#{Process.pid}.txt"
|
|
65
147
|
output = File.open(output_file_name, 'wb')
|
|
66
|
-
child = Process.create :command_line =>
|
|
148
|
+
child = Process.create :command_line => _event.cmd, :startup_info => {:stdout => output, :stderr => output}
|
|
149
|
+
#----
|
|
150
|
+
abort_action = proc{
|
|
151
|
+
Process.kill(9,child.process_id)
|
|
152
|
+
}
|
|
153
|
+
alive_check = proc{
|
|
154
|
+
WMI::Win32_Process.find(:first, :conditions => {:ProcessId => child.process_id})
|
|
155
|
+
}
|
|
156
|
+
Arcadia.process_event(SubProcessEvent.new(self,'pid'=>child.process_id, 'name'=>_event.file,'abort_action'=>abort_action, 'alive_check'=>alive_check))
|
|
157
|
+
#----
|
|
67
158
|
timer=nil
|
|
68
159
|
procy = proc {
|
|
69
160
|
still_alive = WMI::Win32_Process.find(:first, :conditions => {:ProcessId => child.process_id})
|
|
70
|
-
if
|
|
161
|
+
if !still_alive #&& File.exists?(output_file_name)
|
|
71
162
|
output.close
|
|
72
163
|
timer.stop
|
|
73
164
|
File.open(output_file_name, 'r') do |f|
|
|
74
165
|
_readed = f.read
|
|
75
166
|
_readed.strip!
|
|
76
|
-
_readed += "\n" + "Done with #{
|
|
77
|
-
Arcadia.console(self,'msg'=>_readed, 'level'=>'debug')
|
|
167
|
+
_readed += "\n" + "Done with #{_event.title} in #{Time.now - start_time}s"
|
|
168
|
+
output_mark = Arcadia.console(self,'msg'=>_readed, 'level'=>'debug', 'mark'=>output_mark)
|
|
78
169
|
_event.add_result(self, 'output'=>_readed)
|
|
79
170
|
end
|
|
80
171
|
File.delete output_file_name
|
|
@@ -84,25 +175,113 @@ class Shell < ArcadiaExt
|
|
|
84
175
|
timer=TkAfter.new(1000,-1,procy) # -1 = repeating every 1000ms...
|
|
85
176
|
timer.start
|
|
86
177
|
else
|
|
87
|
-
|
|
178
|
+
require "open3"
|
|
179
|
+
#_cmd_ = "|#{_event.cmd} 2>&1"
|
|
180
|
+
_cmd_ = _event.cmd
|
|
88
181
|
Thread.new {
|
|
182
|
+
Thread.current.abort_on_exception = true
|
|
89
183
|
begin
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
184
|
+
# th = Thread.current
|
|
185
|
+
fi = nil
|
|
186
|
+
fi_pid = nil
|
|
187
|
+
abort_action = proc{
|
|
188
|
+
ArcadiaUtils.unix_child_pids(fi_pid).each {|pid|
|
|
189
|
+
Process.kill(9,pid.to_i)
|
|
190
|
+
}
|
|
191
|
+
Process.kill(9,fi_pid.to_i)
|
|
192
|
+
#Kernel.system("kill -9 #{unix_child_pids(fi_pid).join(' ')} #{fi_pid}") if fi
|
|
94
193
|
}
|
|
194
|
+
|
|
195
|
+
alive_check = proc{
|
|
196
|
+
num = `ps -p #{fi_pid}|wc -l`
|
|
197
|
+
num.to_i > 1
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
#Arcadia.console(self,'msg'=>"#{th}", 'level'=>'debug', 'abort_action'=>abort_action)
|
|
202
|
+
|
|
203
|
+
Open3.popen3(_cmd_){|stdin, stdout, stderr, th|
|
|
204
|
+
fi_pid = th.pid
|
|
205
|
+
output_mark = Arcadia.console(self,'msg'=>" [pid #{fi_pid}]", 'level'=>'debug', 'mark'=>output_mark, 'append'=>true)
|
|
206
|
+
Arcadia.process_event(SubProcessEvent.new(self, 'pid'=>fi_pid, 'name'=>_event.file,'abort_action'=>abort_action, 'alive_check'=>alive_check))
|
|
207
|
+
|
|
208
|
+
if stdout
|
|
209
|
+
if @stdout_blocking
|
|
210
|
+
output_dump = stdout.read
|
|
211
|
+
if output_dump && output_dump.length > 0
|
|
212
|
+
output_mark = Arcadia.console(self,'msg'=>output_dump, 'level'=>'error', 'mark'=>output_mark)
|
|
213
|
+
_event.add_result(self, 'output'=>output_dump)
|
|
214
|
+
end
|
|
215
|
+
else
|
|
216
|
+
stdout.each do |output_dump|
|
|
217
|
+
output_mark = Arcadia.console(self,'msg'=>output_dump, 'level'=>'debug', 'mark'=>output_mark)
|
|
218
|
+
_event.add_result(self, 'output'=>output_dump)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
if stderr
|
|
224
|
+
if @stderr_blocking
|
|
225
|
+
output_dump = stderr.read
|
|
226
|
+
if output_dump && output_dump.length > 0
|
|
227
|
+
output_mark = Arcadia.console(self,'msg'=>output_dump, 'level'=>'error', 'mark'=>output_mark)
|
|
228
|
+
_event.add_result(self, 'output'=>output_dump)
|
|
229
|
+
end
|
|
230
|
+
else
|
|
231
|
+
stderr.each do |output_dump|
|
|
232
|
+
output_mark = Arcadia.console(self,'msg'=>output_dump, 'level'=>'error', 'mark'=>output_mark)
|
|
233
|
+
_event.add_result(self, 'output'=>output_dump)
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
}
|
|
238
|
+
output_mark = Arcadia.console(self,'msg'=>"\nEnd running #{_event.title}:", 'level'=>'debug', 'mark'=>output_mark)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
# open(_cmd_, "r"){|f|
|
|
242
|
+
# fi = f
|
|
243
|
+
# fi_pid = fi.pid
|
|
244
|
+
# Arcadia.process_event(SubProcessEvent.new(self,'name'=>_event.file,'abort_action'=>abort_action, 'alive_check'=>alive_check))
|
|
245
|
+
# _readed = f.read
|
|
246
|
+
#
|
|
247
|
+
# #f.each{|line|
|
|
248
|
+
# # output_mark = Arcadia.console(self,'msg'=>line, 'level'=>'debug', 'mark'=>output_mark)
|
|
249
|
+
# #}
|
|
250
|
+
# #output_mark = Arcadia.console(self,'msg'=>"\nEnd running #{_event.file}:", 'level'=>'debug', 'mark'=>output_mark)
|
|
251
|
+
#
|
|
252
|
+
# output_dump="#{_readed}\nEnd running #{_event.file}:"
|
|
253
|
+
# output_mark = Arcadia.console(self,'msg'=>output_dump, 'level'=>'debug', 'mark'=>output_mark)
|
|
254
|
+
# _event.add_result(self, 'output'=>_readed)
|
|
255
|
+
# }
|
|
256
|
+
if _event.persistent == false && _event.file[-2..-1] == '~~'
|
|
257
|
+
File.delete(_event.file) if File.exist?(_event.file)
|
|
258
|
+
end
|
|
95
259
|
rescue Exception => e
|
|
96
|
-
Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug')
|
|
260
|
+
output_mark = Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug', 'mark'=>output_mark)
|
|
97
261
|
end
|
|
98
262
|
}
|
|
99
263
|
end
|
|
100
264
|
rescue Exception => e
|
|
101
|
-
Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug')
|
|
265
|
+
output_mark = Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug', 'mark'=>output_mark)
|
|
102
266
|
end
|
|
103
267
|
end
|
|
104
268
|
end
|
|
105
|
-
|
|
269
|
+
|
|
270
|
+
# def unix_child_pids(_ppid)
|
|
271
|
+
# ret = Array.new
|
|
272
|
+
# readed = ''
|
|
273
|
+
# open("|ps -o pid,ppid ax | grep #{_ppid}", "r"){|f| readed = f.read }
|
|
274
|
+
# apids = readed.split
|
|
275
|
+
# apids.each_with_index do |v,i|
|
|
276
|
+
# ret << v if i % 2 == 0 && v != _ppid.to_s
|
|
277
|
+
# end
|
|
278
|
+
# subpids = Array.new
|
|
279
|
+
# ret.each{|ccp|
|
|
280
|
+
# subpids.concat(unix_child_pids(ccp))
|
|
281
|
+
# }
|
|
282
|
+
# ret.concat(subpids)
|
|
283
|
+
# end
|
|
284
|
+
|
|
106
285
|
def on_system_exec_bo(_event)
|
|
107
286
|
command = "#{_event.command} 2>&1"
|
|
108
287
|
(RUBY_PLATFORM.include?('mswin32'))?_cmd="cmd":_cmd='sh'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#========================================
|
|
2
|
+
#========================================
|
|
3
|
+
name=subprocess-inspector
|
|
4
|
+
frames=0.0
|
|
5
|
+
frames.labels=Ps
|
|
6
|
+
frames.names=subprocess_inspector
|
|
7
|
+
active=yes
|
|
8
|
+
require=ext/ae-subprocess-inspector/ae-subprocess-inspector
|
|
9
|
+
class=SubProcessInspector
|
|
10
|
+
#========================================
|
|
11
|
+
#========================================
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
class SubProcessInspector < ArcadiaExt
|
|
2
|
+
attr_reader :processs
|
|
3
|
+
def on_before_build(_event)
|
|
4
|
+
@processs = []
|
|
5
|
+
Arcadia.attach_listener(self, SubProcessEvent)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def on_sub_process(_event)
|
|
9
|
+
self.frame.show_anyway
|
|
10
|
+
@processs << SubProcessWidget.new(self, _event)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def on_exit_query(_event)
|
|
14
|
+
_event.can_exit=true
|
|
15
|
+
@processs.each{|pr|
|
|
16
|
+
if !pr.nil?
|
|
17
|
+
message = "Some sub process are running! Exit anyware?"
|
|
18
|
+
r=Arcadia.dialog(self,
|
|
19
|
+
'type'=>'yes_no',
|
|
20
|
+
'level'=>'warning',
|
|
21
|
+
'title'=> 'Confirm exit',
|
|
22
|
+
'msg'=>message)
|
|
23
|
+
if r=="no"
|
|
24
|
+
_event.can_exit=false
|
|
25
|
+
_event.break
|
|
26
|
+
end
|
|
27
|
+
break
|
|
28
|
+
end
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def on_finalize(_event)
|
|
33
|
+
@processs.each{|pr|
|
|
34
|
+
pr.event.abort_action.call if !pr.nil?
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class SubProcessWidget < TkFrame
|
|
41
|
+
attr_reader :event
|
|
42
|
+
def initialize(_parent=nil, _event=nil, *args)
|
|
43
|
+
super(_parent.frame.hinner_frame, Arcadia.style('panel'))
|
|
44
|
+
@parent = _parent
|
|
45
|
+
@event = _event
|
|
46
|
+
@progress = TkVariable.new
|
|
47
|
+
@pb = Tk::BWidget::ProgressBar.new(
|
|
48
|
+
self, Arcadia.style('progress').update({
|
|
49
|
+
:variable=>@progress,
|
|
50
|
+
:type=>'infinite',
|
|
51
|
+
:maximum=>500})).place('width'=>-30,'relwidth' => '1','x' => 0,'y' => 2,'height' => 18)
|
|
52
|
+
#.pack('side' =>'left','fill'=>'x')
|
|
53
|
+
|
|
54
|
+
icon_button = TkButton.new(@pb){
|
|
55
|
+
background Arcadia.style('panel')['background']
|
|
56
|
+
relief 'flat'
|
|
57
|
+
image Arcadia.file_icon(_event.name)
|
|
58
|
+
}.pack
|
|
59
|
+
|
|
60
|
+
b_command = proc{
|
|
61
|
+
message = "Really kill pid #{_event.pid} #{_event.name} ?"
|
|
62
|
+
r=Arcadia.dialog(self,
|
|
63
|
+
'type'=>'yes_no',
|
|
64
|
+
'level'=>'warning',
|
|
65
|
+
'title'=> 'Confirm kill',
|
|
66
|
+
'msg'=>message)
|
|
67
|
+
if r=="yes"
|
|
68
|
+
_event.abort_action.call
|
|
69
|
+
end
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
_b = Tk::BWidget::Button.new(self,
|
|
74
|
+
#_b = TkButton.new(self,
|
|
75
|
+
'command'=>b_command,
|
|
76
|
+
'borderwidth'=>0,
|
|
77
|
+
'background'=>Arcadia.conf('background'),
|
|
78
|
+
'helptext'=>"#{_event.name} [pid #{_event.pid}]",
|
|
79
|
+
'image'=> TkPhotoImage.new('data' => PROCESS_KILL_GIF),
|
|
80
|
+
'relief'=>'flat').pack('side' =>'right','padx'=>0)
|
|
81
|
+
#.pack('side' =>'left','padx'=>5)
|
|
82
|
+
#.place('x' => 2, 'width'=>20)
|
|
83
|
+
pack('side' =>'top','anchor'=>'nw','fill'=>'x','padx'=>5, 'pady'=>5)
|
|
84
|
+
#place('relwidth' => '1')
|
|
85
|
+
start_check
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def start_check
|
|
89
|
+
@progress.numeric=0
|
|
90
|
+
if @event.timecheck
|
|
91
|
+
timecheck = @event.timecheck
|
|
92
|
+
else
|
|
93
|
+
timecheck = 1000
|
|
94
|
+
end
|
|
95
|
+
@timer = TkAfter.new
|
|
96
|
+
proc_check = proc{
|
|
97
|
+
alive = @event.alive_check.call
|
|
98
|
+
#p "ALIVE=#{alive}"
|
|
99
|
+
if !alive
|
|
100
|
+
@timer.stop
|
|
101
|
+
@parent.processs.delete(self)
|
|
102
|
+
self.destroy
|
|
103
|
+
end
|
|
104
|
+
@progress.numeric += 1
|
|
105
|
+
}
|
|
106
|
+
@timer.set_procs(timecheck,-1,proc_check)
|
|
107
|
+
@timer.start
|
|
108
|
+
end
|
|
109
|
+
end
|