visualruby 3.0.12 → 3.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.vr_settings.yaml +6 -6
  3. data/examples/alert_box/.vr_settings.yaml +5 -4
  4. data/examples/alert_box/main.rb +8 -0
  5. data/examples/listview/.vr_settings.yaml +5 -8
  6. data/examples/listview/bin/SongListView.rb +9 -9
  7. data/examples/listview/main.rb +1 -1
  8. data/examples/listview_objects/bin/ListViewObjects.rb +8 -8
  9. data/lib/Alert.rb +30 -21
  10. data/lib/GladeGUI.rb +17 -3
  11. data/lib/oinspect/MethodsListView.rb +11 -10
  12. data/lib/oinspect/ObjectInspectorGUI.rb +36 -20
  13. data/lib/oinspect/VariablesListView.rb +31 -30
  14. data/lib/oinspect/glade/ObjectInspectorGUI.glade +90 -12
  15. data/lib/treeview/FileTreeView.rb +23 -6
  16. data/lib/treeview/IterMethods.rb +66 -66
  17. data/lib/treeview/ListView.rb +5 -5
  18. data/lib/treeview/ViewCommon.rb +43 -23
  19. data/lib/treeview/columns/{TextCol.rb → BlobCol.rb} +6 -6
  20. data/lib/treeview/columns/CalendarCol.rb +23 -27
  21. data/lib/treeview/columns/CellRendererCombo.rb +1 -1
  22. data/lib/treeview/columns/CellRendererObject.rb +1 -1
  23. data/lib/treeview/columns/CellRendererProgress.rb +17 -17
  24. data/lib/treeview/columns/CellRendererSpin.rb +1 -1
  25. data/lib/treeview/columns/CellRendererText.rb +1 -1
  26. data/lib/treeview/columns/CellRendererToggle.rb +3 -3
  27. data/lib/treeview/columns/ComboCol.rb +1 -1
  28. data/lib/treeview/columns/CurrencyCol.rb +1 -1
  29. data/lib/treeview/columns/ImageCol.rb +1 -1
  30. data/lib/treeview/columns/ProgressCol.rb +4 -4
  31. data/lib/treeview/columns/SpinCol.rb +1 -1
  32. data/lib/treeview/columns/TreeViewColumn.rb +15 -20
  33. data/src/main/VR_File_Tree.rb +2 -3
  34. data/src/main/VR_Main.rb +12 -0
  35. data/src/main/glade/VR_Main.glade +14 -0
  36. metadata +3 -10
  37. data/lib/IconHash.rb +0 -18
  38. data/lib/SimpleComboBoxEntry.rb +0 -8
  39. data/lib/treeview/columns/CellRendererDate.rb +0 -45
  40. data/lib/treeview/columns/CellRendererPhone.rb +0 -45
  41. data/lib/treeview/columns/CellRendererPixbuf.rb +0 -16
  42. data/lib/treeview/columns/DateCol.rb +0 -20
  43. data/src/main/ProjectChooserView.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae3044be7b06f6583c01cda072b8f054fb3f5fa2
4
- data.tar.gz: 4b1e38749d8e1bd0e1f9483b12a8523426928ba5
3
+ metadata.gz: 46e25870adcbfcac92e861c3a44e7fb4f0f4d9c8
4
+ data.tar.gz: 042fb3b507391b4a93ec6c9ffe3d6e5d947de7cb
5
5
  SHA512:
6
- metadata.gz: 2607f28bdc75a46bfc35b6782030644e96175afe3f8bf21b81588f1f9ed7d52ed4c61160dd56dae3d9dd830f702dfd15d3b2f86b0c04d84aecdfb47f2e663731
7
- data.tar.gz: 6849a85e9a11d753fdf5ebde6a70f3029ca07510d23fc468271dd1e684e1487f6ca2cbfe0829564358ce37085bfca80246836f48317451bcab903d1f8ee059bc
6
+ metadata.gz: 88abd7c46b358b2432058b6aebec7471817d5e0e7ee84e9d0f4a3b4238c64927eb6a4e131360966b85677033fc99ff6d9322b584c7fc1e35bb2db477b7f56340
7
+ data.tar.gz: f079967a87e8de4ea1f4c294bdb40deda0899a983685ff52e9d0d04f688efae5fa6407f7246e880390107ab32761469b18a825d4359badc93b10468e7ab1ab4e
data/.vr_settings.yaml CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:VR_ENV
2
2
  vr_yaml_file: ".vr_settings.yaml"
