Exemplo n.º 1
0
    def __init__(self, scene):
        Widget.__init__(self, scene, all=True)
        # Respond to Snap is not necessary, but for the sake of completeness...

        self.attraction_points = None  # Clear all
        self.my_x = None
        self.my_y = None
        self.visible_pen = wx.Pen()
        self.visible_pen.SetWidth(1)
        self.closeup_pen = wx.Pen()
        self.closeup_pen.SetWidth(1)
        self.load_colors()
        self.symbol_size = 1  # Will be replaced anyway
        self.display_points = []
        self.show_attract_len = 0
        self.action_attract_len = 0
        self.isShiftPressed = False
        self.isCtrlPressed = False
        self.isAltPressed = False
        self.show_snap_points = False
        self.scene.context.setting(bool, "snap_grid", True)
        self.scene.context.setting(bool, "snap_points", True)
        self.scene.context.setting(int, "show_attract_len", 45)
        self.scene.context.setting(int, "action_attract_len", 20)
        self.scene.context.setting(int, "grid_attract_len", 15)

        self.snap_grid = self.scene.context.snap_grid
        self.snap_points = self.scene.context.snap_points
Exemplo n.º 2
0
 def __init__(self, scene, name=None):
     Widget.__init__(self, scene, all=True)
     if name is None:
         self.name = "Standard"
     else:
         self.name = name
     self.background = None
Exemplo n.º 3
0
 def __init__(self, scene):
     Widget.__init__(self, scene, all=True)
     # Color for selection rectangle (hit, cross, enclose)
     self.selection_style = [
         [
             self.scene.colors.color_selection1,
             wx.PENSTYLE_DOT_DASH,
             "Select all elements the selection rectangle touches.",
         ],
         [
             self.scene.colors.color_selection2,
             wx.PENSTYLE_DOT,
             "Select all elements the selection rectangle crosses.",
         ],
         [
             self.scene.colors.color_selection3,
             wx.PENSTYLE_SHORT_DASH,
             "Select all elements the selection rectangle encloses.",
         ],
     ]
     self.selection_pen = wx.Pen()
     self.selection_pen.SetColour(self.selection_style[0][0])
     self.selection_pen.SetWidth(25)
     self.selection_pen.SetStyle(self.selection_style[0][1])
     # want to have sharp edges
     self.selection_pen.SetJoin(wx.JOIN_MITER)
     self.start_location = None
     self.end_location = None
Exemplo n.º 4
0
    def __init__(
        self,
        scene,
        x,
        y,
        size=1,
        text=None,
        tool_tip=None,
        checked=None,
    ):
        size = size * scene.cell() / 2
        Widget.__init__(
            self,
            scene,
            x - size,
            y - size,
            x + size,
            y + size,
        )
        self.text = text
        self.checked = checked
        self.tool_tip = tool_tip
        self.value = False

        self.checkline_pen = wx.Pen()
        self.checkline_pen.SetColour(wx.CYAN)
        self.checkline_pen.SetWidth(4)

        self.font_color = wx.Colour()
        self.font_color.SetRGBA(0xFF000000)
        self.font = wx.Font(wx.SWISS_FONT)
        self.text_height = float("inf")
        self.text_width = float("inf")

        self._text_gap = 0.2
Exemplo n.º 5
0
    def __init__(
        self,
        scene,
        start_x,
        start_y,
        end_x,
        end_y,
        value_min,
        value_max,
        changed,
        clicked=None,
    ):
        size = scene.cell() / 2
        Widget.__init__(
            self,
            scene,
            min(start_x, end_x) - size,
            min(start_y, end_y) - size,
            max(start_x, end_x) + size,
            max(start_y, end_y) + size,
        )
        self.start_x = start_x
        self.start_y = start_y
        self.end_x = end_x
        self.end_y = end_y
        self.changed = changed
        self.clicked = clicked

        self.values = []
        self.moving = False
        self.value_min = value_min
        self.value_max = value_max
        self.offset = self.value_min
        self.range = self.value_max - self.value_min
        self.seeker = -1
        self.text = None

        self.selected_pen = wx.Pen()
        self.selected_pen.SetColour(wx.CYAN)
        self.selected_pen.SetWidth(4)

        self.selected_brush = wx.Brush()
        self.selected_brush.SetColour(wx.CYAN)

        self.lacking_pen = wx.Pen()
        self.lacking_pen.SetWidth(2)
        self.lacking_pen.SetColour(wx.BLACK)  # medium gray

        self.lacking_brush = wx.Brush()
        self.lacking_brush.SetColour(wx.Colour().SetRGBA(0x88888888))

        self.value_brush = wx.Brush()
        self.value_brush.SetColour(wx.LIGHT_GREY)

        self.moving_brush = wx.Brush()
        self.moving_brush.SetColour(wx.BLUE)

        self.background_brush = wx.Brush()
        self.background_brush.SetColour(wx.WHITE)
