def __init__(self, app, fcdraw):
        FlatCAMTool.__init__(self, app)

        self.fcdraw = fcdraw

        ## Title
        title_label = QtGui.QLabel("<font size=4><b>%s</b></font>" % self.toolName)
        self.layout.addWidget(title_label)

        ## Form Layout
        form_layout = QtGui.QFormLayout()
        self.layout.addLayout(form_layout)

        ## Buffer distance
        self.buffer_distance_entry = LengthEntry()
        form_layout.addRow("Buffer distance:", self.buffer_distance_entry)

        ## Buttons
        hlay = QtGui.QHBoxLayout()
        self.layout.addLayout(hlay)
        hlay.addStretch()
        self.buffer_button = QtGui.QPushButton("Buffer")
        hlay.addWidget(self.buffer_button)

        self.layout.addStretch()

        ## Signals
        self.buffer_button.clicked.connect(self.on_buffer)
Exemple #2
0
    def __init__(self, app, fcdraw):
        FlatCAMTool.__init__(self, app)

        self.fcdraw = fcdraw

        ## Title
        title_label = QtGui.QLabel("<font size=4><b>%s</b></font>" %
                                   self.toolName)
        self.layout.addWidget(title_label)

        ## Form Layout
        form_layout = QtGui.QFormLayout()
        self.layout.addLayout(form_layout)

        ## Buffer distance
        self.buffer_distance_entry = LengthEntry()
        form_layout.addRow("Buffer distance:", self.buffer_distance_entry)

        ## Buttons
        hlay = QtGui.QHBoxLayout()
        self.layout.addLayout(hlay)
        hlay.addStretch()
        self.buffer_button = QtGui.QPushButton("Buffer")
        hlay.addWidget(self.buffer_button)

        self.layout.addStretch()

        ## Signals
        self.buffer_button.clicked.connect(self.on_buffer)
Exemple #3
0
    def __init__(self, app):
        FlatCAMTool.__init__(self, app)

        # self.setContentsMargins(0, 0, 0, 0)
        self.layout.setMargin(0)
        self.layout.setContentsMargins(0, 0, 3, 0)

        self.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Maximum)

        self.point1 = None
        self.point2 = None
        self.label = QtGui.QLabel("Click on a reference point ...")
        self.label.setFrameStyle(QtGui.QFrame.StyledPanel | QtGui.QFrame.Plain)
        self.label.setMargin(3)
        self.layout.addWidget(self.label)
        # self.layout.setMargin(0)
        self.setVisible(False)

        self.click_subscription = None
        self.move_subscription = None
Exemple #4
0
    def __init__(self, app):
        FlatCAMTool.__init__(self, app)

        self.setContentsMargins(0, 0, 0, 0)
        #self.layout.setMargin(0)
        self.layout.setContentsMargins(0, 0, 3, 0)

        self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Maximum)

        self.point1 = None
        self.point2 = None
        self.label = QLabel("Click on a reference point ...")
        self.label.setFrameStyle(QFrame.StyledPanel | QFrame.Plain)
        self.label.setMargin(3)
        self.layout.addWidget(self.label)
        # self.layout.setMargin(0)
        self.setVisible(False)

        self.click_subscription = None
        self.move_subscription = None
