-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathprogram.rb
executable file
·40 lines (34 loc) · 910 Bytes
/
program.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env ruby
# Example for progressbox widget. It is similar to the
# one comes with dialog source code.
# [email protected] Apr-02-2014
require [File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mrdialog'].join('/')
begin
ME = File.basename($0)
if ENV['CHANGE_TITLE']
if ME =~ /(.+)\.rb$/
base = $1
puts "\033]0;mrdialog - #{base}\007"
end
end
text = "Hi, this is a gauge widget"
height = 20
width = 70
percent = 0
dialog = MRDialog.new
dialog.logger = Logger.new(ENV["HOME"] + "/dialog_" + ME + ".log")
dialog.clear = true
dialog.title = "PROGRAMBOX"
description="Description of progress:"
dialog.programbox(description,height, width) do |f|
la = `/bin/ls -l1`.split("\n")
la.each do |l|
f.puts l
sleep 0.05
end
end
rescue => e
puts "#{$!}"
t = e.backtrace.join("\n\t")
puts "Error: #{t}"
end