visualruby 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.vr_settings.yaml +27 -0
  3. data/bin/editor/VR_Document.rb +156 -156
  4. data/bin/editor/VR_TabSearch.rb +37 -37
  5. data/bin/editor/VR_Tabs.rb +82 -82
  6. data/bin/editor/VR_TextShell.rb +49 -52
  7. data/bin/editor/VR_TextViewCommon.rb +31 -31
  8. data/bin/main/GemTree.rb +14 -14
  9. data/bin/main/NewProjectGUI.rb +24 -24
  10. data/bin/main/OpenProject.rb +53 -53
  11. data/bin/main/ProjectChooserView.rb +31 -31
  12. data/bin/main/ProjectTree.rb +17 -17
  13. data/bin/main/RubygemsAPI.rb +73 -63
  14. data/bin/main/VR_ENV.rb +29 -29
  15. data/bin/main/VR_ENV_GLOBAL.rb +52 -52
  16. data/bin/main/VR_File_Tree.rb +88 -88
  17. data/bin/main/VR_Local_Gem_Tree.rb +53 -53
  18. data/bin/main/VR_Main.rb +240 -238
  19. data/bin/main/VR_Remote_Gem_Tree.rb +41 -41
  20. data/bin/main/glade/Splash.glade +19 -0
  21. data/bin/tools/VR_Tools.rb +72 -72
  22. data/examples/active_record/.vr_settings.yaml +50 -0
  23. data/examples/active_record/active_record.rb +2 -2
  24. data/examples/active_record/bin/ChoosePerson.rb +10 -10
  25. data/examples/active_record/bin/Person.rb +6 -6
  26. data/examples/active_record2/.vr_settings.yaml +23 -0
  27. data/examples/active_record2/bin/CompanyGUI.rb +42 -42
  28. data/examples/active_record2/bin/Employee.rb +13 -13
  29. data/examples/active_record2/bin/Employer.rb +5 -5
  30. data/examples/active_record2/bin/Paycheck.rb +5 -5
  31. data/examples/active_record2/main.rb +4 -4
  32. data/examples/alert_box/bin/AlertBoxDemo.rb +40 -50
  33. data/examples/alert_box/bin/glade/AlertBoxDemo.glade +14 -45
  34. data/examples/all_widgets/.vr_settings.yaml +18 -0
  35. data/examples/all_widgets/bin/AllWidgets.rb +19 -16
  36. data/examples/calculator/.vr_settings.yaml +18 -0
  37. data/examples/calculator/bin/Calculator.rb +22 -22
  38. data/examples/child_window/.vr_settings.yaml +21 -0
  39. data/examples/child_window/bin/ChildWindowDemo.rb +10 -10
  40. data/examples/child_window/bin/ModalWindow.rb +4 -4
  41. data/examples/child_window/bin/ModelessWindow.rb +4 -4
  42. data/examples/child_window/bin/MyChildClass.rb +10 -10
  43. data/examples/drag_drop/.vr_settings.yaml +16 -0
  44. data/examples/drag_drop/bin/DragDropDemo.rb +28 -28
  45. data/examples/filetreeview/.vr_settings.yaml +20 -0
  46. data/examples/filetreeview/bin/ProjectTree.rb +13 -23
  47. data/examples/filetreeview/bin/ProjectTreeGUI.rb +18 -17
  48. data/examples/listview/.vr_settings.yaml +19 -0
  49. data/examples/listview/bin/SongListView.rb +72 -72
  50. data/examples/listview/bin/SongListViewGUI.rb +52 -52
  51. data/examples/listview_objects/.vr_settings.yaml +19 -0
  52. data/examples/listview_objects/bin/DataObject.rb +23 -23
  53. data/examples/listview_objects/bin/ListViewObjects.rb +29 -29
  54. data/examples/listview_objects/bin/ListViewObjectsGUI.rb +12 -12
  55. data/examples/settings_file/bin/MainApp.rb +25 -25
  56. data/examples/settings_file/bin/SavableSettings.rb +25 -26
  57. data/examples/settings_file/settings.yaml +1 -1
  58. data/examples/simple_ruby_gui/.vr_settings.yaml +20 -0
  59. data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +12 -12
  60. data/examples/treeview/.vr_settings.yaml +17 -0
  61. data/examples/treeview/bin/MyClass.rb +18 -17
  62. data/examples/treeview/bin/glade/MyClass.glade +61 -6
  63. data/skeleton/document/NewWindow.rb +8 -8
  64. data/skeleton/project/.vr_settings.yaml +15 -0
  65. data/skeleton/project/bin/MyClass.rb +7 -7
  66. data/vr +38 -41
  67. data/vrlib/doc/images/add.png +0 -0
  68. data/vrlib/doc/images/arrow_up.png +0 -0
  69. data/vrlib/doc/images/brick.png +0 -0
  70. data/vrlib/doc/images/brick_link.png +0 -0
  71. data/vrlib/doc/images/bug.png +0 -0
  72. data/vrlib/doc/images/bullet_black.png +0 -0
  73. data/vrlib/doc/images/bullet_toggle_minus.png +0 -0
  74. data/vrlib/doc/images/bullet_toggle_plus.png +0 -0
  75. data/vrlib/doc/images/date.png +0 -0
  76. data/vrlib/doc/images/delete.png +0 -0
  77. data/vrlib/doc/images/find.png +0 -0
  78. data/vrlib/doc/images/macFFBgHack.png +0 -0
  79. data/vrlib/doc/images/package.png +0 -0
  80. data/vrlib/doc/images/page_green.png +0 -0
  81. data/vrlib/doc/images/page_white_text.png +0 -0
  82. data/vrlib/doc/images/page_white_width.png +0 -0
  83. data/vrlib/doc/images/plugin.png +0 -0
  84. data/vrlib/doc/images/ruby.png +0 -0
  85. data/vrlib/doc/images/tag_blue.png +0 -0
  86. data/vrlib/doc/images/tag_green.png +0 -0
  87. data/vrlib/doc/images/transparent.png +0 -0
  88. data/vrlib/doc/images/wrench.png +0 -0
  89. data/vrlib/doc/images/wrench_orange.png +0 -0
  90. data/vrlib/doc/images/zoom.png +0 -0
  91. data/vrlib/lib/Alert.rb +98 -55
  92. data/vrlib/lib/DragDrop.rb +43 -43
  93. data/vrlib/lib/GladeGUI.rb +207 -207
  94. data/vrlib/lib/IconHash.rb +10 -10
  95. data/vrlib/lib/SavableClass.rb +38 -38
  96. data/vrlib/lib/SimpleComboBoxEntry.rb +3 -3
  97. data/vrlib/lib/treeview/FileTreeView.rb +71 -70
  98. data/vrlib/lib/treeview/IterMethods.rb +35 -35
  99. data/vrlib/lib/treeview/ListView.rb +25 -25
  100. data/vrlib/lib/treeview/TreeView.rb +15 -15
  101. data/vrlib/lib/treeview/ViewCommon.rb +134 -131
  102. data/vrlib/lib/treeview/columns/CalendarCol.rb +48 -48
  103. data/vrlib/lib/treeview/columns/CellRendererCombo.rb +26 -26
  104. data/vrlib/lib/treeview/columns/CellRendererDate.rb +25 -25
  105. data/vrlib/lib/treeview/columns/CellRendererObject.rb +37 -37
  106. data/vrlib/lib/treeview/columns/CellRendererPhone.rb +25 -25
  107. data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +8 -8
  108. data/vrlib/lib/treeview/columns/CellRendererProgress.rb +8 -8
  109. data/vrlib/lib/treeview/columns/CellRendererSpin.rb +17 -17
  110. data/vrlib/lib/treeview/columns/CellRendererText.rb +18 -18
  111. data/vrlib/lib/treeview/columns/CellRendererToggle.rb +25 -25
  112. data/vrlib/lib/treeview/columns/ComboCol.rb +12 -12
  113. data/vrlib/lib/treeview/columns/CurrencyCol.rb +13 -13
  114. data/vrlib/lib/treeview/columns/DateCol.rb +10 -10
  115. data/vrlib/lib/treeview/columns/ImageCol.rb +16 -16
  116. data/vrlib/lib/treeview/columns/SpinCol.rb +5 -5
  117. data/vrlib/lib/treeview/columns/TextCol.rb +24 -24
  118. data/vrlib/lib/treeview/columns/TreeViewColumn.rb +71 -76
  119. data/vrlib/rdoc_replace.yaml +36 -36
  120. metadata +43 -6
  121. data/Splash.rb +0 -40
