Exemplo n.º 1
0
    def put_selected_color(self, widget, matrix_id, image_object, row, col):
        if row < 0 or row > 4 or col < 0 or col > 3:
            return

        selected_color = utilities.get_operation_name(self.matrix_info[matrix_id]["selected_color"])
        selected_counter = self.color_counter[selected_color]

        current_color = self.matrix_info[matrix_id]["matrix"][row][col]
        current_counter = self.color_counter[current_color]

        if current_color == selected_color:
            self.matrix_info[matrix_id][current_counter] -= 1
            self.matrix_info[matrix_id]["matrix"][row][col] = "*"
            image_object.clear()

        elif self.matrix_info[matrix_id][selected_counter] < self.color_amount[selected_color]:
            if selected_color == '-' and row != 0:
                return

            if current_color != '*':
                self.matrix_info[matrix_id][current_counter] -= 1

            image_object.set_from_file(utilities.get_matrix_image_name(selected_color))
            self.matrix_info[matrix_id][selected_counter] += 1
            self.matrix_info[matrix_id]["matrix"][row][col] = selected_color
Exemplo n.º 2
0
    def put_selected_color(self, widget, matrix_id, image_object, row, col):
        if row < 0 or row > 4 or col < 0 or col > 3:
            return

        selected_color = utilities.get_operation_name(
            self.matrix_info[matrix_id]["selected_color"])
        selected_counter = self.color_counter[selected_color]

        current_color = self.matrix_info[matrix_id]["matrix"][row][col]
        current_counter = self.color_counter[current_color]

        if current_color == selected_color:
            self.matrix_info[matrix_id][current_counter] -= 1
            self.matrix_info[matrix_id]["matrix"][row][col] = "*"
            image_object.clear()

        elif self.matrix_info[matrix_id][selected_counter] < self.color_amount[
                selected_color]:
            if selected_color == '-' and row != 0:
                return

            if current_color != '*':
                self.matrix_info[matrix_id][current_counter] -= 1

            image_object.set_from_file(
                utilities.get_matrix_image_name(selected_color))
            self.matrix_info[matrix_id][selected_counter] += 1
            self.matrix_info[matrix_id]["matrix"][row][col] = selected_color
Exemplo n.º 3
0
 def change_selected_color(self, widget, matrix_id, color_id):
     self.matrix_info[matrix_id][
         "selected_color"] = utilities.get_matrix_image_name(color_id)
     if (matrix_id == 1):
         self.cw_matrix_1_selected_color.set_from_file(
             self.matrix_info[matrix_id]["selected_color"])
     else:
         self.cw_matrix_2_selected_color.set_from_file(
             self.matrix_info[matrix_id]["selected_color"])
Exemplo n.º 4
0
 def load_configuration_matrix(self, matrix, matrix_id):
     i = 0
     j = 0
     array = self.cw_toy_images_1
     if(matrix_id == 2):
         array = self.cw_toy_images_2
     for i in range(0, 5):
         for j in range(0, 4):
             self.matrix_info[matrix_id][self.color_counter[matrix[i][j]]] += 1
             image = utilities.get_matrix_image_name(matrix[i][j])
             gtk_object = array[i][j]
             gtk_object.set_from_file(image)
Exemplo n.º 5
0
 def load_configuration_matrix(self, matrix, matrix_id):
     i = 0
     j = 0
     array = self.cw_toy_images_1
     if (matrix_id == 2):
         array = self.cw_toy_images_2
     for i in range(0, 5):
         for j in range(0, 4):
             self.matrix_info[matrix_id][self.color_counter[matrix[i]
                                                            [j]]] += 1
             image = utilities.get_matrix_image_name(matrix[i][j])
             gtk_object = array[i][j]
             gtk_object.set_from_file(image)
Exemplo n.º 6
0
 def change_selected_color(self, widget, matrix_id, color_id):
     self.matrix_info[matrix_id]["selected_color"] = utilities.get_matrix_image_name(color_id)
     if (matrix_id == 1):
         self.cw_matrix_1_selected_color.set_from_file(self.matrix_info[matrix_id]["selected_color"])
     else:
         self.cw_matrix_2_selected_color.set_from_file(self.matrix_info[matrix_id]["selected_color"])