Exemple #5
0
    def __init__(self, app):
        FlatCAMTool.__init__(self, app)

        ## Title
        title_label = QtGui.QLabel("<font size=4><b>%s</b></font>" % self.toolName)
        self.layout.addWidget(title_label)

        ## Form Layout
        form_layout = QtGui.QFormLayout()
        self.layout.addLayout(form_layout)

        ## Layer to mirror
        self.object_combo = QtGui.QComboBox()
        self.object_combo.setModel(self.app.collection)
        self.botlay_label = QtGui.QLabel("Bottom Layer:")
        self.botlay_label.setToolTip(
            "Layer to be mirrorer."
        )
        # form_layout.addRow("Bottom Layer:", self.object_combo)
        form_layout.addRow(self.botlay_label, self.object_combo)

        ## Axis
        self.mirror_axis = RadioSet([{'label': 'X', 'value': 'X'},
                                     {'label': 'Y', 'value': 'Y'}])
        self.mirax_label = QtGui.QLabel("Mirror Axis:")
        self.mirax_label.setToolTip(
            "Mirror vertically (X) or horizontally (Y)."
        )
        # form_layout.addRow("Mirror Axis:", self.mirror_axis)
        form_layout.addRow(self.mirax_label, self.mirror_axis)

        ## Axis Location
        self.axis_location = RadioSet([{'label': 'Point', 'value': 'point'},
                                       {'label': 'Box', 'value': 'box'}])
        self.axloc_label = QtGui.QLabel("Axis Location:")
        self.axloc_label.setToolTip(
            "The axis should pass through a <b>point</b> or cut "
            "a specified <b>box</b> (in a Geometry object) in "
            "the middle."
        )
        # form_layout.addRow("Axis Location:", self.axis_location)
        form_layout.addRow(self.axloc_label, self.axis_location)

        ## Point/Box
        self.point_box_container = QtGui.QVBoxLayout()
        self.pb_label = QtGui.QLabel("Point/Box:")
        self.pb_label.setToolTip(
            "Specify the point (x, y) through which the mirror axis "
            "passes or the Geometry object containing a rectangle "
            "that the mirror axis cuts in half."
        )
        # form_layout.addRow("Point/Box:", self.point_box_container)
        form_layout.addRow(self.pb_label, self.point_box_container)

        self.point = EvalEntry()
        self.point_box_container.addWidget(self.point)
        self.box_combo = QtGui.QComboBox()
        self.box_combo.setModel(self.app.collection)
        self.point_box_container.addWidget(self.box_combo)
        self.box_combo.hide()

        ## Alignment holes
        self.alignment_holes = EvalEntry()
        self.ah_label = QtGui.QLabel("Alignment Holes:")
        self.ah_label.setToolTip(
            "Alignment holes (x1, y1), (x2, y2), ... "
            "on one side of the mirror axis."
        )
        form_layout.addRow(self.ah_label, self.alignment_holes)

        ## Drill diameter for alignment holes
        self.drill_dia = LengthEntry()
        self.dd_label = QtGui.QLabel("Drill diam.:")
        self.dd_label.setToolTip(
            "Diameter of the drill for the "
            "alignment holes."
        )
        form_layout.addRow(self.dd_label, self.drill_dia)

        ## Buttons
        hlay = QtGui.QHBoxLayout()
        self.layout.addLayout(hlay)
        hlay.addStretch()
        self.create_alignment_hole_button = QtGui.QPushButton("Create Alignment Drill")
        self.create_alignment_hole_button.setToolTip(
            "Creates an Excellon Object containing the "
            "specified alignment holes and their mirror "
            "images."
        )
        self.mirror_object_button = QtGui.QPushButton("Mirror Object")
        self.mirror_object_button.setToolTip(
            "Mirrors (flips) the specified object around "
            "the specified axis. Does not create a new "
            "object, but modifies it."
        )
        hlay.addWidget(self.create_alignment_hole_button)
        hlay.addWidget(self.mirror_object_button)

        self.layout.addStretch()

        ## Signals
        self.create_alignment_hole_button.clicked.connect(self.on_create_alignment_holes)
        self.mirror_object_button.clicked.connect(self.on_mirror)

        self.axis_location.group_toggle_fn = self.on_toggle_pointbox

        ## Initialize form
        self.mirror_axis.set_value('X')
        self.axis_location.set_value('point')