@@ -71,23 +71,23 @@ This just shows a message on the screen. Its very useful for alerts and debuggi
71
71
  </packing>
72
72
  </child>
73
73
  <child>
74
- <object class="GtkLabel" id="label4">
74
+ <object class="GtkLabel" id="label2">
75
75
  <property name="visible">True</property>
76
76
  <property name="can_focus">False</property>
77
77
  <property name="xalign">0</property>
78
- <property name="label" translatable="yes">&lt;big&gt;Ask Any Question&lt;/big&gt;
79
- Change the text on the buttons to ask anything</property>
78
+ <property name="label" translatable="yes">&lt;big&gt;Yes/No Example&lt;/big&gt;
79
+ Ask the user a yes/no question by changing the text on the buttons.</property>
80
80
  <property name="use_markup">True</property>
81
81
  </object>
82
82
  <packing>
83
83
  <property name="left_attach">0</property>
84
- <property name="top_attach">4</property>
84
+ <property name="top_attach">1</property>
85
85
  <property name="width">1</property>
86
86
  <property name="height">1</property>
87
87
  </packing>
88
88
  </child>
89
89
  <child>
90
- <object class="GtkButton" id="buttonQuestion">
90
+ <object class="GtkButton" id="buttonYesNo">
91
91
  <property name="label" translatable="yes">Try</property>
