def _onLoading(self, text, imageSubstitutions, *args, **kwargs): super(SimpleText, self)._onLoading(*args, **kwargs) viewModel = self.getViewModel() viewModel.setText(toString(text)) if imageSubstitutions: substitutionList = viewModel.getImageSubstitutions() for subs in imageSubstitutions: imageSubstitutionVM = ImageSubstitutionViewModel() imageSubstitutionVM.setPath(subs.resourceID) imageSubstitutionVM.setPlaceholder(subs.placeholder) imageSubstitutionVM.setMarginTop(subs.marginTop) imageSubstitutionVM.setMarginRight(subs.marginRight) imageSubstitutionVM.setMarginBottom(subs.marginBottom) imageSubstitutionVM.setMarginLeft(subs.marginLeft) substitutionList.addViewModel(imageSubstitutionVM)
def __updateViewModel(self): with self.viewModel.transaction() as vm: vm.setText(toString(self.__text)) isDiscount = self.__price.isActionPrice() vm.tooltip.setType( TooltipType.BACKPORT if isDiscount else TooltipType.ABSENT) cost = vm.cost currency = self.__price.getCurrency() cost.setType(CurrencyType(currency)) cost.setSize(self.__size) cost.setValue(int(self.__price.price.get(currency))) cost.setIsDiscount(isDiscount) cost.setDiscountValue(self.__price.getActionPrc()) cost.setIsEnough(not bool( self._itemsCache.items.stats.money.getShortage( self.__price.price)))
def updateText(self, text): self.getViewModel().setText(toString(text))
def setDescription(self, text): self.__description = toString(text)
def setTitle(self, text): self.__title = toString(text)
def setDescription(self, text, imageSubstitutions=None): self.__description = toString(text) if imageSubstitutions: self.__descriptionImageSubstitutions = imageSubstitutions
def setTitle(self, text, imageSubstitutions=None): self.__title = toString(text) if imageSubstitutions: self.__titleImageSubstitutions = imageSubstitutions
def _onLoading(self, mainText, warningText, *args, **kwargs): super(TextWithWarning, self)._onLoading(*args, **kwargs) viewModel = self.getViewModel() viewModel.setMainText(toString(mainText)) if warningText: viewModel.setWarningText(toString(warningText))