Class: Fugit::RunCommandDialog

Inherits:
Dialog
  • Object
show all
Defined in:
lib/fugit/run_command_dialog.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ RunCommandDialog

Returns a new instance of RunCommandDialog.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fugit/run_command_dialog.rb', line 5

def initialize(parent)
  super(parent, ID_ANY, "Run command", :size => Size.new(300, 100))

  @cmd = TextCtrl.new(self, ID_ANY)

  butt_sizer = create_button_sizer(OK|CANCEL)
  butt_sizer.get_children.map {|s| s.get_window}.compact.each {|b| b.set_label("Run") if b.get_label == "OK"}
  evt_button(get_affirmative_id, :on_ok)

  box = BoxSizer.new(VERTICAL)
  box.add(StaticText.new(self, ID_ANY, "Command:"), 0, EXPAND|ALL, 4)
  box.add(@cmd, 0, EXPAND|LEFT|RIGHT|BOTTOM, 4)
  box.add(butt_sizer, 0, EXPAND|BOTTOM, 4)

  self.set_sizer(box)
end

Instance Method Details

#on_okObject



29
30
31
32
33
34
35
36
37
# File 'lib/fugit/run_command_dialog.rb', line 29

def on_ok
  command = @cmd.get_value

  end_modal(ID_OK)

  @log_dialog ||= LoggedDialog.new(self, "Run command")
  @log_dialog.show
  @log_dialog.run_command(command)
end

#showObject



22
23
24
25
26
27
# File 'lib/fugit/run_command_dialog.rb', line 22

def show()
  @cmd.set_value("")

  super()
  @cmd.set_focus
end