def _update_values(dlg, vals): """Update a publication's values in the form.""" for key, val in vals.items(): if key == "image": if val: change_image(dlg, val) else: remove_image(dlg) elif key == "name": elem = find_child(".row.name .react-select input", dlg) set_elem_text(elem, val) elem.send_keys(Keys.RETURN) elif key == "publisher": select = ReactSelect( find_child(".row.publisher .react-select", dlg)) select.select_by_name(val) elif key == "tags": select = ReactSelect(find_child(".row.tags .react-select", dlg)) select.update_multiselect_values(*val) else: if key == "edition": sel = "input.edition" elif key == "description": sel = ".row.description textarea" else: sel = ".row.{} input".format(key) set_elem_text(find_child(sel, dlg), val)
def _update_values(dlg, vals): """Update an article's values in the form.""" for key, val in vals.items(): if key == "image": if val: change_image(dlg, val) else: remove_image(dlg) elif key in ("publication", "publisher"): row = find_child(".row.{}".format(key), dlg) select = ReactSelect(find_child(".react-select", row)) if not select.select.is_displayed(): key2 = "publisher" if key == "publication" else "publication" row2 = find_child(".row.{}".format(key2), dlg) find_child("label.parent-mode", row2).click() wait_for(2, select.select.is_displayed) select.select_by_name(val) elif key in ["authors", "scenarios", "tags"]: select = ReactSelect( find_child(".row.{} .react-select".format(key), dlg)) select.update_multiselect_values(*val) else: if key == "snippet": sel = ".row.snippet textarea" elif key == "pageno": sel = "input.pageno" else: sel = ".row.{} input".format(key) set_elem_text(find_child(sel, dlg), val)
def _update_values( dlg, vals ): """Update a publishers's values in the form.""" for key,val in vals.items(): if key == "image": if val: change_image( dlg, val ) else: remove_image( dlg ) else: sel = ".row.{} {}".format( key , "textarea" if key == "description" else "input" ) set_elem_text( find_child( sel, dlg ), val )
def _update_values(dlg, vals): """Update an article's values in the form.""" for key, val in vals.items(): if key == "image": if val: change_image(dlg, val) else: remove_image(dlg) elif key == "publication": select = ReactSelect( find_child(".row.publication .react-select", dlg)) select.select_by_name(val) elif key in ["authors", "scenarios", "tags"]: select = ReactSelect( find_child(".row.{} .react-select".format(key), dlg)) select.update_multiselect_values(*val) else: if key == "snippet": sel = ".row.snippet textarea" elif key == "pageno": sel = "input.pageno" else: sel = ".row.{} input".format(key) set_elem_text(find_child(sel, dlg), val)