Hinting is set to off, not nil. Some more tests
This commit is contained in:
@@ -9,12 +9,11 @@ module Squib
|
||||
# hint text: :cyan
|
||||
# hint text: :cyan, progress_bar: true
|
||||
#
|
||||
# @param [String] text the color of the text hint. To turn off use nil or :off. @see README.md
|
||||
# @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: nil)
|
||||
text = nil if text == :off
|
||||
def hint(text: :off)
|
||||
@text_hint = text
|
||||
end
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ module Squib
|
||||
:format => :png,
|
||||
:gap => 0,
|
||||
:height => :native,
|
||||
:hint => :off,
|
||||
:justify => false,
|
||||
:margin => 75,
|
||||
:markup => false,
|
||||
@@ -50,7 +51,7 @@ module Squib
|
||||
CONFIG_DEFAULTS = {
|
||||
'custom_colors' => {},
|
||||
'dpi' => 300,
|
||||
'hint' => nil,
|
||||
'hint' => :none,
|
||||
'progress_bar' => false,
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ module Squib
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def svg(file, id, x, y, width, height, alpha, blend)
|
||||
Squib.logger.debug {"Rendering: #{file}, #{id} #{x}, #{y}, #{width}, #{height}, #{alpha}, #{blend}"}
|
||||
return if file.nil? or file.eql? ''
|
||||
svg = RSVG::Handle.new_from_file(file)
|
||||
width = svg.width if width == :native
|
||||
|
||||
@@ -6,8 +6,8 @@ module Squib
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def draw_text_hint(x,y,layout, color)
|
||||
return if color.nil? && @deck.text_hint.nil?
|
||||
color ||= @deck.text_hint
|
||||
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
|
||||
w = layout.extents[1].width / Pango::SCALE if w < 0
|
||||
|
||||
@@ -8,11 +8,10 @@ module Squib
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def needs(opts, params)
|
||||
Squib.logger.debug {"Pre input-helper opts: #{opts}"}
|
||||
Squib.logger.debug {"Given opts: #{opts}"}
|
||||
opts = layoutify(opts) if params.include? :layout
|
||||
opts = Squib::SYSTEM_DEFAULTS.merge(opts)
|
||||
opts = expand_singletons(opts, params)
|
||||
Squib.logger.debug {"Post expand opts: #{opts}"}
|
||||
opts = rangeify(opts) if params.include? :range
|
||||
opts = fileify(opts) if params.include? :file
|
||||
opts = fileify(opts, false) if params.include? :file_to_save
|
||||
@@ -40,6 +39,7 @@ module Squib
|
||||
end
|
||||
end
|
||||
end
|
||||
Squib.logger.debug {"After expand_singletons: #{opts}"}
|
||||
opts
|
||||
end
|
||||
module_function :expand_singletons
|
||||
@@ -56,13 +56,15 @@ module Squib
|
||||
entry = @layout[layout.to_s]
|
||||
unless entry.nil?
|
||||
entry.each do |key, value|
|
||||
opts[key.to_sym] ||= entry[key]
|
||||
opts[key.to_sym] = [] if opts[key.to_sym].nil?
|
||||
opts[key.to_sym][i] ||= entry[key] #don't override if it's already there
|
||||
end
|
||||
else
|
||||
Squib.logger.warn ("Layout entry '#{layout}' does not exist." )
|
||||
end
|
||||
end
|
||||
end
|
||||
Squib.logger.debug {"After layoutify: #{opts}"}
|
||||
opts
|
||||
end
|
||||
module_function :layoutify
|
||||
@@ -86,6 +88,7 @@ module Squib
|
||||
raise ArgumentError.new("#{range} is outside of deck range of 0..#{@cards.size-1}")
|
||||
end
|
||||
opts[:range] = range
|
||||
Squib.logger.debug {"After rangeify: #{opts}"}
|
||||
opts
|
||||
end
|
||||
module_function :rangeify
|
||||
@@ -127,6 +130,7 @@ module Squib
|
||||
opts[key][i] = Cairo::Color.parse(color)
|
||||
end
|
||||
end
|
||||
Squib.logger.debug {"After colorify: #{opts}"}
|
||||
opts
|
||||
end
|
||||
module_function :colorify
|
||||
@@ -138,6 +142,7 @@ module Squib
|
||||
opts[:font][i] = @font if font==:use_set
|
||||
opts[:font][i] = Squib::SYSTEM_DEFAULTS[:default_font] if font == :default
|
||||
end
|
||||
Squib.logger.debug {"After fontify: #{opts}"}
|
||||
opts
|
||||
end
|
||||
module_function :fontify
|
||||
@@ -151,6 +156,7 @@ module Squib
|
||||
opts[:y_radius][i] = radius
|
||||
end
|
||||
end
|
||||
Squib.logger.debug {"After radiusify: #{opts}"}
|
||||
opts
|
||||
end
|
||||
module_function :radiusify
|
||||
@@ -163,6 +169,7 @@ module Squib
|
||||
opts[:id][i] = '#' << id unless id.start_with? '#'
|
||||
end
|
||||
end
|
||||
Squib.logger.debug {"After svgidify: #{opts}"}
|
||||
opts
|
||||
end
|
||||
module_function :svgidify
|
||||
|
||||
Reference in New Issue
Block a user