def add_new_user_disulfide(self):
# Checks that both the comboboxes have been used to select a cys.
if (self.list_of_disulfide_combos[-1].cys1_combobox.get() == "" or self.list_of_disulfide_combos[-1].cys2_combobox.get() == ""):
txt = "You have to select two cysteines residue to define a disulfide bridge!"
tkMessageBox.showwarning("Warning", txt,parent=self.pymod_object.modeling_window)
# Checks that the same cys has not been selected in both comboboxes.
elif (self.list_of_disulfide_combos[-1].cys1_combobox.get() == self.list_of_disulfide_combos[-1].cys2_combobox.get()):
txt = "You cannot select the same cysteine to form a disulfide bridge!"
tkMessageBox.showwarning("Message", txt,parent=self.pymod_object.modeling_window)
# Checks that the selected cys are not engaged in other bridges.
# ...
# If the two cys are free to form a bridge, then adds the new bridge and updates the
# frame with a new combobox row.
else:
self.user_disulfides_row_counter += 1
# Adds the new row with comboboxes and an "Add" button.
new_ds_combo = User_disulfide_combo(
self.pymod_object,
self.user_disulfides_row_counter,
self.target_list_of_cysteines,
self.combobox_frame,
self)
# Activates the previous row and returns the name of the 2 selected cys.
cysteines = self.list_of_disulfide_combos[-1].activate()
# Finishes and adds the new row.
self.list_of_disulfide_combos.append(new_ds_combo)
# Adds the cys pair to the self.user_defined_disulfide_bridges, which is going to be
# used in the perform_modelization() method.
self.user_defined_disulfide_bridges.append(cysteines)
# self.print_user_ds_list()
self.pymod_object.disulfides_scrolled_frame.reposition()
# This is called when the "Remove" button is pressed.
评论列表
文章目录