rutui 0.4 → 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.
@@ -1,55 +1,56 @@
1
- # Simple themeing engine
2
- class Theme
3
- @@themes = {}
4
- @@use = :default
5
-
6
- # init themes
7
- def self.init
8
- @@themes[:default] = {
9
- :background => Pixel.new(236,234,":"),
10
- :border => Pixel.new(144,234,"-"),
11
- :textcolor => 11,
12
- :rainbow => [1,3,11,2,4,5]
13
- }
14
- @@themes[:light] = {
15
- :background => Pixel.new(251,253,":"),
16
- :border => Pixel.new(237,253,"-"),
17
- :textcolor => 0,
18
- :rainbow => [1,3,11,2,4,5]
19
- }
20
- @@themes[:basic] = {
21
- :background => Pixel.new(0,14," "),
22
- :border => Pixel.new(8,14,"-"),
23
- :textcolor => 0,
24
- :rainbow => [1,2,3,4,5,6]
25
- }
26
- end
27
-
28
- # Create new theme
29
- def self.create name, theme
30
- @@themes[name] = theme
31
- end
32
-
33
- # Delete theme
34
- def self.delete name
35
- @@themes.delete(name)
36
- end
37
-
38
- # Set value from current theme
39
- def self.set key, val
40
- @@themes[@@use][key] = val
41
- end
42
-
43
- # Get value from current theme
44
- def self.get val
45
- @@themes[@@use][val]
1
+ module RuTui
2
+ # Simple themeing engine
3
+ class Theme
4
+ @@themes = {}
5
+ @@use = :default
6
+
7
+ # init themes
8
+ def self.init
9
+ @@themes[:default] = {
10
+ :background => Pixel.new(236,234,":"),
11
+ :border => Pixel.new(144,234,"-"),
12
+ :textcolor => 11,
13
+ :rainbow => [1,3,11,2,4,5]
14
+ }
15
+ @@themes[:light] = {
16
+ :background => Pixel.new(251,253,":"),
17
+ :border => Pixel.new(237,253,"-"),
18
+ :textcolor => 0,
19
+ :rainbow => [1,3,11,2,4,5]
20
+ }
21
+ @@themes[:basic] = {
22
+ :background => Pixel.new(0,14," "),
23
+ :border => Pixel.new(8,14,"-"),
24
+ :textcolor => 0,
25
+ :rainbow => [1,2,3,4,5,6]
26
+ }
27
+ end
28
+
29
+ # Create new theme
30
+ def self.create name, theme
31
+ @@themes[name] = theme
32
+ end
33
+
34
+ # Delete theme
35
+ def self.delete name
36
+ @@themes.delete(name)
37
+ end
38
+
39
+ # Set value from current theme
40
+ def self.set key, val
41
+ @@themes[@@use][key] = val
42
+ end
43
+
44
+ # Get value from current theme
45
+ def self.get val
46
+ @@themes[@@use][val]
47
+ end
48
+
49
+ # set current theme
50
+ def self.use name
51
+ @@use = name if !@@themes[name].nil?
52
+ end
46
53
  end
47
-
48
- # set current theme
49
- def self.use name
50
- @@use = name if !@@themes[name].nil?
51
- end
52
-
53
54
  end
54
55
 
55
- Theme.init
56
+ RuTui::Theme.init
metadata CHANGED
@@ -1,56 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rutui
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
5
- prerelease:
4
+ version: '0.7'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Roman Pramberger
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-22 00:00:00.000000000 Z
11
+ date: 2014-08-22 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Create Pure Ruby textbased interfaces of all kinds (Unix only)
15
- email: roman.pramberger@gmail.com
14
+ email: roman@pramberger.ch
16
15
  executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files: []
19
18
  files:
20
19
  - lib/rutui.rb
21
- - lib/rutui/util.rb
22
- - lib/rutui/pixel.rb
23
- - lib/rutui/theme.rb
20
+ - lib/rutui/ansi.rb
21
+ - lib/rutui/axx.rb
22
+ - lib/rutui/figlet.rb
24
23
  - lib/rutui/objects.rb