92
92
  <property name="visible">True</property>
93
93
  <property name="can_focus">True</property>
@@ -96,7 +96,7 @@ Change the text on the buttons to ask anything</property>
96
96
  </object>
97
97
  <packing>
98
98
  <property name="left_attach">1</property>
99
- <property name="top_attach">4</property>
99
+ <property name="top_attach">1</property>
100
100
  <property name="width">1</property>
101
101
  <property name="height">1</property>
102
102
  </packing>
@@ -110,37 +110,6 @@ Change the text on the buttons to ask anything</property>
110
110
  This example shows how you can ask the user to enter text into a textbox.</property>
111
111
  <property name="use_markup">True</property>
112
112
  </object>
113
- <packing>
114
- <property name="left_attach">0</property>
115
- <property name="top_attach">3</property>
116
- <property name="width">1</property>
117
- <property name="height">1</property>
118
- </packing>
119
- </child>
120
- <child>
121
- <object class="GtkButton" id="buttonInput">
122
- <property name="label" translatable="yes">Try</property>
123
- <property name="visible">True</property>
124
- <property name="can_focus">True</property>
125
- <property name="receives_default">True</property>
126
- <property name="valign">start</property>
127
- </object>
128
- <packing>
129
- <property name="left_attach">1</property>
130
- <property name="top_attach">3</property>
131
- <property name="width">1</property>
132
- <property name="height">1</property>
133
- </packing>
134
- </child>
135
- <child>
136
- <object class="GtkLabel" id="label2">
137
- <property name="visible">True</property>
138
- <property name="can_focus">False</property>
139
- <property name="xalign">0</property>
140
- <property name="label" translatable="yes">&lt;big&gt;Yes/No Example&lt;/big&gt;
141
- Ask the user a yes/no question by changing the text on the buttons.</property>
142
- <property name="use_markup">True</property>
143
- </object>
144
113
  <packing>
145
114
  <property name="left_attach">0</property>
146
115
  <property name="top_attach">2</property>
@@ -149,7 +118,7 @@ Ask the user a yes/no question by changing the text on the buttons.</property>
149
118
  </packing>
150
119
  </child>
151
120
  <child>
152
- <object class="GtkButton" id="buttonYesNo">
121
+ <object class="GtkButton" id="buttonInput">
153
122
  <property name="label" translatable="yes">Try</property>
154
123
  <property name="visible">True</property>
155
124
  <property name="can_focus">True</property>
@@ -164,23 +133,23 @@ Ask the user a yes/no question by changing the text on the buttons.</property>
164
133
  </packing>
165
134
  </child>
166
135
  <child>
167
- <object class="GtkLabel" id="label6">
136
+ <object class="GtkLabel" id="label4">
168
137
  <property name="visible">True</property>
169
138
  <property name="can_focus">False</property>
170
139
  <property name="xalign">0</property>
