lang_cards 1.0.0
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/bin/lang_cards +6 -0
- data/lang_cards.gemspec +25 -0
- data/lib/default.store +0 -0
- data/lib/lang_cards.rb +255 -0
- data/lib/lang_cards.rb~ +255 -0
- data/lib/lang_cards/create_new_db.rb +19 -0
- data/lib/lang_cards/instructions_about.rb +48 -0
- data/lib/lang_cards/lang_card_class.rb +16 -0
- data/lib/lang_cards/version.rb +3 -0
- data/lib/store_for_all_dbs.store +1 -0
- data/lib/store_for_all_dbs.store~ +3 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a039b48b6cc37e8d4c9d66a392932a86508884c7
|
4
|
+
data.tar.gz: 10c1dd7d335f7391f0b57af0691831ae571aca69
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 40bd056e83fcd586e373b66d0926d389dc24f2a342be92780ec9dff998276961321fa15c63880007b6f978b075e5d6cf18136d1f063dfe82bee696719eee2fd4
|
7
|
+
data.tar.gz: dc4a164b52603bbfb25ac793e89175bd79feebc8dccabbc81c07efd33afe70c99d1d9c3f9cef86a04141c503c6c8f4a7addcb7e2818661426871a8bb4d993c3b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Sebastjan Hribar
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# LangCards
|
2
|
+
|
3
|
+
LangCards is a desktop flashcard application for learning
|
4
|
+
foreign language vocabulary. Read more in the application
|
5
|
+
instructions.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'lang_cards'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install lang_cards
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Runing the application
|
26
|
+
1. Windows
|
27
|
+
1.1. Navigate to c:\my\installation\folder\lang_cards\lib\lang_cards.rb and double click
|
28
|
+
1.2. run from the command line: land_cards
|
29
|
+
|
30
|
+
2. Linux
|
31
|
+
2.1. run from the command line: land_cards
|
32
|
+
|
33
|
+
Usage
|
34
|
+
See instructions in the application.
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/lang_cards
ADDED
data/lang_cards.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lang_cards/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lang_cards"
|
8
|
+
spec.version = LangCards::VERSION
|
9
|
+
spec.authors = ["Sebastjan Hribar"]
|
10
|
+
spec.email = ["sebastjan.hribar@gmail.com"]
|
11
|
+
spec.description = %q{This application supports you in learning foreing language vocabulary.}
|
12
|
+
spec.summary = %q{Language flash-cards application}
|
13
|
+
spec.homepage = "https://github.com/sebastjan-hribar/lang_cards"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = ["lang_cards"]
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "green_shoes", "=1.1.367"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
data/lib/default.store
ADDED
File without changes
|
data/lib/lang_cards.rb
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
require_relative "lang_cards/version"
|
2
|
+
require_relative "lang_cards/create_new_db"
|
3
|
+
require_relative "lang_cards/lang_card_class"
|
4
|
+
require_relative "lang_cards/instructions_about"
|
5
|
+
require 'green_shoes'
|
6
|
+
require 'yaml/store'
|
7
|
+
|
8
|
+
include NewDB
|
9
|
+
include LangCard
|
10
|
+
include Instructions
|
11
|
+
|
12
|
+
###################
|
13
|
+
# Shoes app start #
|
14
|
+
###################
|
15
|
+
Shoes.app width: 800, height: 1050,
|
16
|
+
title: "LangCards" do
|
17
|
+
|
18
|
+
@store_for_all_dbs = YAML::Store.new("store_for_all_dbs.store")
|
19
|
+
|
20
|
+
$db = YAML::Store.new("default.store")
|
21
|
+
|
22
|
+
#####################################################
|
23
|
+
# Instructions, About and listing of all FlashCards #
|
24
|
+
#####################################################
|
25
|
+
flow width: 800 do
|
26
|
+
caption "Instructions", margin_left: 5
|
27
|
+
background papayawhip
|
28
|
+
button "Instructions", margin: 5 do
|
29
|
+
window title: "Instructions", width: 600, height: 1200 do
|
30
|
+
background lavender
|
31
|
+
para INSTRUCTIONS
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
button "About", margin: 5 do
|
36
|
+
window title: "About", widht: 200, height: 200, margin: 20 do
|
37
|
+
background lavender
|
38
|
+
para ABOUT
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
button "List all flashcard", margin: 5 do
|
43
|
+
if $db
|
44
|
+
window title: "All flashcards" do
|
45
|
+
background lavender
|
46
|
+
$db.transaction(true) do
|
47
|
+
@all_cards = $db.roots
|
48
|
+
@all_cards.sort!
|
49
|
+
@all_cards.each_with_index do |c,i|
|
50
|
+
str = " #{i+1}. #{c}"
|
51
|
+
edit_line text: str, state: 'readonly'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
else
|
56
|
+
alert "No database is active!"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
#########################################################
|
61
|
+
# Instructions, About and listing of all FlashCards end #
|
62
|
+
#########################################################
|
63
|
+
|
64
|
+
|
65
|
+
#################################
|
66
|
+
# Database creation flow start #
|
67
|
+
#################################
|
68
|
+
flow do
|
69
|
+
caption "Database creation", margin: 5
|
70
|
+
background lightgrey
|
71
|
+
@new_db_entry_field = edit_line margin: 5
|
72
|
+
button "Create new database", margin: 5 do
|
73
|
+
@new_db = @new_db_entry_field.text
|
74
|
+
create_new_db(@new_db, @store_for_all_dbs)
|
75
|
+
@new_db_entry_field.text = ""
|
76
|
+
|
77
|
+
@store_for_all_dbs.transaction(true) do
|
78
|
+
@list_of_all_dbs.items = @store_for_all_dbs.roots
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
##############################
|
83
|
+
# Database creation flow end #
|
84
|
+
##############################
|
85
|
+
|
86
|
+
|
87
|
+
#################################
|
88
|
+
# Database selection flow start #
|
89
|
+
#################################
|
90
|
+
flow do
|
91
|
+
caption "Database selection", margin: 5
|
92
|
+
background lightsteelblue
|
93
|
+
|
94
|
+
@list_of_all_dbs = list_box margin: 5
|
95
|
+
|
96
|
+
@store_for_all_dbs.transaction(true) do
|
97
|
+
@list_of_all_dbs.items = @store_for_all_dbs.roots
|
98
|
+
end
|
99
|
+
|
100
|
+
button "Activate the selected database", margin: 5 do
|
101
|
+
@selected_database = @list_of_all_dbs.text
|
102
|
+
$db = YAML::Store.new("#{@selected_database}.store")
|
103
|
+
|
104
|
+
$db.transaction(true) do
|
105
|
+
@all_cards_list.items = $db.roots
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
###############################
|
110
|
+
# Database selection flow end #
|
111
|
+
###############################
|
112
|
+
|
113
|
+
|
114
|
+
#######################################
|
115
|
+
# Stack for the Create function start #
|
116
|
+
#######################################
|
117
|
+
stack width: 800 do
|
118
|
+
background antiquewhite
|
119
|
+
caption "Create"
|
120
|
+
|
121
|
+
flow width: 800, margin: 5 do
|
122
|
+
para "Name:", width: 150; @name = edit_line
|
123
|
+
para "Source:", width: 150; @source = edit_line
|
124
|
+
para "Target:", width: 150; @target = edit_line
|
125
|
+
para "Part of speech:", width: 150; @part_of_speech = list_box items:
|
126
|
+
[" ", "verb", "noun", "adjective", "adverb", "pronoun",
|
127
|
+
"preposition", "conjunction", "interjection"], choose: " "
|
128
|
+
para "Example:", width: 150; @example = edit_line
|
129
|
+
|
130
|
+
button "Save/update flashcard", margin_top: 30, margin_bottom: 20 do
|
131
|
+
card = Card.new(@name.text, @source.text, @target.text,
|
132
|
+
@part_of_speech.text, @example.text)
|
133
|
+
|
134
|
+
unless card.name == ""
|
135
|
+
$db.transaction do
|
136
|
+
$db[card.name] = card
|
137
|
+
$db_roots = $db.roots
|
138
|
+
end
|
139
|
+
|
140
|
+
$db.transaction(true) do
|
141
|
+
@all_cards = $db.roots
|
142
|
+
end
|
143
|
+
|
144
|
+
$db.transaction do
|
145
|
+
@all_cards_list.items = $db.roots
|
146
|
+
end
|
147
|
+
|
148
|
+
# Clear the input fields after save or update
|
149
|
+
@name.text = ""
|
150
|
+
@source.text = ""
|
151
|
+
@target.text = ""
|
152
|
+
@part_of_speech.choose " "
|
153
|
+
@example.text = ""
|
154
|
+
alert("Flashcard saved successfully.")
|
155
|
+
else
|
156
|
+
alert("Enter Name, please!")
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
#####################################
|
163
|
+
# Stack for the Create function end #
|
164
|
+
#####################################
|
165
|
+
|
166
|
+
|
167
|
+
########################################################
|
168
|
+
# Stack for the Read, Update and Delete functions start #
|
169
|
+
########################################################
|
170
|
+
stack do
|
171
|
+
background powderblue
|
172
|
+
stack margin: 10 do
|
173
|
+
caption "Read, Update and Delete"
|
174
|
+
para "Select flashcard to delete from the database or to retrieve it for update:"
|
175
|
+
|
176
|
+
@all_cards_list = list_box
|
177
|
+
|
178
|
+
button "Delete from database" do
|
179
|
+
$db.transaction do
|
180
|
+
if @all_cards_list.items.empty?
|
181
|
+
alert("No flashcard is selected.")
|
182
|
+
else
|
183
|
+
del = @all_cards_list.text
|
184
|
+
$db.delete(del)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
$db.transaction do
|
188
|
+
@all_cards_list.items = $db.roots
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
button "Retrieve for update" do
|
193
|
+
$db.transaction(true) do
|
194
|
+
abc = @all_cards_list.text
|
195
|
+
if @all_cards_list.items.empty?
|
196
|
+
alert("No flashcard is selected.")
|
197
|
+
else
|
198
|
+
@name.text = abc
|
199
|
+
@source.text = $db[abc].source
|
200
|
+
@target.text = $db[abc].target
|
201
|
+
@part_of_speech.choose($db[abc].part_of_speech)
|
202
|
+
@example.text = $db[abc].example
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
#######################################################
|
209
|
+
# Stack for the Read, Update and Delete functions end #
|
210
|
+
#######################################################
|
211
|
+
|
212
|
+
|
213
|
+
########################
|
214
|
+
# Learning stack start #
|
215
|
+
########################
|
216
|
+
stack width: 800, height: 550, margin: 10 do
|
217
|
+
background rosybrown
|
218
|
+
caption "Learn"
|
219
|
+
button "Select random flashcard" do
|
220
|
+
$db.transaction(true) do
|
221
|
+
@all_cards = $db.roots
|
222
|
+
if @all_cards.empty?
|
223
|
+
alert("Database is empty.")
|
224
|
+
else
|
225
|
+
samp_name = @all_cards.sample
|
226
|
+
samp_source = $db[samp_name].source
|
227
|
+
samp_target = $db[samp_name].target
|
228
|
+
samp_part_of_speech = $db[samp_name].part_of_speech
|
229
|
+
samp_example = $db[samp_name].example
|
230
|
+
@samp_area.clear do
|
231
|
+
button(samp_name) do
|
232
|
+
@samp_source.text = samp_source
|
233
|
+
@samp_part_of_speech.text = samp_part_of_speech
|
234
|
+
end
|
235
|
+
para "Source:", :emphasis => "oblique"; @samp_source = para
|
236
|
+
para "Part of speech:",
|
237
|
+
:emphasis => "oblique"; @samp_part_of_speech = para
|
238
|
+
|
239
|
+
button "Show target and example" do
|
240
|
+
@samp_target.text = samp_target
|
241
|
+
@samp_example.text = samp_example
|
242
|
+
end
|
243
|
+
para "Target:", :emphasis => "oblique"; @samp_target = para
|
244
|
+
para "Example:", :emphasis => "oblique"; @samp_example = para
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
@samp_area = stack{}
|
250
|
+
end
|
251
|
+
######################
|
252
|
+
# Learning stack end #
|
253
|
+
######################
|
254
|
+
|
255
|
+
end
|
data/lib/lang_cards.rb~
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
require_relative "lang_cards/version"
|
2
|
+
require_relative "lang_cards/create_new_db"
|
3
|
+
require_relative "lang_cards/lang_card_class"
|
4
|
+
require_relative "lang_cards/instructions_about"
|
5
|
+
require 'green_shoes'
|
6
|
+
require 'yaml/store'
|
7
|
+
|
8
|
+
include NewDB
|
9
|
+
include LangCard
|
10
|
+
include Instructions
|
11
|
+
|
12
|
+
###################
|
13
|
+
# Shoes app start #
|
14
|
+
###################
|
15
|
+
Shoes.app width: 800, height: 1050,
|
16
|
+
title: "LangCards" do
|
17
|
+
|
18
|
+
@store_for_all_dbs = YAML::Store.new("store_for_all_dbs.store")
|
19
|
+
|
20
|
+
$db = YAML::Store.new("default.store")
|
21
|
+
|
22
|
+
#####################################################
|
23
|
+
# Instructions, About and listing of all FlashCards #
|
24
|
+
#####################################################
|
25
|
+
flow width: 800 do
|
26
|
+
caption "Instructions", margin_left: 5
|
27
|
+
background papayawhip
|
28
|
+
button "Instructions", margin: 5 do
|
29
|
+
window title: "Instructions", width: 600, height: 1200 do
|
30
|
+
background lavender
|
31
|
+
para INSTRUCTIONS
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
button "About", margin: 5 do
|
36
|
+
window title: "About", widht: 200, height: 200, margin: 20 do
|
37
|
+
background lavender
|
38
|
+
para ABOUT
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
button "List all flashcard", margin: 5 do
|
43
|
+
if $db
|
44
|
+
window title: "All flashcards" do
|
45
|
+
background lavender
|
46
|
+
$db.transaction(true) do
|
47
|
+
@all_cards = $db.roots
|
48
|
+
@all_cards.sort!
|
49
|
+
@all_cards.each_with_index do |c,i|
|
50
|
+
str = " #{i+1}. #{c}"
|
51
|
+
edit_line text: str, state: 'readonly'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
else
|
56
|
+
alert "No database is active!"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
#########################################################
|
61
|
+
# Instructions, About and listing of all FlashCards end #
|
62
|
+
#########################################################
|
63
|
+
|
64
|
+
|
65
|
+
#################################
|
66
|
+
# Database creation flow start #
|
67
|
+
#################################
|
68
|
+
flow do
|
69
|
+
caption "Database creation", margin: 5
|
70
|
+
background lightgrey
|
71
|
+
@new_db_entry_field = edit_line margin: 5
|
72
|
+
button "Create new database", margin: 5 do
|
73
|
+
@new_db = @new_db_entry_field.text
|
74
|
+
create_new_db(@new_db, @store_for_all_dbs)
|
75
|
+
@new_db_entry_field.text = ""
|
76
|
+
|
77
|
+
@store_for_all_dbs.transaction(true) do
|
78
|
+
@list_of_all_dbs.items = @store_for_all_dbs.roots
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
##############################
|
83
|
+
# Database creation flow end #
|
84
|
+
##############################
|
85
|
+
|
86
|
+
|
87
|
+
#################################
|
88
|
+
# Database selection flow start #
|
89
|
+
#################################
|
90
|
+
flow do
|
91
|
+
caption "Database selection", margin: 5
|
92
|
+
background lightsteelblue
|
93
|
+
|
94
|
+
@list_of_all_dbs = list_box margin: 5
|
95
|
+
|
96
|
+
@store_for_all_dbs.transaction(true) do
|
97
|
+
@list_of_all_dbs.items = @store_for_all_dbs.roots
|
98
|
+
end
|
99
|
+
|
100
|
+
button "Activate the selected database", margin: 5 do
|
101
|
+
@selected_database = @list_of_all_dbs.text
|
102
|
+
$db = YAML::Store.new("#{@selected_database}.store")
|
103
|
+
|
104
|
+
$db.transaction(true) do
|
105
|
+
@all_cards_list.items = $db.roots
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
###############################
|
110
|
+
# Database selection flow end #
|
111
|
+
###############################
|
112
|
+
|
113
|
+
|
114
|
+
#######################################
|
115
|
+
# Stack for the Create function start #
|
116
|
+
#######################################
|
117
|
+
stack width: 800 do
|
118
|
+
background antiquewhite
|
119
|
+
caption "Create"
|
120
|
+
|
121
|
+
flow width: 800, margin: 5 do
|
122
|
+
para "Name:", width: 150; @name = edit_line
|
123
|
+
para "Source:", width: 150; @source = edit_line
|
124
|
+
para "Target:", width: 150; @target = edit_line
|
125
|
+
para "Part of speech:", width: 150; @part_of_speech = list_box items:
|
126
|
+
[" ", "verb", "noun", "adjective", "adverb", "pronoun",
|
127
|
+
"preposition", "conjunction", "interjection"], choose: " "
|
128
|
+
para "Example:", width: 150; @example = edit_line
|
129
|
+
|
130
|
+
button "Save/update flashcard", margin_top: 30, margin_bottom: 20 do
|
131
|
+
card = Card.new(@name.text, @source.text, @target.text,
|
132
|
+
@part_of_speech.text, @example.text)
|
133
|
+
|
134
|
+
unless card.name == ""
|
135
|
+
$db.transaction do
|
136
|
+
$db[card.name] = card
|
137
|
+
$db_roots = $db.roots
|
138
|
+
end
|
139
|
+
|
140
|
+
$db.transaction(true) do
|
141
|
+
@all_cards = $db.roots
|
142
|
+
end
|
143
|
+
|
144
|
+
$db.transaction do
|
145
|
+
@all_cards_list.items = $db.roots
|
146
|
+
end
|
147
|
+
|
148
|
+
# Clear the input fields after save or update
|
149
|
+
@name.text = ""
|
150
|
+
@source.text = ""
|
151
|
+
@target.text = ""
|
152
|
+
@part_of_speech.choose " "
|
153
|
+
@example.text = ""
|
154
|
+
alert("Flashcard saved successfully.")
|
155
|
+
else
|
156
|
+
alert("Enter Name, please!")
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
#####################################
|
163
|
+
# Stack for the Create function end #
|
164
|
+
#####################################
|
165
|
+
|
166
|
+
|
167
|
+
########################################################
|
168
|
+
# Stack for the Read, Update and Delete functions start #
|
169
|
+
########################################################
|
170
|
+
stack do
|
171
|
+
background powderblue
|
172
|
+
stack margin: 10 do
|
173
|
+
caption "Read, Update and Delete"
|
174
|
+
para "Select flashcard to delete from the database or to retrieve it for update:"
|
175
|
+
|
176
|
+
@all_cards_list = list_box
|
177
|
+
|
178
|
+
button "Delete from database" do
|
179
|
+
$db.transaction do
|
180
|
+
if @all_cards_list.items.empty?
|
181
|
+
alert("No flashcard is selected.")
|
182
|
+
else
|
183
|
+
del = @all_cards_list.text
|
184
|
+
$db.delete(del)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
$db.transaction do
|
188
|
+
@all_cards_list.items = $db.roots
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
button "Retrieve for update" do
|
193
|
+
$db.transaction(true) do
|
194
|
+
abc = @all_cards_list.text
|
195
|
+
if @all_cards_list.items.empty?
|
196
|
+
alert("No flashcard is selected.")
|
197
|
+
else
|
198
|
+
@name.text = abc
|
199
|
+
@source.text = $db[abc].source
|
200
|
+
@target.text = $db[abc].target
|
201
|
+
@part_of_speech.choose($db[abc].part_of_speech)
|
202
|
+
@example.text = $db[abc].example
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
#######################################################
|
209
|
+
# Stack for the Read, Update and Delete functions end #
|
210
|
+
#######################################################
|
211
|
+
|
212
|
+
|
213
|
+
########################
|
214
|
+
# Learning stack start #
|
215
|
+
########################
|
216
|
+
stack width: 800, height: 550, margin: 10 do
|
217
|
+
background rosybrown
|
218
|
+
caption "Learn"
|
219
|
+
button "Select random flashcard" do
|
220
|
+
$db.transaction(true) do
|
221
|
+
@all_cards = $db.roots
|
222
|
+
if @all_cards.empty?
|
223
|
+
alert("Database is empty.")
|
224
|
+
else
|
225
|
+
samp_name = @all_cards.sample
|
226
|
+
samp_source = $db[samp_name].source
|
227
|
+
samp_target = $db[samp_name].target
|
228
|
+
samp_part_of_speech = $db[samp_name].part_of_speech
|
229
|
+
samp_example = $db[samp_name].example
|
230
|
+
@samp_area.clear do
|
231
|
+
button(samp_name) do
|
232
|
+
@samp_source.text = samp_source
|
233
|
+
@samp_part_of_speech.text = samp_part_of_speech
|
234
|
+
end
|
235
|
+
para "Source:", :emphasis => "oblique"; @samp_source = para
|
236
|
+
para "Part of speech:",
|
237
|
+
:emphasis => "oblique"; @samp_part_of_speech = para
|
238
|
+
|
239
|
+
button "Show target and example" do
|
240
|
+
@samp_target.text = samp_target
|
241
|
+
@samp_example.text = samp_example
|
242
|
+
end
|
243
|
+
para "Target:", :emphasis => "oblique"; @samp_target = para
|
244
|
+
para "Example:", :emphasis => "oblique"; @samp_example = para
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
@samp_area = stack{}
|
250
|
+
end
|
251
|
+
######################
|
252
|
+
# Learning stack end #
|
253
|
+
######################
|
254
|
+
|
255
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module NewDB
|
2
|
+
|
3
|
+
class Db
|
4
|
+
attr_accessor :name
|
5
|
+
def initialize(name)
|
6
|
+
@name = name
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def create_new_db(new_db, store_for_all_dbs)
|
12
|
+
database = Db.new(new_db)
|
13
|
+
store_for_all_dbs.transaction do
|
14
|
+
store_for_all_dbs[database.name] = database
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Instructions
|
2
|
+
|
3
|
+
INSTRUCTIONS = "Instructions
|
4
|
+
|
5
|
+
\tThis is a flashcard application for learning a foreign
|
6
|
+
\tlanguage vocabulary. The application enables you to
|
7
|
+
\tcreate flashcards of your choice and then use them
|
8
|
+
\tto learn the vocabulary.
|
9
|
+
|
10
|
+
\tFollow the specific instructions below:
|
11
|
+
|
12
|
+
\tSelect target language.
|
13
|
+
\t\tLangCards supports learning of multiple databases.
|
14
|
+
\t\tSelect the desired database from the listbox
|
15
|
+
\t\tand then activate it by pressing the 'Activate the
|
16
|
+
\t\tselected database' button.
|
17
|
+
|
18
|
+
\t\tThe default database is preset, however you can create
|
19
|
+
\t\tas many different databases as you need (e.g. per language).
|
20
|
+
\t\tTo create a database enter the desired name in the respective
|
21
|
+
\t\tfield and press the 'Create new database' button.
|
22
|
+
|
23
|
+
\tCreate, Read, Update and Delete.
|
24
|
+
\t\t1. Enter the name and all the attributes for a flashcard.
|
25
|
+
\t\t2. Press 'Save/update flashcard'.
|
26
|
+
\t\t * To delete a FlashCard from the database, select it
|
27
|
+
\t\t\s from the listbox and press 'Delete from database'.
|
28
|
+
\t\t * To update an existing flashcard in the database
|
29
|
+
\t\t\s select it from the listbox, change the desired
|
30
|
+
\t\t\s attribute in the displayed input fields and pres
|
31
|
+
\t\t\s 'Save/update flashcard'.
|
32
|
+
|
33
|
+
\tLearning
|
34
|
+
\t\t1. Press 'Select random selection' to get a random
|
35
|
+
\t\t\s flashcard from the database.
|
36
|
+
\t\t2. Press the button with the random flashcard
|
37
|
+
\t\t\s to display all attributes except the target and
|
38
|
+
\t\t\s the example.
|
39
|
+
\t\t3. Press 'Show target and example' to display the target
|
40
|
+
\t\t\s and the example attributes."
|
41
|
+
|
42
|
+
ABOUT = "About
|
43
|
+
\LangCards
|
44
|
+
\tAuthor: Sebastjan Hribar
|
45
|
+
\te-mail: sebastjan.hribar@gmail.com
|
46
|
+
\tCredits: ashbb, the creator of Green Shoes"
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module LangCard
|
2
|
+
|
3
|
+
class Card
|
4
|
+
attr_reader :name, :source, :target, :part_of_speech, :example
|
5
|
+
|
6
|
+
def initialize name, source, target, part_of_speech, example
|
7
|
+
@name, @source, @target, @part_of_speech, @example =
|
8
|
+
name, source, target, part_of_speech, example
|
9
|
+
end
|
10
|
+
|
11
|
+
def attributes
|
12
|
+
[@name, @source, @target, @part_of_speech, @example]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lang_cards
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sebastjan Hribar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: green_shoes
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.367
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.367
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: This application supports you in learning foreing language vocabulary.
|
56
|
+
email:
|
57
|
+
- sebastjan.hribar@gmail.com
|
58
|
+
executables:
|
59
|
+
- lang_cards
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/lang_cards
|
69
|
+
- lang_cards.gemspec
|
70
|
+
- lib/default.store
|
71
|
+
- lib/lang_cards.rb
|
72
|
+
- lib/lang_cards.rb~
|
73
|
+
- lib/lang_cards/create_new_db.rb
|
74
|
+
- lib/lang_cards/instructions_about.rb
|
75
|
+
- lib/lang_cards/lang_card_class.rb
|
76
|
+
- lib/lang_cards/version.rb
|
77
|
+
- lib/store_for_all_dbs.store
|
78
|
+
- lib/store_for_all_dbs.store~
|
79
|
+
homepage: https://github.com/sebastjan-hribar/lang_cards
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.4.7
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: Language flash-cards application
|
103
|
+
test_files: []
|