Exemple #6
0
    def __init__(self, app):
        FlatCAMTool.__init__(self, app)

        ## Title
        title_label = QtGui.QLabel("<font size=4><b>%s</b></font>" % self.toolName)
        self.layout.addWidget(title_label)

        ## Form Layout
        form_layout = QtGui.QFormLayout()
        self.layout.addLayout(form_layout)

        ## Layer to mirror
        self.object_combo = QtGui.QComboBox()
        self.object_combo.setModel(self.app.collection)
        self.botlay_label = QtGui.QLabel("Bottom Layer:")
        self.botlay_label.setToolTip("Layer to be mirrorer.")
        # form_layout.addRow("Bottom Layer:", self.object_combo)
        form_layout.addRow(self.botlay_label, self.object_combo)

        ## Axis
        self.mirror_axis = RadioSet([{"label": "X", "value": "X"}, {"label": "Y", "value": "Y"}])
        self.mirax_label = QtGui.QLabel("Mirror Axis:")
        self.mirax_label.setToolTip("Mirror vertically (X) or horizontally (Y).")
        # form_layout.addRow("Mirror Axis:", self.mirror_axis)
        form_layout.addRow(self.mirax_label, self.mirror_axis)

        ## Axis Location
        self.axis_location = RadioSet([{"label": "Point", "value": "point"}, {"label": "Box", "value": "box"}])
        self.axloc_label = QtGui.QLabel("Axis Location:")
        self.axloc_label.setToolTip(
            "The axis should pass through a <b>point</b> or cut "
            "a specified <b>box</b> (in a Geometry object) in "
            "the middle."
        )
        # form_layout.addRow("Axis Location:", self.axis_location)
        form_layout.addRow(self.axloc_label, self.axis_location)

        ## Point/Box
        self.point_box_container = QtGui.QVBoxLayout()
        self.pb_label = QtGui.QLabel("Point/Box:")
        self.pb_label.setToolTip(
            "Specify the point (x, y) through which the mirror axis "
            "passes or the Geometry object containing a rectangle "
            "that the mirror axis cuts in half."
        )
        # form_layout.addRow("Point/Box:", self.point_box_container)
        form_layout.addRow(self.pb_label, self.point_box_container)

        self.point = EvalEntry()
        self.point_box_container.addWidget(self.point)
        self.box_combo = QtGui.QComboBox()
        self.box_combo.setModel(self.app.collection)
        self.point_box_container.addWidget(self.box_combo)
        self.box_combo.hide()

        ## Alignment holes
        self.alignment_holes = EvalEntry()
        self.ah_label = QtGui.QLabel("Alignment Holes:")
        self.ah_label.setToolTip("Alignment holes (x1, y1), (x2, y2), ... " "on one side of the mirror axis.")
        form_layout.addRow(self.ah_label, self.alignment_holes)

        ## Drill diameter for alignment holes
        self.drill_dia = LengthEntry()
        self.dd_label = QtGui.QLabel("Drill diam.:")
        self.dd_label.setToolTip("Diameter of the drill for the " "alignment holes.")
        form_layout.addRow(self.dd_label, self.drill_dia)

        ## Buttons
        hlay = QtGui.QHBoxLayout()
        self.layout.addLayout(hlay)
        hlay.addStretch()
        self.create_alignment_hole_button = QtGui.QPushButton("Create Alignment Drill")
        self.create_alignment_hole_button.setToolTip(
            "Creates an Excellon Object containing the " "specified alignment holes and their mirror " "images."
        )
        self.mirror_object_button = QtGui.QPushButton("Mirror Object")
        self.mirror_object_button.setToolTip(
            "Mirrors (flips) the specified object around "
            "the specified axis. Does not create a new "
            "object, but modifies it."
        )
        hlay.addWidget(self.create_alignment_hole_button)
        hlay.addWidget(self.mirror_object_button)

        self.layout.addStretch()

        ## Signals
        self.create_alignment_hole_button.clicked.connect(self.on_create_alignment_holes)
        self.mirror_object_button.clicked.connect(self.on_mirror)

        self.axis_location.group_toggle_fn = self.on_toggle_pointbox

        ## Initialize form
        self.mirror_axis.set_value("X")
        self.axis_location.set_value("point")
Exemple #7
0
 def install(self):
     FlatCAMTool.install(self)
     self.app.ui.right_layout.addWidget(self)
     self.app.plotcanvas.vis_connect('key_press', self.on_key_press)
Exemple #8
0
 def install(self):
     FlatCAMTool.install(self)
     self.app.ui.right_layout.addWidget(self)
     self.app.plotcanvas.vis_connect('key_press', self.on_key_press)
