golf_handicap 0.0.4 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0f4b40555fb323feb4bc3f356c96b4ca4df470a
4
- data.tar.gz: 4d8d1f5f10f1dd2c4c330e0a4d93716f7f499914
3
+ metadata.gz: 8d4c07757c4a383cee090d7c90a0e01726e893ed
4
+ data.tar.gz: d5e98a5b26876102229c730f24c115a5fd58711d
5
5
  SHA512:
6
- metadata.gz: 957ed734cbf66c832c64b20c5c4ef584323aa2d6c4bb53b0acf9f176060d42512c35b806b15494229a51738d46090e80c7e64d045243ddcaa314c60f4c1e766b
7
- data.tar.gz: e3e68ea31922aec60505a4e4ad2a981d8cceff00a1db18f62b2820c60a0e0d21232c7760167602e19bbd4e40a8907be6ac85db1ac81c787872c3e63fccff0f29
6
+ metadata.gz: 293a54632b43382b8cf02d762d8a410eaba052580bf4ab2264d2969e112570e27c23f6649c27d3cc877f58a8632f74f035b0737b4484761befcdbcdffeb41453
7
+ data.tar.gz: 40b52f2de1935d182095fb766c4cf64696a1dc2d9a4413bf830fa9a0823644cb52e210fe95a98383e50948d53aa1e00bbb427ce3ca28608c2ce2b37486ab1e80
data/golf_handicap CHANGED
@@ -5,7 +5,30 @@ require "vrlib"
5
5
  # from require_all gem:
6
6
  require_rel 'src/'
7
7
 
8
- $MAIN = VR::load_yaml(Handicap, File.expand_path("~/visualruby/golf_handicap/golf_handicap.yaml"))
8
+
9
+ files = []
10
+ names = []
11
+ Dir[File.expand_path('~/visualruby/golf_handicap/**/*.yaml')].each do |file_name|
12
+ files << file_name
13
+ names << File.basename(file_name, ".*")
14
+ end
15
+
16
+ answer = alert("Choose Golfer:", choices: names, button_no: "New Golfer")
17
+ if answer.is_a?(String)
18
+ load_file = files[names.index(answer)]
19
+ elsif answer == false
20
+ golfer_name = alert("Enter Name of Golfer to Create a new Handicap File:",
21
+ input_text: "",
22
+ button_yes: "Add Golfer"
23
+ )
24
+ exit unless golfer_name.is_a?(String)
25
+ exit unless golfer_name.length > 2
26
+ load_file = golfer_name.downcase.tr("^a-z\s", '').gsub(" ", "_") + ".yaml"
27
+ else
28
+ exit
29
+ end
30
+
31
+ $MAIN = VR::load_yaml(Handicap, load_file)
9
32
 
10
33
  $MAIN.show_glade()
11
34
 
data/src/Handicap.rb CHANGED
@@ -4,21 +4,18 @@ class Handicap
4
4
 
5
5
  def initialize()
6
6
  @scores = []
7
- @name = "<big><big><big><big><big>Your Name Here</big></big></big></big></big>"
8
- end
9
-
10
- def buttonEnterName__clicked(*a)
11
- if name = alert("Enter Your Name", input_text: "")
12
- @name = @builder[:name].label = "<big><big><big><big><big>#{name}</big></big></big></big></big>"
13
- end
14
7
  end
15
8
 
16
9
  def before_show()
17
10
  @view = VR::ListView.new(rnd: String, date: VR::Col::CalendarCol,
18
11
  course: String, rating_slope: String, score: String, diff: Score,
19
- handicap: String)
20
- @view.col_xalign(diff: 1, handicap: 1, score: 1)
12
+ hcp: String)
13
+ @view.col_xalign(diff: 1, hcp: 1, score: 1)
14
+ @view.col_sortable(date: true, course: true)
21
15
  @view.show
16
+ golfer = File.basename(@vr_yaml_file, ".*")
17
+ golfer = golfer.split("_").map(&:capitalize).join(' ')
18
+ @builder[:name].label = "<big><big><big><big><big>#{golfer}</big></big></big></big></big>"
22
19
  refresh()
23
20
  end
24
21
 
@@ -35,7 +32,7 @@ class Handicap
35
32
  row[:score] = s.score
36
33
  row[:rating_slope] = "#{s.course_rating.to_s}/#{s.course_slope.to_s}"
37
34
  row[:diff] = s
38
- row[:handicap] = s.handicap
35
+ row[:hcp] = s.handicap
39
36
  end
40
37
  end
41
38
 
@@ -55,8 +52,6 @@ class Handicap
55
52
  end
56
53
  end
57
54
 
58
-
59
-
60
55
  def update_handicaps
61
56
  @scores.each_index do |i|
62
57
  fill_handicap(@scores[@scores.size-i-1..@scores.size-1])
data/src/Handicaps.rb ADDED
@@ -0,0 +1,11 @@
1
+ class ChooseFile
2
+
3
+ include GladeGUI
4
+
5
+ def initialize()
6
+ @handicaps = []
7
+ @handicaps << Handicap.new()
8
+ end
9
+
10
+
11
+ end
@@ -3,11 +3,12 @@
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.0"/>
5
5
  <object class="GtkWindow" id="window1">
6
- <property name="width_request">600</property>
6
+ <property name="width_request">670</property>
7
7
  <property name="height_request">660</property>
8
8
  <property name="can_focus">False</property>
9
9
  <property name="title" translatable="yes">USGA Handicap Index Calculator</property>
10
10
  <property name="modal">True</property>
11
+ <property name="type_hint">utility</property>
11
12
  <child>
12
13
  <object class="GtkBox" id="box1">
13
14
  <property name="visible">True</property>
@@ -102,19 +103,6 @@
102
103
  <property name="can_focus">False</property>
103
104
  <property name="spacing">5</property>
104
105
  <property name="layout_style">end</property>
105
- <child>
106
- <object class="GtkButton" id="buttonEnterName">
107
- <property name="label" translatable="yes">Enter Name</property>
108
- <property name="visible">True</property>
109
- <property name="can_focus">True</property>
110
- <property name="receives_default">True</property>
111
- </object>
112
- <packing>
113
- <property name="expand">False</property>
114
- <property name="fill">True</property>
115
- <property name="position">0</property>
116
- </packing>
117
- </child>
118
106
  <child>
119
107
  <object class="GtkButton" id="buttonAdd">
120
108
  <property name="label" translatable="yes">Add Score</property>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: golf_handicap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.7
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: 2017-09-06 00:00:00.000000000 Z
12
+ date: 2018-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: visualruby
@@ -49,6 +49,7 @@ extra_rdoc_files: []
49
49
  files:
50
50
  - "./golf_handicap"
51
51
  - src/Handicap.rb
52
+ - src/Handicaps.rb
52
53
  - src/Score.rb
53
54
  - src/glade/Handicap.glade
54
55
  - src/glade/Score.glade