Class | RemoteTkIp
In: | tk/lib/remote-tk.rb
Parent: | MultiTkIp

### Methods

__eval __invoke _conv_listelement _create_console _eval _eval_with_enc _eval_without_enc _fromUTF8 _get_global_var _get_global_var2 _get_variable _get_variable2 _invoke _invoke _invoke_with_enc _invoke_without_enc _ip_id_ _merge_tklist _return_value _set_global_var _set_global_var2 _set_variable _set_variable2 _split_tklist _thread_tkwait _thread_vwait _toUTF8 _unset_global_var _unset_global_var2 _unset_variable _unset_variable2 allow_ruby_exit= allow_ruby_exit? appsend create_slave delete deleted? do_one_evant do_one_evant get_eventloop_tick get_eventloop_tick get_eventloop_weight get_eventloop_weight get_no_event_wait get_no_event_wait has_mainwindow? invalid_namespace? is_rubytk? mainloop mainloop mainloop_abort_on_exception mainloop_abort_on_exception mainloop_abort_on_exception= mainloop_abort_on_exception= mainloop_watchdog mainloop_watchdog make_safe new new rb_appsend ready? restart safe? safe_base? set_eventloop_tick set_eventloop_tick set_eventloop_weight set_eventloop_weight set_no_event_wait set_no_event_wait

### Public Class methods

do_one_evant(flag = nil)

[Source]

    # File tk/lib/remote-tk.rb, line 463
      def do_one_evant(flag = nil)
        fail RuntimeError, 'not support "do_one_event" on the remote interpreter'
      end

get_eventloop_tick()

[Source]

    # File tk/lib/remote-tk.rb, line 475
      def get_eventloop_tick
        fail RuntimeError, 'not support "get_eventloop_tick" on the remote interpreter'
      end

get_eventloop_weight()

[Source]

    # File tk/lib/remote-tk.rb, line 487
      def get_eventloop_weight
        fail RuntimeError, 'not support "get_eventloop_weight" on the remote interpreter'
      end

get_no_event_wait()

[Source]

    # File tk/lib/remote-tk.rb, line 481
      def get_no_event_wait
        fail RuntimeError, 'not support "get_no_event_wait" on the remote interpreter'
      end

