visualruby 3.2.0 → 3.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e357cc2ff4c771cc573325c4dc8023e4ea2fcd87
4
- data.tar.gz: 94c434debee191dfc4e91bb0f04c7d63c43f26d5
2
+ SHA256:
3
+ metadata.gz: 0074b60a95460353ace8f4a4e202449b0518cb02defb20280ba0d909f06a1843
4
+ data.tar.gz: bcdfdaba09fce6e9b3b9a3da3c8e64985a88ae7aaa286f8f37d581a7b5b90ef2
5
5
  SHA512:
6
- metadata.gz: 0e58c238a1de0cf1703fa0f58402f458291f5b41aab14a3318d258adb30e3b5e8414446bf8e1257befa90c83fbb5628b150362c52546674df2941899ca33b9e1
7
- data.tar.gz: 3b5d266b28bbbb86e28bf4c390481384a228820ae89a7a83929381163b467f1b045f0c61acec0c5f309bb8c447d7f583c874ff9ba55b56a79e706a79f4f28cae
6
+ metadata.gz: 040e37dad70ab5aa5cfaae814d12bb211c616c826ad1218f4184994fe3888c02afa0eb488d2053a1eb820c3db3624d6b872a6b9467158fc85c1e47ceb1c90836
7
+ data.tar.gz: dd2e5c97ef06edcef9406a65163f67ec0a0da1ee88e4c1c61628325bdef835a903a8f1d89ac4a69ed9744b489ac170356ae367e148a1d40c7c1ff6df190cfd4b
data/.vr_settings.yaml CHANGED
@@ -14,16 +14,26 @@ open_files:
14
14
  - "/home/eric/vrp/vr3/vr"
15
15
  - "/home/eric/vrp/vr3/src/main/VR_Main.rb"
16
16
  - "/home/eric/vrp/vr3/lib/GladeGUI.rb"
17
- - "/home/eric/vrp/vr3/src/editor/VR_TextShell.rb"
17
+ - "/home/eric/vrp/vr3/lib/treeview/FileTreeView.rb"
18
18
  - "/home/eric/vrp/vr3/src/editor/VR_Document.rb"
19
+ - "/home/eric/vrp/vr3/lib/SavableClass.rb"
20
+ - "/home/eric/vrp/vr3/lib/ActLikeAHash.rb"
21
+ - "/home/eric/vrp/vr3/src/main/VR_Remote_Gem_Tree.rb"
22
+ - "/home/eric/vrp/vr3/src/main/RubygemsAPI.rb"
23
+ - "/home/eric/vrp/vr3/examples/alert_box/main.rb"
24
+ - "/home/eric/vrp/vr3/examples/active_record/active_record.rb"
25
+ - "/home/eric/vrp/vr3/examples/active_record2/main.rb"
26
+ - "/home/eric/vrp/vr3/lib/vrlib.rb"
27
+ - "/home/eric/vrp/vr3/lib/treeview/TreeView.rb"
19
28
  open_folders:
20
29
  - "/home/eric/vrp/vr3"
30
+ - "/home/eric/vrp/vr3/lib"
21
31
  - "/home/eric/vrp/vr3/site"
22
32
  - "/home/eric/vrp/vr3/src"
23
33
  - "/home/eric/vrp/vr3/src/editor"
24
34
  - "/home/eric/vrp/vr3/src/main"