171
- <property name="label" translatable="yes">&lt;big&gt;Simple Input Box Example&lt;/big&gt;
172
- This just prompts the user for input in one line of code.</property>
140
+ <property name="label" translatable="yes">&lt;big&gt;Ask Any Question&lt;/big&gt;
141
+ Change the text on the buttons to ask anything</property>
173
142
  <property name="use_markup">True</property>
174
143
  </object>
175
144
  <packing>
176
145
  <property name="left_attach">0</property>
177
- <property name="top_attach">1</property>
146
+ <property name="top_attach">3</property>
178
147
  <property name="width">1</property>
179
148
  <property name="height">1</property>
180
149
  </packing>
181
150
  </child>
182
151
  <child>
183
- <object class="GtkButton" id="buttonSimpleInput">
152
+ <object class="GtkButton" id="buttonQuestion">
184
153
  <property name="label" translatable="yes">Try</property>
185
154
  <property name="visible">True</property>
186
155
  <property name="can_focus">True</property>
@@ -189,7 +158,7 @@ This just prompts the user for input in one line of code.</property>
189
158
  </object>
190
159
  <packing>
191
160
  <property name="left_attach">1</property>
192
- <property name="top_attach">1</property>
161
+ <property name="top_attach">3</property>
193
162
  <property name="width">1</property>
194
163
  <property name="height">1</property>
195
164
  </packing>
@@ -208,7 +177,7 @@ This just prompts the user for input in one line of code.</property>
208
177
  <property name="margin_right">20</property>
209
178
  <property name="layout_style">end</property>
210
179
  <child>
211
- <object class="GtkButton" id="buttonQuit">
180
+ <object class="GtkButton" id="buttonCancel">
212
181
  <property name="label" translatable="yes">Quit</property>
213
182
  <property name="visible">True</property>
214
183
  <property name="can_focus">True</property>
@@ -0,0 +1,18 @@
1
+ --- !ruby/object:VR_ENV
2
+ width: 1125
3
+ height: 688
4
+ panel_pos: 327
5
+ run_command_line: ruby main.rb
6
+ open_files:
7
+ - "/home/eric/vrp/vr3/examples/all_widgets/bin/AllWidgets.rb"
8
+ - "/home/eric/vrp/vr3/examples/all_widgets/main.rb"
9
+ open_folders:
10
+ - "/home/eric/vrp/vr3/examples/all_widgets"
11
+ - "/home/eric/vrp/vr3/examples/all_widgets/bin"
12
+ current_file: "/home/eric/vrp/vr3/examples/all_widgets/bin/AllWidgets.rb"
13
+ rdoc_command_line: rdoc -x README
14
+ vr_yaml_file: ".vr_settings.yaml"
15
+ notebook_panel_position: 400
16
+ current_line: 35
17
+ settings_file_version: 1
18
+ builder: !ruby/object:Gtk::Builder {}
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # with GladeGui, you can write:
11
11
  #
12
- # @window1 = "All Widgets"
12
+ # @window1 = "All Widgets"
13
13
  #
14
14
  # them yourself using @builder["widget_name"].property= statement
15
15
  #
@@ -29,22 +29,25 @@
29
29
  #
30
30
  class AllWidgets
31
31
 
32
- include GladeGUI
32
+ include GladeGUI
33
33
 
34
- def window1__show(*args)
35
- @window1 = "Showing All Widgets"
36
- @label1 = "I'm a Label"
37
- @checkbutton1 = true
38
- @builder["checkbutton1"].label = "I'm a Check Button" #this could be set in glade
39
- @image1 = "bin/splash.png"
40
- @linkbutton1 = "http://www.visualruby.net"
41
- @entry1 = "I'm an Entry Box"
42
- @progressbar1 = 0.85 # text property set in glade
43
- @textview1 = "I'm a Textview"
44
- @spinbutton1 = 10.5
45
- @fontbutton1 = "Courier 10"
46
- @calendar1 = DateTime.new(2011, 5, 14)
47
- end
34
+ def before_show()
35
+ @builder["checkbutton1"].label = "I'm a Check Button" #this could be set in glade
36
+ end
37
+
38
+ def initialize() #window1__show(*args)
39
+ @window1 = "Showing All Widgets"
40
+ @label1 = "I'm a Label"
41
+ @checkbutton1 = true
42
+ @image1 = "bin/splash.png"
43
+ @linkbutton1 = "http://www.visualruby.net"
44
+ @entry1 = "I'm an Entry Box"
45
+ @progressbar1 = 0.85 # text property set in glade
46
+ @textview1 = "I'm a Textview"
47
+ @spinbutton1 = 10.5
48
+ @fontbutton1 = "Courier 10"
49
+ @calendar1 = DateTime.new(2011, 5, 14)
50
+ end
48
51
 
