visualruby 3.6.9 → 3.6.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vr_settings.yaml +15 -6
- data/.yardoc/my_yard.yaml +2 -3
- data/examples/03_builder_variable/.vr_settings.yaml +2 -2
- data/examples/04_before_show/.vr_settings.yaml +1 -1
- data/examples/06_alert_box/.vr_settings.yaml +5 -2
- data/examples/06_alert_box/alertdemo.rb +1 -0
- data/examples/06_alert_box/src/AlertBoxDemo.rb +2 -2
- data/examples/35_child_window/.vr_settings.yaml +2 -2
- data/examples/35_child_window/child_window.rb +2 -2
- data/examples/70_better_views/.vr_settings.yaml +3 -2
- data/examples/72_object_views/object_views.rb +1 -1
- data/examples/78_listview/listview.rb +2 -3
- data/examples/78_listview_objects/listviewobjects.rb +2 -2
- data/examples/95_active_record/active_record.rb +1 -4
- data/examples/97_active_record2/main.rb +1 -1
- data/examples/dialog_box/.vr_settings.yaml +16 -0
- data/examples/dialog_box/dialog_box.rb +11 -0
- data/examples/dialog_box/src/ChooserDialog.rb +19 -0
- data/examples/dialog_box/src/glade/ChooserDialog.glade +136 -0
- data/examples/dialog_box/src/glade/MyClass.glade +36 -0
- data/lib/Alert.rb +4 -1
- data/lib/AlertDialog.rb +145 -0
- data/lib/glade/AlertDialog.glade +181 -0
- data/lib/vrlib.rb +2 -2
- data/src/editor/VR_Tabs.rb +3 -4
- data/src/main/VR_Main.rb +0 -1
- data/src/version.rb +1 -1
- data/vr +2 -2
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e15dd9e8e52407fa845892c35368830810a838f222e6128a1812a53a07924b5
|
4
|
+
data.tar.gz: 47c1cf77cc648edb67fb142ee163ea56806b470291e0919f3d67086ea4dcc16f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57cd278417e7c253c354a7edcaa47b60ef9db1336dbdef755879f7089bcca0e077cd6b7e16f3608f0c5a940a0b0a29936fb8b82952dc6e60d0787fd31069389a
|
7
|
+
data.tar.gz: e5701785c8307ffcc3f85337562d82685333ba4e67353c9dd6220a5430cb6fe90ccf125835321300e6a0c837b0e35d5c1cdace6174b19f1569a7aa8601ce5bff
|
data/.vr_settings.yaml
CHANGED
@@ -12,11 +12,20 @@ open_files:
|
|
12
12
|
- "/home/eric/vrp/vr3/src/editor/VR_Document.rb"
|
13
13
|
- "/home/eric/vrp/vr3/src/main/VR_Tools.rb"
|
14
14
|
- "/home/eric/vrp/vr3/src/main/OpenProject.rb"
|
15
|
-
- "/home/eric/vrp/vr3/src/main/NewProjectGUI.rb"
|
16
15
|
- "/home/eric/vrp/vr3/src/version.rb"
|
17
|
-
- "/home/eric/vrp/vr3/
|
18
|
-
- "/home/eric/vrp/vr3/
|
19
|
-
- "/home/eric/vrp/vr3/
|
16
|
+
- "/home/eric/vrp/vr3/lib/Alert.rb"
|
17
|
+
- "/home/eric/vrp/vr3/lib/vrlib.rb"
|
18
|
+
- "/home/eric/vrp/vr3/lib/AlertDialog.rb"
|
19
|
+
- "/home/eric/vrp/vr3/src/main/NewProjectGUI.rb"
|
20
|
+
- "/home/eric/vrp/vr3/src/editor/VR_Tabs.rb"
|
21
|
+
- "/home/eric/vrp/vr3/examples/06_alert_box/alertdemo.rb"
|
22
|
+
- "/home/eric/vrp/vr3/examples/35_child_window/child_window.rb"
|
23
|
+
- "/home/eric/vrp/vr3/examples/71_prettify_view/prettify_view.rb"
|
24
|
+
- "/home/eric/vrp/vr3/examples/72_object_views/object_views.rb"
|
25
|
+
- "/home/eric/vrp/vr3/examples/78_listview/listview.rb"
|
26
|
+
- "/home/eric/vrp/vr3/examples/78_listview_objects/listviewobjects.rb"
|
27
|
+
- "/home/eric/vrp/vr3/examples/95_active_record/active_record.rb"
|
28
|
+
- "/home/eric/vrp/vr3/examples/97_active_record2/main.rb"
|
20
29
|
open_folders:
|
21
30
|
- "/home/eric/vrp/vr3"
|
22
31
|
- "/home/eric/vrp/vr3/lib"
|
@@ -28,8 +37,8 @@ open_folders:
|
|
28
37
|
- "/home/eric/vrp/vr3/src/editor"
|
29
38
|
- "/home/eric/vrp/vr3/src/main"
|
30
39
|
- "/home/eric/vrp/vr3/src/main/glade"
|
31
|
-
current_file: "/home/eric/vrp/vr3/
|
32
|
-
current_line:
|
40
|
+
current_file: "/home/eric/vrp/vr3/examples/78_listview_objects/listviewobjects.rb"
|
41
|
+
current_line: 4
|
33
42
|
rdoc_command_line: rdoc -x README
|
34
43
|
builder: !ruby/object:Gtk::Builder {}
|
35
44
|
top_level_window: false
|
data/.yardoc/my_yard.yaml
CHANGED
@@ -5,8 +5,8 @@ template_root: "/home/eric/my_yard/templates"
|
|
5
5
|
output_dir: docs
|
6
6
|
theme: visualruby
|
7
7
|
template: visualruby
|
8
|
-
files: lib/**/*.rb
|
9
|
-
extra_files: "
|
8
|
+
files: 'lib/**/*.rb '
|
9
|
+
extra_files: "*/**/*.md"
|
10
10
|
exclude: ''
|
11
11
|
include_public: true
|
12
12
|
include_private: false
|
@@ -19,4 +19,3 @@ export_db_path: ".yardoc"
|
|
19
19
|
vr_yaml_file: "/home/eric/vrp/vr3/.yardoc/my_yard.yaml"
|
20
20
|
builder: !ruby/object:Gtk::Builder
|
21
21
|
top_level_window: false
|
22
|
-
top_level_window: false
|
@@ -6,10 +6,10 @@ panel_pos: 360
|
|
6
6
|
notebook_panel_position: 718
|
7
7
|
run_command_line: builder.rb
|
8
8
|
open_files:
|
9
|
-
- "/home/eric/vrp/vr3/examples/
|
9
|
+
- "/home/eric/vrp/vr3/examples/03_builder_variable/README.txt"
|
10
10
|
open_folders:
|
11
11
|
- "/home/eric/vrp/vr3/examples/03_builder_variable"
|
12
|
-
current_file: "/home/eric/vrp/vr3/examples/
|
12
|
+
current_file: "/home/eric/vrp/vr3/examples/03_builder_variable/README.txt"
|
13
13
|
current_line: 1
|
14
14
|
rdoc_command_line: rdoc -x README
|
15
15
|
builder: !ruby/object:Gtk::Builder {}
|
@@ -11,8 +11,8 @@ open_folders:
|
|
11
11
|
- "/home/eric/vrp/vr3/examples/04_before_show"
|
12
12
|
current_file: "/home/eric/vrp/vr3/examples/04_before_show/README.txt"
|
13
13
|
current_line: 9
|
14
|
-
builder: !ruby/object:Gtk::Builder {}
|
15
14
|
rdoc_command_line: rdoc -x README
|
15
|
+
builder: !ruby/object:Gtk::Builder {}
|
16
16
|
top_level_window: false
|
17
17
|
browser: firefox
|
18
18
|
backup_path: "/home/eric"
|
@@ -7,10 +7,13 @@ notebook_panel_position: 501
|
|
7
7
|
run_command_line: alertdemo.rb
|
8
8
|
open_files:
|
9
9
|
- "/home/eric/vrp/vr3/examples/06_alert_box/README.txt"
|
10
|
+
- "/home/eric/vrp/vr3/examples/06_alert_box/alertdemo.rb"
|
11
|
+
- "/home/eric/vrp/vr3/examples/06_alert_box/src/AlertBoxDemo.rb"
|
10
12
|
open_folders:
|
11
13
|
- "/home/eric/vrp/vr3/examples/06_alert_box"
|
12
|
-
|
13
|
-
|
14
|
+
- "/home/eric/vrp/vr3/examples/06_alert_box/src"
|
15
|
+
current_file: "/home/eric/vrp/vr3/examples/06_alert_box/src/AlertBoxDemo.rb"
|
16
|
+
current_line: 9
|
14
17
|
rdoc_command_line: rdoc -x README
|
15
18
|
builder: !ruby/object:Gtk::Builder {}
|
16
19
|
top_level_window: false
|
@@ -54,7 +54,7 @@ class AlertBoxDemo
|
|
54
54
|
if answer.is_a?(String)
|
55
55
|
alert ("You chose: #{answer}\nUser_id: #{user_id[names.index(answer)].to_s}")
|
56
56
|
elsif answer == false #no_button pressed = new name
|
57
|
-
new_name = alert("Enter New Person:",
|
57
|
+
new_name = alert("Enter New Person:", data: "")
|
58
58
|
elsif answer.nil?
|
59
59
|
alert "You pressed the 'X' button"
|
60
60
|
end
|
@@ -62,7 +62,7 @@ class AlertBoxDemo
|
|
62
62
|
|
63
63
|
def buttonHash__clicked(*a)
|
64
64
|
my_hash = { username: "", password: "" }
|
65
|
-
answer = alert("Enter your credentials:", headline: "Sign In", data: my_hash, button_no: "Forgot Password")
|
65
|
+
answer = alert("Enter your credentials:", headline: "Sign In", data: my_hash, button_no: "Forgot Password", width:550)
|
66
66
|
if answer.is_a? Hash
|
67
67
|
alert "Alert() Returned Hash: \n\n" + answer.to_s
|
68
68
|
elsif answer == false
|
@@ -15,8 +15,8 @@ open_folders:
|
|
15
15
|
- "/home/eric/vrp/vr3/examples/35_child_window"
|
16
16
|
- "/home/eric/vrp/vr3/examples/35_child_window/src"
|
17
17
|
- "/home/eric/vrp/vr3/examples/35_child_window/src/glade"
|
18
|
-
current_file: "/home/eric/vrp/vr3/examples/35_child_window/
|
19
|
-
current_line:
|
18
|
+
current_file: "/home/eric/vrp/vr3/examples/35_child_window/src/ChildWindowDemo.rb"
|
19
|
+
current_line: 42
|
20
20
|
rdoc_command_line: rdoc -x README
|
21
21
|
builder: !ruby/object:Gtk::Builder {}
|
22
22
|
top_level_window: false
|
@@ -4,7 +4,7 @@ width: 1854
|
|
4
4
|
height: 1003
|
5
5
|
panel_pos: 360
|
6
6
|
notebook_panel_position: 718
|
7
|
-
run_command_line:
|
7
|
+
run_command_line: better_views.rb
|
8
8
|
open_files:
|
9
9
|
- "/home/eric/vrp/vr3/examples/70_better_views/README.txt"
|
10
10
|
- "/home/eric/vrp/vr3/examples/70_better_views/better_views.rb"
|
@@ -16,7 +16,8 @@ open_folders:
|
|
16
16
|
current_file: "/home/eric/vrp/vr3/examples/70_better_views/src/BetterView.rb"
|
17
17
|
current_line: 9
|
18
18
|
rdoc_command_line: rdoc -x README
|
19
|
-
builder: !ruby/object:Gtk::Builder
|
19
|
+
builder: !ruby/object:Gtk::Builder
|
20
|
+
top_level_window: false
|
20
21
|
top_level_window: false
|
21
22
|
browser: firefox
|
22
23
|
backup_path: "/home/eric"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
--- !ruby/object:VR_ENV
|
2
|
+
vr_yaml_file: "/home/eric/vrp/vr3/examples/dialog_box/.vr_settings.yaml"
|
3
|
+
width: 1854
|
4
|
+
height: 1003
|
5
|
+
panel_pos: 360
|
6
|
+
notebook_panel_position: 506
|
7
|
+
run_command_line: dialog_box.rb
|
8
|
+
open_files:
|
9
|
+
- "/home/eric/vrp/vr3/examples/dialog_box/dialog_box.rb"
|
10
|
+
- "/home/eric/vrp/vr3/examples/dialog_box/src/ChooserDialog.rb"
|
11
|
+
open_folders:
|
12
|
+
- "/home/eric/vrp/vr3/examples/dialog_box"
|
13
|
+
- "/home/eric/vrp/vr3/examples/dialog_box/src"
|
14
|
+
- "/home/eric/vrp/vr3/examples/dialog_box/src/glade"
|
15
|
+
current_file: "/home/eric/vrp/vr3/examples/dialog_box/src/ChooserDialog.rb"
|
16
|
+
current_line: 12
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
class ChooserDialog
|
3
|
+
|
4
|
+
include GladeGUI
|
5
|
+
|
6
|
+
def run()
|
7
|
+
load_glade
|
8
|
+
response = @builder[:window1].run()
|
9
|
+
@builder[:window1].hide
|
10
|
+
case response
|
11
|
+
when Gtk::ResponseType::OK
|
12
|
+
return @builder[:comboLang].active_text, @builder[:checkDefault].active?
|
13
|
+
when Gtk::ResponseType::CANCEL
|
14
|
+
return nil, nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,136 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- Generated with glade 3.40.0 -->
|
3
|
+
<interface>
|
4
|
+
<requires lib="gtk+" version="3.24"/>
|
5
|
+
<object class="GtkDialog" id="window1">
|
6
|
+
<property name="can-focus">False</property>
|
7
|
+
<property name="type-hint">dialog</property>
|
8
|
+
<child internal-child="vbox">
|
9
|
+
<object class="GtkBox">
|
10
|
+
<property name="can-focus">False</property>
|
11
|
+
<property name="margin-start">40</property>
|
12
|
+
<property name="margin-end">40</property>
|
13
|
+
<property name="margin-top">40</property>
|
14
|
+
<property name="margin-bottom">40</property>
|
15
|
+
<property name="orientation">vertical</property>
|
16
|
+
<property name="spacing">15</property>
|
17
|
+
<child internal-child="action_area">
|
18
|
+
<object class="GtkButtonBox">
|
19
|
+
<property name="can-focus">False</property>
|
20
|
+
<property name="layout-style">end</property>
|
21
|
+
<child>
|
22
|
+
<object class="GtkButton" id="buttonCancel">
|
23
|
+
<property name="label" translatable="yes">Cancel</property>
|
24
|
+
<property name="visible">True</property>
|
25
|
+
<property name="can-focus">True</property>
|
26
|
+
<property name="receives-default">True</property>
|
27
|
+
</object>
|
28
|
+
<packing>
|
29
|
+
<property name="expand">True</property>
|
30
|
+
<property name="fill">True</property>
|
31
|
+
<property name="position">0</property>
|
32
|
+
</packing>
|
33
|
+
</child>
|
34
|
+
<child>
|
35
|
+
<object class="GtkButton" id="buttonOK">
|
36
|
+
<property name="label" translatable="yes">OK</property>
|
37
|
+
<property name="visible">True</property>
|
38
|
+
<property name="can-focus">True</property>
|
39
|
+
<property name="receives-default">True</property>
|
40
|
+
</object>
|
41
|
+
<packing>
|
42
|
+
<property name="expand">True</property>
|
43
|
+
<property name="fill">True</property>
|
44
|
+
<property name="position">1</property>
|
45
|
+
</packing>
|
46
|
+
</child>
|
47
|
+
</object>
|
48
|
+
<packing>
|
49
|
+
<property name="expand">False</property>
|
50
|
+
<property name="fill">False</property>
|
51
|
+
<property name="position">0</property>
|
52
|
+
</packing>
|
53
|
+
</child>
|
54
|
+
<child>
|
55
|
+
<object class="GtkBox">
|
56
|
+
<property name="visible">True</property>
|
57
|
+
<property name="can-focus">False</property>
|
58
|
+
<property name="margin-start">10</property>
|
59
|
+
<property name="margin-end">10</property>
|
60
|
+
<property name="margin-top">10</property>
|
61
|
+
<property name="margin-bottom">10</property>
|
62
|
+
<property name="orientation">vertical</property>
|
63
|
+
<property name="spacing">20</property>
|
64
|
+
<child>
|
65
|
+
<object class="GtkLabel">
|
66
|
+
<property name="visible">True</property>
|
67
|
+
<property name="can-focus">False</property>
|
68
|
+
<property name="label" translatable="yes"><big><b>Choose Your Favorite Language:</b></big></property>
|
69
|
+
<property name="use-markup">True</property>
|
70
|
+
</object>
|
71
|
+
<packing>
|
72
|
+
<property name="expand">False</property>
|
73
|
+
<property name="fill">True</property>
|
74
|
+
<property name="position">0</property>
|
75
|
+
</packing>
|
76
|
+
</child>
|
77
|
+
<child>
|
78
|
+
<object class="GtkBox">
|
79
|
+
<property name="visible">True</property>
|
80
|
+
<property name="can-focus">False</property>
|
81
|
+
<property name="spacing">10</property>
|
82
|
+
<child>
|
83
|
+
<object class="GtkComboBoxText" id="comboLang">
|
84
|
+
<property name="visible">True</property>
|
85
|
+
<property name="can-focus">False</property>
|
86
|
+
<property name="hexpand">True</property>
|
87
|
+
<property name="active">0</property>
|
88
|
+
<items>
|
89
|
+
<item translatable="yes">Python</item>
|
90
|
+
<item translatable="yes">Ruby</item>
|
91
|
+
<item translatable="yes">Java</item>
|
92
|
+
<item translatable="yes">Swift</item>
|
93
|
+
</items>
|
94
|
+
</object>
|
95
|
+
<packing>
|
96
|
+
<property name="expand">False</property>
|
97
|
+
<property name="fill">True</property>
|
98
|
+
<property name="position">1</property>
|
99
|
+
</packing>
|
100
|
+
</child>
|
101
|
+
<child>
|
102
|
+
<object class="GtkCheckButton" id="checkDefault">
|
103
|
+
<property name="label" translatable="yes">Set Default</property>
|
104
|
+
<property name="visible">True</property>
|
105
|
+
<property name="can-focus">True</property>
|
106
|
+
<property name="receives-default">False</property>
|
107
|
+
<property name="draw-indicator">True</property>
|
108
|
+
</object>
|
109
|
+
<packing>
|
110
|
+
<property name="expand">False</property>
|
111
|
+
<property name="fill">True</property>
|
112
|
+
<property name="position">2</property>
|
113
|
+
</packing>
|
114
|
+
</child>
|
115
|
+
</object>
|
116
|
+
<packing>
|
117
|
+
<property name="expand">False</property>
|
118
|
+
<property name="fill">True</property>
|
119
|
+
<property name="position">1</property>
|
120
|
+
</packing>
|
121
|
+
</child>
|
122
|
+
</object>
|
123
|
+
<packing>
|
124
|
+
<property name="expand">False</property>
|
125
|
+
<property name="fill">True</property>
|
126
|
+
<property name="position">1</property>
|
127
|
+
</packing>
|
128
|
+
</child>
|
129
|
+
</object>
|
130
|
+
</child>
|
131
|
+
<action-widgets>
|
132
|
+
<action-widget response="-6">buttonCancel</action-widget>
|
133
|
+
<action-widget response="-5">buttonOK</action-widget>
|
134
|
+
</action-widgets>
|
135
|
+
</object>
|
136
|
+
</interface>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- Generated with glade 3.16.1 -->
|
3
|
+
<interface>
|
4
|
+
<requires lib="gtk+" version="3.0"/>
|
5
|
+
<object class="GtkWindow" id="window1">
|
6
|
+
<property name="can_focus">False</property>
|
7
|
+
<property name="window_position">center</property>
|
8
|
+
<child>
|
9
|
+
<object class="GtkButtonBox" id="buttonbox1">
|
10
|
+
<property name="visible">True</property>
|
11
|
+
<property name="can_focus">False</property>
|
12
|
+
<property name="halign">center</property>
|
13
|
+
<property name="valign">center</property>
|
14
|
+
<property name="margin_left">50</property>
|
15
|
+
<property name="margin_right">50</property>
|
16
|
+
<property name="margin_top">50</property>
|
17
|
+
<property name="margin_bottom">50</property>
|
18
|
+
<property name="orientation">vertical</property>
|
19
|
+
<property name="layout_style">start</property>
|
20
|
+
<child>
|
21
|
+
<object class="GtkButton" id="button1">
|
22
|
+
<property name="label" translatable="yes">button</property>
|
23
|
+
<property name="visible">True</property>
|
24
|
+
<property name="can_focus">True</property>
|
25
|
+
<property name="receives_default">True</property>
|
26
|
+
</object>
|
27
|
+
<packing>
|
28
|
+
<property name="expand">True</property>
|
29
|
+
<property name="fill">True</property>
|
30
|
+
<property name="position">0</property>
|
31
|
+
</packing>
|
32
|
+
</child>
|
33
|
+
</object>
|
34
|
+
</child>
|
35
|
+
</object>
|
36
|
+
</interface>
|
data/lib/Alert.rb
CHANGED
@@ -142,7 +142,7 @@ end
|
|
142
142
|
#
|
143
143
|
# There are many examples in the "alert_box" example project.
|
144
144
|
|
145
|
-
def
|
145
|
+
def alert2(message, options = {})
|
146
146
|
ans = VR::Alert::DialogAnswer.new()
|
147
147
|
VR::Alert.new(message, ans, options).show_glade(options[:parent])
|
148
148
|
return ans.answer
|
@@ -150,3 +150,6 @@ end
|
|
150
150
|
|
151
151
|
|
152
152
|
|
153
|
+
|
154
|
+
|
155
|
+
|
data/lib/AlertDialog.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
module VR
|
2
|
+
|
3
|
+
# Class that the #alert method uses. This class is note useful by itself. See #alert method instead.
|
4
|
+
# @see #alert
|
5
|
+
# @private
|
6
|
+
class AlertDialog
|
7
|
+
|
8
|
+
include GladeGUI
|
9
|
+
|
10
|
+
# Just passes on values from #alert method.
|
11
|
+
# @see #alert
|
12
|
+
|
13
|
+
def initialize(message, flags = {})
|
14
|
+
@flags = flags
|
15
|
+
@message = message
|
16
|
+
end
|
17
|
+
|
18
|
+
def before_show
|
19
|
+
@builder[:window1].show_all
|
20
|
+
@builder[:boxData].visible = false
|
21
|
+
@builder[:input_text].visible = false
|
22
|
+
@builder[:ui_grid].visible = false
|
23
|
+
@builder[:choices_text].visible = false
|
24
|
+
@builder[:headline].hide
|
25
|
+
@flags[:title] = @flags[:title] ? @flags[:title] : @flags[:headline]
|
26
|
+
@builder[:window1].title = @flags[:title] if @flags[:title]
|
27
|
+
width = @flags[:width].to_i > 100 ? @flags[:width].to_i : 300
|
28
|
+
@builder[:window1].resize(width, 150)
|
29
|
+
@builder[:headline].show if @flags[:headline]
|
30
|
+
|
31
|
+
if @flags[:data].is_a? Hash
|
32
|
+
row = 0
|
33
|
+
@my_hash = @flags[:data]
|
34
|
+
@flags[:data].each_pair do |key,val|
|
35
|
+
label = Gtk::Label.new(key.to_s + ": ")
|
36
|
+
label.halign = :end # use to_s for symbol keys
|
37
|
+
@builder["ui_grid"].attach(label, 0, row, 1, 1)
|
38
|
+
entry = Gtk::Entry.new(Gtk::EntryBuffer.new(val.to_s))
|
39
|
+
entry.hexpand = true
|
40
|
+
@builder["ui_grid"].attach(entry, 1, row, 1, 1)
|
41
|
+
@my_hash[key] = entry
|
42
|
+
row = row + 1
|
43
|
+
end
|
44
|
+
@flags[:button_yes] ||= "Save"
|
45
|
+
@flags[:button_cancel] ||= "Cancel"
|
46
|
+
@builder[:boxData].visible = true
|
47
|
+
@builder["ui_grid"].show_all
|
48
|
+
elsif @flags[:data].is_a? Array
|
49
|
+
@flags[:button_yes] ||= "Select"
|
50
|
+
@flags[:button_cancel] ||= "Cancel"
|
51
|
+
@flags[:data].each { |c| @builder[:choices_text].append_text(c) }
|
52
|
+
@choices_text = @flags[:data][0]
|
53
|
+
@builder[:boxData].visible = true
|
54
|
+
@builder[:choices_text].show
|
55
|
+
elsif @flags[:data].is_a? String
|
56
|
+
@flags[:button_yes] ||= "Save"
|
57
|
+
@flags[:button_cancel] ||= "Cancel"
|
58
|
+
@builder[:input_text].buffer.text = @flags[:data]
|
59
|
+
@builder[:boxData].visible = true
|
60
|
+
@builder[:input_text].show
|
61
|
+
end
|
62
|
+
@builder[:button_no].hide unless @flags[:button_no]
|
63
|
+
@builder[:button_cancel].hide unless @flags[:button_cancel]
|
64
|
+
set_glade_variables
|
65
|
+
set_glade_hash(@flags)
|
66
|
+
end
|
67
|
+
|
68
|
+
def run()
|
69
|
+
load_glade()
|
70
|
+
before_show()
|
71
|
+
response = @builder[:window1].run
|
72
|
+
case response
|
73
|
+
when Gtk::ResponseType::YES
|
74
|
+
if @flags[:data].is_a? String
|
75
|
+
answer = @builder[:input_text].buffer.text
|
76
|
+
elsif @flags[:data].is_a? Array
|
77
|
+
answer = @builder[:choices_text].active_text
|
78
|
+
elsif @flags[:data].is_a? Hash
|
79
|
+
answer = @my_hash # clean up
|
80
|
+
@my_hash.each_pair do |key, val|
|
81
|
+
answer[key] = @my_hash[key].buffer.text
|
82
|
+
end
|
83
|
+
else
|
84
|
+
answer = true
|
85
|
+
end
|
86
|
+
when Gtk::ResponseType::NO
|
87
|
+
answer = false
|
88
|
+
else
|
89
|
+
answer = nil
|
90
|
+
end # case
|
91
|
+
@builder[:window1].destroy
|
92
|
+
return answer
|
93
|
+
end # run
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
# @param [String] message text message to display in alert box. Uses markup.
|
100
|
+
# @param [Hash] options Hash of options: :button_yes => text on the button that returns true.
|
101
|
+
# @option options [String] :button_yes Text that appears on the "yes" button.
|
102
|
+
# @option options [String] :button_no Text that appears on "no" button. (set to make no button appear)
|
103
|
+
# @option options [String] :button_cancel Text that appears on "cancel" button. (set to make cancel button appear)
|
104
|
+
# @option options [Variable] :data Either String, Array, or Hash. This will determine type of user input.
|
105
|
+
# @option options [String] :headline Larger headline over text message.
|
106
|
+
# @option options [String] :title Title of the alert box window. Defaults to :headline.
|
107
|
+
# @option options [Integer] :width The width in pixels of the window. Used for wrapping text.
|
108
|
+
# @option options [Object #builder] :parent The window that the alert box is always on top of.
|
109
|
+
# @return [String] text in the text entry field when the :button_yes button is pressed. (:data passed a String)
|
110
|
+
# @return [String] selected text from dropdown when the :button_yes button is pressed. (:data passed an Array)
|
111
|
+
# @return [Hash] When :data is passed as Hash, this is updated Hash from user input.
|
112
|
+
# @return [true] When the :button_yes button is selected and there's no text entry box.
|
113
|
+
# @return [false] When :button_no is pressed
|
114
|
+
# @return [nil] When :button_cancel or the "X" button is pressed.
|
115
|
+
# The alert method creates a pop-up alert in your program. It creates a modal
|
116
|
+
# window that halts execution of your code until the user closes it. Its great
|
117
|
+
# for displaying messages and debugging. It also has the option of allowing the user
|
118
|
+
# input in the form of a String or a selection from a Hash or Array. This small tool can save
|
119
|
+
# hundreds of lines of code in your programs. It can be used extesnively to
|
120
|
+
# display all types of messages and request all types of user input.
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# alert("Continue?", button_no: "Nope", button_cancel: "Quit", parent: self)
|
124
|
+
#
|
125
|
+
# @example
|
126
|
+
# alert "The file you selected is already on disk. Do you want to overwrite it?",
|
127
|
+
# headline: "Overwrite FIle?",
|
128
|
+
# button_yes: "Overwrite",
|
129
|
+
# button_no: "Reload From Disk",
|
130
|
+
# button_cancel: "Cancel"
|
131
|
+
#
|
132
|
+
# The alert box can disply 1, 2 or 3 buttons. The first button is denoted using the symbol: :button_yes
|
133
|
+
# button and is always displayed. You can add :button_no and :button_cancel.
|
134
|
+
# If you want to add these buttons, just set their values to whatever text you want them to
|
135
|
+
# display and they will appear. Likewise, if you pass a :data parameter with a String, Hash or Array,
|
136
|
+
# it will ask for user input.
|
137
|
+
#
|
138
|
+
# There are many examples in the "alert_box" example project.
|
139
|
+
|
140
|
+
def alert(message, options = {})
|
141
|
+
win = VR::AlertDialog.new(message, options)
|
142
|
+
return win.run()
|
143
|
+
end
|
144
|
+
|
145
|
+
# alert2("Hello There", data: {name: "", password: ""}, headline: "testing", width: 500)
|
@@ -0,0 +1,181 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- Generated with glade 3.40.0 -->
|
3
|
+
<interface>
|
4
|
+
<requires lib="gtk+" version="3.24"/>
|
5
|
+
<object class="GtkDialog" id="window1">
|
6
|
+
<property name="width-request">400</property>
|
7
|
+
<property name="height-request">200</property>
|
8
|
+
<property name="can-focus">False</property>
|
9
|
+
<property name="default-width">400</property>
|
10
|
+
<property name="default-height">200</property>
|
11
|
+
<property name="type-hint">dialog</property>
|
12
|
+
<child internal-child="vbox">
|
13
|
+
<object class="GtkBox">
|
14
|
+
<property name="can-focus">False</property>
|
15
|
+
<property name="margin-start">20</property>
|
16
|
+
<property name="margin-end">20</property>
|
17
|
+
<property name="margin-top">20</property>
|
18
|
+
<property name="margin-bottom">20</property>
|
19
|
+
<property name="orientation">vertical</property>
|
20
|
+
<child internal-child="action_area">
|
21
|
+
<object class="GtkButtonBox">
|
22
|
+
<property name="can-focus">False</property>
|
23
|
+
<property name="margin-top">10</property>
|
24
|
+
<property name="layout-style">end</property>
|
25
|
+
<child>
|
26
|
+
<object class="GtkButton" id="button_cancel">
|
27
|
+
<property name="label" translatable="yes">button</property>
|
28
|
+
<property name="can-focus">True</property>
|
29
|
+
<property name="receives-default">True</property>
|
30
|
+
</object>
|
31
|
+
<packing>
|
32
|
+
<property name="expand">False</property>
|
33
|
+
<property name="fill">True</property>
|
34
|
+
<property name="position">0</property>
|
35
|
+
</packing>
|
36
|
+
</child>
|
37
|
+
<child>
|
38
|
+
<object class="GtkButton" id="button_no">
|
39
|
+
<property name="label" translatable="yes">button</property>
|
40
|
+
<property name="can-focus">True</property>
|
41
|
+
<property name="receives-default">True</property>
|
42
|
+
</object>
|
43
|
+
<packing>
|
44
|
+
<property name="expand">True</property>
|
45
|
+
<property name="fill">True</property>
|
46
|
+
<property name="position">1</property>
|
47
|
+
</packing>
|
48
|
+
</child>
|
49
|
+
<child>
|
50
|
+
<object class="GtkButton" id="button_yes">
|
51
|
+
<property name="label" translatable="yes">OK</property>
|
52
|
+
<property name="visible">True</property>
|
53
|
+
<property name="can-focus">True</property>
|
54
|
+
<property name="receives-default">True</property>
|
55
|
+
</object>
|
56
|
+
<packing>
|
57
|
+
<property name="expand">True</property>
|
58
|
+
<property name="fill">True</property>
|
59
|
+
<property name="position">2</property>
|
60
|
+
</packing>
|
61
|
+
</child>
|
62
|
+
</object>
|
63
|
+
<packing>
|
64
|
+
<property name="expand">False</property>
|
65
|
+
<property name="fill">False</property>
|
66
|
+
<property name="position">0</property>
|
67
|
+
</packing>
|
68
|
+
</child>
|
69
|
+
<child>
|
70
|
+
<object class="GtkBox" id="box1">
|
71
|
+
<property name="visible">True</property>
|
72
|
+
<property name="can-focus">False</property>
|
73
|
+
<property name="margin-start">20</property>
|
74
|
+
<property name="margin-end">20</property>
|
75
|
+
<property name="margin-top">20</property>
|
76
|
+
<property name="margin-bottom">20</property>
|
77
|
+
<property name="orientation">vertical</property>
|
78
|
+
<property name="spacing">15</property>
|
79
|
+
<child>
|
80
|
+
<object class="GtkLabel" id="headline">
|
81
|
+
<property name="can-focus">False</property>
|
82
|
+
<property name="label" translatable="yes">label</property>
|
83
|
+
<attributes>
|
84
|
+
<attribute name="size" value="18000"/>
|
85
|
+
</attributes>
|
86
|
+
</object>
|
87
|
+
<packing>
|
88
|
+
<property name="expand">False</property>
|
89
|
+
<property name="fill">True</property>
|
90
|
+
<property name="position">0</property>
|
91
|
+
</packing>
|
92
|
+
</child>
|
93
|
+
<child>
|
94
|
+
<object class="GtkLabel" id="message">
|
95
|
+
<property name="visible">True</property>
|
96
|
+
<property name="can-focus">False</property>
|
97
|
+
<property name="valign">start</property>
|
98
|
+
<property name="hexpand">True</property>
|
99
|
+
<property name="vexpand">True</property>
|
100
|
+
<property name="label" translatable="yes">label</property>
|
101
|
+
<property name="use-markup">True</property>
|
102
|
+
<property name="wrap">True</property>
|
103
|
+
</object>
|
104
|
+
<packing>
|
105
|
+
<property name="expand">False</property>
|
106
|
+
<property name="fill">True</property>
|
107
|
+
<property name="position">1</property>
|
108
|
+
</packing>
|
109
|
+
</child>
|
110
|
+
</object>
|
111
|
+
<packing>
|
112
|
+
<property name="expand">False</property>
|
113
|
+
<property name="fill">True</property>
|
114
|
+
<property name="position">1</property>
|
115
|
+
</packing>
|
116
|
+
</child>
|
117
|
+
<child>
|
118
|
+
<object class="GtkBox" id="boxData">
|
119
|
+
<property name="visible">True</property>
|
120
|
+
<property name="can-focus">False</property>
|
121
|
+
<property name="margin-start">20</property>
|
122
|
+
<property name="margin-end">20</property>
|
123
|
+
<property name="margin-bottom">20</property>
|
124
|
+
<property name="hexpand">True</property>
|
125
|
+
<property name="vexpand">True</property>
|
126
|
+
<property name="orientation">vertical</property>
|
127
|
+
<child>
|
128
|
+
<object class="GtkEntry" id="input_text">
|
129
|
+
<property name="can-focus">True</property>
|
130
|
+
</object>
|
131
|
+
<packing>
|
132
|
+
<property name="expand">False</property>
|
133
|
+
<property name="fill">True</property>
|
134
|
+
<property name="position">0</property>
|
135
|
+
</packing>
|
136
|
+
</child>
|
137
|
+
<child>
|
138
|
+
<object class="GtkComboBoxText" id="choices_text">
|
139
|
+
<property name="can-focus">False</property>
|
140
|
+
</object>
|
141
|
+
<packing>
|
142
|
+
<property name="expand">False</property>
|
143
|
+
<property name="fill">True</property>
|
144
|
+
<property name="position">1</property>
|
145
|
+
</packing>
|
146
|
+
</child>
|
147
|
+
<child>
|
148
|
+
<!-- n-columns=2 n-rows=0 -->
|
149
|
+
<object class="GtkGrid" id="ui_grid">
|
150
|
+
<property name="can-focus">False</property>
|
151
|
+
<property name="row-spacing">10</property>
|
152
|
+
<property name="column-spacing">10</property>
|
153
|
+
<child>
|
154
|
+
<placeholder/>
|
155
|
+
</child>
|
156
|
+
<child>
|
157
|
+
<placeholder/>
|
158
|
+
</child>
|
159
|
+
</object>
|
160
|
+
<packing>
|
161
|
+
<property name="expand">False</property>
|
162
|
+
<property name="fill">True</property>
|
163
|
+
<property name="position">2</property>
|
164
|
+
</packing>
|
165
|
+
</child>
|
166
|
+
</object>
|
167
|
+
<packing>
|
168
|
+
<property name="expand">False</property>
|
169
|
+
<property name="fill">True</property>
|
170
|
+
<property name="position">3</property>
|
171
|
+
</packing>
|
172
|
+
</child>
|
173
|
+
</object>
|
174
|
+
</child>
|
175
|
+
<action-widgets>
|
176
|
+
<action-widget response="-6">button_cancel</action-widget>
|
177
|
+
<action-widget response="-9">button_no</action-widget>
|
178
|
+
<action-widget response="-8">button_yes</action-widget>
|
179
|
+
</action-widgets>
|
180
|
+
</object>
|
181
|
+
</interface>
|
data/lib/vrlib.rb
CHANGED
@@ -6,10 +6,10 @@ require "yaml"
|
|
6
6
|
require "find"
|
7
7
|
require "fileutils"
|
8
8
|
|
9
|
-
|
10
9
|
#tools go first
|
11
10
|
require_relative "GladeGUI"
|
12
|
-
require_relative "Alert"
|
11
|
+
# require_relative "Alert"
|
12
|
+
require_relative "AlertDialog"
|
13
13
|
require_relative "DragDrop"
|
14
14
|
require_relative "SavableClass"
|
15
15
|
|
data/src/editor/VR_Tabs.rb
CHANGED
@@ -36,12 +36,11 @@ class VR_Tabs < Gtk::Notebook
|
|
36
36
|
end
|
37
37
|
return false
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def save_changes?
|
41
|
-
answer = alert
|
42
|
-
parent: @main,
|
41
|
+
answer = alert("Save chages to: <b> #{File.basename(@docs[page].full_path_file)}</b> ?",
|
43
42
|
button_yes: "Save Changes", button_no: "Discard Changes",
|
44
|
-
headline: "Save Changes?", button_cancel: "Cancel"
|
43
|
+
headline: "Save Changes?", button_cancel: "Cancel")
|
45
44
|
if answer == true # save
|
46
45
|
if @docs[page].title.label == "Untitled"
|
47
46
|
return save_as()
|
data/src/main/VR_Main.rb
CHANGED
data/src/version.rb
CHANGED
data/vr
CHANGED
@@ -6,11 +6,11 @@ require GTK_VERSION
|
|
6
6
|
require GTK_SOURCEVIEW_VERSION
|
7
7
|
|
8
8
|
$root = File.dirname(__FILE__)
|
9
|
-
|
9
|
+
|
10
10
|
require_relative "all_requires"
|
11
11
|
|
12
12
|
VR_Main.new(ARGV).show_glade()
|
13
|
-
|
13
|
+
|
14
14
|
# Gtk.main_quit
|
15
15
|
#
|
16
16
|
# main = Gtk::Application.new("visualruby.org.main", [:non_unique] )
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visualruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Cunningham
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir:
|
10
10
|
- "."
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gtk3
|
@@ -204,6 +204,11 @@ files:
|
|
204
204
|
- "./examples/97_active_record2/bin/glade/Paycheck.glade"
|
205
205
|
- "./examples/97_active_record2/db/development.sqlite3"
|
206
206
|
- "./examples/97_active_record2/main.rb"
|
207
|
+
- "./examples/dialog_box/.vr_settings.yaml"
|
208
|
+
- "./examples/dialog_box/dialog_box.rb"
|
209
|
+
- "./examples/dialog_box/src/ChooserDialog.rb"
|
210
|
+
- "./examples/dialog_box/src/glade/ChooserDialog.glade"
|
211
|
+
- "./examples/dialog_box/src/glade/MyClass.glade"
|
207
212
|
- "./img/close.png"
|
208
213
|
- "./img/folder.png"
|
209
214
|
- "./img/glade.png"
|
@@ -215,11 +220,13 @@ files:
|
|
215
220
|
- "./img/splash.png"
|
216
221
|
- "./img/unknown.png"
|
217
222
|
- "./lib/Alert.rb"
|
223
|
+
- "./lib/AlertDialog.rb"
|
218
224
|
- "./lib/DragDrop.rb"
|
219
225
|
- "./lib/GladeGUI.rb"
|
220
226
|
- "./lib/SavableClass.rb"
|
221
227
|
- "./lib/Tools.rb"
|
222
228
|
- "./lib/glade/Alert.glade"
|
229
|
+
- "./lib/glade/AlertDialog.glade"
|
223
230
|
- "./lib/oinspect/MethodsListView.rb"
|
224
231
|
- "./lib/oinspect/ObjectInspectorGUI.rb"
|
225
232
|
- "./lib/oinspect/VariablesListView.rb"
|