Module: Naksh::Interfaces::Rbgtk

Defined in:
lib/naksh/interfaces/gtk.rb,
lib/naksh/interfaces/gtk/io.rb,
lib/naksh/interfaces/gtk/abtwin.rb,
lib/naksh/interfaces/gtk/optwin.rb,
lib/naksh/interfaces/gtk/helpwin.rb,
lib/naksh/interfaces/gtk/mainwin.rb,
lib/naksh/interfaces/gtk/gnomeapp.rb,
lib/naksh/interfaces/gtk/mainwin/console.rb,
lib/naksh/interfaces/gtk/mainwin/main_menu.rb

Defined Under Namespace

Classes: GtkRuBuffer, HelpWindowInterface

Class Method Summary collapse

Class Method Details

.aboutObject



47
48
49
# File 'lib/naksh/interfaces/gtk/abtwin.rb', line 47

def Rbgtk.about
  @abtwin
end

.backObject



62
63
64
# File 'lib/naksh/interfaces/gtk.rb', line 62

def Rbgtk.back
  (@console.buffer.get_iter_at_mark(@console.buffer.get_mark('current_input_start'))==@console.buffer.get_iter_at_mark(@console.buffer.get_mark('insert'))) ? true : false
end

.consoleObject



67
68
69
# File 'lib/naksh/interfaces/gtk.rb', line 67

def Rbgtk.console
  @console
end

.errObject



88
89
90
# File 'lib/naksh/interfaces/gtk/io.rb', line 88

def Rbgtk.err
  @err
end

.helpObject



63
64
65
# File 'lib/naksh/interfaces/gtk/helpwin.rb', line 63

def Rbgtk.help
  @helpwin
end

.inObject

duplicate of the current input, modifications are ignored if the user pressed ‘return’ right now, this is what would be sent to syntax.execute



30
31
32
# File 'lib/naksh/interfaces/gtk/io.rb', line 30

def Rbgtk.in
  @console.buffer.get_slice(@console.buffer.get_iter_at_mark(@console.buffer.get_mark('current_input_start')),@console.buffer.end_iter,true)
end

.in=(str) ⇒ Object



35
36
37
38
# File 'lib/naksh/interfaces/gtk/io.rb', line 35

def Rbgtk.in= str
  @console.buffer.delete @console.buffer.get_iter_at_mark(@console.buffer.get_mark('current_input_start')),@console.buffer.end_iter
  @console.buffer.insert @console.buffer.end_iter,str.to_str
end

.mainObject

the principal Terminal Emulator window



49
50
51
# File 'lib/naksh/interfaces/gtk/mainwin.rb', line 49

def Rbgtk.main
  @mainwin
end

.new_promptObject



73
74
75
76
77
# File 'lib/naksh/interfaces/gtk.rb', line 73

def Rbgtk.new_prompt
  @console.buffer.text=@console.buffer.text<<Naksh.replace_vars(Naksh.config['/interface/tty/prompt'])
  @console.buffer.create_mark('current_input_start',@console.buffer.end_iter,true)
  @console.scroll_to_mark @console.buffer.get_mark('current_input_start'),0.3,false,1,1
end

.on_pre_submitObject

I don’t really like this



35
36
37
# File 'lib/naksh/interfaces/gtk.rb', line 35

def Rbgtk.on_pre_submit
  @console.buffer.insert(@console.buffer.end_iter,"\n")
end

.optionsObject



71
72
73
# File 'lib/naksh/interfaces/gtk/optwin.rb', line 71

def Rbgtk.options
  @optwin
end

.outObject



84
85
86
# File 'lib/naksh/interfaces/gtk/io.rb', line 84

def Rbgtk.out
  @out
end

.potential_autocomplete_key(config_entry) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/naksh/interfaces/gtk.rb', line 42

def Rbgtk.potential_autocomplete_key config_entry
  case Naksh.config[config_entry]
    when 'autocomplete'
      if @tabbed
        Naksh.interface.out.pp Naksh.suggestions(Naksh.interface.in)
        Naksh.interface.new_prompt
      else
        Naksh.interface.in=Naksh.autocomplete(Naksh.interface.in)
        @tabbed=true
      end
      return true
    when 'char'
      return false
    else
    $stderr.puts _("Naksh.config[%s] has unrecognized value: %s")%[config_entry,Naksh.config[config_entry].inspect]
  end
  nil
end

.quitObject



28
29
30
31
# File 'lib/naksh/interfaces/gtk.rb', line 28

def Rbgtk.quit
  Gtk.main_quit
  true
end

.run(*a) ⇒ Object

run the Gtk GUI with main window



88
89
90
91
92
93
# File 'lib/naksh/interfaces/gtk.rb', line 88

def Rbgtk.run *a
  a.each do |i|
    #Rbgtk.new_tab i
  end
  Gtk.main
end