Esempio n. 1
0
    def buy(self):
        isContinue = True
        isShowReplaceDialog = False
        replaceElements = [[], [], []]
        selectedItems = []
        for item in self.__searchDP.collection:
            if item['titleMode']:
                continue
            if item['selected']:
                installedItem = g_customizationController.carousel.slots.getInstalledItem(
                    item['slotIdx'], item['cType'])
                if installedItem.duration > 0:
                    isShowReplaceDialog = True
                    availableItem = g_customizationController.carousel.slots.getItemById(
                        item['cType'], installedItem.getID())
                    replaceElements[item['cType']].append(
                        text_styles.main(availableItem.getName()))
                if item['isDuplicatePrice']:
                    item['price'] = 0
            selectedItems.append(item)

        if isShowReplaceDialog:
            isContinue = yield DialogsInterface.showDialog(
                getDialogReplaceElements(replaceElements))
        if isContinue:
            g_customizationController.carousel.slots.cart.buyItems(
                copy.deepcopy(selectedItems))
Esempio n. 2
0
    def buy(self):
        isContinue = True
        isShowReplaceDialog = False
        replaceElements = [[], [], []]
        for item in self.__searchDP.collection:
            if item['selected']:
                installedItem = g_customizationController.carousel.slots.getInstalledItem(item['slotIdx'], item['cType'])
                if installedItem.duration > 0:
                    isShowReplaceDialog = True
                    availableItem = g_customizationController.carousel.slots.getItemById(item['cType'], installedItem.getID())
                    replaceElements[item['cType']].append(text_styles.main(availableItem.getName()))

        if isShowReplaceDialog:
            isContinue = yield DialogsInterface.showDialog(getDialogReplaceElements(replaceElements))
        if isContinue:
            g_customizationController.carousel.slots.cart.buyItems(copy.deepcopy(self.__searchDP.collection))
Esempio n. 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))