Finally got around to checking out shoes, and I have to say, this all
looks very exciting :)
The good-reminder.rb sample had a few problems:
1. needs require 'yaml'
2. Time.today went away
3. "parenthesize arguments" warning
4. todo and completed panes overlap scrollbar
patch attached.
martin
--- /opt/shoes-git/samples/good-reminder.rb 2008-06-08 00:59:44.000000000 -0700
+++ ../../good-reminder.rb 2008-06-08 03:23:24.000000000 -0700
@@ -1,3 +1,10 @@
+require 'yaml'
+
+def Time.today
+ t = Time.now
+ t - (t.to_i % 86400)
+end unless Time.respond_to? :today
+
Shoes.app :title => "A Gentle Reminder",
:width => 370, :height => 560, :resizable => false do
@@ -8,7 +15,7 @@
stack :margin => 10, :margin_top => 50 do
para "You need to", :stroke => red, :fill => yellow
- stack :margin_left => 5, :width => 1.0, :height => 200, :scroll => true do
+ stack :margin_left => 5, :margin_right => 10, :width => 1.0, :height => 200, :scroll => true do
background white
border white, :strokewidth => 3
@gui_todo = para
@@ -26,13 +33,13 @@
para strong('Completed'), :stroke => white
end
- @gui_completed = stack :width => 1.0, :height => 207
+ @gui_completed = stack :width => 1.0, :height => 207, :margin_right => 20
def data_path
if RUBY_PLATFORM =~ /win32/
if ENV['USERPROFILE']
- if File.exist?(File.join File.expand_path(ENV['USERPROFILE']), "Application Data")
+ if File.exist?(File.join(File.expand_path(ENV['USERPROFILE']), "Application Data"))
user_data_directory = File.join File.expand_path(ENV['USERPROFILE']), "Application Data", "GentleReminder"
else
user_data_directory = File.join File.expand_path(ENV['USERPROFILE']), "GentleReminder"
@@ -41,14 +48,14 @@
user_data_directory = File.join File.expand_path(Dir.getwd), "data"
end
else
- user_data_directory = File.expand_path(File.join "~", ".gentlereminder")
+ user_data_directory = File.expand_path(File.join("~", ".gentlereminder"))
end
unless File.exist?(user_data_directory)
Dir.mkdir(user_data_directory)
end
- return File.join user_data_directory, "data.yaml"
+ return File.join(user_data_directory, "data.yaml")
end