Пример #1
0
 def installCustomizationElement(self, idx):
     isContinue = True
     carouselItem = g_customizationController.carousel.items[idx]['object']
     cType = g_customizationController.carousel.currentType
     if carouselItem.isInDossier:
         if g_customizationController.carousel.slots.getInstalledItem(
         ).getNumberOfDaysLeft() > 0 and carouselItem.getIgrType(
         ) != IGR_TYPE.PREMIUM:
             slotItem = g_customizationController.carousel.slots.getSlotItem(
             )
             isContinue = yield DialogsInterface.showDialog(
                 getDialogReplaceElement(slotItem.getName(), cType))
         if carouselItem.numberOfDays is not None and not carouselItem.isReplacedByIGRItem:
             isContinue = yield DialogsInterface.showDialog(
                 self.__getInvoiceItemDialogMeta(
                     'temporary', cType, carouselItem, {
                         'willBeDeleted':
                         text_styles.error(
                             _ms('#dialogs:customization/install_invoice_item/will_be_deleted'
                                 ))
                     }))
         elif carouselItem.numberOfItems is not None:
             if carouselItem.numberOfItems > 1:
                 isContinue = yield DialogsInterface.showDialog(
                     self.__getInvoiceItemDialogMeta(
                         'permanent', cType, carouselItem,
                         {'numberLeft': carouselItem.numberOfItems - 1}))
             else:
                 isContinue = yield DialogsInterface.showDialog(
                     self.__getInvoiceItemDialogMeta(
                         'permanent_last', cType, carouselItem, {}))
     if isContinue:
         g_customizationController.carousel.applyItem(idx)
     return
Пример #2
0
 def installCustomizationElement(self, idx):
     isContinue = True
     carouselItem = g_customizationController.carousel.items[idx]['object']
     cType = g_customizationController.carousel.currentType
     if carouselItem.isInDossier:
         if g_customizationController.carousel.slots.getInstalledItem().getNumberOfDaysLeft() > 0 and carouselItem.getIgrType() != IGR_TYPE.PREMIUM:
             slotItem = g_customizationController.carousel.slots.getSlotItem()
             isContinue = yield DialogsInterface.showDialog(getDialogReplaceElement(slotItem.getName(), cType))
         if carouselItem.numberOfDays is not None and not carouselItem.isReplacedByIGRItem:
             isContinue = yield DialogsInterface.showDialog(self.__getInvoiceItemDialogMeta('temporary', cType, carouselItem, {'willBeDeleted': text_styles.error(_ms('#dialogs:customization/install_invoice_item/will_be_deleted'))}))
         elif carouselItem.numberOfItems is not None:
             if carouselItem.numberOfItems > 1:
                 isContinue = yield DialogsInterface.showDialog(self.__getInvoiceItemDialogMeta('permanent', cType, carouselItem, {'numberLeft': carouselItem.numberOfItems - 1}))
             else:
                 isContinue = yield DialogsInterface.showDialog(self.__getInvoiceItemDialogMeta('permanent_last', cType, carouselItem, {}))
     if isContinue:
         g_customizationController.carousel.applyItem(idx)
     return
Пример #3
0
    def buy(self):
        isContinue = True
        replaceElementsName = []
        for item in self.__searchDP.collection:
            cType = item['cType']
            if item['selected']:
                installedItem = g_customizationController.carousel.slots.getInstalledItem(item['slotIdx'], cType)
                if installedItem.duration > 0:
                    availableItem = g_customizationController.carousel.slots.getItemById(cType, installedItem.getID())
                    replaceElementsName.append(availableItem.getName())

        replaceElementsCount = len(replaceElementsName)
        if replaceElementsCount > 0:
            if replaceElementsCount == 1:
                isContinue = yield DialogsInterface.showDialog(getDialogReplaceElement(replaceElementsName[0]))
            else:
                isContinue = yield DialogsInterface.showDialog(getDialogReplaceElements(replaceElementsName))
        if isContinue:
            g_customizationController.carousel.slots.cart.buyItems(copy.deepcopy(self.__searchDP.collection))