def invalidate_item(self, t_item: QTreeWidgetItem = None):
     if t_item is None:
         t_item = []
         for i in range(0, self.topLevelItemCount()):
             t_item.append(self.topLevelItem(i))
     elif isinstance(t_item, QTreeWidgetItem):
         t_item = [t_item]
     return self.invalidate_items(t_item)
Exemplo n.º 2
0
    def invalidate_equipment(self, t_item: QTreeWidgetItem = None):
        frmObj = self.ui
        tw = frmObj.table_Equip
        if t_item is None:
            t_item = []
            for i in range(0, tw.topLevelItemCount()):
                t_item.append(tw.topLevelItem(i))
        elif isinstance(t_item, QTreeWidgetItem):
            t_item = [t_item]

        self.model.invalidate_enahce_list()
        for itm in t_item:
            gw = tw.itemWidget(itm, 0)
            gear = gw.gear
            gear.costs_need_update = True
            tw.invalidated_gear.add(gw.gear)
            parent_cost = int(round(gear.base_item_cost))
            str_monies = MONNIES_FORMAT.format(parent_cost)
            with QBlockSig(tw):
                itm.setText(2, str_monies)
                itm.setText(4, '')
                itm.setText(5, '')
                itm.setText(6, '')
                itm.setText(7, '')
                itm.setText(8, '')
                itm.setText(9, '')
                itm.setText(10, '')
                for i in range(0, itm.childCount()):
                    child = itm.child(i)
                    child_gw = tw.itemWidget(child, 0)
                    child_gw.gear.set_base_item_cost(parent_cost)
                    child.setText(2, str_monies)
                    child.setText(4, '')
                    child.setText(5, '')
                    child.setText(6, '')
                    child.setText(7, '')
                    child.setText(8, '')
                    child.setText(9, '')
                    child.setText(10, '')
        self.invalidate_strategy()