Exemple #1
0
 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)
Exemple #2
0
 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)))
Exemple #3
0
 def updateText(self, text):
     self.getViewModel().setText(toString(text))
Exemple #4
0
 def setDescription(self, text):
     self.__description = toString(text)
Exemple #5
0
 def setTitle(self, text):
     self.__title = toString(text)
Exemple #6
0
 def setDescription(self, text, imageSubstitutions=None):
     self.__description = toString(text)
     if imageSubstitutions:
         self.__descriptionImageSubstitutions = imageSubstitutions
Exemple #7
0
 def setTitle(self, text, imageSubstitutions=None):
     self.__title = toString(text)
     if imageSubstitutions:
         self.__titleImageSubstitutions = imageSubstitutions
Exemple #8
0
 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))