From 73f2c5aa5d59f4456626cf8fb67b94c6e97bdf98 Mon Sep 17 00:00:00 2001
From: Paolo Capriotti
Date: Mon, 13 Jul 2009 14:41:47 +0200
Subject: [PATCH] Fix square coloring.
---
lib/plugins/layouts/layouts.rb | 7 ++-----
lib/plugins/layouts/{cool => lib}/cool.rb | 0
lib/plugins/squares/default.rb | 4 ++--
lib/qtutils.rb | 5 +++++
4 files changed, 9 insertions(+), 7 deletions(-)
rename lib/plugins/layouts/{cool => lib}/cool.rb (100%)
diff --git a/lib/plugins/layouts/layouts.rb b/lib/plugins/layouts/layouts.rb
index 3883e58..9e79d3a 100644
--- a/lib/plugins/layouts/layouts.rb
+++ b/lib/plugins/layouts/layouts.rb
@@ -5,8 +5,5 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-def require_relative(file)
- require File.join(File.dirname(__FILE__), file)
-end
-
-require_relative 'cool/cool'
+require_bundle 'layouts', 'cool'
+require_bundle 'layouts', 'xboard'
diff --git a/lib/plugins/layouts/cool/cool.rb b/lib/plugins/layouts/lib/cool.rb
similarity index 100%
rename from lib/plugins/layouts/cool/cool.rb
rename to lib/plugins/layouts/lib/cool.rb
diff --git a/lib/plugins/squares/default.rb b/lib/plugins/squares/default.rb
index 0ad5692..8bcd67d 100644
--- a/lib/plugins/squares/default.rb
+++ b/lib/plugins/squares/default.rb
@@ -12,7 +12,7 @@ class DefaultBackground
include Plugin
include Background
- plugin :name => 'Default',
+ plugin :name => 'Default Background',
:interface => :board,
:keywords => %w(chess)
@@ -25,7 +25,7 @@ class DefaultBackground
(0...@squares.x).each do |x|
(0...@squares.y).each do |y|
rect = Qt::RectF.new(size.x * x, size.y * y, size.x, size.y)
- color = if (x + y) % 2 == 0
+ color = if (x + y) % 2 == 1
Qt::Color.new(0x6b, 0x82, 0x9c)
else
Qt::Color.new(0xb8, 0xc0, 0xc0)
diff --git a/lib/qtutils.rb b/lib/qtutils.rb
index 1107292..4f86990 100644
--- a/lib/qtutils.rb
+++ b/lib/qtutils.rb
@@ -24,6 +24,11 @@ class Object
def metaclass_eval(&blk)
metaclass.instance_eval(&blk)
end
+
+ def alter(property)
+ value = yield(send(property))
+ send("#{property}=", value)
+ end
end
module Enumerable
--
2.11.4.GIT