49
52
 
50
53
  end
@@ -0,0 +1,18 @@
1
+ --- !ruby/object:VR_ENV
2
+ width: 1028
3
+ height: 691
4
+ panel_pos: 365
5
+ run_command_line: ruby main.rb
6
+ open_files:
7
+ - "/home/eric/vrp/vr3/examples/calculator/main.rb"
8
+ - "/home/eric/vrp/vr3/examples/calculator/bin/Calculator.rb"
9
+ open_folders:
10
+ - "/home/eric/vrp/vr3/examples/calculator"
11
+ - "/home/eric/vrp/vr3/examples/calculator/bin"
12
+ current_file: "/home/eric/vrp/vr3/examples/calculator/bin/Calculator.rb"
13
+ rdoc_command_line: rdoc -x README
14
+ vr_yaml_file: ".vr_settings.yaml"
15
+ notebook_panel_position: 400
16
+ current_line: 65
17
+ settings_file_version: 1
18
+ filename: ".vr_settings.yaml"
@@ -21,15 +21,15 @@
21
21
 
22
22
  class Calculator
23
23
 
24
- include GladeGUI
24
+ include GladeGUI
25
25
 
26
- def before_show()
27
- @window1 = "Calculator" #sets window1's title to "Calculator"
28
- @button = [ 1, 2, 3, "C" ] +
29
- [ 4, 5, 6, "+" ] +
30
- [ 7, 8, 9, "-" ] +
31
- [ 0, ".","/","=" ]
32
- end
26
+ def before_show()
27
+ @window1 = "Calculator" #sets window1's title to "Calculator"
28
+ @button = [ 1, 2, 3, "C" ] +
29
+ [ 4, 5, 6, "+" ] +
30
+ [ 7, 8, 9, "-" ] +
31
+ [ 0, ".","/","=" ]
32
+ end
33
33
 
34
34
  # This method is called when any key is clicked. It follows
35
35
  # this naming convention: <glade_name>__<signal_name>. (Separator is
@@ -43,20 +43,20 @@ class Calculator
43
43
  # each button!
44
44
 
45
45
 
46
- def button__clicked(button)
47
- case button.label
48
- when "C" then
49
- @builder["display"].text = ""
50
- when "=" then
51
- begin # this doesn't catch all errors
52
- @builder["display"].text = eval(@builder["display"].text).to_s
53
- rescue
54
- @builder["display"].text = "error"
55
- end
56
- else
57
- @builder["display"].text = @builder["display"].text + button.label
58
- end
59
- end
46
+ def button__clicked(button)
47
+ case button.label
48
+ when "C" then
49
+ @builder["display"].text = ""
50
+ when "=" then
51
+ begin # this doesn't catch all errors
52
+ @builder["display"].text = eval(@builder["display"].text).to_s
53
+ rescue
54
+ @builder["display"].text = "error"
55
+ end
56
+ else
57
+ @builder["display"].text = @builder["display"].text + button.label
58
+ end
59
+ end
60
60
 
61
61
 
62
62
 
@@ -0,0 +1,21 @@
1
+ --- !ruby/object:VR_ENV
2
+ width: 1084
3
+ height: 691
4
+ panel_pos: 437
5
+ run_command_line: ruby main.rb
6
+ open_files:
7
+ - "/home/eric/vrp/vr3/examples/child_window/main.rb"
8
+ - "/home/eric/vrp/vr3/examples/child_window/bin/MyChildClass.rb"
9
+ - "/home/eric/vrp/vr3/examples/child_window/bin/ChildWindowDemo.rb"
10
+ - "/home/eric/vrp/vr3/examples/child_window/bin/ModalWindow.rb"
11
+ - "/home/eric/vrp/vr3/examples/child_window/bin/ModelessWindow.rb"
12
+ open_folders:
13
+ - "/home/eric/vrp/vr3/examples/child_window"
14
+ - "/home/eric/vrp/vr3/examples/child_window/bin"
15
+ - "/home/eric/vrp/vr3/examples/child_window/bin/glade"
16
+ current_file: "/home/eric/vrp/vr3/examples/child_window/bin/ChildWindowDemo.rb"
17
+ rdoc_command_line: rdoc -x README
18
+ vr_yaml_file: ".vr_settings.yaml"
19
+ notebook_panel_position: 400
20
+ current_line: 1
21
+ settings_file_version: 1
@@ -27,24 +27,24 @@
27
27
 
