Пример #1
0
    def checkBarcode(self, event):
        import Util.Barcode as Barcode
        bc = self.text_ctrl_barcode.GetValue()
        if not Barcode.validateBarcode(bc):
            wx.MessageDialog(self, "That barcode is wrong!", "Barcode Error", wx.OK | wx.ICON_HAND).ShowModal()
        else:
            if bc[0] == "0" or len(bc) == 12:
                self.choice_country.SetSelection(1)
            else:
                self.choice_country.SetSelection(0)

            res = getAmazonInfoByUPC(bc)
            if res:
                self.amazonStore = res[0]
                self.amazonASIN = res[1]
                self._setInfoLabel(self.button_amazon, "%s (%s)" % (res[1], res[0]))
                self.coverjpg = res[2]
            else:
                self._setInfoLabel(self.button_amazon, "not found")
Пример #2
0
    def checkBarcode(self, event):
        import Util.Barcode as Barcode
        bc = self.text_ctrl_barcode.GetValue()
        if not Barcode.validateBarcode(bc):
            wx.MessageDialog(self, "That barcode is wrong!", "Barcode Error",
                             wx.OK | wx.ICON_HAND).ShowModal()
        else:
            if bc[0] == "0" or len(bc) == 12:
                self.choice_country.SetSelection(1)
            else:
                self.choice_country.SetSelection(0)

            res = getAmazonInfoByUPC(bc)
            if res:
                self.amazonStore = res[0]
                self.amazonASIN = res[1]
                self._setInfoLabel(self.button_amazon,
                                   "%s (%s)" % (res[1], res[0]))
                self.coverjpg = res[2]
            else:
                self._setInfoLabel(self.button_amazon, "not found")
Пример #3
0
 def testNonNumeric(self):
     for bc in ("0000000000X", "Barcode123456"):
         result = Barcode.validateBarcode(bc)
         self.assertFalse(result)
Пример #4
0
 def testTooLong(self):
     for i in range(14, 20):
         bc = "0" * i
         result = Barcode.validateBarcode(bc)
         self.assertFalse(result)
Пример #5
0
 def testTooShort(self):
     for i in range(0, 11):
         bc = "0" * i
         result = Barcode.validateBarcode(bc)
         self.assertFalse(result)
Пример #6
0
 def testKnownValues(self):
     for bc, expectedResult in self.knownValues:
         print bc
         result = Barcode.validateBarcode(bc)
         self.assertEqual(result, expectedResult)
Пример #7
0
 def testNonNumeric(self):
     for bc in ("0000000000X", "Barcode123456"):
         result = Barcode.validateBarcode(bc)
         self.assertFalse(result)        
Пример #8
0
 def testTooLong(self):
     for i in range(14,20):
         bc = "0" * i
         result = Barcode.validateBarcode(bc)
         self.assertFalse(result)
Пример #9
0
 def testTooShort(self):
     for i in range(0,11):
         bc = "0" * i
         result = Barcode.validateBarcode(bc)
         self.assertFalse(result)
Пример #10
0
 def testKnownValues(self):
     for bc, expectedResult in self.knownValues:
         print bc
         result = Barcode.validateBarcode(bc)
         self.assertEqual(result, expectedResult)