Class: Osaka::TypicalOpenDialog
Instance Attribute Summary
#control
Instance Method Summary
collapse
#initialize, #set_folder
Instance Method Details
#amount_of_files_in_list ⇒ Object
42
43
44
45
46
|
# File 'lib/osaka/typicalopendialog.rb', line 42
def amount_of_files_in_list
amount_of_rows = control.get!("rows", file_list_location)
amount_match_data = amount_of_rows.match(/.*row (\d) of/)
amount_match_data.nil? ? 0 : amount_match_data[1].to_i
end
|
#click_open ⇒ Object
25
26
27
|
# File 'lib/osaka/typicalopendialog.rb', line 25
def click_open
control.click(at.button("Open"))
end
|
#field_location_from_row(row) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/osaka/typicalopendialog.rb', line 29
def field_location_from_row(row)
if (greyed_out?(row))
static_field_location_from_row(row)
else
text_field_location_from_row(row)
end
end
|
#file_list_location ⇒ Object
9
10
11
|
# File 'lib/osaka/typicalopendialog.rb', line 9
def file_list_location
at.outline(1).scroll_area(2).splitter_group(1).group(1)
end
|
#filename_at(row) ⇒ Object
48
49
50
|
# File 'lib/osaka/typicalopendialog.rb', line 48
def filename_at(row)
control.get!("value", field_location_from_row(row))
end
|
#greyed_out?(row) ⇒ Boolean
21
22
23
|
# File 'lib/osaka/typicalopendialog.rb', line 21
def greyed_out?(row)
!control.exists?(text_field_location_from_row(row))
end
|
#select_file(filename) ⇒ Object
52
53
54
55
56
57
58
59
60
|
# File 'lib/osaka/typicalopendialog.rb', line 52
def select_file(filename)
amount_of_files_in_list.times() { |row|
if filename_at(row+1) == filename
select_file_by_row(row+1)
click_open
return
end
}
end
|
#select_file_by_row(row) ⇒ Object
37
38
39
40
|
# File 'lib/osaka/typicalopendialog.rb', line 37
def select_file_by_row(row)
raise(OpenDialogCantSelectFile, "Tried to select a file, but it either doesn't exist or is greyed out") if (greyed_out?(row))
control.set!("selected", at.row(row) + file_list_location, true)
end
|
#static_field_location_from_row(row) ⇒ Object
17
18
19
|
# File 'lib/osaka/typicalopendialog.rb', line 17
def static_field_location_from_row(row)
at.static_text(1).ui_element(1).row(row) + file_list_location
end
|
#text_field_location_from_row(row) ⇒ Object
13
14
15
|
# File 'lib/osaka/typicalopendialog.rb', line 13
def text_field_location_from_row(row)
at.text_field(1).ui_element(1).row(row) + file_list_location
end
|