25
- current_file: "/home/eric/vrp/vr3/src/editor/VR_Document.rb"
26
- current_line: 44
35
+ current_file: "/home/eric/vrp/vr3/vr.gemspec"
36
+ current_line: 7
27
37
  rdoc_command_line: yardoc lib - site/*.*
28
38
  builder: !ruby/object:Gtk::Builder {}
29
39
  top_level_window: false
@@ -36,6 +36,7 @@ class AllWidgets
36
36
  end
37
37
 
38
38
  def initialize() #window1__show(*args)
39
+ p hello
39
40
  @window1 = "Showing All Widgets"
40
41
  @label1 = "I'm a Label"
41
42
  @checkbutton1 = true
@@ -0,0 +1,27 @@
1
+ --- !ruby/object:VR_ENV
2
+ vr_yaml_file: "/home/eric/vrp/vr3/examples/golf_handicap/.vr_settings.yaml"
3
+ width: 1086
4
+ height: 600
5
+ panel_pos: 360
6
+ notebook_panel_position: 400
7
+ run_command_line: ruby golf_handicap eric
8
+ open_files:
9
+ - "/home/eric/vrp/vr3/examples/golf_handicap/golf_handicap"
10
+ - "/home/eric/vrp/vr3/examples/golf_handicap/src/Handicap.rb"
11
+ - "/home/eric/vrp/vr3/examples/golf_handicap/src/Score.rb"
12
+ - "/home/eric/vrp/vr3/examples/golf_handicap/golf_handicap.gemspec"
13
+ - "/home/eric/vrp/vr3/examples/golf_handicap/src/LoadGolfer.rb"
14
+ open_folders:
15
+ - "/home/eric/vrp/vr3/examples/golf_handicap"
16
+ - "/home/eric/vrp/vr3/examples/golf_handicap/src"
17
+ - "/home/eric/vrp/vr3/examples/golf_handicap/src/glade"
18
+ current_file: "/home/eric/vrp/vr3/examples/golf_handicap/golf_handicap.gemspec"
19
+ current_line: 3
20
+ rdoc_command_line: rdoc -x README
21
+ builder: !ruby/object:Gtk::Builder {}
22
+ top_level_window: false
23
+ browser: firefox
24
+ backup_path: "/home/eric"
25
+ tab_spaces: 2
26
+ glade_path: glade-3
27
+ font_name: Monospace 10
@@ -0,0 +1,115 @@
1
+ class Handicap
2
+
3
+ include GladeGUI
4
+
5
+ def initialize()
6
+ @scores = []
7
+ end
8
+
9
+ def before_show()
10
+ @view = VR::ListView.new(rnd: String, date: VR::Col::CalendarCol,
11
+ course: String, rating_slope: String, score: String, diff: Score,
12
+ hcp: String)
13
+ @view.col_xalign(diff: 1, hcp: 1, score: 1)
14
+ @view.col_sortable(date: true, course: true)
15
+ @view.show
16
+ golfer_file = File.basename(@vr_yaml_file, ".*")
17
+ golfer = golfer_file.split("_").map(&:capitalize).join(' ')
18
+ @builder[:name].label = "<big><big><big><big><big>#{golfer}</big></big></big></big></big>"
19
+ if File.exists?(golfer_file + ".jpg")
20
+ @builder[:image].file = golfer_file + ".jpg"
21
+ @builder[:image].visible = true
22
+ end
23
+ refresh()
24
+ end
25
+
26
+ def refresh()
27
+ update_handicaps
28
+ @view.model.clear
29
+ i = 1
30
+ @scores.each do |s|
31
+ row = @view.add_row()
32
+ row[:rnd] = "#{i}."
33
+ i += 1
34
+ row[:date] = VR::Col::CalendarCol.new(s.date, :format => "%d %b %Y ", :hide_time=>true, :hide_date => false)
35
+ row[:course] = s.course_name
36
+ row[:score] = s.score
37
+ row[:rating_slope] = "#{s.course_rating.to_s}/#{s.course_slope.to_s}"
38
+ row[:diff] = s
39
+ row[:hcp] = s.handicap
40
+ end
41
+ end
42
+
43
+ def buttonAdd__clicked(*a)
44
+ if row = @view.selected_rows.first
45
+ course = row[:course]
46
+ rating, slope = row[:rating_slope].split("/")
47
+ else
48
+ course = rating = slope = ""
49
+ end
50
+ score = Score.new(course, rating, slope)
51
+ score.show_glade
52
+ if !score.used.nil? and score.score.to_i > 50
53
+ @scores << score
54
+ @scores.sort! { |x,y| y.date <=> x.date }
55
+ refresh()
56
+ end
57
+ end
58
+
59
+ def update_handicaps
60
+ @scores.each_index do |i|
61
+ fill_handicap(@scores[@scores.size-i-1..@scores.size-1])
62
+ end
63
+ @scores.each {|s| s.used = ""}
64
+ fill_handicap(@scores)
65
+ @builder[:handicap].label = "<big><big><big><big><big><big><big><big>#{@scores[0].handicap}</big></big></big></big></big></big></big></big>" if @scores[0]
66
+ end
67
+
68
+ def fill_handicap(score_array)
69
+ score_ar = score_array.size > 20 ? score_array[0..19] : score_array
70
+ count = use_count(score_ar) # number of scores to use for handicap
71
+ best_scores = score_ar.sort { |x,y| x.diff <=> y.diff }
72
+ best_scores = count > 0 ? best_scores[0..count-1] : []
73
+ best_scores.each {|s| s.used = "y"}
74
+ tot = best_scores.inject(0) { |sum, s| sum + s.diff }
75
+ x = (0.96*tot/count).to_s
76
+ score_array[0].handicap = count > 0 ? x[0..x.index(".")+1] : "n/a" if score_array[0]
77
+ end
78
+
79
+ def buttonChangeGolfer__clicked(*a)
80
+ @view = nil # so it doesn't save contents
81
+ VR::save_yaml(self)
82
+ @builder[:window1].destroy
83
+ load_new_golfer
84
+ end
85
+
86
+
87
+ def window1__delete_event(*)
88
+ @view = nil
89
+ VR::save_yaml(self)
90
+ return false #ok to close
91
+ end
92
+
93
+ def use_count(score_ar)
94
+ if score_ar.size > 20
95
+ return 10
96
+ else
97
+ return [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,8,9,10][score_ar.size-1]
98
+ end
99
+ end
100
+
101
+ def buttonDelete__clicked(*a)
102
+ return unless row = @view.selected_rows.first
103
+ if alert("Are you sure you want to delete this score?", button_yes: "Delete", button_no: "Cancel")
104
+ @scores.delete(row[:diff])
105
+ refresh
106
+ end
107
+ end
108
+
109
+ def buttonEditScore__clicked(*a)
110
+ return unless row = @view.selected_rows.first
111
+ row[:diff].show_glade
112
+ @scores.sort! { |x,y| y.date <=> x.date }
113
+ refresh
114
+ end
115
+ end
@@ -0,0 +1,27 @@
1
+ def load_new_golfer
2
+ files = []
3
+ names = []
4
+ Dir[File.expand_path('~/visualruby/golf_handicap/**/*.yaml')].each do |file_name|
5
+ files << file_name
6
+ names << File.basename(file_name, ".*")
7
+ end
8
+
9
+ answer = files.empty? ? false : alert("Choose Golfer:", choices: names, button_no: "New Golfer")
10
+
11
+ if answer.is_a?(String)
12
+ load_file = files[names.index(answer)]
13
+ elsif answer == false
14
+ golfer_name = alert("Enter Name of Golfer to Create a new Handicap File:",
15
+ input_text: "",
16
+ button_yes: "Add Golfer"
17
+ )
18
+ exit! unless golfer_name.is_a?(String)
19
+ exit! unless golfer_name.length > 2
20
+ load_file = golfer_name.downcase.tr("^a-z\s", '').gsub(" ", "_") + ".yaml"
21
+ else
22
+ exit!
23
+ end
24
+
25
+ VR::load_yaml(Handicap, load_file).show_glade
26
+
27
+ end
@@ -0,0 +1,37 @@
1
+
2
+ class Score
3
+
4
+ attr_accessor :date, :score, :course_name, :course_rating, :course_slope, :used, :handicap
5
+
6
+ include GladeGUI
7
+
8
+ def initialize(course, rating, slope)
9
+ @course_name = course
10
+ @course_rating = rating
11
+ @course_slope = slope
12
+ @date = DateTime.now
13
+ @score = "0"
14
+ @used = nil
15
+ @handicap = "0"
16
+ end
17
+
18
+ def buttonSave__clicked(*a)
19
+ get_glade_variables
20
+ @used = "n" # signals save occured
21
+ @builder[:window1].destroy
22
+ end
23
+
24
+ def diff()
25
+ (@score.to_f - @course_rating.to_f) * 113 / @course_slope.to_f
26
+ end
27
+
28
+ def to_s
29
+ (@used == "y" ? "*" : " ") + diff.round(1).to_s
30
+ end
31
+
32
+ def visual_attributes
33
+ # return @used == "y" ? {background: "#ABB" , weight: 600} : {background: "white", weight: 300 }
34
+ return @used == "y" ? { weight: 1200} : {weight: 400 }
35
+ end
36
+
37
+ end
@@ -0,0 +1,178 @@
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="width_request">670</property>
7
+ <property name="height_request">660</property>
8
+ <property name="can_focus">False</property>
9
+ <property name="title" translatable="yes">USGA Handicap Index Calculator</property>
10
+ <property name="modal">True</property>
11
+ <property name="type_hint">utility</property>
12
+ <child>
13
+ <object class="GtkBox" id="box1">
14
+ <property name="visible">True</property>
15
+ <property name="can_focus">False</property>
16
+ <property name="margin_left">10</property>
17
+ <property name="margin_right">10</property>
18
+ <property name="margin_top">10</property>
19
+ <property name="margin_bottom">10</property>
20
+ <property name="orientation">vertical</property>
21
+ <property name="spacing">10</property>
22
+ <child>
23
+ <object class="GtkBox" id="box2">
24
+ <property name="visible">True</property>
25
+ <property name="can_focus">False</property>
26
+ <property name="spacing">20</property>
27
+ <child>
28
+ <object class="GtkImage" id="image">
29
+ <property name="can_focus">False</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="GtkLabel" id="name">
39
+ <property name="visible">True</property>
40
+ <property name="can_focus">False</property>
41
+ <property name="label" translatable="yes">&lt;big&gt;&lt;big&gt;&lt;big&gt;&lt;big&gt;Eric Cunningham&lt;/big&gt;&lt;/big&gt;&lt;/big&gt;&lt;/big&gt;</property>
42
+ <property name="use_markup">True</property>
43
+ </object>
44
+ <packing>
45
+ <property name="expand">True</property>
46
+ <property name="fill">True</property>
47
+ <property name="position">1</property>
48
+ </packing>
49
+ </child>
50
+ <child>
51
+ <object class="GtkFrame" id="frame1">
52
+ <property name="visible">True</property>
53
+ <property name="can_focus">False</property>
54
+ <property name="label_xalign">0</property>
55
+ <property name="shadow_type">in</property>
56
+ <child>
57
+ <object class="GtkAlignment" id="alignment1">
58
+ <property name="visible">True</property>
59
+ <property name="can_focus">False</property>
60
+ <property name="left_padding">12</property>
61
+ <child>
62
+ <object class="GtkLabel" id="handicap">
63
+ <property name="visible">True</property>
64
+ <property name="can_focus">False</property>
65
+ <property name="label" translatable="yes">&lt;big&gt;&lt;big&gt;&lt;big&gt;&lt;big&gt;&lt;big&gt;&lt;big&gt;&lt;big&gt;&lt;big&gt;n/a&lt;/big&gt;&lt;/big&gt;&lt;/big&gt;&lt;/big&gt;&lt;/big&gt;&lt;/big&gt;&lt;/big&gt;&lt;/big&gt;</property>
66
+ <property name="use_markup">True</property>
67
+ </object>
68
+ </child>
69
+ </object>
70
+ </child>
71
+ <child type="label">
72
+ <object class="GtkLabel" id="label2">
73
+ <property name="visible">True</property>
74
+ <property name="can_focus">False</property>
75
+ <property name="label" translatable="yes">Handicap</property>
76
+ <property name="justify">center</property>
77
+ </object>
78
+ </child>
79
+ </object>
80
+ <packing>
81
+ <property name="expand">False</property>
82
+ <property name="fill">True</property>
83
+ <property name="position">2</property>
84
+ </packing>
85
+ </child>
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="GtkScrolledWindow" id="view">
95
+ <property name="visible">True</property>
96
+ <property name="can_focus">True</property>
97
+ <property name="hexpand">True</property>
98
+ <property name="vexpand">True</property>
99
+ <property name="shadow_type">in</property>
100
+ <child>
101
+ <placeholder/>
102
+ </child>
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
+ <child>
111
+ <object class="GtkButtonBox" id="buttonbox1">
112
+ <property name="visible">True</property>
113
+ <property name="can_focus">False</property>
114
+ <property name="spacing">5</property>
115
+ <property name="layout_style">end</property>
116
+ <child>
117
+ <object class="GtkButton" id="buttonChangeGolfer">
118
+ <property name="label" translatable="yes">Change Golfer</property>
119
+ <property name="visible">True</property>
120
+ <property name="can_focus">True</property>
121
+ <property name="receives_default">True</property>
122
+ </object>
123
+ <packing>
124
+ <property name="expand">False</property>
125
+ <property name="fill">True</property>
126
+ <property name="position">0</property>
127
+ </packing>
128
+ </child>
129
+ <child>
130
+ <object class="GtkButton" id="buttonAdd">
131
+ <property name="label" translatable="yes">Add Score</property>
132
+ <property name="visible">True</property>
133
+ <property name="can_focus">True</property>
134
+ <property name="receives_default">True</property>
135
+ </object>
136
+ <packing>
137
+ <property name="expand">False</property>
138
+ <property name="fill">True</property>
139
+ <property name="position">1</property>
140
+ </packing>
141
+ </child>
142
+ <child>
143
+ <object class="GtkButton" id="buttonEditScore">
144
+ <property name="label" translatable="yes">Edit Score</property>
145
+ <property name="visible">True</property>
146
+ <property name="can_focus">True</property>
147
+ <property name="receives_default">True</property>
148
+ </object>
149
+ <packing>
150
+ <property name="expand">False</property>
151
+ <property name="fill">True</property>
152
+ <property name="position">2</property>
153
+ </packing>
154
+ </child>
155
+ <child>
156
+ <object class="GtkButton" id="buttonDelete">
157
+ <property name="label" translatable="yes">Delete Score</property>
158
+ <property name="visible">True</property>
159
+ <property name="can_focus">True</property>
160
+ <property name="receives_default">True</property>
161
+ </object>
162
+ <packing>
163
+ <property name="expand">False</property>
164
+ <property name="fill">True</property>
165
+ <property name="position">3</property>
166
+ </packing>
167
+ </child>
168
+ </object>
169
+ <packing>
170
+ <property name="expand">False</property>
171
+ <property name="fill">True</property>
172
+ <property name="position">2</property>
173
+ </packing>
174
+ </child>
175
+ </object>
176
+ </child>
177
+ </object>
178
+ </interface>
@@ -0,0 +1,219 @@
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="modal">True</property>
8
+ <child>
9
+ <object class="GtkBox" id="box1">
10
+ <property name="visible">True</property>
11
+ <property name="can_focus">False</property>
12
+ <property name="margin_left">10</property>
13
+ <property name="margin_right">10</property>
14
+ <property name="margin_top">10</property>
15
+ <property name="margin_bottom">10</property>
16
+ <property name="orientation">vertical</property>
17
+ <property name="spacing">10</property>
18
+ <child>
19
+ <object class="GtkLabel" id="label6">
20
+ <property name="visible">True</property>
21
+ <property name="can_focus">False</property>
22
+ <property name="label" translatable="yes">&lt;big&gt;&lt;big&gt;Enter Score&lt;/big&gt;&lt;/big&gt;</property>
23
+ <property name="use_markup">True</property>
24
+ </object>
25
+ <packing>
26
+ <property name="expand">False</property>
27
+ <property name="fill">True</property>
28
+ <property name="position">0</property>
29
+ </packing>
30
+ </child>
31
+ <child>
32
+ <object class="GtkGrid" id="grid1">
33
+ <property name="visible">True</property>
34
+ <property name="can_focus">False</property>
35
+ <property name="row_spacing">2</property>
36
+ <property name="column_spacing">5</property>
37
+ <child>
38
+ <object class="GtkLabel" id="label4">
39
+ <property name="visible">True</property>
40
+ <property name="can_focus">False</property>
41
+ <property name="xalign">1</property>
42
+ <property name="label" translatable="yes">Score:</property>
43
+ </object>
44
+ <packing>
45
+ <property name="left_attach">0</property>
46
+ <property name="top_attach">4</property>
47
+ <property name="width">1</property>
48
+ <property name="height">1</property>
49
+ </packing>
50
+ </child>
51
+ <child>
52
+ <object class="GtkLabel" id="label3">
53
+ <property name="visible">True</property>
54
+ <property name="can_focus">False</property>
55
+ <property name="xalign">1</property>
56
+ <property name="label" translatable="yes">Course Slope:</property>
57
+ </object>
58
+ <packing>
59
+ <property name="left_attach">0</property>
60
+ <property name="top_attach">3</property>
61
+ <property name="width">1</property>
62
+ <property name="height">1</property>
63
+ </packing>
64
+ </child>
65
+ <child>
66
+ <object class="GtkLabel" id="label2">
67
+ <property name="visible">True</property>
68
+ <property name="can_focus">False</property>
69
+ <property name="xalign">1</property>
70
+ <property name="label" translatable="yes">Course Rating:</property>
71
+ </object>
72
+ <packing>
73
+ <property name="left_attach">0</property>
74
+ <property name="top_attach">2</property>
75
+ <property name="width">1</property>
76
+ <property name="height">1</property>
77
+ </packing>
78
+ </child>
79
+ <child>
80
+ <object class="GtkLabel" id="label1">
81
+ <property name="visible">True</property>
82
+ <property name="can_focus">False</property>
83
+ <property name="xalign">1</property>
84
+ <property name="label" translatable="yes">Course Name:</property>
85
+ </object>
86
+ <packing>
87
+ <property name="left_attach">0</property>
88
+ <property name="top_attach">1</property>
89
+ <property name="width">1</property>
90
+ <property name="height">1</property>
91
+ </packing>
92
+ </child>
93
+ <child>
94
+ <object class="GtkLabel" id="label5">
95
+ <property name="visible">True</property>
96
+ <property name="can_focus">False</property>
97
+ <property name="xalign">1</property>
98
+ <property name="label" translatable="yes">Date:</property>
99
+ </object>
100
+ <packing>
101
+ <property name="left_attach">0</property>
102
+ <property name="top_attach">0</property>
103
+ <property name="width">1</property>
104
+ <property name="height">1</property>
105
+ </packing>
106
+ </child>
107
+ <child>
108
+ <object class="GtkEntry" id="course_rating">
109
+ <property name="visible">True</property>
110
+ <property name="can_focus">True</property>
111
+ </object>
112
+ <packing>
113
+ <property name="left_attach">1</property>
114
+ <property name="top_attach">2</property>
115
+ <property name="width">1</property>
116
+ <property name="height">1</property>
117
+ </packing>
118
+ </child>
119
+ <child>
120
+ <object class="GtkEntry" id="course_slope">
121
+ <property name="visible">True</property>
122
+ <property name="can_focus">True</property>
123
+ </object>
124
+ <packing>
125
+ <property name="left_attach">1</property>
126
+ <property name="top_attach">3</property>
127
+ <property name="width">1</property>
128
+ <property name="height">1</property>
129
+ </packing>
130
+ </child>
131
+ <child>
132
+ <object class="GtkEntry" id="score">
133
+ <property name="visible">True</property>
134
+ <property name="can_focus">True</property>
135
+ </object>
136
+ <packing>
137
+ <property name="left_attach">1</property>
138
+ <property name="top_attach">4</property>
139
+ <property name="width">1</property>
140
+ <property name="height">1</property>
141
+ </packing>
142
+ </child>
143
+ <child>
144
+ <object class="GtkCalendar" id="date">
145
+ <property name="visible">True</property>
146
+ <property name="can_focus">True</property>
147
+ <property name="year">2017</property>
148
+ <property name="month">8</property>
149
+ <property name="day">4</property>
150
+ </object>
151
+ <packing>
152
+ <property name="left_attach">1</property>
153
+ <property name="top_attach">0</property>
154
+ <property name="width">1</property>
155
+ <property name="height">1</property>
156
+ </packing>
157
+ </child>
158
+ <child>
159
+ <object class="GtkEntry" id="course_name">
160
+ <property name="visible">True</property>
161
+ <property name="can_focus">True</property>
162
+ </object>
163
+ <packing>
164
+ <property name="left_attach">1</property>
165
+ <property name="top_attach">1</property>
166
+ <property name="width">1</property>
167
+ <property name="height">1</property>
168
+ </packing>
169
+ </child>
170
+ </object>
171
+ <packing>
172
+ <property name="expand">False</property>
173
+ <property name="fill">True</property>
174
+ <property name="position">1</property>
175
+ </packing>
176
+ </child>
177
+ <child>
178
+ <object class="GtkButtonBox" id="buttonbox1">
179
+ <property name="visible">True</property>
180
+ <property name="can_focus">False</property>
181
+ <property name="spacing">5</property>
182
+ <property name="layout_style">end</property>
183
+ <child>
184
+ <object class="GtkButton" id="buttonSave">
185
+ <property name="label" translatable="yes">Save</property>
186
+ <property name="visible">True</property>
187
+ <property name="can_focus">True</property>
188
+ <property name="receives_default">True</property>
189
+ </object>
190
+ <packing>
191
+ <property name="expand">False</property>
192
+ <property name="fill">True</property>
193
+ <property name="position">0</property>
194
+ </packing>
195
+ </child>
196
+ <child>
197
+ <object class="GtkButton" id="buttonCancel">
198
+ <property name="label" translatable="yes">Cancel</property>
199
+ <property name="visible">True</property>
200
+ <property name="can_focus">True</property>
201
+ <property name="receives_default">True</property>
202
+ </object>
203
+ <packing>
204
+ <property name="expand">False</property>
205
+ <property name="fill">True</property>
206
+ <property name="position">1</property>
207
+ </packing>
208
+ </child>
209
+ </object>
210
+ <packing>
211
+ <property name="expand">False</property>
212
+ <property name="fill">True</property>
213
+ <property name="position">2</property>
214
+ </packing>
215
+ </child>
216
+ </object>
217
+ </child>
218
+ </object>
219
+ </interface>
@@ -1,7 +1,9 @@
1
1
  --- !ruby/object:VR_ENV