Exemple #9
0
    def __init__(self, app):
        FlatCAMTool.__init__(self, app)

        self.transform_lay = QVBoxLayout()
        self.layout.addLayout(self.transform_lay)
        ## Title
        title_label = QLabel("<font size=4><b>%s</b></font><br>" %
                             self.toolName)
        self.transform_lay.addWidget(title_label)

        self.empty_label = QLabel("")
        self.empty_label.setFixedWidth(80)
        self.empty_label1 = QLabel("")
        self.empty_label1.setFixedWidth(80)
        self.empty_label2 = QLabel("")
        self.empty_label2.setFixedWidth(80)
        self.transform_lay.addWidget(self.empty_label)

        ## Rotate Title
        rotate_title_label = QLabel("<font size=3><b>%s</b></font>" %
                                    self.rotateName)
        self.transform_lay.addWidget(rotate_title_label)

        ## Form Layout
        form_layout = QFormLayout()
        self.transform_lay.addLayout(form_layout)

        self.rotate_entry = FCEntry()
        self.rotate_entry.setFixedWidth(70)
        self.rotate_entry.setAlignment(QtCore.Qt.AlignRight
                                       | QtCore.Qt.AlignVCenter)
        self.rotate_label = QLabel("Angle Rotation:")
        self.rotate_label.setToolTip("Angle for Rotation action, in degrees.\n"
                                     "Float number between -360 and 359.\n"
                                     "Positive numbers for CW motion.\n"
                                     "Negative numbers for CCW motion.")
        self.rotate_label.setFixedWidth(80)

        self.rotate_button = FCButton()
        self.rotate_button.set_value("Rotate")
        self.rotate_button.setToolTip(
            "Rotate the selected object(s).\n"
            "The point of reference is the middle of\n"
            "the bounding box for all selected objects.\n")
        self.rotate_button.setFixedWidth(70)

        form_layout.addRow(self.rotate_label, self.rotate_entry)
        form_layout.addRow(self.empty_label, self.rotate_button)

        self.transform_lay.addWidget(self.empty_label1)

        ## Skew Title
        skew_title_label = QLabel("<font size=3><b>%s</b></font>" %
                                  self.skewName)
        self.transform_lay.addWidget(skew_title_label)

        ## Form Layout
        form1_layout = QFormLayout()
        self.transform_lay.addLayout(form1_layout)

        self.skewx_entry = FCEntry()
        self.skewx_entry.setAlignment(QtCore.Qt.AlignRight
                                      | QtCore.Qt.AlignVCenter)
        self.skewx_entry.setFixedWidth(70)
        self.skewx_label = QLabel("Angle SkewX:")
        self.skewx_label.setToolTip("Angle for Skew action, in degrees.\n"
                                    "Float number between -360 and 359.")
        self.skewx_label.setFixedWidth(80)

        self.skewx_button = FCButton()
        self.skewx_button.set_value("Skew_X")
        self.skewx_button.setToolTip(
            "Skew/shear the selected object(s).\n"
            "The point of reference is the middle of\n"
            "the bounding box for all selected objects.\n")
        self.skewx_button.setFixedWidth(70)

        self.skewy_entry = FCEntry()
        self.skewy_entry.setAlignment(QtCore.Qt.AlignRight
                                      | QtCore.Qt.AlignVCenter)
        self.skewy_entry.setFixedWidth(70)
        self.skewy_label = QLabel("Angle SkewY:")
        self.skewy_label.setToolTip("Angle for Skew action, in degrees.\n"
                                    "Float number between -360 and 359.")
        self.skewy_label.setFixedWidth(80)

        self.skewy_button = FCButton()
        self.skewy_button.set_value("Skew_Y")
        self.skewy_button.setToolTip(
            "Skew/shear the selected object(s).\n"
            "The point of reference is the middle of\n"
            "the bounding box for all selected objects.\n")
        self.skewy_button.setFixedWidth(70)

        form1_layout.addRow(self.skewx_label, self.skewx_entry)
        form1_layout.addRow(self.empty_label, self.skewx_button)
        form1_layout.addRow(self.skewy_label, self.skewy_entry)
        form1_layout.addRow(self.empty_label, self.skewy_button)

        self.transform_lay.addWidget(self.empty_label2)

        ## Flip Title
        flip_title_label = QLabel("<font size=3><b>%s</b></font>" %
                                  self.flipName)
        self.transform_lay.addWidget(flip_title_label)

        ## Form Layout
        form2_layout = QFormLayout()
        self.transform_lay.addLayout(form2_layout)

        self.flipx_button = FCButton()
        self.flipx_button.set_value("Flip_X")
        self.flipx_button.setToolTip(
            "Flip the selected object(s) over the X axis.\n"
            "Does not create a new object.\n ")
        self.flipx_button.setFixedWidth(70)

        self.flipy_button = FCButton()
        self.flipy_button.set_value("Flip_Y")
        self.flipy_button.setToolTip(
            "Flip the selected object(s) over the X axis.\n"
            "Does not create a new object.\n ")
        self.flipy_button.setFixedWidth(70)

        form2_layout.setSpacing(16)
        form2_layout.addRow(self.flipx_button, self.flipy_button)

        self.transform_lay.addStretch()

        ## Signals
        self.rotate_button.clicked.connect(self.on_rotate)
        self.skewx_button.clicked.connect(self.on_skewx)
        self.skewy_button.clicked.connect(self.on_skewy)
        self.flipx_button.clicked.connect(self.on_flipx)
        self.flipy_button.clicked.connect(self.on_flipy)

        self.rotate_entry.returnPressed.connect(self.on_rotate)
        self.skewx_entry.returnPressed.connect(self.on_skewx)
        self.skewy_entry.returnPressed.connect(self.on_skewy)

        ## Initialize form
        self.rotate_entry.set_value('0')
        self.skewx_entry.set_value('0')
        self.skewy_entry.set_value('0')
Exemple #10
0
 def install(self, icon=None, separator=None, **kwargs):
     FlatCAMTool.install(self, icon, separator, **kwargs)
     self.app.ui.right_layout.addWidget(self)
     self.app.plotcanvas.mpl_connect('key_press_event', self.on_key_press)