28
28
  class ChildWindowDemo #(change name)
29
29
 
30
- include GladeGUI
30
+ include GladeGUI
31
31
 
32
- def buttonOpenModeless__clicked(*argv)
33
- ModelessWindow.new.show_glade() # no parent given so windows can overlap
34
- end
32
+ def buttonOpenModeless__clicked(*argv)
33
+ ModelessWindow.new.show_glade() # no parent given so windows can overlap
34
+ end
35
35
 
36
36
  # This modal window has its "modal" property set to true in glade.
37
37
  # I pass a reference to "self" in the show method, setting the parent to this window,
38
38
  # making it always on top. Its a good idea to have modal windows always on top
39
39
  # because the parent is frozen, so the next action must be in the modal window.
40
40
 
41
- def buttonOpenModal__clicked(*argv)
42
- ModalWindow.new.show_glade(self) # self = parent, so always on top of parent
43
- end
41
+ def buttonOpenModal__clicked(*argv)
42
+ ModalWindow.new.show_glade(self) # self = parent, so always on top of parent
43
+ end
44
44
 
45
- def buttonCancel__clicked(*argv)
46
- @builder["window1"].destroy
47
- end
45
+ def buttonCancel__clicked(*argv)
46
+ @builder["window1"].destroy
47
+ end
48
48
 
49
49
  end
50
50
 
@@ -1,9 +1,9 @@
1
1
  class ModalWindow
2
2
 
3
- include GladeGUI
3
+ include GladeGUI
4
4
 
5
- def buttonOk__clicked(*argv)
6
- @builder["window1"].destroy
7
- end
5
+ def buttonOk__clicked(*argv)
6
+ @builder["window1"].destroy
7
+ end
8
8
 
9
9
  end
@@ -1,9 +1,9 @@
1
1
  class ModelessWindow
2
2
 
3
- include GladeGUI
3
+ include GladeGUI
4
4
 
5
- def buttonOk__clicked(*argv)
6
- @builder["window1"].destroy
7
- end
5
+ def buttonOk__clicked(*argv)
6
+ @builder["window1"].destroy
7
+ end
8
8
 
9
9
  end
@@ -5,17 +5,17 @@
5
5
 
6
6
  class MyChildClass
7
7
 
8
- include GladeGUI
8
+ include GladeGUI
9
9
 
10
- def initialize(title, message)
11
- @labelMessage = message
12
- @window1 = title
13
- end
14
-
15
- # When cancel clicked in MyChildClass.glade
16
- def buttonCancel__clicked(*args)
17
- @builder["window1"].destroy
18
- end
10
+ def initialize(title, message)
11
+ @labelMessage = message
12
+ @window1 = title
13
+ end
14
+
15
+ # When cancel clicked in MyChildClass.glade
16
+ def buttonCancel__clicked(*args)
17
+ @builder["window1"].destroy
18
+ end
19
19
 
20
20
  end
21
21
 
@@ -0,0 +1,16 @@
1
+ --- !ruby/object:VR_ENV
2
+ width: 1307
3
+ height: 698
4
+ panel_pos: 423
5
+ run_command_line: ruby main.rb
6
+ open_files:
7
+ - "/home/eric/vrp/vr3/examples/drag_drop/bin/DragDropDemo.rb"
8
+ open_folders:
9
+ - "/home/eric/vrp/vr3/examples/drag_drop"
10
+ - "/home/eric/vrp/vr3/examples/drag_drop/bin"
11
+ current_file: "/home/eric/vrp/vr3/examples/drag_drop/bin/DragDropDemo.rb"
12
+ rdoc_command_line: rdoc -x README
13
+ vr_yaml_file: ".vr_settings.yaml"
14
+ notebook_panel_position: 400
15
+ current_line: 12
16
+ settings_file_version: 1
@@ -1,41 +1,41 @@
1
1
 
