Class: X11UI
Instance Method Summary
collapse
Methods inherited from BaseUI
#bell, #colorize, #enable_progress_bar, #error, #name, #not_implemented, #pinc, #pmsg, #progress, #progress_bar, #progress_bar_enabled?, #progress_bar_implementation, #progress_inc, #progress_message, #question_yes_no, #question_yes_no_retry, #select, #select_index, #warn
Instance Method Details
#execute_in_console(command, options = {}) ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/libisi/ui/x11.rb', line 48
def execute_in_console(command, options = {})
command = command_line_parse(command)
konsole = ["xterm", "-T", command.join(" "),"-e"]
new_command = konsole + command
$log.debug("Executing konsole command #{new_command.inspect}")
system(*new_command)
end
|
#info(text, options = {}) ⇒ Object
20
21
22
|
# File 'lib/libisi/ui/x11.rb', line 20
def info(text, options = {})
system("xmessage", "-center",text)
end
|
#info_non_blocking(text, options = {}) ⇒ Object
23
24
25
|
# File 'lib/libisi/ui/x11.rb', line 23
def info_non_blocking(text, options = {})
system("xmessage", "-timeout", "5", "-center",text)
end
|
#password(text) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/libisi/ui/x11.rb', line 31
def password(text)
Open3.popen3("pinentry") { |stdin, stdout, stderr|
stdin.write("SETPROMPT Password\n")
$log.debug(stdout.readline)
stdin.write("SETDESC " + text.gsub("\n","\\\n") + "\n")
$log.debug(stdout.readline)
stdin.write("GETPIN\n")
$log.debug(stdout.readline)
ans = stdout.readline
return nil if ans == "ERR 111 canceled\n"
unless ans =~ /^D (.*)\n$/
raise "Unexpected answer #{ans} from pinentry."
end
$1.gsub("%25","%")
}
end
|
#question(text, options = {}) ⇒ Object
26
27
28
29
|
# File 'lib/libisi/ui/x11.rb', line 26
def question(text, options = {})
system("xmessage", "-buttons","yes,no","-center",text)
$?.exitstatus == 101
end
|