Пример #1
0
 def testIndedexContainerItemIds(self):
     ic = IndexedContainer()
     ic.addContainerProperty('prop1', str, None)
     idd = ic.addItem()
     ic.getItem(idd).getItemProperty('prop1').setValue('1')
     item2 = ic.addItem('item2')
     item2.getItemProperty('prop1').setValue('2')
     self.serializeAndDeserialize(ic)
Пример #2
0
    def getResolutionContainer(self):
        resolutionContainer = IndexedContainer()
        resolutionContainer.addContainerProperty(self.resolution_PROPERTY_NAME,
                                                 str, None)

        for i, res in enumerate(self._resolutions):
            added = resolutionContainer.addItem(res)
            added.getItemProperty(self.resolution_PROPERTY_NAME).setValue(
                self._resolutionNames[i])

        return resolutionContainer
Пример #3
0
 def getLocaleContainer(cls):
     localeContainer = IndexedContainer()
     localeContainer.addContainerProperty(cls.locale_PROPERTY_LOCALE, Locale, None)
     localeContainer.addContainerProperty(cls.locale_PROPERTY_NAME, str, None)
     for i in range(len(cls._locales)):
         idd = cls._locales[i][2]
         item = localeContainer.addItem(idd)
         v = Locale(cls._locales[i][0], cls._locales[i][1])
         item.getItemProperty(cls.locale_PROPERTY_LOCALE).setValue(v)
         v = cls._locales[i][2]
         item.getItemProperty(cls.locale_PROPERTY_NAME).setValue(v)
     return localeContainer
Пример #4
0
    def getResolutionContainer(self):
        resolutionContainer = IndexedContainer()
        resolutionContainer.addContainerProperty(
                self.resolution_PROPERTY_NAME, str, None)

        for i, res in enumerate(self._resolutions):
            added = resolutionContainer.addItem(res)
            added.getItemProperty(
                    self.resolution_PROPERTY_NAME).setValue(
                            self._resolutionNames[i])

        return resolutionContainer
Пример #5
0
 def getNameContainer(cls):
     contactContainer = IndexedContainer()
     contactContainer.addContainerProperty(cls.PERSON_PROPERTY_NAME, str, "")
     i = 0
     while i < 50:
         fn = cls._firstnames[int(random() * len(cls._firstnames))]
         ln = cls._lastnames[int(random() * len(cls._lastnames))]
         idd = fn + ln
         item = contactContainer.addItem(idd)
         if item is not None:
             i += 1
             v = fn + " " + ln
             item.getItemProperty(cls.PERSON_PROPERTY_NAME).setValue(v)
     return contactContainer
Пример #6
0
 def getLocaleContainer(cls):
     localeContainer = IndexedContainer()
     localeContainer.addContainerProperty(cls.locale_PROPERTY_LOCALE,
                                          Locale, None)
     localeContainer.addContainerProperty(cls.locale_PROPERTY_NAME, str,
                                          None)
     for i in range(len(cls._locales)):
         idd = cls._locales[i][2]
         item = localeContainer.addItem(idd)
         v = Locale(cls._locales[i][0], cls._locales[i][1])
         item.getItemProperty(cls.locale_PROPERTY_LOCALE).setValue(v)
         v = cls._locales[i][2]
         item.getItemProperty(cls.locale_PROPERTY_NAME).setValue(v)
     return localeContainer
Пример #7
0
 def getNameContainer(cls):
     contactContainer = IndexedContainer()
     contactContainer.addContainerProperty(cls.PERSON_PROPERTY_NAME, str,
                                           '')
     i = 0
     while i < 50:
         fn = cls._firstnames[int(random() * len(cls._firstnames))]
         ln = cls._lastnames[int(random() * len(cls._lastnames))]
         idd = fn + ln
         item = contactContainer.addItem(idd)
         if item is not None:
             i += 1
             v = fn + ' ' + ln
             item.getItemProperty(cls.PERSON_PROPERTY_NAME).setValue(v)
     return contactContainer
Пример #8
0
    def createContainer(cls):
        """Creates a container with three properties "col1,col2,col3"
        with 100 items

        @return: Returns the created table
        """
        container = IndexedContainer()
        container.addContainerProperty('col1', str, '')
        container.addContainerProperty('col2', str, '')
        container.addContainerProperty('col3', str, '')

        for i in range(100):
            item = container.addItem('item %d' % i)
            item.getItemProperty('col1').setValue('first%d' % i)
            item.getItemProperty('col2').setValue('middle%d' % i)
            item.getItemProperty('col3').setValue('last%d' % i)

        return container
