Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: danlucraft/zerenity
base: master
...
head fork: farrel/zerenity
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 16 commits
  • 11 files changed
  • 0 commit comments
  • 2 contributors
View
3  .gitignore
@@ -1,2 +1,5 @@
/pkg
/doc
+/coverage
+Gemfile.lock
+*.gem
View
5 CHANGELOG → CHANGELOG.rdoc
@@ -1,4 +1,9 @@
= Zerenity Changelog
+== 1.4
+* Ruby 1.9 compatibilty
+* Dialog closes and returns nil on 'close' signal, usually generated by ESC keypress.
+* Center all dialogs on the screen
+* Gemspec and some cleanups
== 1.3
* Added a color selection dialog
== 1.2
View
2  Gemfile
@@ -0,0 +1,2 @@
+source "http://rubygems.org"
+gemspec
View
25 README → README.rdoc
@@ -1,29 +1,30 @@
= Zerenity
== Version
-1.3
+1.5.0
== Author
Farrel Lifson http://www.lifson.info http://www.aimred.com
== Contributors
-Daniel Lucraft http://www.daniellucraft.com
+* Daniel Lucraft http://www.daniellucraft.com
+* Kacper Cieśla ({comboy}[https://github.com/comboy])
-== Synopsis
+== Synopsis
Zerenity is an almost clone of Zenity(http://freshmeat.net/projects/zenity) for Ruby. It allows for the easy creation of simple graphical dialogs from a Ruby script.
== Features
Zerenity allows for the creation of the following dialogs
* Date selection
* Text entry
-* Error display
+* Error display
* File/directory selection
-* Information display
-* List display and selection
+* Information display
+* List display and selection
* Progress display
* Question display
-* Text information display and editing
-* Warning display
+* Text information display and editing
+* Warning display
* Sliding scales
* Color selection
@@ -33,13 +34,13 @@ Zerenity requires GTK2(http://www.gtk.org) and Ruby/GTK2(http://ruby-gnome2.sour
== Installation
Zerenity is avaiable as a Ruby gem. Links to the latest release can be found at http://www.aimred.com/files/projects/zerenity.
-The code is also available via it's Github repository at http://github.com/farrel/zerenity/tree/master
+The code is also available via it's Github repository at http://github.com/farrel/zerenity/tree/master
== Example Usage
=== User Input and Display
require 'zerenity'
- if (name = Zerenity::Entry(:text=>"What is your name?"))
+ if (name = Zerenity::Entry(:text=>"What is your name?"))
Zerenity::Info(:text=>"Hello #{name}")
else
puts "No name entered"
@@ -59,5 +60,5 @@ The code is also available via it's Github repository at http://github.com/farre
== License
Zerenity is released under the BSD license.
-== Copyright
-(c) 2006 - 2009 Farrel Lifson
+== Copyright
+(c) 2006 - 2009 Farrel Lifson
View
31 Rakefile
@@ -1,37 +1,18 @@
require 'rubygems'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
+require 'rdoc/task'
require 'rake/testtask'
require 'rcov/rcovtask'
-SPEC = Gem::Specification.new do |spec|
- spec.name = "zerenity"
- spec.version = "1.3"
- spec.author = "Farrel Lifson"
- spec.email = "farrel.lifson@gmail.com"
- spec.homepage = "http://www.aimred.com/projects/zerenity"
- spec.platform = Gem::Platform::RUBY
- spec.summary = "A Zenity clone for Ruby"
- spec.files = Dir.glob("{lib,examples,test}/**/*")
- spec.require_path = "lib"
- spec.autorequire = "zerenity"
- spec.has_rdoc = true
- spec.extra_rdoc_files = ["README","CHANGELOG"]
-end
-
-Rake::GemPackageTask.new(SPEC) do |pkg|
- pkg.need_tar = true
-end
-
Rake::RDocTask.new do |rdoc|
rdoc.main = "README"
- rdoc.rdoc_files.include("README","CHANGELOG","lib/**/*.rb")
+ rdoc.rdoc_files.include("README.rdoc","CHANGELOG.rdoc","lib/**/*.rb")
rdoc.rdoc_dir = "doc"
end
Rake::TestTask.new do |test|
- test.test_files = ['test/ts_zerenity.rb']
+ test.libs << [ 'test', 'lib', 'lib/zerenity' ]
+ test.test_files = FileList['test/tc_*.rb']
end
task :stats do
@@ -43,5 +24,7 @@ end
Rcov::RcovTask.new do |rcov|
- rcov.test_files = FileList['test/ts_zerenity.rb']
+ rcov.test_files = FileList['test/tc_*.rb']
end
+
+task( :default => :test )
View
4 lib/zerenity/base.rb
@@ -9,6 +9,7 @@
# button when the Enter key is pressed.
module Zerenity
CLICKED = "clicked"
+ CLOSE = "close"
class Base # :nodoc:
class << self
attr_accessor :no_main_loop
@@ -47,6 +48,9 @@ def self.run(options)
Base.open_dialogs.delete(dialog)
Gtk.main_quit unless Base.no_main_loop
end
+ dialog.signal_connect(CLOSE) do
+ Gtk.main_quit unless Base.no_main_loop
+ end
dialog.show_all
Base.open_dialogs << dialog
Gtk.main unless Base.no_main_loop
View
6 lib/zerenity/messagedialog.rb
@@ -12,6 +12,7 @@ def self.run(options={})
dialog = Gtk::MessageDialog.new(nil,Gtk::Dialog::MODAL,options[:type],Gtk::MessageDialog::BUTTONS_NONE,options[:text])
self.build(dialog,options)
dialog.set_title(options[:title]) if options[:title]
+ dialog.set_window_position(Gtk::Window::POS_CENTER)
result = nil
if options[:cancel_button]
options[:cancel_button].signal_connect(CLICKED) do
@@ -20,13 +21,16 @@ def self.run(options={})
Gtk.main_quit unless Base.no_main_loop
end
end
-
options[:ok_button].signal_connect(CLICKED) do
result = true
dialog.destroy
Base.open_dialogs.delete(dialog)
Gtk.main_quit unless Base.no_main_loop
end
+ # dialog can be closed by ESC button, which won't trigger ok_button or cancelL_button signals
+ dialog.signal_connect(CLOSE) do
+ Gtk.main_quit unless Base.no_main_loop
+ end
dialog.show_all
Base.open_dialogs << dialog
Gtk.main unless Base.no_main_loop
View
3  lib/zerenity/version.rb
@@ -0,0 +1,3 @@
+module Zerenity
+ VERSION = '1.5.0'
+end
View
2  test/all.rb
@@ -1,2 +0,0 @@
-require 'test/unit'
-Dir[File.dirname(__FILE__) + "/tc_*.rb"].each {|fn| require fn}
View
33 test/ts_zerenity.rb
@@ -1,33 +0,0 @@
-require ('test/unit')
-require('test/tc_list')
-require('test/tc_progress')
-require('test/tc_question')
-require('test/tc_textinfo')
-require('test/tc_entry')
-require('test/tc_base')
-require('test/tc_calendar')
-require('test/tc_fileselection')
-require('test/tc_info')
-require('test/tc_messagedialog')
-require('test/tc_scale')
-require('test/tc_warning')
-
-class TS_Zerenity < Test::Unit::TestSuite
- def initialize(name="Zerenity Test Suite")
- super(name)
- @tests << TC_List.suite
- @tests << TC_Progress.suite
- @tests << TC_Question.suite
- @tests << TC_TextInfo.suite
- @tests << TC_Entry.suite
- @tests << TC_Base.suite
- @tests << TC_Calender.suite
- @tests << TC_Error.suite
- @tests << Tc_FileSelection.suite
- @tests << TC_Info.suite
- @tests << TC_MessageDialog.suite
- @tests << TC_Progress.suite
- @tests << TC_Warning.suite
- @tests << TC_Scale.suite
- end
-end
View
23 zerenity.gemspec
@@ -0,0 +1,23 @@
+$:.push File.expand_path("../lib", __FILE__)
+
+# Maintain your gem's version:
+require "zerenity/version"
+
+# Describe your gem and declare its dependencies:
+Gem::Specification.new do |s|
+ s.name = "zerenity"
+ s.version = Zerenity::VERSION
+ s.authors = ["Farrel Lifson","Daniel Lucraft", "Kacper Ciesla"]
+ s.email = ["farrel.lifson@gmail.com"]
+ s.homepage = "http://www.aimred.com/projects/zerenity"
+ s.summary = "A Zenity clone for Ruby."
+ s.description = ""
+
+ s.files = Dir["{lib,examples}/**/*"] + ["Rakefile", "README.rdoc", "CHANGELOG.rdoc"]
+ s.test_files = Dir["test/**/*"]
+
+ s.add_dependency "gtk2"
+ s.add_development_dependency "rcov"
+ s.add_development_dependency "rake"
+ s.add_development_dependency "rdoc"
+end

No commit comments for this range

Something went wrong with that request. Please try again.