Module: Nametrainer

Defined in:
lib/nametrainer.rb,
lib/nametrainer.rb,
lib/nametrainer/gui.rb,
lib/nametrainer/rng.rb,
lib/nametrainer/person.rb,
lib/nametrainer/version.rb,
lib/nametrainer/collection.rb,
lib/nametrainer/statistics.rb,
lib/nametrainer/optionparser.rb,
lib/nametrainer/collectionloader.rb

Overview

This module contains the classes for the nametrainer tool.

Defined Under Namespace

Modules: CollectionLoader Classes: Collection, GUI, Optionparser, Person, RNG, Statistics

Constant Summary collapse

FILE_EXTENSIONS =
%w{png jpg jpeg}
PROGNAME =
'nametrainer'
VERSION =
'0.2.2'
DATE =
'2013-01-04'
HOMEPAGE =
'https://github.com/stomar/nametrainer/'
"Copyright (C) 2012-2013 Marcus Stollsteimer.\n" +
"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n" +
"This is free software: you are free to change and redistribute it.\n" +
"There is NO WARRANTY, to the extent permitted by law."

Class Method Summary collapse

Class Method Details

.collection_empty_messageObject

Returns the warning message for an empty collection.



52
53
54
55
# File 'lib/nametrainer.rb', line 52

def self.collection_empty_message
  'Could not load collection.<br><br>' +
  "Maybe the specified directory does not exist or contains no #{extension_string} files."
end

.extension_stringObject

Returns a string with all accepted image file extensions.



47
48
49
# File 'lib/nametrainer.rb', line 47

def self.extension_string
  "#{FILE_EXTENSIONS[0...-1].join(', ').upcase}, or #{FILE_EXTENSIONS.last.upcase}"
end

.help_messageObject

Returns the text for the help window.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/nametrainer.rb', line 58

def self.help_message
  <<-HELPTEXT
  <big>Basic Functions / Keyboard Shortcuts</big><br>

  <table>
  <tr><td>Display name &nbsp;&nbsp;&nbsp;</td>
      <td>Shows the person's name (<strong>D</strong>)</td></tr>
  <tr><td>Correct</td>
      <td>You know this person (<strong>S</strong>)</td></tr>
  <tr><td>Wrong</td>
      <td>You do not know this person yet (<strong>F</strong>)</td></tr>
  <tr><td>Quit</td>
      <td>Quit (<strong>Ctrl+W</strong>)</td></tr>
  </tr>
  </table>
  <br><br>

  <big>Collections</big><br><br>

  A collection is simply a diretory with image files.
  #{PROGNAME} uses the file name as the person's display name
  or the content of a corresponding TXT file.<br><br>

  Accepted file formats: #{extension_string}.<br><br>

  Please note: JPG files may not be supported on Windows;
  in this case use PNG images instead.<br><br>

  <big>About</big><br><br>

  <b>#{PROGNAME}</b> version #{VERSION} (#{DATE})<br><br>

  Project home page:
  <a href='#{HOMEPAGE}'>#{HOMEPAGE.gsub(%r{https?://}, '')}</a><br><br>

  #{COPYRIGHT.lines.first.gsub(/\(C\)/, '&copy;')}<br>
  For license information use <code>#{PROGNAME} -v</code>.
  HELPTEXT
end