Exemplo n.º 6
0
 def __init__(self, scene, left, top, right, bottom, bitmap, buttons):
     Widget.__init__(self, scene, left, top, right, bottom)
     self.buttons = buttons
     self.bitmap = bitmap
     self._opened = False
     flag = self.scene.context.menu_autohide
     self.autohide = flag
     self.scene.request_refresh()
Exemplo n.º 7
0
 def __init__(self, scene, camera, index, mid=False):
     self.cam = camera
     self.mid = mid
     self.index = index
     half = CORNER_SIZE / 2.0
     Widget.__init__(self, scene, -half, -half, half, half)
     self.update()
     c = Color.distinct(self.index + 2)
     self.pen = wx.Pen(wx.Colour(c.red, c.green, c.blue))
Exemplo n.º 8
0
 def __init__(self, scene: Scene):
     Widget.__init__(self, scene, all=True)
     self.brush = CircleBrush()
     self.pen = wx.Pen()
     self.pen.SetColour(wx.BLUE)
     self.pen.SetWidth(1000)
     # Set proper default values for cap and join
     # as MKs defaults differ from wxPythons...
     self.pen.SetCap(wx.CAP_BUTT)
     self.pen.SetJoin(wx.JOIN_MITER)
Exemplo n.º 9
0
 def translate_self(self, dx, dy):
     """
     Dx and Dy for the translation provided by the relocation widget fails to move the x and y value since they
     are not from the base widget. This hook catches the self translation routine and also changes x and y position
     @param dx:
     @param dy:
     @return:
     """
     Widget.translate_self(self, dx, dy)
     self.x += dx
     self.y += dy
Exemplo n.º 10
0
 def __init__(self, scene, cyclowidget):
     self.size = 20000
     Widget.__init__(self, scene, 0, 0, self.size, self.size)
     self.pen = wx.Pen()
     self.pen.SetColour(wx.BLUE)
     self.pen.SetWidth(1000)
     self.widget = cyclowidget
     self.bitmap = icons.icons8_point_50.GetBitmap()
     self._start_x = None
     self._start_y = None
     self._current_x = None
     self._current_y = None
     self._start_value = None
Exemplo n.º 11
0
    def __init__(self, scene, name=None):
        Widget.__init__(self, scene, all=True)
        if name is None:
            self.name = "Standard"
        else:
            self.name = name
        self.grid = None
        self.grid2 = None
        self.background = None
        self.grid_line_pen = wx.Pen()
        self.grid_line_pen2 = wx.Pen()
        self.grid_line_pen3 = wx.Pen()
        self.last_ticksize = 0
        self.last_w = 0
        self.last_h = 0
        self.last_min_x = float("inf")
        self.last_min_y = float("inf")
        self.last_max_x = -float("inf")
        self.last_max_y = -float("inf")

        self.draw_grid = True
        self.sx = 0
        self.sy = 0
        self.sx2 = 0
        self.sy2 = 0
        self.cx = 0
        self.cy = 0
        # Min and max coords of the screen estate
        self.min_x = 0
        self.min_y = 0
        self.max_x = 0
        self.max_y = 0
        self.tlenx1 = 0
        self.tleny1 = 0
        self.tlenx2 = 0
        self.tleny2 = 0
        self.sxx1 = 0
        self.syy1 = 0
        self.sxx2 = 0
        self.syy2 = 0
        # Circular Grid
        self.min_radius = float("inf")
        self.max_radius = -float("inf")
        self.min_angle = 0
        self.max_angle = tau
        self.osv = -1
        self.sector = 0

        self.set_colors()
