Class: MetaBuilder::ParameterTypes::FileParameter

Inherits:
StringParameter show all
Defined in:
lib/MetaBuilder/Parameters/strings.rb,
lib/MetaBuilder/Qt4/Parameters/strings.rb

Overview

An integer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from StringParameter

#string_to_type

Methods inherited from MetaBuilder::ParameterType

#default_value, from_string, get_param_type, get_type, #lookup_const, #option_parser_long_option, #option_parser_option, #option_parser_raw, #string_to_type, #stt_run_hook, type_name, #type_to_string, #type_to_string_internal, #type_to_variant, #variant_to_type

Constructor Details

#initialize(type) ⇒ FileParameter

Returns a new instance of FileParameter.



47
48
49
50
# File 'lib/MetaBuilder/Parameters/strings.rb', line 47

def initialize(type)
  super(type)
  @filter = type[:filter]
end

Instance Attribute Details

#filterObject (readonly)

The file filters, Qt style.



45
46
47
# File 'lib/MetaBuilder/Parameters/strings.rb', line 45

def filter
  @filter
end

Instance Method Details

#qt4_create_input_widget(parent = nil, target = nil, style = nil) ⇒ Object



28
29
30
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 28

def qt4_create_input_widget(parent = nil, target = nil, style = nil)
  return Qt4MB::FileInputWidget.new(parent, self)
end

#qt4_get(parent, title, label, default, target = nil) ⇒ Object

Directly wraps to Qt::FileDialog.get_open_file_name; the title is therefore ignored…



34
35
36
37
38
39
40
41
42
# File 'lib/MetaBuilder/Qt4/Parameters/strings.rb', line 34

def qt4_get(parent, title, label, default, target = nil) 
  
  file = Qt::FileDialog.get_open_file_name(parent, label,
                                           File.dirname(default),
                                           filter)
  if file.nil?
    raise CancelInput
  end
end

#type_nameObject



52
53
54
# File 'lib/MetaBuilder/Parameters/strings.rb', line 52

def type_name
  return 'file'
end