def get_equip(self, name): equip = getattr(self.ui, name) main_cell = equip.item(0, 0) glamor_cell = equip.item(0, 1) if main_cell == None or type(main_cell) is QTableWidgetItem: main = save_file.empty_slot() else: main = (main_cell.name, main_cell.item_count, main_cell.variant) if glamor_cell == None or type(glamor_cell) is QTableWidgetItem: glamor = save_file.empty_slot() else: glamor = (glamor_cell.name, glamor_cell.item_count, glamor_cell.variant) return main, glamor
def get_equip(self, name): """Return the raw values of both slots in a given equipment bag.""" equip = getattr(self.ui, name) main_cell = equip.item(0, 0) glamor_cell = equip.item(0, 1) # when you drag itemwidgets around the cell will become empty so just # pretend it had an empty slot value if main_cell == None or type(main_cell) is QTableWidgetItem: main = save_file.empty_slot() else: main = (main_cell.name, main_cell.item_count, main_cell.variant) if glamor_cell == None or type(glamor_cell) is QTableWidgetItem: glamor = save_file.empty_slot() else: glamor = (glamor_cell.name, glamor_cell.item_count, glamor_cell.variant) return main, glamor
def empty_slot(): """Return an empty bag slot widget.""" return ItemWidget(save_file.empty_slot())