code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
ActionController::Routing::Routes.draw do |map|
map.resources :sprints, :has_many => :stories
map.resources :stories
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.login '/login', :controller => 'sessions', :action => 'new'
map.register '/register', :controller => 'users', :action ... | Ruby |
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | Ruby |
# Be sure to restart your server when you modify this file
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
module AuthenticatedSystem
protected
# Returns true or false if the user is logged in.
# Preloads @current_user with the user model if they're logged in.
def logged_in?
!!current_user
end
# Accesses the current user from the session.
# Future calls avoid the database because nil is not ... | Ruby |
module AuthenticatedTestHelper
# Sets the current user in the session from the user fixtures.
def login_as(user)
@request.session[:user_id] = user ? users(user).id : nil
end
def authorize_as(user)
@request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentication::Basic.encode_credentials... | Ruby |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
# Ajouter le fichier de la classe CFONB
load 'classe.cfonb.rb' | Ruby |
# Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Ruby |
#!/usr/bin/env ruby
class ExampleRemoteLibrary
def count_items_in_directory(path)
Dir.entries(path).find_all{|i| not i.match('^\.')}.length
end
def strings_should_be_equal(str1, str2)
puts "Comparing '#{str1}' to '#{str2}'"
if str1 != str2
raise RuntimeError, "Given strings are not equal"
... | Ruby |
require('zerenity/textinfo')
Zerenity::TextInfo(:title=>"Source file: #{$0}",:textSource=>File.new($0).read)
text = Zerenity::TextInfo(:title=>"Editable Text",:editable=>true)
if text
puts "You entered:"
puts text
else
puts "You clicked cancel"
end
| Ruby |
require('zerenity/entry')
text = Zerenity::Entry(:text=>"Please enter your name")
puts "Hello #{text}" if text
puts "You did not enter your name" unless text
text = Zerenity::Entry(:text=>"Please enter your password",:password=>true)
puts "Your password is: #{text}" if text
puts "You did not enter your password" unle... | Ruby |
require('zerenity/list')
choice = Zerenity::List(:columns=>["Food","Energy"],:data=>[["Chips","200KJ"],["Chocolate","300KJ"]])
choice ? puts("You chose #{choice[0]} which has #{choice[1]} of energy.") : puts("You didn't choose an item.")
choice = Zerenity::List(:columns=>["Selected","Food","Energy"],:data=>[[true,"C... | Ruby |
require("zerenity/info")
Zerenity::Info(:text=>"Hello, world",:title=>"Hello!")
| Ruby |
require('zerenity/question')
choice = Zerenity::Question(:text=>"Process images?")
choice ? (puts "OK") : (puts "CANCEL")
| Ruby |
require('zerenity/fileselection')
fileName = Zerenity::FileSelection(:title=>"Which file do you want?",:filename=>File.expand_path(__FILE__),:action=>:open)
puts "You chose #{fileName}" if fileName
puts "You did not select a file" unless fileName
fileNames = Zerenity::FileSelection(:title=>"Please choose the require... | Ruby |
require 'zerenity/error'
Zerenity::Error(:text=>"An error has occured.",:title=>"Oops!")
| Ruby |
require 'zerenity/warning'
Zerenity::Warning(:text=>"An error could occur",:title=>"Danger!")
| Ruby |
require('zerenity/calendar')
date = Zerenity::Calendar(:text=>"What day is your birthday?",:title=>"Please select a date")
puts "You selected #{date.to_s}" if date
puts "You didn't select a date" unless date
| Ruby |
require('zerenity/progress')
Zerenity::Progress(:title=>"Normal",:text=>"Building index") do |progress|
0.step(1,0.01) do |number|
progress.update(number,"#{(number*100).to_i}%")
sleep(0.02)
end
end
Zerenity::Progress(:title=>"Normal pulse",:text=>"Querying Database") do |progress|
0.step(1,0.01) do
... | Ruby |
require('zerenity/base')
require('zerenity/calendar')
require('zerenity/entry')
require('zerenity/error')
require('zerenity/fileselection')
require('zerenity/info')
require('zerenity/list')
require('zerenity/messagedialog')
require('zerenity/progress')
require('zerenity/question')
require('zerenity/textinfo')
require('... | Ruby |
require 'zerenity/messagedialog'
module Zerenity
# Displays an informational popup dialog on the screen.
def Zerenity::Info(options={})
Info.run(options)
end
class Info < MessageDialog # :nodoc:
def self.build(options)
super(options)
options[:type] = Gtk::MessageDialog::INFO
... | Ruby |
require('zerenity/base')
module Zerenity
# Displays text in a multiline text info box.
#
# Options:
# * :editable - If set to true the text info box is editable.
# * :scrollable - If the size of the text does not fit in the
# height and width constraints, the text info box will become
# scrollable
... | Ruby |
require 'zerenity/base'
module Zerenity
# Creates a calendar dialog allowing the user to select a date. Returns
# a Time object representing the selected date or nil if Cancel is
# clicked.
def self.Calendar(options={})
Calendar.run(options)
end
class Calendar < Zerenity::Base # :nodoc:
def self.... | Ruby |
require 'zerenity/messagedialog'
module Zerenity
# Displays an error dialog.
def self.Error(options={})
Error.run(options)
end
class Error < MessageDialog # :nodoc:
def self.build(options)
super(options)
options[:type] = Gtk::MessageDialog::ERROR
end
end
end
| Ruby |
require('zerenity/base')
module Zerenity
# Displays a list dialog on the screen. Items in the list
# can be selected. Returns the rows which were selected
# or nil if Cancel is clicked.
#
# Options:
# * :columns - The names which will be displayed at the top og
# each column. This option is mandatory.... | Ruby |
require('zerenity/base')
module Zerenity
# Displays a text entry box. Returns the text entered or nil if
# Cancel is pressed.
#
# Options:
# * :password - When set to true all all characters in the text
# entry area will be masked by the '*' character.
def self.Entry(options={})
Entry.run(option... | Ruby |
require('zerenity/base')
module Zerenity
# Displays a progress bar which can be updated via a processing
# block which is passed a ProgressProxy object.
#
# Options:
# * :autoClose - The dialog will automatically close once the
# progressing block is complete.
# * :cancellable - If set to true the Cance... | Ruby |
require 'zerenity/messagedialog'
module Zerenity
# Displays a warning dialog on the screen.
def self.Warning(options={})
Warning.run(options)
end
class Warning < MessageDialog # :nodoc:
def self.build(options)
super(options)
options[:type] = Gtk::MessageDialog::WARNING
en... | Ruby |
require 'zerenity/base'
module Zerenity
# Displays a file/directory selection dialog. Returns the name(s)
# of the files/directories chosen or nil if Cancel is pressed.
#
# Options:
# * :filename - The file to selected initially
# * :multiple - If set to true multiple files/directories can be selected
... | Ruby |
require 'gtk2'
# Zerenity provides a number of simple graphical dialogs.
#
# Global Options:
# * :title - The text displayed in the title bar
# * :text - The text that will be displayed in the dialog
module Zerenity
CLICKED = "clicked"
class Base # :nodoc:
def self.check(options)
end
def self.build(vb... | Ruby |
require('zerenity/messagedialog')
module Zerenity
# Displays a question dialog. Returns true if OK is clicked, false if
# Cancel is clicked.
def self.Question(options={})
Question.run(options)
end
class Question < MessageDialog # :nodoc:
def self.check(options)
super(options)
end
def... | Ruby |
require 'zerenity/base'
module Zerenity
class MessageDialog < Base # :nodoc:
def self.build(options)
super(nil,options)
options[:cancel_button] = nil
end
def self.run(options={})
self.check(options)
Gtk.init
self.build(options)
dialog = Gtk::MessageDialog.new(ni... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/fileselection')
class TC_FileSelection < Test::Unit::TestCase
def setup
Gtk.init
@options={}
@vbox=Gtk::VBox.new
end
def test_check_normal
Zerenity::FileSelection.check(@options)
assert_equal(Gtk::FileChooser::ACTION_OPEN,@options[:actio... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/messagedialog')
class TC_MessageDialog < Test::Unit::TestCase
def setup
Gtk.init
@options={}
end
def test_build_normal
Zerenity::MessageDialog.build(@options)
assert(@options.keys.include?(:cancel_button))
assert_nil(@options[:cancel_but... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/info')
class TC_Info < Test::Unit::TestCase
def setup
@options={}
end
def test_build_normal
Zerenity::Info.build(@options)
assert_equal(Gtk::MessageDialog::INFO,@options[:type])
end
end
| Ruby |
require('zerenity/question')
class TC_Question < Test::Unit::TestCase
def setup
@options = {:text=>"Do you wish to continue"}
end
def test_check
Zerenity::Question.check(@options)
assert_equal("Do you wish to continue",@options[:text])
end
def test_build_normal
Zerenity::Question.build(@opt... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/warning')
class TC_Waring < Test::Unit::TestCase
def setup
Gtk.init
@options={}
end
def test_build_normal
Zerenity::Warning.build(@options)
assert_equal(Gtk::MessageDialog::WARNING,@options[:type])
end
end
| Ruby |
require('test/unit')
require('gtk2')
require('zerenity/textinfo')
class TC_TextInfo < Test::Unit::TestCase
def setup
Gtk.init #Prevents segmentation fault
@options = {}
@vbox = Gtk::VBox.new
end
def test_check_normal
Zerenity::TextInfo.check(@options)
assert_equal(false,@options[:editable])
... | Ruby |
require('test/unit')
require('zerenity/progress')
class TC_Progress < Test::Unit::TestCase
def setup
Gtk.init
@options = {:title=>"Operation in progress",:text=>"Building index..."}
@vbox = Gtk::VBox.new
@hButtonBox = Gtk::HButtonBox.new
@hButtonBox.add(Gtk::Button.new)
@hButtonBox.add(Gtk::B... | Ruby |
require('zerenity/entry')
class TC_Entry < Test::Unit::TestCase
def setup
Gtk.init
@options = {:title=>"Enter your name",:text=>"Enter your name"}
@vbox = Gtk::VBox.new
end
def test_build_normal
Zerenity::Entry.build(@vbox,@options)
assert_equal(true,@vbox.children[1].visibility?)
end
d... | Ruby |
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_warnin... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/calendar')
class TC_Calender < Test::Unit::TestCase
def setup
Gtk.init
@options={:text=>"Select a date"}
@vbox = Gtk::VBox.new
end
def test_build_normal
Zerenity::Calendar.build(@vbox,@options)
assert_equal(Gtk::Label,@vbox.children[0... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/list')
class TC_List < Test::Unit::TestCase
def setup
Gtk.init
@options = {:columns=>["Snack","Energy(KJ)"],:data=>[["Beer","300"],["Chips","500"],["Chocolate","750"]]}
@vbox = Gtk::VBox.new
end
def test_check_normal
assert_nothing_raised{Ze... | Ruby |
require('zerenity/textinfo')
Zerenity::TextInfo(:title=>"Source file: #{$0}",:text=>File.new($0).read)
text = Zerenity::TextInfo(:title=>"Editable Text",:editable=>true)
if text
puts "You entered:"
puts text
else
puts "You clicked cancel"
end
| Ruby |
require('zerenity/entry')
text = Zerenity::Entry(:text=>"Please enter your name")
puts "Hello #{text}" if text
puts "You did not enter your name" unless text
text = Zerenity::Entry(:text=>"Please enter your password",:password=>true)
puts "Your password is: #{text}" if text
puts "You did not enter your password" unle... | Ruby |
require('zerenity/list')
choice = Zerenity::List(:columns=>["Food","Energy"],:data=>[["Chips","200KJ"],["Chocolate","300KJ"]])
choice ? puts("You chose #{choice[0]} which has #{choice[1]} of energy.") : puts("You didn't choose an item.")
choice = Zerenity::List(:columns=>["Selected","Food","Energy"],:data=>[[true,"C... | Ruby |
require("zerenity/info")
Zerenity::Info(:text=>"Hello, world",:title=>"Hello!")
| Ruby |
require('zerenity/question')
choice = Zerenity::Question(:text=>"Process images?")
choice ? (puts "OK") : (puts "CANCEL")
| Ruby |
require('zerenity/fileselection')
fileName = Zerenity::FileSelection(:title=>"Which file do you want?",:filename=>File.expand_path(__FILE__),:action=>:open)
puts "You chose #{fileName}" if fileName
puts "You did not select a file" unless fileName
fileNames = Zerenity::FileSelection(:title=>"Please choose the require... | Ruby |
require 'zerenity/error'
Zerenity::Error(:text=>"An error has occured.",:title=>"Oops!")
| Ruby |
require 'zerenity/warning'
Zerenity::Warning(:text=>"An error could occur",:title=>"Danger!")
| Ruby |
require('zerenity/calendar')
date = Zerenity::Calendar(:text=>"What day is your birthday?",:title=>"Please select a date")
puts "You selected #{date.to_s}" if date
puts "You didn't select a date" unless date
| Ruby |
require('zerenity/progress')
Zerenity::Progress(:title=>"Normal",:text=>"Building index") do |progress|
0.step(1,0.01) do |number|
progress.update(number,"#{(number*100).to_i}%")
sleep(0.02)
end
end
Zerenity::Progress(:title=>"Normal pulse",:text=>"Querying Database") do |progress|
0.step(1,0.01) do
... | Ruby |
require('zerenity/base')
require('zerenity/calendar')
require('zerenity/entry')
require('zerenity/error')
require('zerenity/fileselection')
require('zerenity/info')
require('zerenity/list')
require('zerenity/messagedialog')
require('zerenity/progress')
require('zerenity/question')
require('zerenity/textinfo')
require('... | Ruby |
require 'zerenity/messagedialog'
module Zerenity
# Displays an informational popup dialog on the screen.
def Zerenity::Info(options={})
Info.run(options)
end
class Info < MessageDialog # :nodoc:
def self.check(options)
super(options)
options[:type] = Gtk::MessageDialog::INFO
e... | Ruby |
require('zerenity/base')
module Zerenity
# Displays text in a multiline text info box.
#
# Options:
# * :editable - If set to true the text info box is editable.
# * :scrollable - If the size of the text does not fit in the
# height and width constraints, the text info box will become
# scrollable
... | Ruby |
require 'zerenity/base'
module Zerenity
# Creates a calendar dialog allowing the user to select a date. Returns
# a Time object representing the selected date or nil if Cancel is
# clicked.
def self.Calendar(options={})
Calendar.run(options)
end
class Calendar < Zerenity::Base # :nodoc:
def self.... | Ruby |
require 'zerenity/messagedialog'
module Zerenity
# Displays an error dialog.
def self.Error(options={})
Error.run(options)
end
class Error < MessageDialog # :nodoc:
def self.check(options)
super(options)
options[:type] = Gtk::MessageDialog::ERROR
end
end
end
| Ruby |
require('zerenity/base')
module Zerenity
# Displays a list dialog on the screen. Items in the list
# can be selected. Returns the rows which were selected
# or nil if Cancel is clicked.
#
# Options:
# * :columns - The names which will be displayed at the top og
# each column. This option is mandatory.... | Ruby |
require('zerenity/base')
module Zerenity
# Displays a text entry box. Returns the text entered or nil if
# Cancel is pressed.
#
# Options:
# * :password - When set to true all all characters in the text
# entry area will be masked by the '*' character.
def self.Entry(options={})
Entry.run(option... | Ruby |
require('zerenity/base')
module Zerenity
# Displays a progress bar which can be updated via a processing
# block which is passed a ProgressProxy object.
#
# Options:
# * :autoClose - The dialog will automatically close once the
# progressing block is complete.
# * :cancellable - If set to true the Cance... | Ruby |
require 'zerenity/messagedialog'
module Zerenity
# Displays a warning dialog on the screen.
def self.Warning(options={})
Warning.run(options)
end
class Warning < MessageDialog # :nodoc:
def self.check(options)
super(options)
options[:type] = Gtk::MessageDialog::WARNING
en... | Ruby |
require 'zerenity/base'
module Zerenity
# Displays a file/directory selection dialog. Returns the name(s)
# of the files/directories chosen or nil if Cancel is pressed.
#
# Options:
# * :filename - The file to selected initially
# * :multiple - If set to true multiple files/directories can be selected
... | Ruby |
require 'gtk2'
# Zerenity provides a number of simple graphical dialogs.
#
# Global Options:
# * :title - The text displayed in the title bar.
# * :text - The text that will be displayed in the dialog (if needed).
# * :activatesDefault - If set to false disables the firing of the OK
# button when the Enter key is pr... | Ruby |
require('zerenity/messagedialog')
module Zerenity
# Displays a question dialog. Returns true if OK is clicked, false if
# Cancel is clicked.
def self.Question(options={})
Question.run(options)
end
class Question < MessageDialog # :nodoc:
def self.check(options)
super(options)
options[:t... | Ruby |
require 'zerenity/base'
module Zerenity
class MessageDialog < Base # :nodoc:
def self.build(dialog,options)
options[:ok_button] = dialog.add_button(Gtk::Stock::OK,Gtk::Dialog::RESPONSE_OK)
dialog.set_default_response(Gtk::Dialog::RESPONSE_OK)
end
def self.run(options={})
Gtk.init... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/fileselection')
class TC_FileSelection < Test::Unit::TestCase
def setup
Gtk.init
@options={}
@dialog=Gtk::Dialog.new
end
def test_check_normal
Zerenity::FileSelection.check(@options)
assert_equal(Gtk::FileChooser::ACTION_OPEN,@options[:a... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/messagedialog')
class TC_MessageDialog < Test::Unit::TestCase
def setup
Gtk.init
@options={}
@dialog = Gtk::Dialog.new
end
def test_build_normal
Zerenity::MessageDialog.build(@dialog,@options)
assert_nil(@options[:cancel_button])
end
e... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/info')
class TC_Info < Test::Unit::TestCase
def setup
Gtk.init
@options={}
@dialog=Gtk::Dialog.new
end
def test_check_normal
Zerenity::Info.check(@options)
assert_equal(Gtk::MessageDialog::INFO,@options[:type])
end
end
| Ruby |
require('test/unit')
require('gtk2')
require('zerenity/question')
class TC_Question < Test::Unit::TestCase
def setup
Gtk.init
@options = {:text=>"Do you wish to continue"}
@dialog = Gtk::Dialog.new
end
def test_check
Zerenity::Question.check(@options)
assert_equal("Do you wish to continue",@... | Ruby |
require('test/unit')
require('zerenity/base')
class TC_Base < Test::Unit::TestCase
def setup
Gtk.init
@options={}
@dialog=Gtk::Dialog.new
end
def test_check_normal
Zerenity::Base.check(@options)
assert(@options[:activatesDefault])
assert_equal("",@options[:title])
assert_equal("",@op... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/warning')
class TC_Waring < Test::Unit::TestCase
def setup
Gtk.init
@options={}
@dialog = Gtk::Dialog.new
end
def test_build_normal
Zerenity::Warning.check(@options)
assert_equal(Gtk::MessageDialog::WARNING,@options[:type])
end
end
| Ruby |
require('test/unit')
require('gtk2')
require('zerenity/textinfo')
class TC_TextInfo < Test::Unit::TestCase
def setup
Gtk.init #Prevents segmentation fault
@options = {}
@dialog = Gtk::Dialog.new
end
def test_check_normal
Zerenity::TextInfo.check(@options)
assert_equal(false,@options[:editabl... | Ruby |
require('test/unit')
require('zerenity/progress')
class TC_Progress < Test::Unit::TestCase
def setup
Gtk.init
@options = {:title=>"Operation in progress",:text=>"Building index..."}
@dialog = Gtk::Dialog.new
@hButtonBox = Gtk::HButtonBox.new
@hButtonBox.add(Gtk::Button.new)
@hButtonBox.add(Gt... | Ruby |
require('zerenity/entry')
class TC_Entry < Test::Unit::TestCase
def setup
Gtk.init
@options = {:title=>"Enter your name",:text=>"Enter your name"}
@dialog = Gtk::Dialog.new
end
def test_build_normal
Zerenity::Entry.build(@dialog,@options)
assert_equal(true,@dialog.vbox.children[1].visibility... | Ruby |
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_warnin... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/calendar')
class TC_Calender < Test::Unit::TestCase
def setup
Gtk.init
@options={:text=>"Select a date"}
@dialog=Gtk::Dialog.new
end
def test_build_normal
Zerenity::Calendar.build(@dialog,@options)
assert_equal(Gtk::Label,@dialog.vbox... | Ruby |
require('test/unit')
require('gtk2')
require('zerenity/list')
class TC_List < Test::Unit::TestCase
def setup
Gtk.init
@options = {:columns=>["Snack","Energy(KJ)"],:data=>[["Beer","300"],["Chips","500"],["Chocolate","750"]]}
@dialog = Gtk::Dialog.new
end
def test_check_normal
assert_nothing_raise... | Ruby |
require('zerenity/textinfo')
Zerenity::TextInfo(:title=>"Source file: #{$0}",:text=>File.new($0).read)
text = Zerenity::TextInfo(:title=>"Editable Text",:editable=>true)
if text
puts "You entered:"
puts text
else
puts "You clicked cancel"
end
| Ruby |
require('zerenity/entry')
text = Zerenity::Entry(:text=>"Please enter your name")
puts "Hello #{text}" if text
puts "You did not enter your name" unless text
text = Zerenity::Entry(:text=>"Please enter your password",:password=>true)
puts "Your password is: #{text}" if text
puts "You did not enter your password" unle... | Ruby |
require('zerenity/list')
choice = Zerenity::List(:columns=>["Food","Energy"],:data=>[["Chips","200KJ"],["Chocolate","300KJ"]])
choice ? puts("You chose #{choice[0]} which has #{choice[1]} of energy.") : puts("You didn't choose an item.")
choice = Zerenity::List(:columns=>["Selected","Food","Energy"],:data=>[[true,"C... | Ruby |
require("zerenity/info")
Zerenity::Info(:text=>"Hello, world",:title=>"Hello!")
| Ruby |
require('zerenity/question')
choice = Zerenity::Question(:text=>"Process images?")
choice ? (puts "OK") : (puts "CANCEL")
| Ruby |
require('zerenity/fileselection')
fileName = Zerenity::FileSelection(:title=>"Which file do you want?",:filename=>File.expand_path(__FILE__),:action=>:open)
puts "You chose #{fileName}" if fileName
puts "You did not select a file" unless fileName
fileNames = Zerenity::FileSelection(:title=>"Please choose the require... | Ruby |
require 'zerenity/error'
Zerenity::Error(:text=>"An error has occured.",:title=>"Oops!")
| Ruby |
require 'zerenity/warning'
Zerenity::Warning(:text=>"An error could occur",:title=>"Danger!")
| Ruby |
require('zerenity/calendar')
date = Zerenity::Calendar(:text=>"What day is your birthday?",:title=>"Please select a date")
puts "You selected #{date.to_s}" if date
puts "You didn't select a date" unless date
| Ruby |
require('zerenity/progress')
Zerenity::Progress(:title=>"Normal",:text=>"Building index") do |progress|
0.step(1,0.01) do |number|
progress.update(number,"#{(number*100).to_i}%")
sleep(0.02)
end
end
Zerenity::Progress(:title=>"Normal pulse",:text=>"Querying Database") do |progress|
0.step(1,0.01) do
... | Ruby |
require('zerenity/base')
require('zerenity/calendar')
require('zerenity/entry')
require('zerenity/error')
require('zerenity/fileselection')
require('zerenity/info')
require('zerenity/list')
require('zerenity/messagedialog')
require('zerenity/progress')
require('zerenity/question')
require('zerenity/scale')
require('zer... | Ruby |
require 'zerenity/messagedialog'
module Zerenity
# Displays an informational popup dialog on the screen.
#
# ====Examle Usage
# Zerenity::Info(:text=>"Processing has completed.")
def Zerenity::Info(options={})
Info.run(options)
end
class Info < MessageDialog # :nodoc:
def self.check(options)... | Ruby |
require('zerenity/base')
module Zerenity
# Displays text in a multiline text info box.
#
# ====Options
# [:editable] If set to true the text info box is editable.
# [:scrollable] If the size of the text does not fit in the
# height and width constraints, the text info box will become
# ... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.