Commit 563826b6 authored by sumpfralle's avatar sumpfralle

added a toolpath operation tab interface

fixed toolpath cropping and grid cloning
minor ui tweaks


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1156 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 05f49414
......@@ -92,12 +92,12 @@
<property name="orientation">vertical</property>
<property name="layout_style">center</property>
<child>
<object class="GtkButton" id="ModelDelete">
<property name="label">gtk-delete</property>
<object class="GtkColorButton" id="ModelColorButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="use_alpha">True</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -106,8 +106,8 @@
</packing>
</child>
<child>
<object class="GtkButton" id="ModelDeleteAll">
<property name="label">gtk-clear</property>
<object class="GtkButton" id="ModelDelete">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -120,12 +120,12 @@
</packing>
</child>
<child>
<object class="GtkColorButton" id="ModelColorButton">
<object class="GtkButton" id="ModelDeleteAll">
<property name="label">gtk-clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_alpha">True</property>
<property name="color">#000000000000</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
......
......@@ -50,7 +50,6 @@
<child>
<object class="GtkTreeViewColumn" id="NameColumn">
<property name="title">Name</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="NameCell"/>
<attributes>
......@@ -62,6 +61,7 @@
<child>
<object class="GtkTreeViewColumn" id="DescriptionColumn">
<property name="title">Description</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="DescriptionCell"/>
</child>
......
......@@ -1898,10 +1898,10 @@ Hotkey: &lt;p&gt;</property>
<property name="program_name">PyCAM</property>
<property name="version">0.1</property>
<property name="copyright" translatable="yes">Copyright &#xA9; 2008-2010 Lode Leroy
Copyright &#xA9; 2010 Lars Kruse</property>
Copyright &#xA9; 2010-2011 Lars Kruse</property>
<property name="comments" translatable="yes">Toolpath Generation for 3-Axis CNC machining</property>
<property name="website">http://sourceforge.net/projects/pycam/</property>
<property name="website_label" translatable="yes">Webseite des PyCAM-Projekts</property>
<property name="website">http://pycam.sourceforge.net/</property>
<property name="website_label" translatable="yes">Website of the PyCAM project</property>
<property name="license" translatable="yes">This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PyCAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
......
......@@ -2,20 +2,40 @@
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="ToolpathCropDialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">Crop toolpath</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<object class="GtkAdjustment" id="ToolpathCropMarginValue">
<property name="lower">-1000</property>
<property name="upper">1000</property>
<property name="step_increment">1</property>
</object>
<object class="GtkAdjustment" id="ToolpathCropZSliceValue">
<property name="lower">-1000</property>
<property name="upper">1000</property>
<property name="step_increment">1</property>
</object>
<object class="GtkFrame" id="ToolpathCropFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox1">
<object class="GtkVBox" id="vbox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkAlignment" id="ModelTableContainer">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
......@@ -57,7 +77,7 @@
<object class="GtkLabel" id="ToolpathCropZSliceLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Slicing z-level:</property>
<property name="label" translatable="yes">Slicing level (z):</property>
</object>
<packing>
<property name="y_options">GTK_FILL</property>
......@@ -79,20 +99,6 @@
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ToolpathCropKeepOriginal">
<property name="label" translatable="yes">Keep original toolpath</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
......@@ -100,8 +106,9 @@
</child>
<child>
<object class="GtkViewport" id="ToolpathCropInfoBox">
<property name="no_show_all">True</property>
<property name="visible">True</property>
<property name="resize_mode">queue</property>
<property name="shadow_type">etched-out</property>
<child>
<object class="GtkLabel" id="ToolpathCropInfo">
<property name="visible">True</property>
......@@ -115,72 +122,54 @@
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ToolpathCropCancel">
<property name="label">gtk-cancel</property>
<object class="GtkCheckButton" id="ToolpathCropKeepOriginal">
<property name="label" translatable="yes">Keep original toolpath</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ToolpathCropOK">
<property name="label">gtk-ok</property>
<object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="CropButton">
<property name="label">gtk-execute</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ToolpathCropCancel</action-widget>
<action-widget response="0">ToolpathCropOK</action-widget>
</action-widgets>
</object>
<object class="GtkAdjustment" id="ToolpathCropMarginValue">
<property name="lower">-1000</property>
<property name="upper">1000</property>
<property name="step_increment">1</property>
</object>
<object class="GtkAdjustment" id="ToolpathCropZSliceValue">
<property name="lower">-1000</property>
<property name="upper">1000</property>
<property name="step_increment">1</property>
</object>
<object class="GtkButton" id="ToolpathCropButton">
<property name="label" translatable="yes">Crop</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Crop toolpath&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
</interface>
This diff is collapsed.
This diff is collapsed.
......@@ -273,16 +273,6 @@ class Tasks(pycam.Plugins.ListPluginBase):
self.generate_toolpaths(self)
def generate_toolpath(self, task, progress=None):
func = self.core.get("get_parameter_sets")("task")[task["type"]]["func"]
toolpath = func(task)
return toolpath
# TODO: remove this obsolete code as soon as toolpath generation works
models = task["models"]
tool = task["tool"]
process = task["process"]
bounds = task["bounds"]
path_generator = self._get_path_generator(process)
motion_grid = self._get_motion_grid(tool, process, bounds, models)
start_time = time.time()
if progress:
use_multi_progress = True
......@@ -318,11 +308,10 @@ class Tasks(pycam.Plugins.ListPluginBase):
# run the toolpath generation
progress.update(text="Starting the toolpath generation")
low, high = bounds.get_absolute_limits()
try:
toolpath = path_generator.GenerateToolPath(tool,
models, motion_grid, minz=low[2], maxz=high[2],
draw_callback=draw_callback)
func = self.core.get("get_parameter_sets")(
"task")[task["type"]]["func"]
toolpath = func(task, callback=draw_callback)
except Exception:
# catch all non-system-exiting exceptions
self.log.error(pycam.Utils.get_exception_report())
......
......@@ -24,6 +24,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
import pycam.Plugins
from pycam.Geometry.Point import Point
from pycam.Geometry.Plane import Plane
import pycam.Gui.ControlsGTK
"""
......@@ -40,61 +41,141 @@ class ToolpathCrop(pycam.Plugins.PluginBase):
def setup(self):
if self.gui:
action_button = self.gui.get_object("ToolpathCropButton")
action_button.unparent()
self.core.register_ui("toolpath_crop", "Crop", action_button, -3)
self._frame = self.gui.get_object("ToolpathCropFrame")
self.core.register_ui("toolpath_handling", "Crop",
self._frame, 40)
for objname in ("ToolpathCropZSlice", "ToolpathCropMargin"):
obj = self.gui.get_object(objname)
obj.set_value(0)
obj.connect("value-changed", self._update_widgets)
self.gui.get_object("CropButton").connect("clicked",
self.crop_toolpath)
# model selector
self.models_widget = pycam.Gui.ControlsGTK.InputTable([],
force_type=long, change_handler=self._update_widgets)
# configure the input/output converter
def get_converter(model_refs):
models_dict = {}
for model in self.core.get("models"):
models_dict[id(model)] = model
models = []
for model_ref in model_refs:
models.append(models_dict[model_ref])
return models
def set_converter(models):
return [id(model) for model in models]
self.models_widget.set_conversion(set_conv=set_converter,
get_conv=get_converter)
self.gui.get_object("ModelTableContainer").add(
self.models_widget.get_widget())
self.core.register_event("model-list-changed",
self._update_models_list)
self.core.register_event("toolpath-selection-changed",
self._update_visibility)
self._update_widgets()
self._update_visibility()
return True
def teardown(self):
if self.gui:
self.core.unregister_ui("toolpath_crop",
self.gui.get_object("ToolpathCropButton"))
def _update_model_type_controls(self):
model = self.core.get("model")
if not model:
return
self.gui.get_object("ModelTableContainer").remove(
self.models_widget.get_widget())
self.core.unregister_ui("toolpath_handling", self._frame)
self.core.unregister_event("model-list-changed",
self._update_models_list)
self.core.unregister_event("toolpath-selection-changed",
self._update_visibility)
def _update_models_list(self):
choices = []
models = self.core.get("models")
for model in models:
choices.append((models.get_attr(model, "name"), model))
self.models_widget.update_choices(choices)
def _update_visibility(self):
if self.core.get("toolpaths").get_selected():
self._frame.show()
else:
self._frame.hide()
def _update_widgets(self, widget=None):
models = self.models_widget.get_value()
info_label = self.gui.get_object("ToolpathCropInfo")
info_box = self.gui.get_object("ToolpathCropInfoBox")
button = self.gui.get_object("CropButton")
slicing_models = [model for model in models
if hasattr(model, "get_waterline_contour")]
# show or hide z-slice controls
can_slice = hasattr(model, "get_waterline_contour")
for name in "ToolpathCropZSliceLabel", "ToolpathCropZSlice":
if can_slice:
self.gui.get_object(name).show()
slice_controls = ("ToolpathCropZSliceLabel", "ToolpathCropZSlice")
if slicing_models:
# set lower and upper limit for z-slice
z_slice = self.gui.get_object("ToolpathCropZSlice")
minz = min([model.minz for model in slicing_models])
maxz = max([model.maxz for model in slicing_models])
z_slice.set_range(minz, maxz)
if z_slice.get_value() > maxz:
z_slice.set_value(maxz)
elif z_slice.get_value() < minz:
z_slice.set_value(minz)
else:
pass
for name in slice_controls:
self.gui.get_object(name).show()
else:
for name in slice_controls:
self.gui.get_object(name).hide()
# set lower and upper limit for z-slice
z_slice_value = self.gui.get_object("ToolpathCropZSliceValue")
z_slice_value.set_lower(model.minz)
z_slice_value.set_upper(model.maxz)
def crop_toolpath(self, widget=None):
# TODO: how to get the currently selected toolpath???
toolpath = self.core.get("toolpath")[0]
model = self.core.get("model")
if not model:
return
if hasattr(model, "get_polygons"):
contour = model
elif hasattr(model, "get_waterline_contour"):
z_slice = self.gui.get_object("ToolpathCropZSlice").get_value()
plane = Plane(Point(0, 0, z_slice))
#self.update_progress_bar("Calculating the 2D projection")
contour = model.get_waterline_contour(plane)
# update info
if not models:
info_box.show()
info_label.set_label("Hint: select a model")
button.set_sensitive(False)
else:
self.log.warn(("The current model (%s) does not support " \
+ "projections") % str(type(model)))
return
#self.update_progress_bar("Applying the tool diameter offset")
polygons = self._get_waterlines()
if polygons:
info_box.hide()
button.set_sensitive(True)
else:
info_label.set_label("Hint: there is no usable contour at this splice level")
info_box.show()
button.set_sensitive(False)
def _get_waterlines(self):
models = self.models_widget.get_value()
polygons = []
# get all waterlines and polygons
for model in models:
if hasattr(model, "get_polygons"):
for poly in model.get_polygons():
polygons.append(poly.copy())
elif hasattr(model, "get_waterline_contour"):
z_slice = self.gui.get_object("ToolpathCropZSlice").get_value()
plane = Plane(Point(0, 0, z_slice))
for poly in model.get_waterline_contour(plane).get_polygons():
polygons.append(poly.copy())
# add an offset if requested
margin = self.gui.get_object("ToolpathCropMargin").get_value()
if margin:
contour = contour.get_offset_model(margin)
#self.update_progress_bar("Cropping the toolpath")
#toolpath.crop(contour.get_polygons(), callback=self.update_progress_bar)
if self.gui.get_object("ToolpathCropKeepOriginal").get_active():
new_tp = toolpath.get_cropped_copy(contour.get_polygons(),
callback=self.update_progress_bar)
new_tp.visible = True
old_index = self.core.get("toolpath").index(toolpath)
self.core.get("toolpath").insert(old_index + 1, new_tp)
else:
toolpath.crop(contour.get_polygons(), callback=self.update_progress_bar)
if margin != 0:
shifted = []
for poly in polygons:
shifted.extend(poly.get_offset_polygons(margin))
polygons = shifted
return polygons
def crop_toolpath(self, widget=None):
selected = self.core.get("toolpaths").get_selected()
polygons = self._get_waterlines()
keep_original = self.gui.get_object(
"ToolpathCropKeepOriginal").get_active()
for toolpath in self.core.get("toolpaths").get_selected():
new_tp = toolpath.get_cropped_copy(polygons)
if new_tp.paths:
if keep_original:
self.core.get("toolpaths").append(new_tp)
else:
toolpath.paths = new_tp.paths
else:
self.log.info("Toolpath cropping: the result is empty")
self.core.emit_event("visual-item-updated")
self.core.get("toolpaths").select(selected)
......@@ -22,73 +22,88 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
import pycam.Plugins
import pycam.Geometry.Point
class ToolpathGrid(pycam.Plugins.PluginBase):
UI_FILE = "toolpath_grid.ui"
DEPENDS = ["Toolpaths"]
def setup(self):
if self.gui:
self._frame = self.gui.get_object("ToolpathGridFrame")
self.core.register_ui("toolpath_handling", "Clone grid",
self._frame, 30)
for objname in ("GridYCount", "GridXCount"):
self.gui.get_object(objname).set_value(1)
for objname in ("GridYCount", "GridXCount", "GridYDistance",
"GridXDistance"):
self.gui.get_object(objname).connect("value-changed",
self.update_toolpath_grid_window)
# TODO: add a button to the toolpath action UI
self._update_widgets)
self.gui.get_object("GridCreate").connect("clicked",
self.create_toolpath_grid)
self.core.register_event("toolpath-selection-changed",
self._update_widgets)
self._update_widgets()
return True
def teardown(self):
if self.gui:
self.core.unregister_ui("toolpath_handling", self._frame)
self.core.unregister_event("toolpath-selection-changed",
self._update_widgets)
pass
def update_toolpath_grid_window(self, widget=None):
data = self._toolpath_for_grid_data
x_dim = data["maxx"] - data["minx"]
y_dim = data["maxy"] - data["miny"]
x_count = self.gui.get_object("GridXCount").get_value()
x_space = self.gui.get_object("GridXDistance").get_value()
y_count = self.gui.get_object("GridYCount").get_value()
y_space = self.gui.get_object("GridYDistance").get_value()
x_width = x_dim * x_count + x_space * (x_count - 1)
y_width = y_dim * y_count + y_space * (y_count - 1)
self.gui.get_object("LabelGridXWidth").set_label("%g%s" % \
(x_width, self.settings.get("unit")))
self.gui.get_object("LabelGridYWidth").set_label("%g%s" % \
(y_width, self.settings.get("unit")))
def create_toolpath_grid(self, toolpath):
dialog = self.gui.get_object("ToolpathGridDialog")
data = self._toolpath_for_grid_data
data["minx"] = toolpath.minx()
data["maxx"] = toolpath.maxx()
data["miny"] = toolpath.miny()
data["maxy"] = toolpath.maxy()
self.gui.get_object("GridXCount").set_value(1)
self.gui.get_object("GridYCount").set_value(1)
self.update_toolpath_grid_window()
result = dialog.run()
if result == 1:
# "OK" was pressed
new_tp = []
x_count = int(self.gui.get_object("GridXCount").get_value())
y_count = int(self.gui.get_object("GridYCount").get_value())
def _get_toolpaths_dim(self, toolpaths):
if toolpaths:
maxx = max([tp.maxx for tp in toolpaths])
minx = min([tp.minx for tp in toolpaths])
maxy = max([tp.maxy for tp in toolpaths])
miny = min([tp.miny for tp in toolpaths])
return (maxx - minx), (maxy - miny)
else:
return None, None
def _update_widgets(self, widget=None):
toolpaths = self.core.get("toolpaths").get_selected()
if toolpaths:
x_dim, y_dim = self._get_toolpaths_dim(toolpaths)
x_count = self.gui.get_object("GridXCount").get_value()
x_space = self.gui.get_object("GridXDistance").get_value()
y_count = self.gui.get_object("GridYCount").get_value()
y_space = self.gui.get_object("GridYDistance").get_value()
x_dim = data["maxx"] - data["minx"]
y_dim = data["maxy"] - data["miny"]
x_width = x_dim * x_count + x_space * (x_count - 1)
y_width = y_dim * y_count + y_space * (y_count - 1)
self.gui.get_object("LabelGridXWidth").set_label("%g%s" % \
(x_width, self.core.get("unit_string")))
self.gui.get_object("LabelGridYWidth").set_label("%g%s" % \
(y_width, self.core.get("unit_string")))
self._frame.show()
else:
self._frame.hide()
def create_toolpath_grid(self, widget=None):
toolpaths = self.core.get("toolpaths").get_selected()
x_count = int(self.gui.get_object("GridXCount").get_value())
y_count = int(self.gui.get_object("GridYCount").get_value())
x_space = self.gui.get_object("GridXDistance").get_value()
y_space = self.gui.get_object("GridYDistance").get_value()
x_dim, y_dim = self._get_toolpaths_dim(toolpaths)
for toolpath in toolpaths:
new_paths = []
for x in range(x_count):
for y in range(y_count):
shift = Point(x * (x_space + x_dim),
shift = pycam.Geometry.Point.Vector(x * (x_space + x_dim),
y * (y_space + y_dim), 0)
for path in toolpath.get_paths():
for path in toolpath.paths:
new_path = pycam.Geometry.Path.Path()
new_path.points = [shift.add(p) for p in path.points]
new_tp.append(new_path)
new_toolpath = pycam.Toolpath.Toolpath(new_tp, toolpath.name,
toolpath.toolpath_settings)
toolpath.visible = False
new_toolpath.visible = True
# TODO: emit "toolpath-list-changed"
self.toolpath.append(new_toolpath)
self.update_toolpath_table()
dialog.hide()
new_paths.append(new_path)
if not self.gui.get_object("KeepOriginal").get_active():
toolpath.paths = new_paths
else:
self.core.get("toolpaths").append(new_toolpath)
self.core.emit_event("visual-item-updated")
self.core.get("toolpaths").select(toolpaths)
......@@ -46,12 +46,22 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
(self.ACTION_CLEAR, "ToolpathDeleteAll")):
self.register_list_action_button(action, self._modelview,
self.gui.get_object(obj_name))
# toolpath operations
toolpath_handling_obj = self.gui.get_object(
"ToolpathHandlingNotebook")
def clear_toolpath_handling_obj():
for index in range(toolpath_handling_obj.get_n_pages()):
toolpath_handling_obj.remove_page(0)
def add_toolpath_handling_item(item, name):
toolpath_handling_obj.append_page(item, gtk.Label(name))
self.core.register_ui_section("toolpath_handling",
add_toolpath_handling_item, clear_toolpath_handling_obj)
# handle table changes
self._modelview.connect("row-activated",
self._list_action_toggle_custom, self.COLUMN_VISIBLE)
self.gui.get_object("ToolpathVisibleColumn").set_cell_data_func(
self.gui.get_object("ToolpathVisibleSymbol"),
self._visualize_machine_time)
self._visualize_visible_state)
self.gui.get_object("ToolpathNameCell").connect("edited",
self._edit_toolpath_name)
self.gui.get_object("ToolpathTimeColumn").set_cell_data_func(
......@@ -93,8 +103,10 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
self.register_model_update(update_model)
self.core.register_event("toolpath-list-changed",
self._update_widgets)
self.core.register_event("toolpath-list-changed",
lambda: self.core.emit_event("visual-item-updated"))
self._update_widgets()
self.core.add_item("toolpaths", lambda: self)
self.core.set("toolpaths", self)
return True
def teardown(self):
......@@ -115,6 +127,18 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
return [self[index] for index, item in enumerate(self._treemodel)
if item[self.COLUMN_VISIBLE]]
def select(self, toolpaths):
selection = self._modelview.get_selection()
model = self._modelview.get_model()
if not isinstance(toolpaths, (list, tuple)):
toolpaths = [toolpaths]
tp_refs = [id(tp) for tp in toolpaths]
for index, row in enumerate(model):
if row[self.COLUMN_REF] in tp_refs:
selection.select_path((index,))
else:
selection.unselect_path((index,))
def _update_widgets(self):
toolpaths = self
if not toolpaths:
......@@ -147,6 +171,13 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
new_text:
self._treemodel[path][self.COLUMN_NAME] = new_text
def _visualize_visible_state(self, column, cell, model, m_iter):
visible = model.get_value(m_iter, self.COLUMN_VISIBLE)
if visible:
cell.set_property("pixbuf", self.ICONS["visible"])
else:
cell.set_property("pixbuf", self.ICONS["hidden"])
def _visualize_machine_time(self, column, cell, model, m_iter):
path = model.get_path(m_iter)
toolpath = self[path[0]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment