From 985c925d99200e06a4a2b32fa99148d6299961f7 Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Fri, 17 Oct 2014 08:33:25 -0400 Subject: [PATCH] Fixing globally togglable text hints --- lib/squib/api/settings.rb | 3 +-- lib/squib/deck.rb | 1 + lib/squib/graphics/text.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/squib/api/settings.rb b/lib/squib/api/settings.rb index 12a3425..69cd25c 100644 --- a/lib/squib/api/settings.rb +++ b/lib/squib/api/settings.rb @@ -7,10 +7,9 @@ module Squib # Setting a hint to nil or to :off will disable hints. @see samples/text.rb # @example # hint text: :cyan - # hint text: :cyan, progress_bar: true + # hint text: :cyan # # @param [String] text the color of the text hint. To turn off use :off. @see README.md - # @param [Boolean] progress_bar enable progress bars on long-running operations # @return [nil] Returns nothing # @api public def hint(text: :off) diff --git a/lib/squib/deck.rb b/lib/squib/deck.rb index 3407d7e..cd8570a 100644 --- a/lib/squib/deck.rb +++ b/lib/squib/deck.rb @@ -60,6 +60,7 @@ module Squib @custom_colors = {} @img_dir = '.' @progress_bar = Squib::Progress.new(false) + @text_hint = :off cards.times{ @cards << Squib::Card.new(self, width, height) } load_config(config) load_layout(layout) diff --git a/lib/squib/graphics/text.rb b/lib/squib/graphics/text.rb index c74ba5d..024dfdb 100644 --- a/lib/squib/graphics/text.rb +++ b/lib/squib/graphics/text.rb @@ -6,7 +6,7 @@ module Squib # :nodoc: # @api private def draw_text_hint(x,y,layout, color) - color ||= @deck.text_hint + color = @deck.text_hint if color.to_s.eql? 'off' and not @deck.text_hint.to_s.eql? 'off' return if color.to_s.eql? 'off' # when w,h < 0, it was never set. extents[1] are ink extents w = layout.width / Pango::SCALE