mattscilipoti-rdialog 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  +++ 0.5.1 2009-11-03
2
2
  + minor enhancement:
3
+ + Support --yesno dialog
3
4
  + Setup with Jeweller
4
5
 
5
6
  +++ 0.1.0 2007-04-27
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.6.0
@@ -0,0 +1,4 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
+ require 'rdialog'
4
+ require 'rdialog/version'
@@ -11,90 +11,91 @@
11
11
 
12
12
  require 'tempfile'
13
13
  require 'date'
14
- class RDialog
15
- #
14
+ class RDialog
15
+ #.
16
+
16
17
  # All accessors are boolean unless otherwise noted.
17
18
  #
18
-
19
+
19
20
  #
20
- # This gives you some control over the box dimensions when
21
- # using auto sizing (specifying 0 for height and width).
22
- # It represents width / height. The default is 9,
21
+ # This gives you some control over the box dimensions when
22
+ # using auto sizing (specifying 0 for height and width).
23
+ # It represents width / height. The default is 9,
23
24
  # which means 9 characters wide to every 1 line high.
24
25
  #
25
26
  attr_accessor :aspect
26
-
27
+
27
28
  #
28
- # Specifies a backtitle string to be displayed on the backdrop,
29
+ # Specifies a backtitle string to be displayed on the backdrop,
29
30
  # at the top of the screen.
30
31
  #
31
32
  attr_accessor :backtitle
32
-
33
+
33
34
  #
34
35
  # Sound the audible alarm each time the screen is refreshed.
35
36
  #
36
37
  attr_accessor :beep
37
-
38
+
38
39
  #
39
40
  # Specify the position of the upper left corner of a dialog box
40
41
  # on the screen, as an array containing two integers.
41
42
  #
42
43
  attr_accessor :begin
43
-
44
+
44
45
  #
45
- # Interpret embedded newlines in the dialog text as a newline
46
- # on the screen. Otherwise, dialog will only wrap lines where
47
- # needed to fit inside the text box. Even though you can control
48
- # line breaks with this, dialog will still wrap any lines that are
46
+ # Interpret embedded newlines in the dialog text as a newline
47
+ # on the screen. Otherwise, dialog will only wrap lines where
48
+ # needed to fit inside the text box. Even though you can control
49
+ # line breaks with this, dialog will still wrap any lines that are
49
50
  # too long for the width of the box. Without cr-wrap, the layout
50
- # of your text may be formatted to look nice in the source code of
51
+ # of your text may be formatted to look nice in the source code of
51
52
  # your script without affecting the way it will look in the dialog.
52
53
  #
53
54
  attr_accessor :crwrap
54
-
55
+
55
56
  #
56
- # Interpret the tags data for checklist, radiolist and menuboxes
57
- # adding a column which is displayed in the bottom line of the
57
+ # Interpret the tags data for checklist, radiolist and menuboxes
58
+ # adding a column which is displayed in the bottom line of the
58
59
  # screen, for the currently selected item.
59
60
  #
60
61
  attr_accessor :itemhelp
61
62
 
62
63
  #
63
- # Suppress the "Cancel" button in checklist, inputbox and menubox
64
- # modes. A script can still test if the user pressed the ESC key to
64
+ # Suppress the "Cancel" button in checklist, inputbox and menubox
65
+ # modes. A script can still test if the user pressed the ESC key to
65
66
  # cancel to quit.
66
67
  #
67
68
  attr_accessor :nocancel
68
-
69
+
69
70
  #
70
71
  # Draw a shadow to the right and bottom of each dialog box.
71
- #
72
+ #
72
73
  attr_accessor :shadow
73
-
74
+
74
75
  #
75
- # Sleep (delay) for the given integer of seconds after processing
76
+ # Sleep (delay) for the given integer of seconds after processing
76
77
  # a dialog box.
77
78
  #
78
79
  attr_accessor :sleep
79
-
80
+
80
81
  #
81
- # Convert each tab character to one or more spaces.
82
- # Otherwise, tabs are rendered according to the curses library's
82
+ # Convert each tab character to one or more spaces.
83
+ # Otherwise, tabs are rendered according to the curses library's
83
84
  # interpretation.
84
85
  #
85
86
  attr_accessor :tabcorrect
86
-
87
+
87
88
  #
88
- # Specify the number(int) of spaces that a tab character occupies
89
+ # Specify the number(int) of spaces that a tab character occupies
89
90
  # if the tabcorrect option is set true. The default is 8.
90
91
  #
91
92
  attr_accessor :tablen
92
-
93
+
93
94
  #
94
95
  # Title string to be displayed at the top of the dialog box.
95
96
  #
96
97
  attr_accessor :title
97
-
98
+
98
99
  #
99
100
  # Alternate path to dialog. If this is not set, environment path
100
101
  # is used.
@@ -119,9 +120,9 @@ class RDialog
119
120
 
120
121
  tmp = Tempfile.new('tmp')
121
122
 
122
- command = option_string() + "--calendar \"" + text.to_s +
123
- "\" " + height.to_i.to_s + " " + width.to_i.to_s + " " +
124
- day.to_i.to_s + " " + month.to_i.to_s + " " + year.to_i.to_s +
123
+ command = option_string() + "--calendar \"" + text.to_s +
124
+ "\" " + height.to_i.to_s + " " + width.to_i.to_s + " " +
125
+ day.to_i.to_s + " " + month.to_i.to_s + " " + year.to_i.to_s +
125
126
  " 2> " + tmp.path
126
127
  success = system(command)
127
128
  if success
@@ -131,8 +132,8 @@ class RDialog
131
132
  else
132
133
  tmp.close!
133
134
  return success
