Esempio n. 1
0
    def __init__(self, parent=None):
        """
        Creates the user interface for CNCJob objects. GUI elements should
        be placed in ``self.custom_box`` to preserve the layout.
        """

        ObjectUI.__init__(self,
                          title='CNC Job Object',
                          icon_file='share/cnc32.png',
                          parent=parent)

        # Scale and offset are not available for CNCJob objects.
        # Hiding from the GUI.
        for i in range(0, self.scale_grid.count()):
            self.scale_grid.itemAt(i).widget().hide()
        self.scale_label.hide()
        self.scale_button.hide()

        for i in range(0, self.offset_grid.count()):
            self.offset_grid.itemAt(i).widget().hide()
        self.offset_label.hide()
        self.offset_button.hide()
        self.auto_offset_button.hide()

        self.mirror_label.hide()
        for i in range(0, self.mirror_axis_grid.count()):
            self.mirror_axis_grid.itemAt(i).widget().hide()
        self.mirror_auto_center_cb.hide()
        self.mirror_button.hide()

        ## Plot options
        self.plot_options_label = QtWidgets.QLabel("<b>Plot Options:</b>")
        self.custom_box.addWidget(self.plot_options_label)

        grid0 = QtWidgets.QGridLayout()
        self.custom_box.addLayout(grid0)

        # Plot CB
        # self.plot_cb = QtWidgets.QCheckBox('Plot')
        self.plot_cb = FCCheckBox('Plot')
        self.plot_cb.setToolTip("Plot (show) this object.")
        grid0.addWidget(self.plot_cb, 0, 0)

        # Tool dia for plot
        tdlabel = QtWidgets.QLabel('Tool dia:')
        tdlabel.setToolTip("Diameter of the tool to be\n"
                           "rendered in the plot.")
        grid0.addWidget(tdlabel, 1, 0)
        self.tooldia_entry = LengthEntry()
        grid0.addWidget(self.tooldia_entry, 1, 1)

        # Update plot button
        self.updateplot_button = QtWidgets.QPushButton('Update Plot')
        self.updateplot_button.setToolTip("Update the plot.")
        self.custom_box.addWidget(self.updateplot_button)

        ##################
        ## Export G-Code
        ##################
        self.export_gcode_label = QtWidgets.QLabel("<b>Export G-Code:</b>")
        self.export_gcode_label.setToolTip("Export and save G-Code to\n"
                                           "make this object to a file.")
        self.custom_box.addWidget(self.export_gcode_label)

        # Prepend text to Gerber
        prependlabel = QtWidgets.QLabel('Prepend to G-Code:')
        prependlabel.setToolTip(
            "Type here any G-Code commands you would\n"
            "like to add to the beginning of the generated file.")
        self.custom_box.addWidget(prependlabel)

        self.prepend_text = FCTextArea()
        self.custom_box.addWidget(self.prepend_text)

        # Append text to Gerber
        appendlabel = QtWidgets.QLabel('Append to G-Code:')
        appendlabel.setToolTip("Type here any G-Code commands you would\n"
                               "like to append to the generated file.\n"
                               "I.e.: M2 (End of program)")
        self.custom_box.addWidget(appendlabel)

        self.append_text = FCTextArea()
        self.custom_box.addWidget(self.append_text)

        processorlabel = QtWidgets.QLabel('Postprocessing-Script:')
        processorlabel.setToolTip("Enter a Postprocessing Script here.\n"
                                  "It gets applied to the G-Code after it\n"
                                  "is generated.")
        self.custom_box.addWidget(processorlabel)
        self.process_script = FCTextArea()
        self.custom_box.addWidget(self.process_script)

        # Dwell
        grid1 = QtWidgets.QGridLayout()
        self.custom_box.addLayout(grid1)

        dwelllabel = QtWidgets.QLabel('Dwell:')
        dwelllabel.setToolTip("Pause to allow the spindle to reach its\n"
                              "speed before cutting.")
        dwelltime = QtWidgets.QLabel('Duration [sec.]:')
        dwelltime.setToolTip("Number of second to dwell.")
        self.dwell_cb = FCCheckBox()
        self.dwelltime_entry = FCEntry()
        grid1.addWidget(dwelllabel, 0, 0)
        grid1.addWidget(self.dwell_cb, 0, 1)
        grid1.addWidget(dwelltime, 1, 0)
        grid1.addWidget(self.dwelltime_entry, 1, 1)

        # GO Button
        self.export_gcode_button = QtWidgets.QPushButton('Export G-Code')
        self.export_gcode_button.setToolTip("Opens dialog to save G-Code\n"
                                            "file.")
        self.custom_box.addWidget(self.export_gcode_button)
