gtk_advent_calendar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e3d4e4199647341e55b260d8658295a080b4924d
4
+ data.tar.gz: a5d2b09c73a30cdf867071054a5f30680da7dfc7
5
+ SHA512:
6
+ metadata.gz: dcddb8250ec4570150d2bb086fda81adbad43b81c70f67ded9587210cfd1afe9abcc1d1ebe91d03b2a7cd68360d679296c9df604d08cf008e49460d55ffbe43e
7
+ data.tar.gz: 0ff557623fbd0e1b709d5a98613ffa543550f325e5b26b94ac8a780780ce41d90c2c3f593acb0049d9382718f6a092a0ec9fb625ffbd15bc91edac228f289a26
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gtk_advent_calendar.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Masafumi Yokoyama
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,33 @@
1
+ # GtkAdventCalendar
2
+
3
+ A calendar by Ruby/GTK3.
4
+
5
+ ## Requirements
6
+
7
+ * Ruby/GTK3 in [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'gtk_advent_calendar'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gtk_advent_calendar
22
+
23
+ ## Usage
24
+
25
+ $ gtk_advent_calendar
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "gtk_advent_calendar/command"
4
+
5
+ GtkAdventCalendar::Command.run(*ARGV)
@@ -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 'gtk_advent_calendar/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gtk_advent_calendar"
8
+ spec.version = GtkAdventCalendar::VERSION
9
+ spec.authors = ["Masafumi Yokoyama"]
10
+ spec.email = ["myokoym@gmail.com"]
11
+ spec.description = %q{A calendar by Ruby/GTK3.}
12
+ spec.summary = %q{A calendar by Ruby/GTK3}
13
+ spec.homepage = "https://github.com/myokoym/gtk_advent_calendar"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency("gtk3")
22
+
23
+ spec.add_development_dependency("bundler", "~> 1.3")
24
+ spec.add_development_dependency("rake")
25
+ end
@@ -0,0 +1,67 @@
1
+ require "gtk3"
2
+
3
+ module GtkAdventCalendar
4
+ class Calendar < Gtk::Frame
5
+ LAST_DAY = 25
6
+ CELL_WIDTH = 40
7
+
8
+ def initialize
9
+ super
10
+ @day = 1
11
+ box = Gtk::Box.new(:vertical)
12
+ box.add(Gtk::Label.new)
13
+ box.add(month)
14
+ add(box)
15
+ end
16
+
17
+ def month
18
+ box = Gtk::Box.new(:vertical)
19
+ box.add(days_of_the_week)
20
+ while @day <= LAST_DAY do
21
+ box.add(week)
22
+ end
23
+ box
24
+ end
25
+
26
+ def days_of_the_week
27
+ box = Gtk::Box.new(:horizontal)
28
+ %w(Sun Mon Tue Wed Thu Fri Sat).each do |day_of_the_week|
29
+ label = Gtk::Label.new("#{day_of_the_week}.")
30
+ label.width_request = CELL_WIDTH
31
+ box.add(label)
32
+ end
33
+ box
34
+ end
35
+
36
+ def week
37
+ box = Gtk::Box.new(:horizontal)
38
+ 7.times do
39
+ break if @day > LAST_DAY
40
+ box.add(day(@day))
41
+ @day += 1
42
+ end
43
+ box
44
+ end
45
+
46
+ def day(n)
47
+ button = Gtk::Button.new(:label => n.to_s)
48
+ button.width_request = CELL_WIDTH
49
+ button.height_request = CELL_WIDTH
50
+ button.signal_connect("clicked") do
51
+ show_uri("http://ja.wikipedia.org/wiki/12%E6%9C%88#{n}%E6%97%A5")
52
+ end
53
+ button
54
+ end
55
+
56
+ def show_uri(uri)
57
+ case RUBY_PLATFORM
58
+ when /darwin/
59
+ system("open", uri)
60
+ when /mswin|mingw|cygwin|bccwin/
61
+ system("start", uri)
62
+ else
63
+ system("firefox", uri)
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,19 @@
1
+ require "gtk3"
2
+ require "gtk_advent_calendar/calendar"
3
+
4
+ module GtkAdventCalendar
5
+ class Command
6
+ class << self
7
+ def run
8
+ window = Gtk::Window.new
9
+ window.title = "Advent Calendar"
10
+ window.add(Calendar.new)
11
+ window.signal_connect("destroy") do
12
+ Gtk.main_quit
13
+ end
14
+ window.show_all
15
+ Gtk.main
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module GtkAdventCalendar
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,2 @@
1
+ require "gtk_advent_calendar/version"
2
+ require "gtk_advent_calendar/calendar"
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gtk_advent_calendar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Masafumi Yokoyama
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gtk3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
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: A calendar by Ruby/GTK3.
56
+ email:
57
+ - myokoym@gmail.com
58
+ executables:
59
+ - gtk_advent_calendar
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/gtk_advent_calendar
69
+ - gtk_advent_calendar.gemspec
70
+ - lib/gtk_advent_calendar.rb
71
+ - lib/gtk_advent_calendar/calendar.rb
72
+ - lib/gtk_advent_calendar/command.rb
73
+ - lib/gtk_advent_calendar/version.rb
74
+ homepage: https://github.com/myokoym/gtk_advent_calendar
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.0.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: A calendar by Ruby/GTK3
98
+ test_files: []
99
+ has_rdoc: