Hid offset and scale tools from CNCJob GUI. Such features are not implemented for CNCJob objects.

This commit is contained in:
Juan Pablo Caram
2015-01-19 11:53:28 -05:00
parent 670dd48127
commit d002b6c5c6
2 changed files with 37 additions and 13 deletions

View File

@@ -770,9 +770,12 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
def __init__(self, name, units="in", kind="generic", z_move=0.1, def __init__(self, name, units="in", kind="generic", z_move=0.1,
feedrate=3.0, z_cut=-0.002, tooldia=0.0): feedrate=3.0, z_cut=-0.002, tooldia=0.0):
FlatCAMApp.App.log.debug("Creating CNCJob object...") FlatCAMApp.App.log.debug("Creating CNCJob object...")
CNCjob.__init__(self, units=units, kind=kind, z_move=z_move, CNCjob.__init__(self, units=units, kind=kind, z_move=z_move,
feedrate=feedrate, z_cut=z_cut, tooldia=tooldia) feedrate=feedrate, z_cut=z_cut, tooldia=tooldia)
FlatCAMObj.__init__(self, name) FlatCAMObj.__init__(self, name)
self.kind = "cncjob" self.kind = "cncjob"

View File

@@ -39,19 +39,23 @@ class ObjectUI(QtGui.QWidget):
self.name_box.addWidget(self.name_entry) self.name_box.addWidget(self.name_entry)
## Box box for custom widgets ## Box box for custom widgets
# This gets populated in offspring implementations.
self.custom_box = QtGui.QVBoxLayout() self.custom_box = QtGui.QVBoxLayout()
layout.addLayout(self.custom_box) layout.addLayout(self.custom_box)
## Common to all objects ###########################
## Scale ## Common to all objects ##
###########################
#### Scale ####
self.scale_label = QtGui.QLabel('<b>Scale:</b>') self.scale_label = QtGui.QLabel('<b>Scale:</b>')
self.scale_label.setToolTip( self.scale_label.setToolTip(
"Change the size of the object." "Change the size of the object."
) )
layout.addWidget(self.scale_label) layout.addWidget(self.scale_label)
grid1 = QtGui.QGridLayout() self.scale_grid = QtGui.QGridLayout()
layout.addLayout(grid1) layout.addLayout(self.scale_grid)
# Factor # Factor
faclabel = QtGui.QLabel('Factor:') faclabel = QtGui.QLabel('Factor:')
@@ -59,10 +63,10 @@ class ObjectUI(QtGui.QWidget):
"Factor by which to multiply\n" "Factor by which to multiply\n"
"geometric features of this object." "geometric features of this object."
) )
grid1.addWidget(faclabel, 0, 0) self.scale_grid.addWidget(faclabel, 0, 0)
self.scale_entry = FloatEntry() self.scale_entry = FloatEntry()
self.scale_entry.set_value(1.0) self.scale_entry.set_value(1.0)
grid1.addWidget(self.scale_entry, 0, 1) self.scale_grid.addWidget(self.scale_entry, 0, 1)
# GO Button # GO Button
self.scale_button = QtGui.QPushButton('Scale') self.scale_button = QtGui.QPushButton('Scale')
@@ -71,25 +75,25 @@ class ObjectUI(QtGui.QWidget):
) )
layout.addWidget(self.scale_button) layout.addWidget(self.scale_button)
## Offset #### Offset ####
self.offset_label = QtGui.QLabel('<b>Offset:</b>') self.offset_label = QtGui.QLabel('<b>Offset:</b>')
self.offset_label.setToolTip( self.offset_label.setToolTip(
"Change the position of this object." "Change the position of this object."
) )
layout.addWidget(self.offset_label) layout.addWidget(self.offset_label)
grid2 = QtGui.QGridLayout() self.offset_grid = QtGui.QGridLayout()
layout.addLayout(grid2) layout.addLayout(self.offset_grid)
self.offset_label = QtGui.QLabel('Vector:') self.offset_vectorlabel = QtGui.QLabel('Vector:')
self.offset_label.setToolTip( self.offset_vectorlabel.setToolTip(
"Amount by which to move the object\n" "Amount by which to move the object\n"
"in the x and y axes in (x, y) format." "in the x and y axes in (x, y) format."
) )
grid2.addWidget(self.offset_label, 0, 0) self.offset_grid.addWidget(self.offset_vectorlabel, 0, 0)
self.offsetvector_entry = EvalEntry() self.offsetvector_entry = EvalEntry()
self.offsetvector_entry.setText("(0.0, 0.0)") self.offsetvector_entry.setText("(0.0, 0.0)")
grid2.addWidget(self.offsetvector_entry, 0, 1) self.offset_grid.addWidget(self.offsetvector_entry, 0, 1)
self.offset_button = QtGui.QPushButton('Offset') self.offset_button = QtGui.QPushButton('Offset')
self.offset_button.setToolTip( self.offset_button.setToolTip(
@@ -106,8 +110,25 @@ class CNCObjectUI(ObjectUI):
""" """
def __init__(self, parent=None): 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) 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 ## Plot options
self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>") self.plot_options_label = QtGui.QLabel("<b>Plot Options:</b>")
self.custom_box.addWidget(self.plot_options_label) self.custom_box.addWidget(self.plot_options_label)