Exemplo n.º 1
0
    def press_current_img(self, widget, event):
        x, y = (int(event.x / config.P_W_viewed),
                int(event.y / config.P_W_viewed))

        x_c, y_c = config.get_position(config.current_position)
        if x_c == config.COLUMNS - 1: x_c -= 2
        elif x_c != 0: x_c -= 1

        if y_c == config.LINES - 1: y_c -= 2
        elif y_c != 0: y_c -= 1
        self.clicked_area = (x_c + x) + (y_c + y) * config.COLUMNS

        if event.get_button()[1] == Gdk.BUTTON_SECONDARY:
            self.menu_popup.popup(None, None, None, None, 0,
                                  Gtk.get_current_event_time())
        else:
            if (x, y) == (1, 1):
                self.show_preview(config.keys[config.current_value + 1][0])
            elif (x, y) == (1, 0):
                self.move_up()
            elif (x, y) == (2, 1):
                self.move_right()
            elif (x, y) == (1, 2):
                self.move_down()
            elif (x, y) == (0, 1):
                self.move_left()
            else:
                self.show_preview("None")
Exemplo n.º 2
0
    def change_position_y(self, widget):
        x, y = config.get_position(config.current_position)
        if y != widget.get_value():
            config.current_position = x + int(
                widget.get_value()) * config.COLUMNS

            self.change_position()
Exemplo n.º 3
0
    def change_position_x(self, widget):
        x, y = config.get_position(config.current_position)
        if x != widget.get_value():
            config.current_position = int(
                widget.get_value()) + y * config.COLUMNS

            self.change_position()
Exemplo n.º 4
0
    def image_preview_draw_current_pos(self, draw):
        keys = config.keys
        pp = config.pp
        p_w = config.PIECE_WIDTH
        l, c = config.get_position(config.current_position)
        x1, y1, x2, y2 = l * p_w + pp / 2 - 1, c * p_w - 1, p_w * (
            l + 1) - pp / 2, p_w * (c + 1)

        draw.line([x1, y1, x2, y1], keys[0][1], pp)
        draw.line([x2, y1, x2, y2], keys[0][1], pp)
        draw.line([x2, y2, x1, y2], keys[0][1], pp)
        draw.line([x1, y2, x1, y1], keys[0][1], pp)
Exemplo n.º 5
0
    def change_position(self, *args):
        # supposing that the width > height always
        config.i_adj.set_value(config.current_position)
        x, y = config.get_position(config.current_position)
        config.x_adj.set_value(x)
        config.y_adj.set_value(y)

        config.current_value = 0
        try:
            config.current_value = JSON_mod.data[config.current_position]
        except:
            if (config.tag_piece * config.current_value != 0):
                config.current_value = int(config.tag_piece[
                    config.current_position].childNodes[0].data)

        n = config.current_value - 1
        if n < 0: self.noneButton.set_active(True)
        else: self.radio_buttons[n].set_active(True)

        self.refresh_preview()
Exemplo n.º 6
0
 def refresh_preview(self):
     x, y = config.get_position(config.current_position)
     imageManipulate.refresh_preview_part(x, y)
     self.button_center.set_from_file(paths.tmp_current)