2
- width: 1366
2
+ vr_yaml_file: "/home/eric/vrp/vr3/examples/simple_ruby_gui/.vr_settings.yaml"
3
+ width: 1301
3
4
  height: 692
4
5
  panel_pos: 490
6
+ notebook_panel_position: 400
5
7
  run_command_line: ruby main.rb
6
8
  open_files:
7
9
  - "/home/eric/vrp/vr3/examples/simple_ruby_gui/bin/DataObjectGUI.rb"
@@ -9,12 +11,9 @@ open_files:
9
11
  open_folders:
10
12
  - "/home/eric/vrp/vr3/examples/simple_ruby_gui"
11
13
  - "/home/eric/vrp/vr3/examples/simple_ruby_gui/bin"
12
- - "/home/eric/vrp/vr3/examples/simple_ruby_gui/bin/glade"
13
14
  current_file: "/home/eric/vrp/vr3/examples/simple_ruby_gui/main.rb"
15
+ current_line: 4
14
16
  rdoc_command_line: rdoc -x README
15
- vr_yaml_file: ".vr_settings.yaml"
16
- notebook_panel_position: 400
17
- current_line: 13
18
- settings_file_version: 1
19
17
  builder: !ruby/object:Gtk::Builder {}
18
+ settings_file_version: 1
20
19
  filename: ".vr_settings.yaml"