Exemplo n.º 12
0
    def __init__(self, scene):
        Widget.__init__(self, scene, all=True)
        self._view = None
        self._frame = None
        self.aspect = False

        self.interface_widget = Widget(scene)
        self.scene_widget = Widget(scene)
        self.add_widget(-1, self.interface_widget)
        self.add_widget(-1, self.scene_widget)
        self.last_position = None
        self._previous_zoom = None
        self._placement_event = None
        self._placement_event_type = None
        self.osv = -1
Exemplo n.º 13
0
 def __init__(self, scene):
     Widget.__init__(self, scene, all=False)
     self.scene.context.setting(bool, "show_negative_guide", True)
     self.edge_gap = 5
     self.line_length = 20
     self.calc_area(True, 0, 0)
     self.scaled_conversion_x = 0
     self.scaled_conversion_y = 0
     self.units = None
     self.options = []
     self.pen_guide1 = wx.Pen()
     self.pen_guide2 = wx.Pen()
     self.pen_magnets = wx.Pen()
     self.color_guide1 = None
     self.color_guide2 = None
     self.set_colors()
Exemplo n.º 14
0
    def __init__(self, scene):
        Widget.__init__(self, scene, all=True)
        self.pen = wx.Pen()
        self.pen.SetColour(wx.BLUE)
        self.pen.SetWidth(1000)

        self.series = []
        self.degree_step = 1
        self.rotations = 20
        self.r_minor = None
        self.r_major = None
        self.offset = None
        bed_width, bed_height = scene.context.device.physical_to_scene_position(
            "100%", "100%"
        )
        self.x, self.y = bed_width / 2, bed_height / 2
        size = 100000

        self.add_widget(
            -1,
            ButtonWidget(
                scene, 0, 0, size, size, icons.icon_corner1.GetBitmap(), self.confirm
            ),
        )
        self.add_widget(
            -1,
            ButtonWidget(
                scene,
                bed_width - size,
                0,
                bed_width,
                size,
                icons.icon_corner2.GetBitmap(),
                self.confirm,
            ),
        )
        self.add_widget(
            -1,
            ButtonWidget(
                scene,
                bed_width - size,
                bed_height - size,
                bed_width,
                bed_height,
                icons.icon_corner3.GetBitmap(),
                self.confirm,
            ),
        )
        self.add_widget(
            -1,
            ButtonWidget(
                scene,
                0,
                bed_height - size,
                size,
                bed_height,
                icons.icon_corner4.GetBitmap(),
                self.confirm,
            ),
        )
        self.add_widget(-1, RelocateWidget(scene, self.x, self.y))
        self.add_widget(-1, MajorHandleWidget(scene, self))
        self.add_widget(-1, MinorHandleWidget(scene, self))
        self.random_shape()
        self.update_shape()
Exemplo n.º 15
0
 def __init__(self, scene):
     Widget.__init__(self, scene, all=False)
     self.reticles = {}
     self.pen = wx.Pen()
Exemplo n.º 16
0
 def __init__(self, scene, x, y):
     size = 10000
     Widget.__init__(self, scene, x - size, y - size, x + size, y + size)
     self.bitmap = icons.icons8_center_of_gravity_50.GetBitmap()
Exemplo n.º 17
0
 def __init__(self, scene, camera):
     Widget.__init__(self, scene, all=False)
     self.cam = camera
Exemplo n.º 18
0
 def __init__(self, scene, renderer):
     Widget.__init__(self, scene, all=True)
     self.renderer = renderer
     self.key_shift_pressed = False
     self.key_ctrl_pressed = False
Exemplo n.º 19
0
 def __init__(self, scene, left, top, right, bottom, bitmap, clicked):
     Widget.__init__(self, scene, left, top, right, bottom)
     self.bitmap = bitmap
     self.background_brush = None
     self.enabled = True
     self.clicked = clicked
Exemplo n.º 20
0
 def __init__(self, scene):
     Widget.__init__(self, scene, all=False)