def cpy_btn(self): """Function for copy button""" smen = [ item.text() for item in self.listWidget_men_names.selectedItems() ] swomen = [ item.text() for item in self.listWidget_women_names.selectedItems() ] try: smen.remove("- None -") swomen.remove("- None -") except: pass if self.radioButton_a.isChecked(): core.A = core.A.union(set(smen + swomen)) self.listWidget_set_a.clear() self.listWidget_set_a.addItems(list(core.A)) if self.radioButton_b.isChecked(): core.B = core.B.union(set(smen + swomen)) self.listWidget_set_b.clear() self.listWidget_set_b.addItems(list(core.B)) core.S, core.R = fr_generator.generate(core.A, core.B, core.s_possibility, core.r_possibility)
def clear_b_btn(self): """Clearing set B and B's listWidget""" core.B = set() self.listWidget_set_b.clear() core.S, core.R = fr_generator.generate(core.A, core.B, core.s_possibility, core.r_possibility)
def read_b_btn(self): """Reads file's content to set B and to B's listWidget""" try: with open(core.b_filename, "r") as f: core.B = set(list(f.read().split(", "))) core.B = core.B - set("") self.listWidget_set_b.clear() self.listWidget_set_b.addItems(list(core.B)) except: pass core.S, core.R = fr_generator.generate(core.A, core.B, core.s_possibility, core.r_possibility)