@@ -2,11 +2,10 @@
2
2
 
3
3
  #Updated for Gtk3!
4
4
 
5
- # ignore -- this is for development, same as require 'vrlib'
6
- require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
5
+ require "vrlib"
7
6
 
8
7
  # from require_all gem:
9
- require_rel 'bin/'
8
+ require_rel 'bin'
10
9
 
11
10
 
12
11
  x = DataObjectGUI.new("Harvey Milktoast", "123 Main, Hemet, CA 90090",
data/lib/ActLikeAHash.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  # @private
2
- #module ActLikeAHash
3
- #
2
+ # #module ActLikeAHash
3
+ # #
4
4
  # def [] (key)
5
5
  # instance_variable_get("@" + key.to_s)
6
6
  # end
7
- #
7
+ # #
8
8
  # def []= (key, val)
9
9
  # instance_variable_put("@" + key_to_s, val)
10
10
  # end
11
- #
11
+ # #
12
12
  #end
data/lib/Alert.rb CHANGED
@@ -7,6 +7,7 @@ module VR
7
7
 
8
8
  attr_accessor :answer
9
9
 
10
+
10
11
  include GladeGUI
11
12
 
12
13
  # Just passes on values from #alert method.
data/lib/vrlib.rb CHANGED
@@ -5,5 +5,8 @@ require "yaml"
5
5
  require "find"
6
6
  require "fileutils"
7
7
 
8
+
9
+
8
10
  require_rel '/'
11
+ require_rel 'treeview'
9
12
 
@@ -92,28 +92,28 @@ class VR_Document < GtkSource::View
92
92
  apply_tag_to_line(line-1, @hilight, nil)
93
93
  end
94
94
 
95
- def comment()
95
+
96
+ def insert_before_selected(text)
96
97
  return unless buffer.has_selection?
97
98
  s,e = get_selected_lines()
98
99
  (s..e).each do |i|
99
100
  iter, iter_end = get_line_iters(i)
100
- iter_end.offset = iter.offset+1
101
- chr = buffer.get_text(iter, iter_end, false)
102
- buffer.insert(iter, "#")
103
- end
104
- end
105
-
106
- def un_comment()
101
+ buffer.insert(iter, text)
102
+ end
103
+ end
104
+
105
+ def delete_before_selected(text)
107
106
  return unless buffer.has_selection?
108
107
  s,e = get_selected_lines()
109
108
  (s..e).each do |i|
110
109
  iter, iter_end = get_line_iters(i)
111
110
  next if iter_end.offset <= iter.offset + 1
112
- iter_end.offset = iter.offset+1
111
+ iter_end.offset = iter.offset + text.size
113
112
  chr = buffer.get_text(iter, iter_end, false)
114
- buffer.delete(iter, iter_end) if chr == "#"
113
+ buffer.delete(iter, iter_end) if chr == text
115
114
  end
116
- end
115
+ end
116
+
117
117
 
118
118
  def get_selected_lines()
119
119
  return unless buffer.has_selection?
@@ -35,14 +35,15 @@ class VR_File_Tree < VR::FileTreeView
35
35
  end
36
36
 
37
37
  def popInstallGem_clicked()
38
- file_name = get_selected_path()
39
- begin
40
- inst = Gem::Installer.new(file_name, :wrappers => true, :ignore_dependencies => true)
41
- inst.install().to_s
38
+ file_name = get_selected_path().to_s
39
+ begin
42
40
  txt = "\nInstalled Gem: " + file_name
41
+ package = Gem::Package.new(file_name)
42
+ inst = Gem::Installer.new(package, wrappers: true, ignore_dependencies: true)
43
+ inst.install
43
44
  txt += "\nNo check was made for dependencies"
44
45
  rescue Exception => e
45
- txt += "\n" + e.message
46
+ txt += "\n" + e.message.to_s
46
47
  end
47
48
  @main.shell.buffer.text = txt
48
49
  end
data/src/main/VR_Main.rb CHANGED
@@ -209,28 +209,20 @@ class VR_Main
209
209
  VR_Tools.back_up()
210
210
  end
211
211
 
212
- def toolIndent__clicked(*a)
213
- press_key(65289) #tab
212
+ def toolIndent__clicked(*a)
213
+ @tabs.docs[@tabs.page].insert_before_selected(" " * $VR_ENV_GLOBAL.tab_spaces.to_i )
214
214
  end
215
215
 
216
- def toolUnIndent__clicked(*a)
217
- press_key(65056, :shift_mask) # shift+tab
216
+ def toolUnIndent__clicked(*a)
217
+ @tabs.docs[@tabs.page].delete_before_selected(" " * $VR_ENV_GLOBAL.tab_spaces.to_i)
218
218
  end
219
219
 
220
- def press_key(keyval, mask = nil)
221
- evt = Gdk::EventKey.new(:key_press)
222
- evt.state = mask if mask
223
- evt.keyval = keyval
224
- @tabs.docs[@tabs.page].signal_emit(:key_press_event, evt)
220
+ def toolComment__clicked(*a)
221
+ @tabs.docs[@tabs.page].insert_before_selected("# ")
225
222
  end
226
223
 
227
-
228
- def toolComment__clicked(*a)
229
- @tabs.docs[@tabs.page].comment()
230
- end
231
-
232
- def toolUnComment__clicked(*a)
233
- @tabs.docs[@tabs.page].un_comment()
224
+ def toolUnComment__clicked(*a)
225
+ @tabs.docs[@tabs.page].delete_before_selected("# ")
234
226
  end
235
227
 
236
228
  def toolRun__clicked(*a)
data/src/version.rb CHANGED
@@ -1 +1 @@
1
- VERSION = "3.2.0"
1
+ VERSION = "3.4.5"
data/vr CHANGED
@@ -13,9 +13,16 @@ def load_everything
13
13
  require "rubygems/specification"
14
14
 
15
15
  require 'require_all'
16
-
16
+
17
17
  require_rel 'lib/'
18
- require_rel 'src/'
18
+ require_rel 'src/'
19
+ # require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
20
+
21
+ # require_rel 'lib/GladeGUI.rb'
22
+
23
+
24
+
25
+
19
26
 
20
27
  VR_Main.new(ARGV, @splash).show_glade()
21
28
 
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.2.0
4
+ version: 3.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Cunningham
@@ -9,64 +9,50 @@ autorequire:
9
9
  bindir:
10
10
  - "."
11
11
  cert_chain: []
12
- date: 2018-04-24 00:00:00.000000000 Z
12
+ date: 2021-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gtk3
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '='
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 3.2.4
20
+ version: '3.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '='
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 3.2.4
28
- - !ruby/object:Gem::Dependency
29
- name: cairo
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - '='
33
- - !ruby/object:Gem::Version
34
- version: 1.15.12
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - '='
40
- - !ruby/object:Gem::Version
41
- version: 1.15.12
27
+ version: '3.0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: gtksourceview3
44
30
  requirement: !ruby/object:Gem::Requirement
45
31
  requirements:
46
- - - '='
32
+ - - "~>"
47
33
  - !ruby/object:Gem::Version
48
- version: 3.2.4
34
+ version: '3.0'
49
35
  type: :runtime
50
36
  prerelease: false
51
37
  version_requirements: !ruby/object:Gem::Requirement
52
38
  requirements:
53
- - - '='
39
+ - - "~>"
54
40
  - !ruby/object:Gem::Version
55
- version: 3.2.4
41
+ version: '3.0'
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: require_all
58
44
  requirement: !ruby/object:Gem::Requirement
59
45
  requirements:
60
- - - ">="
46
+ - - '='
61
47
  - !ruby/object:Gem::Version
62
- version: '1.2'
48
+ version: '1.4'
63
49
  type: :runtime
64
50
  prerelease: false
65
51
  version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
- - - ">="
53
+ - - '='
68
54
  - !ruby/object:Gem::Version
69
- version: '1.2'
55
+ version: '1.4'
70
56
  description: |-
71
57
  Visualruby is a complete IDE for making graphical user interfaces with ruby. It utilizes glade interface designer to create windows, and uses a library of GUI helpers to make coding GTK+ programs easy. The IDE really helps you organize your files and your thoughts because it names your ruby files and glade files by a naming convention. You files take on the names MyClass.rb, and MyClass.glade. Then you can easily edit the GUI (glade file) by right clicking on your class's file.
72
58
  It also creates .gemspec files for you, then you can right-click on the .gemspec file to install it, or upload it to rubygems.org. You can also yank your gems with one click.
@@ -145,6 +131,12 @@ files:
145
131
  - "./examples/filetreeview/img/rb.png"
146
132
  - "./examples/filetreeview/img/unknown.png"
147
133
  - "./examples/filetreeview/main.rb"
134
+ - "./examples/golf_handicap/.vr_settings.yaml"
135
+ - "./examples/golf_handicap/src/Handicap.rb"
136
+ - "./examples/golf_handicap/src/LoadGolfer.rb"
137
+ - "./examples/golf_handicap/src/Score.rb"
138
+ - "./examples/golf_handicap/src/glade/Handicap.glade"
139
+ - "./examples/golf_handicap/src/glade/Score.glade"
148
140
  - "./examples/listview/.vr_settings.yaml"
149
141
  - "./examples/listview/bin/SongListView.rb"
150
142
  - "./examples/listview/bin/SongListViewGUI.rb"
@@ -257,7 +249,7 @@ files:
257
249
  - "./src/main/glade/VR_Remote_Gem_Tree.glade"
258
250
  - "./src/version.rb"
259
251
  - "./vr"
260
- homepage: http://www.visualruby.net/
252
+ homepage: ''
261
253
  licenses:
262
254
  - MIT
263
255
  metadata: {}
@@ -276,8 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
268
  - !ruby/object:Gem::Version
277
269
  version: '0'
278
270
  requirements: []
279
- rubyforge_project: nowarning
280
- rubygems_version: 2.5.1
271
+ rubygems_version: 3.2.15
281
272
  signing_key:
282
273
  specification_version: 4
283
274
  summary: Create IDE designed to make great GUIs with Ruby