2
2
  class DragDropDemo
3
3
 
4
- include GladeGUI
4
+ include GladeGUI
5
5
 
6
- def before_show()
7
- @window1 = "Drag and Drop Demo"
8
- @textview1 = "I'm a widget named textview1.\n\nTry dragging a file or the button onto me."
9
- @view = VR::FileTreeView.new(Dir.pwd,"./img")
10
- @view.refresh()
11
- @view.expand_row(@view.model.iter_first.path, false)
12
- @builder["scrolledwindow1"].add(@view)
13
- set_drag_drop("button1" => "textview1", @view => "textview1", "textview1" => "button1")
14
- end
6
+ def before_show()
7
+ @window1 = "Drag and Drop Demo"
8
+ @textview1 = "I'm a widget named textview1.\n\nTry dragging a file or the button onto me."
9
+ @view = VR::FileTreeView.new(Dir.pwd,"./img")
10
+ @view.refresh()
11
+ @view.expand_row(@view.model.iter_first.path, false)
12
+ @builder["scrolledwindow1"].add(@view)
13
+ set_drag_drop("button1" => "textview1", @view => "textview1", "textview1" => "button1")
14
+ end
15
15
 
16
16
 
17
17
  # This executes when button1 receives a widget dropped on it. When the button1 widget
18
18
  # receives a drag_drop signal, an instance variable named dragged_widget is set automatically set
19
19
  # by visualruby containing a reference to the dragged widget:
20
20
 
21
- def button1__drag_drop(widget, *args)
22
- but1 = @builder["button1"]
23
- if but1.dragged_widget.is_a?(Gtk::TextView)
24
- but1.label = but1.dragged_widget.buffer.text.slice(0,15)
25
- elsif but1.dragged_widget.is_a?(VR::FileTreeView)
26
- but1.label = @view.get_selected_path()
27
- end
28
- end
29
-
30
- def textview1__drag_drop(widget, context, *args)
31
- tv1 = @builder["textview1"]
32
- if tv1.dragged_widget == @view
33
- path = @view.get_selected_path()
34
- tv1.buffer.text = File.basename(path)
35
- elsif tv1.dragged_widget.is_a?(Gtk::Button)
36
- tv1.buffer.text = tv1.dragged_widget.label
37
- end
38
- end
21
+ def button1__drag_drop(widget, *args)
22
+ but1 = @builder["button1"]
23
+ if but1.dragged_widget.is_a?(Gtk::TextView)
24
+ but1.label = but1.dragged_widget.buffer.text.slice(0,15)
25
+ elsif but1.dragged_widget.is_a?(VR::FileTreeView)
26
+ but1.label = @view.get_selected_path()
27
+ end
28
+ end
29
+
30
+ def textview1__drag_drop(widget, context, *args)
31
+ tv1 = @builder["textview1"]
32
+ if tv1.dragged_widget == @view
33
+ path = @view.get_selected_path()
34
+ tv1.buffer.text = File.basename(path)
35
+ elsif tv1.dragged_widget.is_a?(Gtk::Button)
36
+ tv1.buffer.text = tv1.dragged_widget.label
37
+ end
38
+ end
39
39
 
40
40
  end
41
41
 
@@ -0,0 +1,20 @@
1
+ --- !ruby/object:VR_ENV
2
+ width: 1337
3
+ height: 691
4
+ panel_pos: 490
5
+ run_command_line: ruby main.rb
6
+ open_files:
7
+ - "/home/eric/vrp/vr3/examples/filetreeview/main.rb"
8
+ - "/home/eric/vrp/vr3/examples/filetreeview/bin/ProjectTreeGUI.rb"
9
+ - "/home/eric/vrp/vr3/examples/filetreeview/bin/ProjectTree.rb"
10
+ open_folders:
11
+ - "/home/eric/vrp/vr3/examples/filetreeview"
12
+ - "/home/eric/vrp/vr3/examples/filetreeview/bin"
13
+ - "/home/eric/vrp/vr3/examples/filetreeview/bin/glade"
14
+ current_file: "/home/eric/vrp/vr3/examples/filetreeview/bin/ProjectTree.rb"
15
+ rdoc_command_line: rdoc -x README
16
+ vr_yaml_file: ".vr_settings.yaml"
17
+ notebook_panel_position: 400
18
+ current_line: 11
19
+ settings_file_version: 1
20
+ filename: ".vr_settings.yaml"
@@ -1,32 +1,22 @@
1
1
 