Esempio n. 2
0
    def __init__(self, parent=None):
        """
        Creates the user interface for CNCJob objects. GUI elements should
        be placed in ``self.custom_box`` to preserve the layout.
        """

        ObjectUI.__init__(self,
                          title='CNC Job Object',
                          icon_file='share/cnc32.png',
                          parent=parent)

        # Scale and offset are not available for CNCJob objects.
        # Hiding from the GUI.
        for i in range(0, self.scale_grid.count()):
            self.scale_grid.itemAt(i).widget().hide()
        self.scale_label.hide()
        self.scale_button.hide()

        for i in range(0, self.offset_grid.count()):
            self.offset_grid.itemAt(i).widget().hide()
        self.offset_label.hide()
        self.offset_button.hide()

        ## Plot options
        self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>")
        self.custom_box.addWidget(self.plot_options_label)

        grid0 = QtGui.QGridLayout()
        self.custom_box.addLayout(grid0)

        # Plot CB
        # self.plot_cb = QtGui.QCheckBox('Plot')
        self.plot_cb = FCCheckBox('Plot')
        self.plot_cb.setToolTip("Plot (show) this object.")
        grid0.addWidget(self.plot_cb, 0, 0)

        # Tool dia for plot
        tdlabel = QtGui.QLabel('Tool dia:')
        tdlabel.setToolTip("Diameter of the tool to be\n"
                           "rendered in the plot.")
        grid0.addWidget(tdlabel, 1, 0)
        self.tooldia_entry = LengthEntry()
        grid0.addWidget(self.tooldia_entry, 1, 1)

        # Update plot button
        self.updateplot_button = QtGui.QPushButton('Update Plot')
        self.updateplot_button.setToolTip("Update the plot.")
        self.custom_box.addWidget(self.updateplot_button)

        ## Export G-Code
        self.export_gcode_label = QtGui.QLabel("<b>Export G-Code:</b>")
        self.export_gcode_label.setToolTip("Export and save G-Code to\n"
                                           "make this object to a file.")
        self.custom_box.addWidget(self.export_gcode_label)

        # Prepend text to Gerber
        prependlabel = QtGui.QLabel('Prepend to G-Code:')
        prependlabel.setToolTip(
            "Type here any G-Code commands you would\n"
            "like to add to the beginning of the generated file.")
        self.custom_box.addWidget(prependlabel)

        self.prepend_text = FCTextArea()
        self.custom_box.addWidget(self.prepend_text)

        # Append text to Gerber
        appendlabel = QtGui.QLabel('Append to G-Code:')
        appendlabel.setToolTip("Type here any G-Code commands you would\n"
                               "like to append to the generated file.\n"
                               "I.e.: M2 (End of program)")
        self.custom_box.addWidget(appendlabel)

        self.append_text = FCTextArea()
        self.custom_box.addWidget(self.append_text)

        # GO Button
        self.export_gcode_button = QtGui.QPushButton('Export G-Code')
        self.export_gcode_button.setToolTip("Opens dialog to save G-Code\n"
                                            "file.")
        self.custom_box.addWidget(self.export_gcode_button)