Пример #9
0
    def createContainer(cls):
        """Creates a container with three properties "col1,col2,col3"
        with 100 items

        @return: Returns the created table
        """
        container = IndexedContainer()
        container.addContainerProperty('col1', str, '')
        container.addContainerProperty('col2', str, '')
        container.addContainerProperty('col3', str, '')

        for i in range(100):
            item = container.addItem('item %d' % i)
            item.getItemProperty('col1').setValue('first%d' % i)
            item.getItemProperty('col2').setValue('middle%d' % i)
            item.getItemProperty('col3').setValue('last%d' % i)

        return container
Пример #10
0
    def createDummyData(cls):
        fnames = ['Peter', 'Alice', 'Joshua', 'Mike', 'Olivia', 'Nina', 'Alex',
                'Rita', 'Dan', 'Umberto', 'Henrik', 'Rene', 'Lisa', 'Marge']
        lnames = ['Smith', 'Gordon', 'Simpson', 'Brown', 'Clavel', 'Simons',
                'Verne', 'Scott', 'Allison', 'Gates', 'Rowling', 'Barks',
                'Ross', 'Schneider', 'Tate']

        ic = IndexedContainer()

        for p in cls._fields:
            ic.addContainerProperty(p, str, '')

        for _ in range(1000):
            idd = ic.addItem()
            fname = fnames[int( len(fnames) * random() )]
            ic.getContainerProperty(idd, 'First Name').setValue(fname)
            lname = lnames[int( len(lnames) * random() )]
            ic.getContainerProperty(idd, 'Last Name').setValue(lname)

        return ic
Пример #11
0
    def createDummyData(cls):
        fnames = [
            'Peter', 'Alice', 'Joshua', 'Mike', 'Olivia', 'Nina', 'Alex',
            'Rita', 'Dan', 'Umberto', 'Henrik', 'Rene', 'Lisa', 'Marge'
        ]
        lnames = [
            'Smith', 'Gordon', 'Simpson', 'Brown', 'Clavel', 'Simons', 'Verne',
            'Scott', 'Allison', 'Gates', 'Rowling', 'Barks', 'Ross',
            'Schneider', 'Tate'
        ]

        ic = IndexedContainer()

        for p in cls._fields:
            ic.addContainerProperty(p, str, '')

        for _ in range(1000):
            idd = ic.addItem()
            fname = fnames[int(len(fnames) * random())]
            ic.getContainerProperty(idd, 'First Name').setValue(fname)
            lname = lnames[int(len(lnames) * random())]
            ic.getContainerProperty(idd, 'Last Name').setValue(lname)

        return ic
Пример #12
0
    def getOrderContainer(cls):
        container = IndexedContainer()

        # Create the container properties
        container.addContainerProperty(cls.ORDER_DESCRIPTION_PROPERTY_ID, str,
                                       '')
        container.addContainerProperty(cls.ORDER_QUANTITY_PROPERTY_ID, int, 0)
        container.addContainerProperty(cls.ORDER_UNITPRICE_PROPERTY_ID, str,
                                       '$0')
        container.addContainerProperty(cls.ORDER_ITEMPRICE_PROPERTY_ID, str,
                                       '$0')

        # Create some orders
        cls.addOrderToContainer(container, 'Domain Name', 3, 7.99)
        cls.addOrderToContainer(container, 'SSL Certificate', 1, 119.0)
        cls.addOrderToContainer(container, 'Web Hosting', 1, 19.95)
        cls.addOrderToContainer(container, 'Email Box', 20, 0.15)
        cls.addOrderToContainer(container, 'E-Commerce Setup', 1, 25.0)
        cls.addOrderToContainer(container, 'Technical Support', 1, 50.0)

        return container
Пример #13
0
    def getOrderContainer(cls):
        container = IndexedContainer()

        # Create the container properties
        container.addContainerProperty(cls.ORDER_DESCRIPTION_PROPERTY_ID, str, "")
        container.addContainerProperty(cls.ORDER_QUANTITY_PROPERTY_ID, int, 0)
        container.addContainerProperty(cls.ORDER_UNITPRICE_PROPERTY_ID, str, "$0")
        container.addContainerProperty(cls.ORDER_ITEMPRICE_PROPERTY_ID, str, "$0")

        # Create some orders
        cls.addOrderToContainer(container, "Domain Name", 3, 7.99)
        cls.addOrderToContainer(container, "SSL Certificate", 1, 119.0)
        cls.addOrderToContainer(container, "Web Hosting", 1, 19.95)
        cls.addOrderToContainer(container, "Email Box", 20, 0.15)
        cls.addOrderToContainer(container, "E-Commerce Setup", 1, 25.0)
        cls.addOrderToContainer(container, "Technical Support", 1, 50.0)

        return container