def delete_object(self):
     """
     Function handle delete_object_button and delete data from data base.
     """
     self.db.delete_object(self.object_id_entry.get())
     DataMatrixCreator.remove_data_matrix(self.object_id_entry.get())
     self.set_object_listbox()
     self.set_optionmenu()
 def add_object(self):
     """
     Function handle add_object_button and insert data to data base.
     """
     self.db.insert_object(self.object_id_entry.get(), self.object_name_entry.get())
     DataMatrixCreator.create_data_matrix(600, self.object_id_entry.get(), 6)
     self.object_id_entry.delete(0, tk.END)
     self.object_name_entry.delete(0, tk.END)
     self.set_object_listbox()
     self.set_optionmenu()
 def test_create_blank(self):
     color = (205, 205, 205)
     im = DataMatrixCreator.create_blank(600,600,color)
     self.assertTrue(len(im) == 600)
     self.assertTrue(len(im[0]) == 600)
     for x in xrange(im.shape[0]):
         for y in xrange(im.shape[1]):
             self.assertTrue(im[x][y][0]==color[0])
 def test_remove_data_matrix(self):
     DataMatrixCreator.create_data_matrix(600,888,6,"TestMatrix/")
     DataMatrixCreator.remove_data_matrix(888,"TestMatrix/")
     self.assertFalse(os.path.isfile("TestMatrix/888.jpg"))
 def test_create_data_matrix(self):
     DataMatrixCreator.create_data_matrix(600,666,6,"TestMatrix/")
     self.assertTrue(os.path.isfile("TestMatrix/666.jpg"))
     self.assertTrue(filecmp.cmp("TestMatrix/666.jpg","TestMatrix/666_template.jpg"))