2
2
  class ProjectTree < VR::FileTreeView #(change name)
3
3
 
4
- attr_accessor :ftv
4
+ attr_accessor :ftv
5
5
 
6
- include GladeGUI
6
+ include GladeGUI
7
7
 
8
- def initialize()
9
- path = File.join(ENV["HOME"], "visualruby")
10
- super(path, "/home/eric/vrp/vr3/img")
11
- @test_block = proc { |folder| has_settings_file?(folder) }
12
- end
8
+ def initialize()
9
+ path = File.join(ENV["HOME"], "visualruby")
10
+ super(path, "/home/eric/vrp/vr3/img")
11
+ end
13
12
 
14
13
  def self__row_activated(_self, path, col)
15
- row = vr_row(get_iter(path))
16
- if File.exists?(File.join(row[:path], ".vr_settings.yaml")) #test if its a vr project.
17
- alert "You selected: \n\n" + row[:file_name]
18
- else
19
- expand_or_collapse_folder()
20
- end
21
- end
22
-
23
- def has_settings_file?(path)
24
- Find.find(path) do |file|
25
- if File.basename(file) == ".vr_settings.yaml"
26
- return true
27
- end
28
- end
29
- return false
30
- end
14
+ row = vr_row(get_iter(path))
15
+ if File.exists?(File.join(row[:path], ".vr_settings.yaml")) #test if its a vr project.
16
+ alert "You selected: \n\n" + row[:file_name]
17
+ else
18
+ expand_or_collapse_folder()
19
+ end
20
+ end
31
21
 
32
22
  end
@@ -1,28 +1,29 @@
1
1
 
2
2
  class ProjectTreeGUI #(change name)
3
3
 
4
- attr_accessor :ftv
4
+ attr_accessor :ftv
5
5
 
6
- include GladeGUI
6
+ include GladeGUI
7
7
 
8
- def before_show()
9
- @ftv = ProjectTree.new()
10
- @builder["scrolledwindow1"].add(@ftv) #needs show_all
11
- @open_folders = []
12
- end
8
+ def before_show()
9
+ @ftv = ProjectTree.new()
10
+ @builder["scrolledwindow1"].add(@ftv) #needs show_all
11
+ @ftv.set_show_expanders(false)
12
+ @open_folders = []
13
+ end
13
14
 
14
- def show_expanders__toggled(*a)
15
- @ftv.set_show_expanders(@builder[:show_expanders].active?)
16
- end
15
+ def show_expanders__toggled(*a)
16
+ @ftv.set_show_expanders(@builder[:show_expanders].active?)
17
+ end
17
18
 
18
- def save_state__clicked(*a)
19
- @open_folders = @ftv.get_open_folders()
20
- alert("Saving folders: " + @open_folders.to_s, :parent=>self)
21
- end
19
+ def save_state__clicked(*a)
20
+ @open_folders = @ftv.get_open_folders()
21
+ alert("Saving folders: " + @open_folders.to_s, :parent=>self)
22
+ end
22
23
 
23
- def load_state__clicked(*a)
24
- @ftv.refresh( :open_folders => @open_folders )
25
- end
24
+ def load_state__clicked(*a)
25
+ @ftv.refresh( :open_folders => @open_folders )
26
+ end
26
27
 
27
28
  end
28
29
 
@@ -0,0 +1,19 @@
1
+ --- !ruby/object:VR_ENV
2
+ width: 1251
3
+ height: 691
4
+ panel_pos: 322
5
+ run_command_line: ruby main.rb
6
+ open_files:
7
+ - "/home/eric/vrp/vr3/examples/listview/main.rb"
8
+ - "/home/eric/vrp/vr3/examples/listview/bin/SongListViewGUI.rb"
9
+ - "/home/eric/vrp/vr3/examples/listview/bin/SongListView.rb"
10
+ open_folders:
11
+ - "/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"
15
+ rdoc_command_line: rdoc -x README
16
+ vr_yaml_file: ".vr_settings.yaml"
17
+ notebook_panel_position: 437
18
+ current_line: 22
19
+ filename: ".vr_settings.yaml"