24
+ - lib/rutui/pixel.rb
25
25
  - lib/rutui/screen.rb
26
26
  - lib/rutui/screenmanager.rb
27
- - lib/rutui/figlet.rb
28
- - lib/rutui/axx.rb
29
27
  - lib/rutui/sprites.rb
30
28
  - lib/rutui/table.rb
31
29
  - lib/rutui/textfield.rb
30
+ - lib/rutui/theme.rb
32
31
  homepage: http://rubygems.org/gems/rutui
33
- licenses: []
32
+ licenses:
33
+ - MIT
34
+ metadata: {}
34
35
  post_install_message:
35
36
  rdoc_options: []
36
37
  require_paths:
37
38
  - lib
38
39
  required_ruby_version: !ruby/object:Gem::Requirement
39
- none: false
40
40
  requirements:
41
- - - ! '>='
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: '0'
43
+ version: 2.0.0
44
44
  required_rubygems_version: !ruby/object:Gem::Requirement
45
- none: false
46
45
  requirements:
47
- - - ! '>='
46
+ - - ">="
48
47
  - !ruby/object:Gem::Version
49
48
  version: '0'
50
49
  requirements: []
51
50
  rubyforge_project:
52
- rubygems_version: 1.8.23
51
+ rubygems_version: 2.4.8
53
52
  signing_key:
54
- specification_version: 3
53
+ specification_version: 4
55
54
  summary: RUby Textbased User Interface
56
55
  test_files: []
@@ -1,78 +0,0 @@
1
- #
2
- # If you want to port this to other Systems, this is your file of choice
3
- # Its heavy unix based in here
4
- #
5
-
6
- ## Ansi Class
7
- # This Class generates ansi strings for the
8
- # Terminal based output.
9
- #
10
- # Its only tested on Linux, should work atleast
11
- # on other unix based systems
12
- #
13
-
14
- class Ansi
15
- # Calculate color from RGB values
16
- def self.rgb(red, green, blue); 16 + (red * 36) + (green * 6) + blue; end
17
- # Set background color
18
- def self.bg color; "\x1b[48;5;#{color}m"; end
19
- # Set text color
20
- def self.fg color; "\x1b[38;5;#{color}m"; end
21
- # "Shortcut" to background color
22
- def self.background color; self.bg color; end
23
- # "Shortcut" to foreground/text color
24
- def self.foreground color; self.fg color; end
25
- # Clear all color
26
- def self.clear_color; "\x1b[0m"; end
27
- # Clear Screen/Terminal
28
- def self.clear; "\x1b[2J"; end
29
- # set start
30
- def self.set_start; "\x1b[s"; end
31
- # goto start
32
- def self.goto_start; "\x1b[u"; end
33
- # Go home
34
- def self.go_home; "\x1b[H"; end
35
- # Goto position
36
- def self.position x,y; "\x1b[#{y};#{x}f"; end
37
- end
38
-
39
- ## Screen Utils Class
40
- # Static Stuff that fits nowhere else
41
- #
42
- class Utils
43
- # Get Windows size
44
- def self.winsize
45
- # > Ruby 1.9.3
46
- #require 'io/console'
47
- #IO.console.winsize
48
- #rescue LoadError
49
- # unix only but each ruby
50
- [Integer(`tput lines`), Integer(`tput cols`)]
51
-
52
- #if !ENV["LINES"].nil?
53
- # [ENV["LINES"], ENV["COLUMNS"]]
54
- #else
55
- # [Integer(`tput lines`), Integer(`tput cols`)]
56
- #end
57
- end
58
-
59
- # Get input char without enter
60
- # UNIX only!
61
- def self.gets
62
- # Win32API.new("crtdll", "_getch", [], "L").Call).chr
63
- begin
64
- system("stty raw -echo")
65
- str = STDIN.getc
66
- ensure
67
- system("stty -raw echo")
68
- end
69
- return str.ord
70
- end
71
-
72
- # Hides the cursor
73
- def self.init
74
- system("tput civis")
75
- end
76
-
77
- end
78
-