3
- width: 1142
4
- height: 695
3
+ width: 1308
4
+ height: 761
5
5
  panel_pos: 360
6
6
  notebook_panel_position: 400
7
- run_command_line: ruby main.rb
7
+ run_command_line: ruby vr
8
8
  open_files:
9
- - "/home/eric/vrp/vr3/src/main/NewProjectGUI.rb"
9
+ - "/home/eric/vrp/vr3/Untitled"
10
10
  open_folders:
11
11
  - "/home/eric/vrp/vr3"
12
- current_file: "/home/eric/vrp/vr3/src/main/NewProjectGUI.rb"
13
- current_line: 22
12
+ current_file: "/home/eric/vrp/vr3/Untitled"
13
+ current_line: 1
14
14
  rdoc_command_line: yardoc lib - site/*.*
15
15
  builder: !ruby/object:Gtk::Builder {}
16
16
  top_level_window: false
@@ -1,7 +1,9 @@
1
1
  --- !ruby/object:VR_ENV
2
+ vr_yaml_file: ".vr_settings.yaml"
2
3
  width: 1329
3
4
  height: 753
4
5
  panel_pos: 513
6
+ notebook_panel_position: 400
5
7
  run_command_line: ruby main.rb
6
8
  open_files:
7
9
  - "/home/eric/vrp/vr3/examples/alert_box/bin/AlertBoxDemo.rb"
@@ -9,9 +11,8 @@ open_files:
9
11
  open_folders:
10
12
  - "/home/eric/vrp/vr3/examples/alert_box"
11
13
  - "/home/eric/vrp/vr3/examples/alert_box/bin"
12
- current_file: "/home/eric/vrp/vr3/examples/alert_box/bin/AlertBoxDemo.rb"
14
+ - "/home/eric/vrp/vr3/examples/alert_box/bin/glade"
15
+ current_file: "/home/eric/vrp/vr3/examples/alert_box/main.rb"
16
+ current_line: 9
13
17
  rdoc_command_line: rdoc -x README
14
- vr_yaml_file: ".vr_settings.yaml"
15
- notebook_panel_position: 400
16
- current_line: 61
17
18
  settings_file_version: 1
@@ -6,7 +6,15 @@ require File.exists?("./../../vrlib/vrlib.rb") ? "./../../vrlib/vrlib.rb" : "vr
6
6
  # from require_all gem:
7
7
  require_rel 'bin/'
8
8
 
9
+ alert "The file you selected is already on disk. Do you want to overwrite it?",
10
+ headline: "Overwrite FIle?",
11
+ button_yes: "Overwrite",
12
+ button_no: "Reload From Disk",
13
+ button_cancel: "Cancel"
9
14
 
10
15
 
16
+
17
+
18
+
11
19
  AlertBoxDemo.new.show_glade()
12
20
 
@@ -1,19 +1,16 @@
1
1
  --- !ruby/object:VR_ENV
2
+ vr_yaml_file: ".vr_settings.yaml"
2
3
  width: 1251
3
4
  height: 691
4
5
  panel_pos: 322
6
+ notebook_panel_position: 437
5
7
  run_command_line: ruby main.rb
6
8
  open_files:
7
- - "/home/eric/vrp/vr3/examples/listview/main.rb"
8
9
  - "/home/eric/vrp/vr3/examples/listview/bin/SongListViewGUI.rb"
9
- - "/home/eric/vrp/vr3/examples/listview/bin/SongListView.rb"
10
+ - "/home/eric/vrp/vr3/examples/listview/main.rb"
10
11
  open_folders:
11
12
  - "/home/eric/vrp/vr3/examples/listview"
12
- - "/home/eric/vrp/vr3/examples/listview/bin"
13
- - "/home/eric/vrp/vr3/examples/listview/bin/glade"
14
- current_file: "/home/eric/vrp/vr3/examples/listview/bin/SongListViewGUI.rb"
13
+ current_file: "/home/eric/vrp/vr3/examples/listview/main.rb"
14
+ current_line: 4
15
15
  rdoc_command_line: rdoc -x README
16
- vr_yaml_file: ".vr_settings.yaml"
17
- notebook_panel_position: 437
18
- current_line: 22
19
16
  filename: ".vr_settings.yaml"
@@ -14,14 +14,14 @@ class SongListView < VR::ListView
14
14
  def initialize
15
15
  @cols = {}
16
16
  @cols[:pix] = {:pix => Gdk::Pixbuf, :song => String } #two renderers in this column
17
- @cols[:date] = VR::CalendarCol # DateTime
17
+ @cols[:date] = VR::Col::CalendarCol # DateTime
18
18
  @cols[:artist] = String
19
19
  @cols[:first_name] = String
20
20
  @cols[:last_name] = String
21
- @cols[:popular] = VR::ProgressCol
22
- @cols[:buy] = VR::ComboCol
23
- @cols[:quantity] = VR::SpinCol
24
- @cols[:price] = VR::CurrencyCol
21
+ @cols[:popular] = VR::Col::ProgressCol
22
+ @cols[:buy] = VR::Col::ComboCol
23
+ @cols[:quantity] = VR::Col::SpinCol
24
+ @cols[:price] = VR::Col::CurrencyCol
25
25
  @cols[:check] = TrueClass
26
26
  super(@cols)
27
27
 
@@ -66,12 +66,12 @@ class SongListView < VR::ListView
66
66
  row[id(:last_name)] = data[i][1]
67
67
  row[id(:artist)] = row[id(:first_name)] + " " + row[id(:last_name)]
68
68
  row[id(:song)] = data[i][2]
69
- row[id(:quantity)] = VR::SpinCol.new(0,0,100,1) # Gtk::Adjustment.new(0,0,100,1,0,0) #
70
- row[id(:price)] = VR::CurrencyCol.new(2.99)
69
+ row[id(:quantity)] = VR::Col::SpinCol.new(0,0,100,1) # Gtk::Adjustment.new(0,0,100,1,0,0) #
70
+ row[id(:price)] = VR::Col::CurrencyCol.new(2.99)
71
71
  row[id(:popular)] = data[i][3]
72
- row[id(:buy)] = VR::ComboCol.new("Buy", "Buy", "Rent", "Listen") # all rows use the same combobox
72
+ row[id(:buy)] = VR::Col::ComboCol.new("Buy", "Buy", "Rent", "Listen") # all rows use the same combobox
73
73
  row[id(:check)] = false
74
- row[id(:date)] = VR::CalendarCol.new(data[i][4], :format => "%d %b %Y ", :hide_time=>true, :hide_date => false)
74
+ row[id(:date)] = VR::Col::CalendarCol.new(data[i][4], :format => "%d %b %Y ", :hide_time=>true, :hide_date => false)
75
75
  end
76
76
 
77
77
  end
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
3
  # ignore -- this is for development, same as require 'vrlib'
4
- require File.exists?("./../../vrlib/vrlib.rb") ? "./../../vrlib/vrlib.rb" : "vrlib"
4
+ require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
5
5
 
6
6
  # from require_all gem:
7
7
  require_rel 'bin/'
@@ -7,9 +7,9 @@ class ListViewObjects < VR::ListView
7
7
 
8
8
  #define column types, then call super()
9
9
  @cols = {}
10
- @cols[:join] = VR::CalendarCol
10
+ @cols[:join] = VR::Col::CalendarCol
11
11
  @cols[:name] = DataObject
12
- @cols[:quote] = VR::TextCol
12
+ @cols[:quote] = VR::Col::BlobCol
13
13
  super(@cols)
14
14
  col_title(:join => "Joined On", :name => "Name (email)", :quote => "Favorite Quote")
15
15
  col_width(:join => 200, :name => 300)
@@ -20,17 +20,17 @@ class ListViewObjects < VR::ListView
20
20
 
21
21
  def populate_data() # just populates model with random data
22
22
  row = add_row()
23
- row[:join] = VR::CalendarCol.new DateTime.new(2011, 1, 15, 7, 23, 0)
23
+ row[:join] = VR::Col::CalendarCol.new DateTime.new(2011, 1, 15, 7, 23, 0)
24
24
  row[:name] = DataObject.new("Henry Johnson", "18458 S Beauford St.", "hohohoja@email.net", "154-453-8585")
25
- row[:quote] = VR::TextCol.new "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth.\n\n- Umberto Eco"
25
+ row[:quote] = VR::Col::BlobCol.new "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth.\n\n- Umberto Eco"
26
26
  row = add_row()
27
- row[:join] = VR::CalendarCol.new DateTime.new(1997, 7, 24, 3, 26, 0)
27
+ row[:join] = VR::Col::CalendarCol.new DateTime.new(1997, 7, 24, 3, 26, 0)
28
28
  row[:name] = DataObject.new("Theo Alexander", "935 Medford Ln.", "noreply@gmail.com", "586-673-9474")
29
- row[:quote] = VR::TextCol.new "The instinct of nearly all societies is to lock up anybody who is truly free. First, society begins by trying to beat you up. If this fails, they try to poison you. If this fails too, they finish by loading honors on your head.\n\n- Jean Cocteau (1889-1963)"
29
+ row[:quote] = VR::Col::BlobCol.new "The instinct of nearly all societies is to lock up anybody who is truly free. First, society begins by trying to beat you up. If this fails, they try to poison you. If this fails too, they finish by loading honors on your head.\n\n- Jean Cocteau (1889-1963)"
30
30
  row = add_row()
31
- row[:join] = VR::CalendarCol.new DateTime.new(1987, 5, 11, 6, 43, 0)
31
+ row[:join] = VR::Col::CalendarCol.new DateTime.new(1987, 5, 11, 6, 43, 0)
32
32
  row[:name] = DataObject.new("Billy Vincent", "675 Telegraph Rd.", "jimmy@visualruby.net", "432-485-5863")
33
- row[:quote] = VR::TextCol.new "There are two ways of constructing a software design; one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.\n\n- C. A. R. Hoare"
33
+ row[:quote] = VR::Col::BlobCol.new "There are two ways of constructing a software design; one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.\n\n- C. A. R. Hoare"
34
34
  end
35
35
 
36
36
 
data/lib/Alert.rb CHANGED
@@ -47,16 +47,29 @@ module VR
47
47
  @builder[:window1].destroy
48
48
  end
49
49
 
50
+ # Helper to VR::Alert so :answer can be passed by reference.
51
+ class DialogAnswer # :nodoc:
52
+ attr_accessor :answer
53
+ end
50
54
 
51
55
  end
52
56
 
53
- #so it can be passed by reference
54
- class DialogAnswer # :nodoc:
55
- attr_accessor :answer
56
- end
57
-
58
57
  end
59
58
 
59
+ # @param [String] message text message to display in alert box. Uses markup.
60
+ # @param [Hash] options -- Hash of options: :button_yes => text on the button that returns true.
61
+ # @option options [String] :button_yes Text that appears on the "yes" button.
62
+ # @option options [String] :button_no Text taht appears on "no" button. (set to make no button appear)
63
+ # @option options [String] :button_cancel Text taht appears on "cancel" button. (set to make cancel button appear)
64
+ # @option options [String] :input_text Text that appears in entry box. (set to make entry box appear)
65
+ # @option options [String] :headline Larger headline over text message.
66
+ # @option options [String] :title Title of the alert box window. Defaults to :headline.
67
+ # @option options [Integer] :width The width in pixels of the window for wrapping text.
68
+ # @option options [Object #builder] :parent The window that the alert box is always on top of.
69
+ # @return [String] text in the text entry field when the :button_yes button is pressed
70
+ # @return [true] When the :button_yes button is selected and there's no text entry box.
71
+ # @return [false] When :button_no is pressed
72
+ # @return [nil] When :button_cancel os the "X" button is pressed.
60
73
  # The alert method creates a pop-up alert in your program. It creates a modal
61
74
  # window that halts execution of your code until the user closes it. Its great
62
75
  # for displaying messages and debugging. It also has the option of displaying
@@ -66,7 +79,16 @@ end
66
79
  #
67
80
  # @example
68
81
  # alert("Continue?", button_no: "Nope", button_cancel: "Quit", parent: self)
69
- #
82
+ #
83
+ # @example
84
+ # alert "The file you selected is already on disk. Do you want to overwrite it?",
85
+ # headline: "Overwrite FIle?",
86
+ # button_yes: "Overwrite",
87
+ # button_no: "Reload From Disk",
88
+ # button_cancel: "Cancel"
89
+ #
90
+ # http://visualruby.net/img/alert_overwrite.jpg
91
+ #
70
92
  # The alert box can disply 1, 2 or 3 buttons. The first button is denoted using the symbol: :button_yes
71
93
  # button and is always displayed. You can add :button_no and :button_cancel.
72
94
  # If you want to add these buttons, just set their values to whatever text you want them to
@@ -74,22 +96,9 @@ end
74
96
  # appear.
75
97
  #
76
98
  # There are many examples in the "alert_box" example project.
77
- # @param [String] message text message to display in alert box. Uses markup.
78
- # @param [Hash] options -- Hash of options: :button_yes => text on the button that returns true.
79
- # @option options [String] :button_yes Text that appears on the "yes" button.
80
- # @option options [String] :button_no Text taht appears on "no" button. (set to make no button appear)
81
- # @option options [String] :button_cancel Text taht appears on "cancel" button. (set to make cancel button appear)
82
- # @option options [String] :input_text Text that appears in entry box. (set to make entry box appear)
83
- # @option options [String] :headline Larger headline over text message.
84
- # @option options [String] :title Title of the alert box window. Defaults to :headline.
85
- # @option options [Integer] :width The width in pixels of the window for wrapping text.
86
- # @option options [Object #builder] :parent The window that the alert box is always on top of.
87
- # @return [String] text in the text entry field when the :button_yes button is pressed
88
- # @return [true] When the :button_yes button is selected and there's no text entry box.
89
- # @return [false] When :button_no is pressed
90
- # @return [nil] When :button_cancel os the "X" button is pressed.
99
+
91
100
  def alert(message, options = {})
92
- @answer = VR::DialogAnswer.new()
101
+ @answer = VR::Alert::DialogAnswer.new()
93
102
  VR::Alert.new(message, @answer, options).show_glade(options[:parent])
94
103
  return @answer.answer
95
104
  end
data/lib/GladeGUI.rb CHANGED
@@ -16,7 +16,7 @@
16
16
  # class MyClass
17
17
  # include GladeGUI
18
18
  # ...
19
- # End
19
+ # end
20
20
  #
21
21
  # GladeGUI will load a corresponding
22
22
  # glade file for this class. It knows which glade file to load by using a naming
@@ -86,7 +86,7 @@
86
86
  # set_glade_variables() method.)
87
87
  module GladeGUI
88
88
 
89
- # @attribute A Builder object that holds references to everyhting from the galde form.
89
+ # @attribute A Builder object that holds references to everything from the galde form.
90
90
  attr_accessor :builder
91
91
 
92
92
  ##
@@ -397,6 +397,7 @@ end
397
397
  parse_signals()
398
398
  set_glade_all()
399
399
  @builder[:window1].show #show_all can't hide widgets in before_show
400
+ # @builder[:window1].add_events(Gdk::EventMask.new(:key_press))
400
401
  @top_level_window = Gtk.main_level == 0 ? true : false
401
402
  Gtk.main if @top_level_window or @builder[:window1].modal? #need new Gtk.main for blocking!
402
403
  end
@@ -413,6 +414,12 @@ end
413
414
  @builder[:window1].destroy
414
415
  end
415
416
 
417
+ def self__key_press_event(view, evt)
418
+ return unless evt.keyval == 65535 # Gdk::Keyval::GDK_F3
419
+ oinspect
420
+ end
421
+
422
+
416
423
  #
417
424
  # private def active_record_valid?(show_errors = true)
418
425
  # get_glade_all
@@ -426,5 +433,12 @@ end
426
433
 
427
434
 
428
435
  end
429
-
436
+
437
+
438
+ # Waits for all penting events to finish before continuing.
439
+ def clear_events()
440
+ while (Gtk.events_pending?)
441
+ Gtk.main_iteration
442
+ end
443
+ end
430
444
 
@@ -1,16 +1,17 @@
1
+ module VR::ObjectInspector
1
2
 
2
- class MethodsListView < VR::ListView
3
+ class MethodsListView < VR::ListView
3
4
 
4
- def initialize(obj)
5
- super(:method => String, :arity => String, :parameters => String)
6
- obj.methods.each do |meth|
7
- row = add_row
8
- row[:method] = meth.to_s
9
- row[:arity] = obj.method(meth).arity.to_s
10
- row[:parameters] = obj.method(meth).parameters.to_s
5
+ def initialize(obj)
6
+ super(:method => String, :arity => String, :parameters => String)
7
+ obj.public_methods.each do |meth|
8
+ row = add_row
9
+ row[:method] = meth.to_s
10
+ row[:arity] = obj.method(meth).arity.to_s
11
+ row[:parameters] = obj.method(meth).parameters.to_s
12
+ end
11
13
  end
12
- end
13
-
14
14
 
15
+ end
15
16
 
16
17
  end
@@ -1,26 +1,42 @@
1
+ module VR::ObjectInspector
1
2
 
2
- class ObjectInspectorGUI
3
-
4
- include GladeGUI
3
+ class ObjectInspectorGUI
4
+
5
+ include GladeGUI
5
6
 
6
- def initialize(obj)
7
- @obj = obj
8
- @obj_to_s = obj.to_s
9
- @meth_view = MethodsListView.new(@obj)
10
- @var_view = VariablesListView.new(@obj)
11
- end
7
+ def initialize(obj=self)
8
+ @obj = obj
9
+ @obj_to_s = obj.to_s
10
+ @meth_view = MethodsListView.new(@obj)
11
+ @var_view = VariablesListView.new(@obj)
12
+ end
13
+
14
+ def before_show()
15
+ @headline = "<big><big>#{@obj.class.name} (ID: #{@obj.__id__})</big></big>"
16
+ @builder[:scrolledwindow1].add @meth_view
17
+ @builder[:scrolledwindow2].add @var_view
18
+ @builder[:paned1].position = 400
19
+ @builder[:window1].show_all
20
+ end
21
+
22
+ def var_view__row_activated(*args)
23
+ row = @var_view.selected_rows.first
24
+ oinspect row[:obj]
25
+ end
12
26
 
13
- def before_show()
14
- @headline = "<big><big>#{@obj.class.name} (ID: #{@obj.__id__})</big></big>"
15
- @builder[:scrolledwindow1].add @meth_view
16
- @builder[:scrolledwindow2].add @var_view
17
- @builder[:paned1].position = 400
18
- @builder[:window1].show_all
19
- end
20
-
21
- def var_view__row_activated(*args)
22
- row = @var_view.selected_rows.first
23
- oinspect row[:obj]
24
27
  end
25
28
 
26
29
  end
30
+
31
+ # @param [Object] obj Any object that you want to display.
32
+ # @return none.
33
+ # Displays object on screen and halts the program. Anywhere in your code you can halt
34
+ # the execution, and display an object in a window like this:
35
+ # alert anyobject
36
+ #
37
+ # http://visualruby.net/img/object_inspector.jpg
38
+ #
39
+ def oinspect(obj=self)
40
+ VR::ObjectInspector::ObjectInspectorGUI.new(obj).show_glade()
41
+ end
42
+
@@ -1,38 +1,39 @@
1
+ module VR::ObjectInspector
1
2
 
2
- class VariablesListView < VR::ListView
3
+ class VariablesListView < VR::ListView
3
4
 
4
- def initialize(obj)
5
- super(variable: String, type: String, class: String, value: String, obj: Object)
6
- obj.instance_variables.each do |var|
7
- row = add_row
8
- row[:variable] = var.to_s
9
- row[:class] = obj.instance_variable_get(var).class.name
10
- row[:value] = obj.instance_variable_get(var).to_s
11
- row[:type] = "var"
12
- row[:obj] = obj.instance_variable_get(var)
13
- end
14
- if obj.is_a?(Hash)
15
- obj.each do |key, val|
16
- row = add_row
17
- row[:variable] = key.to_s
18
- row[:class] = val.class.name
19
- row[:value] = val.to_s
20
- row[:type] = "key"
21
- row[:obj] = val
5
+ def initialize(obj)
6
+ super(variable: String, type: String, class: String, value: String, obj: Object)
7
+ obj.instance_variables.each do |var|
8
+ row = add_row
9
+ row[:variable] = var.to_s
10
+ row[:class] = obj.instance_variable_get(var).class.name
11
+ row[:value] = obj.instance_variable_get(var).to_s
12
+ row[:type] = "var"
13
+ row[:obj] = obj.instance_variable_get(var)
22
14
  end
23
- end
24
- if obj.is_a?(Array)
25
- obj.each_index do |i|
26
- row = add_row
27
- row[:variable] = i.to_s
28
- row[:class] = obj[i].class.name
29
- row[:value] = obj[i].to_s
30
- row[:type] = "index"
31
- row[:obj] = obj[i]
15
+ if obj.is_a?(Hash)
16
+ obj.each do |key, val|
17
+ row = add_row
18
+ row[:variable] = key.to_s
19
+ row[:class] = val.class.name
20
+ row[:value] = val.to_s
21
+ row[:type] = "key"
22
+ row[:obj] = val
23
+ end
24
+ end
25
+ if obj.is_a?(Array)
26
+ obj.each_index do |i|
27
+ row = add_row
28
+ row[:variable] = i.to_s
29
+ row[:class] = obj[i].class.name
30
+ row[:value] = obj[i].to_s
31
+ row[:type] = "index"
32
+ row[:obj] = obj[i]
33
+ end
32
34
  end
33
35
  end
34
- end
35
-
36
36
 
37
+ end
37
38
 
38
39
  end
@@ -3,11 +3,11 @@
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.0"/>
5
5
  <object class="GtkWindow" id="window1">
6
- <property name="width_request">1000</property>
7
- <property name="height_request">600</property>
8
6
  <property name="can_focus">False</property>
9
7
  <property name="title" translatable="yes">Object Inspector</property>
10
8
  <property name="modal">True</property>
9
+ <property name="default_width">1000</property>
10
+ <property name="default_height">700</property>
11
11
  <child>
12
12
  <object class="GtkBox" id="box1">
13
13
  <property name="visible">True</property>
@@ -32,14 +32,40 @@
32
32
  </packing>
33
33
  </child>
34
34
  <child>
35
- <object class="GtkScrolledWindow" id="scroll_to_s">
35
+ <object class="GtkFrame" id="frame2">
36
36
  <property name="visible">True</property>
37
- <property name="can_focus">True</property>
37
+ <property name="can_focus">False</property>
38
+ <property name="label_xalign">0</property>
38
39
  <property name="shadow_type">in</property>
39
40
  <child>
40
- <object class="GtkTextView" id="obj_to_s">
41
+ <object class="GtkAlignment" id="alignment2">
41
42
  <property name="visible">True</property>
42
- <property name="can_focus">True</property>
43
+ <property name="can_focus">False</property>
44
+ <property name="left_padding">12</property>
45
+ <child>
46
+ <object class="GtkScrolledWindow" id="scrolledwindow3">
47
+ <property name="visible">True</property>
48
+ <property name="can_focus">True</property>
49
+ <property name="margin_right">10</property>
50
+ <property name="margin_top">3</property>
51
+ <property name="margin_bottom">8</property>
52
+ <property name="shadow_type">in</property>
53
+ <child>
54
+ <object class="GtkTextView" id="obj_to_s">
55
+ <property name="visible">True</property>
56
+ <property name="can_focus">True</property>
57
+ </object>
58
+ </child>
59
+ </object>
60
+ </child>
61
+ </object>
62
+ </child>
63
+ <child type="label">
64
+ <object class="GtkLabel" id="label2">
65
+ <property name="visible">True</property>
66
+ <property name="can_focus">False</property>
67
+ <property name="label" translatable="yes">&lt;big&gt;to_s&lt;/big&gt;</property>
68
+ <property name="use_markup">True</property>
43
69
  </object>
44
70
  </child>
45
71
  </object>
@@ -54,12 +80,38 @@
54
80
  <property name="visible">True</property>
55
81
  <property name="can_focus">True</property>
56
82
  <child>
57
- <object class="GtkScrolledWindow" id="scrolledwindow1">
83
+ <object class="GtkFrame" id="frame3">
58
84
  <property name="visible">True</property>
59
- <property name="can_focus">True</property>
85
+ <property name="can_focus">False</property>
86
+ <property name="label_xalign">0</property>
60
87
  <property name="shadow_type">in</property>
61
88
  <child>
62
- <placeholder/>
89
+ <object class="GtkAlignment" id="alignment3">
90
+ <property name="visible">True</property>
91
+ <property name="can_focus">False</property>
92
+ <property name="left_padding">12</property>
93
+ <child>
94
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
95
+ <property name="visible">True</property>
96
+ <property name="can_focus">True</property>
97
+ <property name="margin_right">10</property>
98
+ <property name="margin_top">3</property>
99
+ <property name="margin_bottom">8</property>
100
+ <property name="shadow_type">in</property>
101
+ <child>
102
+ <placeholder/>
103
+ </child>
104
+ </object>
105
+ </child>
106
+ </object>
107
+ </child>
108
+ <child type="label">
109
+ <object class="GtkLabel" id="label3">
110
+ <property name="visible">True</property>
111
+ <property name="can_focus">False</property>
112
+ <property name="label" translatable="yes">&lt;big&gt;public methods&lt;/big&gt;</property>
113
+ <property name="use_markup">True</property>
114
+ </object>
63
115
  </child>
64
116
  </object>
65
117
  <packing>
@@ -68,12 +120,38 @@
68
120
  </packing>
69
121
  </child>
70
122
  <child>
71
- <object class="GtkScrolledWindow" id="scrolledwindow2">
123
+ <object class="GtkFrame" id="frame4">
72
124
  <property name="visible">True</property>
73
- <property name="can_focus">True</property>
125
+ <property name="can_focus">False</property>
126
+ <property name="label_xalign">0</property>
74
127
  <property name="shadow_type">in</property>
75
128
  <child>
76
- <placeholder/>
129
+ <object class="GtkAlignment" id="alignment4">
130
+ <property name="visible">True</property>
131
+ <property name="can_focus">False</property>
132
+ <property name="left_padding">12</property>
133
+ <child>
134
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
135
+ <property name="visible">True</property>
136
+ <property name="can_focus">True</property>
137
+ <property name="margin_right">10</property>
138
+ <property name="margin_top">5</property>
139
+ <property name="margin_bottom">8</property>
140
+ <property name="shadow_type">in</property>
141
+ <child>
142
+ <placeholder/>
143
+ </child>
144
+ </object>
145
+ </child>
146
+ </object>
147
+ </child>
148
+ <child type="label">
149
+ <object class="GtkLabel" id="label4">
150
+ <property name="visible">True</property>
151
+ <property name="can_focus">False</property>
152
+ <property name="label" translatable="yes">&lt;big&gt;instance variables, array, hash values&lt;/big&gt;</property>
153
+ <property name="use_markup">True</property>
154
+ </object>
77
155
  </child>
78
156
  </object>
79
157
  <packing>