mainloop(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 457
      def mainloop(*args)
        fail RuntimeError, 'not support "mainloop" on the remote interpreter'
      end

mainloop_abort_on_exception()

[Source]

    # File tk/lib/remote-tk.rb, line 466
      def mainloop_abort_on_exception
        fail RuntimeError, 'not support "mainloop_abort_on_exception" on the remote interpreter'
      end

mainloop_abort_on_exception=(mode)

[Source]

    # File tk/lib/remote-tk.rb, line 469
      def mainloop_abort_on_exception=(mode)
        fail RuntimeError, 'not support "mainloop_abort_on_exception=" on the remote interpreter'
      end

mainloop_watchdog(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 460
      def mainloop_watchdog(*args)
        fail RuntimeError, 'not support "mainloop_watchdog" on the remote interpreter'
      end

new(remote_ip, displayof=nil, timeout=5)

[Source]

    # 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
        @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 = {}

        @tk_windows.taint unless @tk_windows.tainted?
        @tk_table_list.taint unless @tk_table_list.tainted?
        @slave_ip_tbl.taint unless @slave_ip_tbl.tainted?
        @slave_ip_top.taint unless @slave_ip_top.tainted?

        @system = Object.new

        @threadgroup  = ThreadGroup.new

        @safe_level = [$SAFE]

        @wait_on_mainloop = [true, 0]

        @cmd_queue = Queue.new

    ??
        @@DEFAULT_MASTER.assign_receiver_and_watchdog(self)

        @@IP_TABLE[@threadgroup] = self
        @@TK_TABLE_LIST.size.times{
          (tbl = {}).tainted? || tbl.taint
          @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

new(*args, &b)

[Source]

    # File tk/lib/remote-tk.rb, line 55
      def new(*args, &b)
        ip = __new(*args)
        ip.eval_proc(&b) if b
        ip
      end

set_eventloop_tick(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 472
      def set_eventloop_tick(*args)
        fail RuntimeError, 'not support "set_eventloop_tick" on the remote interpreter'
      end

set_eventloop_weight(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 484
      def set_eventloop_weight(*args)
        fail RuntimeError, 'not support "set_eventloop_weight" on the remote interpreter'
      end

set_no_event_wait(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 478
      def set_no_event_wait(*args)
        fail RuntimeError, 'not support "set_no_event_wait" on the remote interpreter'
      end

### Public Instance methods

__eval(str)

[Source]

    # File tk/lib/remote-tk.rb, line 307
      def __eval(str)
        _appsend(false, false, str)
      end

__invoke(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 324
      def __invoke(*args)
        _appsend(false, false, *args)
      end

_conv_listelement(str)

[Source]

    # File tk/lib/remote-tk.rb, line 413
      def _conv_listelement(str)
        @interp._conv_listelement(str)
      end

_create_console()

[Source]

    # File tk/lib/remote-tk.rb, line 417
      def _create_console
        fail RuntimeError, 'not support "_create_console" on the remote interpreter'
      end

_eval(str)

[Source]

    # File tk/lib/remote-tk.rb, line 310
      def _eval(str)
        _appsend(nil, false, str)
      end

_eval_with_enc(str)

[Source]

    # File tk/lib/remote-tk.rb, line 316
      def _eval_with_enc(str)
        _appsend(true, false, str)
      end

_eval_without_enc(str)

[Source]

    # File tk/lib/remote-tk.rb, line 313
      def _eval_without_enc(str)
        _appsend(false, false, str)
      end

_fromUTF8(str, encoding=nil)

[Source]

    # File tk/lib/remote-tk.rb, line 341
      def _fromUTF8(str, encoding=nil)
        @interp._fromUTF8(str, encoding)
      end

_get_global_var(var_name)

[Source]

    # File tk/lib/remote-tk.rb, line 384
      def _get_global_var(var_name)
        _appsend(false, 'set', TkComm::_get_eval_string(var_name))
      end

_get_global_var2(var_name, index_name)

[Source]

    # File tk/lib/remote-tk.rb, line 387
      def _get_global_var2(var_name, index_name)
        _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})")
      end

_get_variable(var_name, flag)

[Source]

    # File tk/lib/remote-tk.rb, line 357
      def _get_variable(var_name, flag)
        # ignore flag
        _appsend(false, 'set', TkComm::_get_eval_string(var_name))
      end

_get_variable2(var_name, index_name, flag)

[Source]

    # File tk/lib/remote-tk.rb, line 361
      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

_invoke(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 320
      def _invoke(*args)
        _appsend(nil, false, *args)
      end

_invoke(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 327
      def _invoke(*args)
        _appsend(nil, false, *args)
      end

_invoke_with_enc(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 333
      def _invoke_with_enc(*args)
        _appsend(true, false, *args)
      end

_invoke_without_enc(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 330
      def _invoke_without_enc(*args)
        _appsend(false, false, *args)
      end

_ip_id_()

[Source]

    # File tk/lib/remote-tk.rb, line 130
      def _ip_id_
        @ip_id
      end

_merge_tklist(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 409
      def _merge_tklist(*args)
        @interp._merge_tklist(*args)
      end

_return_value()

[Source]

    # File tk/lib/remote-tk.rb, line 353
      def _return_value
        @interp._return_value
      end

_set_global_var(var_name, value)

[Source]

    # File tk/lib/remote-tk.rb, line 391
      def _set_global_var(var_name, value)
        _appsend(false, 'set', TkComm::_get_eval_string(var_name), TkComm::_get_eval_string(value))
      end

_set_global_var2(var_name, index_name, value)

[Source]

    # File tk/lib/remote-tk.rb, line 394
      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

_set_variable(var_name, value, flag)

[Source]

    # File tk/lib/remote-tk.rb, line 366
      def _set_variable(var_name, value, flag)
        # ignore flag
        _appsend(false, 'set', TkComm::_get_eval_string(var_name), TkComm::_get_eval_string(value))
      end

_set_variable2(var_name, index_name, value, flag)

[Source]

    # File tk/lib/remote-tk.rb, line 370
      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

_split_tklist(str)

[Source]

    # File tk/lib/remote-tk.rb, line 405
      def _split_tklist(str)
        @interp._split_tklist(str)
      end

_thread_tkwait(mode, target)

[Source]

    # File tk/lib/remote-tk.rb, line 349
      def _thread_tkwait(mode, target)
        _appsend(false, 'thread_tkwait', mode, target)
      end

_thread_vwait(var_name)

[Source]

    # File tk/lib/remote-tk.rb, line 345
      def _thread_vwait(var_name)
        _appsend(false, 'thread_vwait', varname)
      end

_toUTF8(str, encoding=nil)

[Source]

    # File tk/lib/remote-tk.rb, line 337
      def _toUTF8(str, encoding=nil)
        @interp._toUTF8(str, encoding)
      end

_unset_global_var(var_name)

[Source]

    # File tk/lib/remote-tk.rb, line 398
      def _unset_global_var(var_name)
        _appsend(false, 'unset', TkComm::_get_eval_string(var_name))
      end

_unset_global_var2(var_name, index_name)

[Source]

    # File tk/lib/remote-tk.rb, line 401
      def _unset_global_var2(var_name, index_name)
        _appsend(false, 'unset', "#{var_name}(#{index_name})")
      end

_unset_variable(var_name, flag)

[Source]

    # File tk/lib/remote-tk.rb, line 375
      def _unset_variable(var_name, flag)
        # ignore flag
        _appsend(false, 'unset', TkComm::_get_eval_string(var_name))
      end

_unset_variable2(var_name, index_name, flag)

[Source]

    # File tk/lib/remote-tk.rb, line 379
      def _unset_variable2(var_name, index_name, flag)
        # ignore flag
        _appsend(false, 'unset', "#{var_name}(#{index_name})")
      end

allow_ruby_exit=(mode)

[Source]

    # File tk/lib/remote-tk.rb, line 263
      def allow_ruby_exit= (mode)
        fail RuntimeError, 'cannot change mode of the remote interpreter'
      end

allow_ruby_exit?()

[Source]

    # File tk/lib/remote-tk.rb, line 259
      def allow_ruby_exit?
        false
      end

appsend(async, *args)

[Source]

    # File tk/lib/remote-tk.rb, line 214
      def appsend(async, *args)
        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

create_slave(name, safe=false)

[Source]

    # File tk/lib/remote-tk.rb, line 238
      def create_slave(name, safe=false)
        if safe
          safe_opt = ''
        else
          safe_opt = '-safe'
        end
        _appsend(false, false, "interp create #{safe_opt} -- #{name}")
      end

delete()

[Source]

    # File tk/lib/remote-tk.rb, line 267
      def delete
        _appsend(false, true, 'exit')
      end

deleted?()

[Source]

    # File tk/lib/remote-tk.rb, line 271
      def deleted?
        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

do_one_evant(flag = nil)

[Source]

    # File tk/lib/remote-tk.rb, line 427
      def do_one_evant(flag = nil)
        fail RuntimeError, 'not support "do_one_event" on the remote interpreter'
      end

get_eventloop_tick()

[Source]

    # File tk/lib/remote-tk.rb, line 439
      def get_eventloop_tick
        fail RuntimeError, 'not support "get_eventloop_tick" on the remote interpreter'
      end

get_eventloop_weight()

[Source]

    # File tk/lib/remote-tk.rb, line 451
      def get_eventloop_weight
        fail RuntimeError, 'not support "get_eventloop_weight" on the remote interpreter'
      end

get_no_event_wait()

[Source]

    # File tk/lib/remote-tk.rb, line 445
      def get_no_event_wait
        fail RuntimeError, 'not support "get_no_event_wait" on the remote interpreter'
      end

has_mainwindow?()

[Source]

    # File tk/lib/remote-tk.rb, line 286
      def has_mainwindow?
        begin
          inf = @interp._invoke_without_enc('info', 'command', '.')
        rescue Exception
          return nil
        end
        if !inf.kind_of?(String) || inf != '.'
          false
        else
          true
        end
      end

invalid_namespace?()

[Source]

    # File tk/lib/remote-tk.rb, line 299
      def invalid_namespace?
        false
      end

is_rubytk?()

[Source]

    # File tk/lib/remote-tk.rb, line 208
      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

mainloop()

[Source]

    # File tk/lib/remote-tk.rb, line 421
      def mainloop
        fail RuntimeError, 'not support "mainloop" on the remote interpreter'
      end

mainloop_abort_on_exception()

[Source]

    # File tk/lib/remote-tk.rb, line 430
      def mainloop_abort_on_exception
        fail RuntimeError, 'not support "mainloop_abort_on_exception" on the remote interpreter'
      end

mainloop_abort_on_exception=(mode)

[Source]

    # File tk/lib/remote-tk.rb, line 433
      def mainloop_abort_on_exception=(mode)
        fail RuntimeError, 'not support "mainloop_abort_on_exception=" on the remote interpreter'
      end

mainloop_watchdog()

[Source]

    # File tk/lib/remote-tk.rb, line 424
      def mainloop_watchdog
        fail RuntimeError, 'not support "mainloop_watchdog" on the remote interpreter'
      end

make_safe()

[Source]

    # File tk/lib/remote-tk.rb, line 247
      def make_safe
        fail RuntimeError, 'cannot change safe mode of the remote interpreter'
      end

rb_appsend(async, *args)

[Source]

    # File tk/lib/remote-tk.rb, line 226
      def rb_appsend(async, *args)
        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

ready?(timeout=5)

[Source]

    # File tk/lib/remote-tk.rb, line 201
      def ready?(timeout=5)
        if timeout < 0
          fail ArgumentError, "timeout must be positive number"
        end
        _available_check(timeout)
      end

restart()

[Source]

    # File tk/lib/remote-tk.rb, line 303
      def restart
        fail RuntimeError, 'cannot restart the remote interpreter'
      end

safe?()

[Source]

    # File tk/lib/remote-tk.rb, line 251
      def safe?
        _appsend(false, false, 'interp issafe')
      end

safe_base?()

[Source]

    # File tk/lib/remote-tk.rb, line 255
      def safe_base?
        false
      end

set_eventloop_tick(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 436
      def set_eventloop_tick(*args)
        fail RuntimeError, 'not support "set_eventloop_tick" on the remote interpreter'
      end

set_eventloop_weight(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 448
      def set_eventloop_weight(*args)
        fail RuntimeError, 'not support "set_eventloop_weight" on the remote interpreter'
      end

set_no_event_wait(*args)

[Source]

    # File tk/lib/remote-tk.rb, line 442
      def set_no_event_wait(*args)
        fail RuntimeError, 'not support "set_no_event_wait" on the remote interpreter'
      end

[Validate]