Class: KdeUI
Instance Method Summary
collapse
Methods inherited from BaseUI
#bell, #colorize, #enable_progress_bar, #name, #not_implemented, #pinc, #pmsg, #progress_bar, #progress_bar_enabled?, #question_yes_no, #question_yes_no_retry, #select, #select_index
Instance Method Details
#error(text) ⇒ Object
38
39
40
|
# File 'lib/libisi/ui/kde.rb', line 38
def error(text)
kdialog("--error", text)
end
|
#execute_in_console(command, options = {}) ⇒ Object
86
87
88
89
90
91
92
|
# File 'lib/libisi/ui/kde.rb', line 86
def execute_in_console(command, options = {})
command = command_line_parse(command)
konsole = ["konsole", "-T", command.join(" "), "--nomenubar","--noframe","-e"]
new_command = konsole + command
$log.debug("Executing konsole command #{new_command.inspect}")
system(*new_command)
end
|
#info(text, options = {}) ⇒ Object
32
33
34
|
# File 'lib/libisi/ui/kde.rb', line 32
def info(text, options = {})
kdialog("--msgbox", text)
end
|
#info_non_blocking(text, options = {}) ⇒ Object
35
36
37
|
# File 'lib/libisi/ui/kde.rb', line 35
def info_non_blocking(text, options = {})
system("xmessage", "-timeout", "5", "-center",text)
end
|
#kdialog(option, text) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/libisi/ui/kde.rb', line 20
def kdialog(option, text)
$log.debug("Kdialog: #{option.inspect} #{text.inspect}")
ret = system("kdialog",option, text)
$log.debug("Kdialog ret: #{ret.inspect}")
ret
end
|
#password(text) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/libisi/ui/kde.rb', line 41
def password(text)
$log.debug("Kdialog passwod: #{text.inspect}")
pw = open("|kdialog --password \"#{text}\"") {|f|
f.readlines.join.gsub(/\n$/,"")
}
if $?.exitstatus == 0
$log.debug("Pwlength: #{pw.length}")
pw
else
$log.debug("Pw: nil")
nil
end
end
|
#progress(count) ⇒ Object
72
73
74
75
76
|
# File 'lib/libisi/ui/kde.rb', line 72
def progress(count)
return unless @pbar
@pbar_progress = count
system("dcop",@pbar,"setProgress",count.to_s)
end
|
#progress_bar_implementation(text, total) ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/libisi/ui/kde.rb', line 55
def progress_bar_implementation(text,total)
ret = nil
begin
@pbar_progress = 0
@pbar = open("|kdialog --progressbar '#{text.gsub("'","\\'")}' #{total}") {|f| f.readlines.join.strip}
ret = yield
pmsg
system("dcop",@pbar,"close")
@pbar = nil
ensure
if @pbar
system("dcop",@pbar,"close")
@pbar = nil
end
end
ret
end
|
#progress_inc ⇒ Object
82
83
84
|
# File 'lib/libisi/ui/kde.rb', line 82
def progress_inc
progress(@pbar_progress + 1)
end
|
#progress_message(message) ⇒ Object
78
79
80
81
|
# File 'lib/libisi/ui/kde.rb', line 78
def progress_message(message)
return unless @pbar
system("dcop",@pbar,"setLabel",message.to_s)
end
|
#question(text, options = {}) ⇒ Object
26
27
28
|
# File 'lib/libisi/ui/kde.rb', line 26
def question(text, options = {})
kdialog("--yesno", text)
end
|
#warn(text, options = {}) ⇒ Object
29
30
31
|
# File 'lib/libisi/ui/kde.rb', line 29
def warn(text, options = {})
kdialog("--sorry", text)
end
|