134
- end
135
-
135
+ end
136
+
136
137
  end
137
138
 
138
139
  # A checklist box is similar to a menu box; there are multiple
@@ -142,7 +143,7 @@ class RDialog
142
143
  # fied by status.
143
144
 
144
145
  def checklist(text, items, height=0, width=0, listheight=0)
145
-
146
+
146
147
  tmp = Tempfile.new('tmp')
147
148
 
148
149
  itemlist = String.new
@@ -153,7 +154,7 @@ class RDialog
153
154
  else
154
155
  item[2] = "off"
155
156
  end
156
- itemlist += "\"" + item[0].to_s + "\" \"" + item[1].to_s +
157
+ itemlist += "\"" + item[0].to_s + "\" \"" + item[1].to_s +
157
158
  "\" " + item[2] + " "
158
159
 
159
160
  if @itemhelp
@@ -164,7 +165,7 @@ class RDialog
164
165
  command = option_string() + "--checklist \"" + text.to_s +
165
166
  "\" " + height.to_i.to_s + " " + width.to_i.to_s +
166
167
  " " + listheight.to_i.to_s + " " + itemlist + "2> " +
167
- tmp.path
168
+ tmp.path
168
169
  puts command
169
170
  success = system(command)
170
171
  puts success
@@ -333,7 +334,7 @@ class RDialog
333
334
  tmp.close!
334
335
  return success
335
336
  end
336
-
337
+
337
338
  end
338
339
 
339
340
  # A message box is very similar to a yes/no box. The only dif-
@@ -427,7 +428,7 @@ class RDialog
427
428
 
428
429
  command = option_string() + opt +" \"" + file.to_s +
429
430
  "\" " + height.to_i.to_s + " " + width.to_i.to_s + " "
430
-
431
+
431
432
  success = system(command)
432
433
 
433
434
  return success
@@ -447,7 +448,7 @@ class RDialog
447
448
 
448
449
  command = option_string() + "--timebox \"" + text.to_s +
449
450
  "\" " + height.to_i.to_s + " " + width.to_i.to_s + " " +
450
- time.hour.to_s + " " + time.min.to_s + " " +
451
+ time.hour.to_s + " " + time.min.to_s + " " +
451
452
  time.sec.to_s + " 2> " + tmp.path
452
453
  success = system(command)
453
454
  if success
@@ -458,7 +459,7 @@ class RDialog
458
459
  tmp.close!
459
460
  return success
460
461
  end
461
-
462
+
462
463
  end
463
464
 
464
465
  # An input box is useful when you want to ask questions that
@@ -492,7 +493,7 @@ class RDialog
492
493
  rescue EOFError
493
494
  selected_string = ""
494
495
  end
495
- tmp.close!
496
+ tmp.close!
496
497
  return selected_string
497
498
  else
498
499
  tmp.close!
@@ -512,14 +513,14 @@ class RDialog
512
513
  # switch between by pressing the TAB key.
513
514
 
514
515
  def yesno(text="Please enter some text", height=0, width=0)
515
- command = option_string() + "--inputbox \"" + text.to_s +
516
+ command = option_string() + "--yesno \"" + text.to_s +
516
517
  "\" " + height.to_i.to_s + " " + width.to_i.to_s
517
518
 
518
519
  success = system(command)
519
520
  return success
520
521
  end
521
522
 
522
- private
523
+ private
523
524
 
524
525
  def option_string()
525
526
  unless @path_to_dialog
@@ -530,18 +531,18 @@ class RDialog
530
531
  if @aspect
531
532
  ostring += "--aspect " + aspect + " "
532
533
  end
533
-
534
+
534
535
  if @beep
535
536
  ostring += "--beep "
536
537
  end
537
-
538
- if @boxbegin
538
+
539
+ if @boxbegin
539
540
  ostring += "--begin " + @boxbegin[0] + @boxbegin[1] + " "
540
541
  end
541
542
 
542
543
  if @backtitle
543
544
  ostring += "--backtitle \"" + @backtitle + "\" "
544
- end
545
+ end
545
546
 
546
547
  if @itemhelp
547
548
  ostring += "--item-help "
@@ -550,7 +551,7 @@ class RDialog
550
551
  unless @shadow == nil
551
552
  if @shadow == true
552
553
  ostring += "--shadow "
553
- else
554
+ else
554
555
  ostring += "--no-shadow "
555
556
  end
556
557
  end
@@ -1,9 +1,10 @@
1
1
  module Rdialog #:nodoc:
2
- module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 5
5
- TINY = 0
6
-
7
- STRING = [MAJOR, MINOR, TINY].join('.')
2
+ def self.version
3
+ version_file = File.expand_path("../../VERSION", File.dirname(__FILE__))
4
+ File.open( version_file, "r") do |version_file|
5
+ version_file.read.strip
6
+ end
8
7
  end
8
+
9
+ VERSION = Rdialog.version
9
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mattscilipoti-rdialog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleks Clark
@@ -50,7 +50,6 @@ files:
50
50
  - lib/rdialog/version.rb
51
51
  - scripts/txt2html
52
52
  - setup.rb
53
- - test/mattscilipoti-rdialog_test.rb
54
53
  - test/test_helper.rb
55
54
  - test/test_rdialog.rb
56
55
  - website/index.html
@@ -87,6 +86,5 @@ signing_key:
87
86
  specification_version: 3
88
87
  summary: A gem providing a ruby interface to the n-curses dialog generator - 'dialog'.
89
88
  test_files:
90
- - test/mattscilipoti-rdialog_test.rb
91
89
  - test/test_rdialog.rb
92
90
  - test/test_helper.rb
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class MattscilipotiRdialogTest < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end