remi-simpletray 0.0.7 → 0.0.8
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.
- data/README.markdown +84 -0
- data/doc/README.rdoc +1 -0
- data/examples/dogs/1.png +0 -0
- data/examples/dogs/2.png +0 -0
- data/examples/dogs/3.png +0 -0
- data/examples/dogs/4.png +0 -0
- data/examples/dogs/5.png +0 -0
- data/examples/dogs/6.png +0 -0
- data/examples/dogs/7.png +0 -0
- data/examples/dogs/dogs.png +0 -0
- data/examples/dogs/dogs.rb +20 -0
- data/examples/my_cool_app.png +0 -0
- data/examples/readme.rb +40 -0
- data/lib/simpletray.rb +2 -2
- data/simpletray.gemspec +2 -2
- data/simpletray.png +0 -0
- metadata +16 -2
data/README.markdown
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# simpletray
|
2
|
+
|
3
|
+
simpletray is a gem for making it really easy to make wxruby-based system tray applications
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
## installation
|
8
|
+
|
9
|
+
### wx
|
10
|
+
|
11
|
+
simpletray uses [wxWidgets](http://www.wxwidgets.org), so you need to install it
|
12
|
+
|
13
|
+
A binary should be available for Windows users. Mac/Linux should be able to use your packaging systems.
|
14
|
+
See [http://www.wxwidgets.org/downloads/#latest_stable](http://www.wxwidgets.org/downloads/#latest_stable) for latest wxWidgets releases.
|
15
|
+
|
16
|
+
For Windows, try [the Windows installer](http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.9-Setup.exe)
|
17
|
+
|
18
|
+
For Mac OS X, try using [MacPorts](http://www.macports.org/):
|
19
|
+
|
20
|
+
$ sudo port install wxwidgets
|
21
|
+
|
22
|
+
For Ubuntu Linux, try:
|
23
|
+
|
24
|
+
# i *think* these are all the packages you need ... `aptitude search wx` to see all wx packages
|
25
|
+
$ sudo aptitude install libwxbase2.8-0 libwxgtk2.8-0
|
26
|
+
|
27
|
+
### gems
|
28
|
+
|
29
|
+
now, install the required rubygems ...
|
30
|
+
|
31
|
+
$ sudo gem install wxruby activesupport
|
32
|
+
|
33
|
+
and ... simpletray!
|
34
|
+
|
35
|
+
$ sudo gem install remi-simpletray -s http://gems.github.com
|
36
|
+
|
37
|
+
## usage
|
38
|
+
|
39
|
+
#! /usr/bin/env ruby
|
40
|
+
require 'rubygems'
|
41
|
+
require 'simpletray'
|
42
|
+
|
43
|
+
# icon my_cool_app.png will be used for the tray icon
|
44
|
+
SimpleTray.app 'My Cool App' do
|
45
|
+
|
46
|
+
# this makes a single item 'About' (about.png will be used if found)
|
47
|
+
# which pops up a message box when clicked
|
48
|
+
about { msgbox "Hello! This is my app!" }
|
49
|
+
|
50
|
+
# this makes a submenu 'Dogs' with rover/spot/rex subitems.
|
51
|
+
# dogs.png, rover.png, spot.png, rex.png will all be looked for
|
52
|
+
_dogs_ {
|
53
|
+
rover { puts "..." }
|
54
|
+
spot { puts "..." }
|
55
|
+
rex { msgbox "w00f, my name is rex!" }
|
56
|
+
|
57
|
+
_more_dogs_ do
|
58
|
+
another_dog { puts "..." }
|
59
|
+
yet_another_dog { puts "..." }
|
60
|
+
end
|
61
|
+
}
|
62
|
+
|
63
|
+
# adds an item (the same as saying my_custom_item) with a custom icon
|
64
|
+
item 'My Custom Item', 'custom-icon.png' do
|
65
|
+
# ...
|
66
|
+
end
|
67
|
+
|
68
|
+
# adds an menu (the same as saying _my_custom_menu_) with a custom icon
|
69
|
+
menu 'My Custom Menu', 'custom-menu-icon.png' do
|
70
|
+
item1 { }
|
71
|
+
item2 { }
|
72
|
+
end
|
73
|
+
|
74
|
+
# this adds a seperator and then a special 'exit' item to quit the application
|
75
|
+
____
|
76
|
+
exit
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
Also, see examples/first.rb (the first file I used for testing), which shows how to add
|
81
|
+
your own helper methods
|
82
|
+
|
83
|
+
Note, currently I'm only supporting PNGs. I'll fix this to support ICO/PNG/BMP/JPG/etc.
|
84
|
+
My TODO list is long :P
|
data/doc/README.rdoc
CHANGED
data/examples/dogs/1.png
ADDED
Binary file
|
data/examples/dogs/2.png
ADDED
Binary file
|
data/examples/dogs/3.png
ADDED
Binary file
|
data/examples/dogs/4.png
ADDED
Binary file
|
data/examples/dogs/5.png
ADDED
Binary file
|
data/examples/dogs/6.png
ADDED
Binary file
|
data/examples/dogs/7.png
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
%w( rubygems simpletray ).each {|lib| require lib }
|
3
|
+
|
4
|
+
dog_image_numbers = Dir[File.join(File.dirname(__FILE__),'?.png')].sort.map { |x| x.sub(/.*(\d+).png$/,'\1') }
|
5
|
+
|
6
|
+
SimpleTray.app 'Dogs' do
|
7
|
+
|
8
|
+
dog_image_numbers.each do |i|
|
9
|
+
item("Dog #{i}", "#{i}.png" ){ msgbox "you clicked on dog ##{i}" }
|
10
|
+
end
|
11
|
+
|
12
|
+
_dogs_ do
|
13
|
+
dog_image_numbers.each do |i|
|
14
|
+
item("Dog #{i}", "#{i}.png" ){ msgbox "you clicked on dog ##{i}" }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
____
|
18
|
+
exit
|
19
|
+
|
20
|
+
end
|
Binary file
|
data/examples/readme.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'simpletray'
|
4
|
+
|
5
|
+
# icon my_cool_app.png will be used for the tray icon
|
6
|
+
SimpleTray.app 'My Cool App' do
|
7
|
+
|
8
|
+
# this makes a single item 'About' (about.png will be used if found)
|
9
|
+
# which pops up a message box when clicked
|
10
|
+
about { msgbox "Hello! This is my app!" }
|
11
|
+
|
12
|
+
# this makes a submenu 'Dogs' with rover/spot/rex subitems.
|
13
|
+
# dogs.png, rover.png, spot.png, rex.png will all be looked for
|
14
|
+
_dogs_ {
|
15
|
+
rover { puts "..." }
|
16
|
+
spot { puts "..." }
|
17
|
+
rex { msgbox "w00f, my name is rex!" }
|
18
|
+
|
19
|
+
_more_dogs_ do
|
20
|
+
another_dog { puts "..." }
|
21
|
+
yet_another_dog { puts "..." }
|
22
|
+
end
|
23
|
+
}
|
24
|
+
|
25
|
+
# adds an item (the same as saying my_custom_item) with a custom icon
|
26
|
+
item 'My Custom Item', 'custom-icon.png' do
|
27
|
+
# ...
|
28
|
+
end
|
29
|
+
|
30
|
+
# adds an menu (the same as saying _my_custom_menu_) with a custom icon
|
31
|
+
menu 'My Custom Menu', 'custom-menu-icon.png' do
|
32
|
+
item1 { }
|
33
|
+
item2 { }
|
34
|
+
end
|
35
|
+
|
36
|
+
# this adds a seperator and then a special 'exit' item to quit the application
|
37
|
+
____
|
38
|
+
exit
|
39
|
+
|
40
|
+
end
|
data/lib/simpletray.rb
CHANGED
@@ -48,7 +48,7 @@ class SimpleTray
|
|
48
48
|
icon = File.join SimpleTray.icon_directory, icon unless File.file?icon
|
49
49
|
if File.file?icon
|
50
50
|
icon = Wx::Bitmap.new icon, Wx::BITMAP_TYPE_PNG
|
51
|
-
item.set_bitmap icon
|
51
|
+
item.set_bitmap icon unless PLATFORM[/darwin/]
|
52
52
|
end
|
53
53
|
|
54
54
|
@menu.append_item item
|
@@ -118,7 +118,7 @@ class SimpleTray
|
|
118
118
|
def init_icon
|
119
119
|
if File.file?@icon
|
120
120
|
icon = Wx::Bitmap.new @icon, Wx::BITMAP_TYPE_PNG
|
121
|
-
set_bitmap icon
|
121
|
+
set_bitmap icon unless PLATFORM[/darwin/]
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
data/simpletray.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = "simpletray"
|
4
|
-
s.version = "0.0.
|
4
|
+
s.version = "0.0.8"
|
5
5
|
s.date = "2008-09-26"
|
6
6
|
s.summary = "Ruby gem that provides a DSL for creating system tray icon applications *really* easily."
|
7
7
|
s.email = "remi@remitaylor.com"
|
@@ -12,6 +12,6 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.authors = ["remi Taylor"]
|
13
13
|
|
14
14
|
# generate using: $ ruby -e "puts Dir['**/**'].select{|x| File.file?x}.inspect"
|
15
|
-
s.files = ["examples/first.rb", "lib/simpletray.rb", "
|
15
|
+
s.files = ["examples/first.rb", "examples/my_cool_app.png", "examples/readme.rb", "examples/dogs/dogs.png", "examples/dogs/3.png", "examples/dogs/7.png", "examples/dogs/6.png", "examples/dogs/4.png", "examples/dogs/dogs.rb", "examples/dogs/2.png", "examples/dogs/5.png", "examples/dogs/1.png", "lib/simpletray.rb", "simpletray.png", "README.markdown", "tmp/test.html", "simpletray.gemspec", "doc/README.rdoc", "Rakefile"]
|
16
16
|
|
17
17
|
end
|
data/simpletray.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remi-simpletray
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- remi Taylor
|
@@ -23,9 +23,23 @@ extra_rdoc_files: []
|
|
23
23
|
|
24
24
|
files:
|
25
25
|
- examples/first.rb
|
26
|
+
- examples/my_cool_app.png
|
27
|
+
- examples/readme.rb
|
28
|
+
- examples/dogs/dogs.png
|
29
|
+
- examples/dogs/3.png
|
30
|
+
- examples/dogs/7.png
|
31
|
+
- examples/dogs/6.png
|
32
|
+
- examples/dogs/4.png
|
33
|
+
- examples/dogs/dogs.rb
|
34
|
+
- examples/dogs/2.png
|
35
|
+
- examples/dogs/5.png
|
36
|
+
- examples/dogs/1.png
|
26
37
|
- lib/simpletray.rb
|
27
|
-
-
|
38
|
+
- simpletray.png
|
39
|
+
- README.markdown
|
40
|
+
- tmp/test.html
|
28
41
|
- simpletray.gemspec
|
42
|
+
- doc/README.rdoc
|
29
43
|
- Rakefile
|
30
44
|
has_rdoc: true
|
31
45
|
homepage: http://github.com/remi/simpletray
|