mainloop(*args)
click to toggle source
# File tk/lib/remote-tk.rb, line 497 def mainloop(*args) fail RuntimeError, 'not support "mainloop" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 503 def do_one_event(flag = nil) fail RuntimeError, 'not support "do_one_event" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 515 def get_eventloop_tick fail RuntimeError, 'not support "get_eventloop_tick" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 527 def get_eventloop_weight fail RuntimeError, 'not support "get_eventloop_weight" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 521 def get_no_event_wait fail RuntimeError, 'not support "get_no_event_wait" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 497 def mainloop(*args) fail RuntimeError, 'not support "mainloop" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 506 def mainloop_abort_on_exception fail RuntimeError, 'not support "mainloop_abort_on_exception" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 509 def mainloop_abort_on_exception=(mode) fail RuntimeError, 'not support "mainloop_abort_on_exception=" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 500 def mainloop_watchdog(*args) fail RuntimeError, 'not support "mainloop_watchdog" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 143 def self.manipulable? true end
# File tk/lib/remote-tk.rb, line 63 def initialize(remote_ip, displayof=nil, timeout=5) if $SAFE >= 4 fail SecurityError, "cannot access another interpreter at level #{$SAFE}" end @interp = MultiTkIp.__getip if @interp.safe? fail SecurityError, "safe-IP cannot create RemoteTkIp" end @interp.allow_ruby_exit = false @appname = @interp._invoke('tk', 'appname') @remote = remote_ip.to_s.dup.freeze if displayof.kind_of?(TkWindow) @displayof = displayof.path.dup.freeze else @displayof = nil end if self.deleted? fail RuntimeError, "no Tk application named \"#{@remote}\"" end @tk_windows = {} @tk_table_list = [] @slave_ip_tbl = {} @slave_ip_top = {} @force_default_encoding ||= TkUtil.untrust([false]) @encoding ||= TkUtil.untrust([nil]) def @encoding.to_s; self.join(nil); end TkUtil.untrust(@tk_windows) unless @tk_windows.tainted? TkUtil.untrust(@tk_table_list) unless @tk_table_list.tainted? TkUtil.untrust(@slave_ip_tbl) unless @slave_ip_tbl.tainted? TkUtil.untrust(@slave_ip_top) unless @slave_ip_top.tainted? @system = Object.new @threadgroup = ThreadGroup.new @safe_level = [$SAFE] @wait_on_mainloop = [true, 0] @cmd_queue = Queue.new @cmd_receiver, @receiver_watchdog = _create_receiver_and_watchdog() @threadgroup.add @cmd_receiver @threadgroup.add @receiver_watchdog @threadgroup.enclose @@DEFAULT_MASTER.assign_receiver_and_watchdog(self) @@IP_TABLE[@threadgroup] = self @@TK_TABLE_LIST.size.times{ (tbl = {}).tainted? || TkUtil.untrust(tbl) @tk_table_list << tbl } @ret_val = TkVariable.new if timeout > 0 && ! _available_check(timeout) fail RuntimeError, "cannot create connection" end @ip_id = _create_connection class << self undef :instance_eval end self.freeze # defend against modification end
# File tk/lib/remote-tk.rb, line 55 def new(*args, &b) ip = __new(*args) ip.eval_proc(&b) if b ip end
# File tk/lib/remote-tk.rb, line 512 def set_eventloop_tick(*args) fail RuntimeError, 'not support "set_eventloop_tick" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 341 def __eval(str) _appsend(false, false, str) end
# File tk/lib/remote-tk.rb, line 358 def __invoke(*args) _appsend(false, false, *args) end
# File tk/lib/remote-tk.rb, line 452 def _conv_listelement(str) raise SecurityError, "no permission to manipulate" unless self.manipulable? @interp._conv_listelement(str) end
# File tk/lib/remote-tk.rb, line 457 def _create_console fail RuntimeError, 'not support "_create_console" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 344 def _eval(str) _appsend(nil, false, str) end
# File tk/lib/remote-tk.rb, line 350 def _eval_with_enc(str) _appsend(true, false, str) end
# File tk/lib/remote-tk.rb, line 347 def _eval_without_enc(str) _appsend(false, false, str) end
# File tk/lib/remote-tk.rb, line 376 def _fromUTF8(str, encoding=nil) raise SecurityError, "no permission to manipulate" unless self.manipulable? @interp._fromUTF8(str, encoding) end
# File tk/lib/remote-tk.rb, line 421 def _get_global_var(var_name) _appsend(false, 'set', TkComm::_get_eval_string(var_name)) end
# File tk/lib/remote-tk.rb, line 424 def _get_global_var2(var_name, index_name) _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})") end
# File tk/lib/remote-tk.rb, line 394 def _get_variable(var_name, flag) # ignore flag _appsend(false, 'set', TkComm::_get_eval_string(var_name)) end
# File tk/lib/remote-tk.rb, line 398 def _get_variable2(var_name, index_name, flag) # ignore flag _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})") end
# File tk/lib/remote-tk.rb, line 354 def _invoke(*args) _appsend(nil, false, *args) end
# File tk/lib/remote-tk.rb, line 367 def _invoke_with_enc(*args) _appsend(true, false, *args) end
# File tk/lib/remote-tk.rb, line 364 def _invoke_without_enc(*args) _appsend(false, false, *args) end
# File tk/lib/remote-tk.rb, line 447 def _merge_tklist(*args) raise SecurityError, "no permission to manipulate" unless self.manipulable? @interp._merge_tklist(*args) end
# File tk/lib/remote-tk.rb, line 389 def _return_value raise SecurityError, "no permission to manipulate" unless self.manipulable? @interp._return_value end
# File tk/lib/remote-tk.rb, line 428 def _set_global_var(var_name, value) _appsend(false, 'set', TkComm::_get_eval_string(var_name), TkComm::_get_eval_string(value)) end
# File tk/lib/remote-tk.rb, line 431 def _set_global_var2(var_name, index_name, value) _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})", TkComm::_get_eval_string(value)) end
# File tk/lib/remote-tk.rb, line 403 def _set_variable(var_name, value, flag) # ignore flag _appsend(false, 'set', TkComm::_get_eval_string(var_name), TkComm::_get_eval_string(value)) end
# File tk/lib/remote-tk.rb, line 407 def _set_variable2(var_name, index_name, value, flag) # ignore flag _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})", TkComm::_get_eval_string(value)) end
# File tk/lib/remote-tk.rb, line 442 def _split_tklist(str) raise SecurityError, "no permission to manipulate" unless self.manipulable? @interp._split_tklist(str) end
# File tk/lib/remote-tk.rb, line 385 def _thread_tkwait(mode, target) _appsend(false, 'thread_tkwait', mode, target) end
# File tk/lib/remote-tk.rb, line 381 def _thread_vwait(var_name) _appsend(false, 'thread_vwait', varname) end
# File tk/lib/remote-tk.rb, line 371 def _toUTF8(str, encoding=nil) raise SecurityError, "no permission to manipulate" unless self.manipulable? @interp._toUTF8(str, encoding) end
# File tk/lib/remote-tk.rb, line 435 def _unset_global_var(var_name) _appsend(false, 'unset', TkComm::_get_eval_string(var_name)) end
# File tk/lib/remote-tk.rb, line 438 def _unset_global_var2(var_name, index_name) _appsend(false, 'unset', "#{var_name}(#{index_name})") end
# File tk/lib/remote-tk.rb, line 412 def _unset_variable(var_name, flag) # ignore flag _appsend(false, 'unset', TkComm::_get_eval_string(var_name)) end
# File tk/lib/remote-tk.rb, line 416 def _unset_variable2(var_name, index_name, flag) # ignore flag _appsend(false, 'unset', "#{var_name}(#{index_name})") end
# File tk/lib/remote-tk.rb, line 293 def allow_ruby_exit= (mode) fail RuntimeError, 'cannot change mode of the remote interpreter' end
# File tk/lib/remote-tk.rb, line 289 def allow_ruby_exit? false end
# File tk/lib/remote-tk.rb, line 240 def appsend(async, *args) raise SecurityError, "no permission to manipulate" unless self.manipulable? if async != true && async != false && async != nil args.unshift(async) async = false end if @displayof Tk.appsend_displayof(@remote, @displayof, async, *args) else Tk.appsend(@remote, async, *args) end end
# File tk/lib/remote-tk.rb, line 268 def create_slave(name, safe=false) if safe safe_opt = '' else safe_opt = '-safe' end _appsend(false, false, "interp create #{safe_opt} -- #{name}") end
# File tk/lib/remote-tk.rb, line 297 def delete _appsend(false, true, 'exit') end
# File tk/lib/remote-tk.rb, line 301 def deleted? raise SecurityError, "no permission to manipulate" unless self.manipulable? if @displayof lst = @interp._invoke_without_enc('winfo', 'interps', '-displayof', @displayof) else lst = @interp._invoke_without_enc('winfo', 'interps') end # unless @interp._split_tklist(lst).index(@remote) unless @interp._split_tklist(lst).index(_toUTF8(@remote)) true else false end end
# File tk/lib/remote-tk.rb, line 467 def do_one_event(flag = nil) fail RuntimeError, 'not support "do_one_event" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 479 def get_eventloop_tick fail RuntimeError, 'not support "get_eventloop_tick" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 491 def get_eventloop_weight fail RuntimeError, 'not support "get_eventloop_weight" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 485 def get_no_event_wait fail RuntimeError, 'not support "get_no_event_wait" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 318 def has_mainwindow? raise SecurityError, "no permission to manipulate" unless self.manipulable? begin inf = @interp._invoke_without_enc('info', 'command', '.') rescue Exception return nil end if !inf.kind_of?(String) || inf != '.' false else true end end
# File tk/lib/remote-tk.rb, line 333 def invalid_namespace? false end
# File tk/lib/remote-tk.rb, line 234 def is_rubytk? return false if _appsend(false, false, 'info', 'command', 'ruby') == "" [ _appsend(false, false, 'ruby', 'RUBY_VERSION'), _appsend(false, false, 'set', 'tk_patchLevel') ] end
# File tk/lib/remote-tk.rb, line 461 def mainloop fail RuntimeError, 'not support "mainloop" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 470 def mainloop_abort_on_exception fail RuntimeError, 'not support "mainloop_abort_on_exception" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 473 def mainloop_abort_on_exception=(mode) fail RuntimeError, 'not support "mainloop_abort_on_exception=" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 464 def mainloop_watchdog fail RuntimeError, 'not support "mainloop_watchdog" on the remote interpreter' end
# File tk/lib/remote-tk.rb, line 277 def make_safe fail RuntimeError, 'cannot change safe mode of the remote interpreter' end
# File tk/lib/remote-tk.rb, line 139 def manipulable? return true if (Thread.current.group == ThreadGroup::Default) MultiTkIp.__getip == @interp && ! @interp.safe? end
# File tk/lib/remote-tk.rb, line 254 def rb_appsend(async, *args) raise SecurityError, "no permission to manipulate" unless self.manipulable? if async != true && async != false && async != nil args.unshift(async) async = false end if @displayof Tk.rb_appsend_displayof(@remote, @displayof, async, *args) else Tk.rb_appsend(@remote, async, *args) end end
# File tk/lib/remote-tk.rb, line 227 def ready?(timeout=5) if timeout < 0 fail ArgumentError, "timeout must be positive number" end _available_check(timeout) end
# File tk/lib/remote-tk.rb, line 337 def restart fail RuntimeError, 'cannot restart the remote interpreter' end
# File tk/lib/remote-tk.rb, line 281 def safe? _appsend(false, false, 'interp issafe') end
# File tk/lib/remote-tk.rb, line 476 def set_eventloop_tick(*args) fail RuntimeError, 'not support "set_eventloop_tick" on the remote interpreter' end
Commenting is here to help enhance the documentation. For example, sample code, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.