Commit 82cca76c authored by sumpfralle's avatar sumpfralle

switched most model-related plugins to the new model manager interface


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1107 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 2fe7f67e
...@@ -45,6 +45,8 @@ class ModelExtrusion(pycam.Plugins.PluginBase): ...@@ -45,6 +45,8 @@ class ModelExtrusion(pycam.Plugins.PluginBase):
extrusion_frame.unparent() extrusion_frame.unparent()
self.core.register_event("model-change-after", self.core.register_event("model-change-after",
self._update_extrude_widgets) self._update_extrude_widgets)
self.core.register_event("model-selection-changed",
self._update_extrude_widgets)
self.core.register_ui("model_handling", "Extrusion", self.core.register_ui("model_handling", "Extrusion",
extrusion_frame, 5) extrusion_frame, 5)
self.gui.get_object("ExtrudeButton").connect("clicked", self.gui.get_object("ExtrudeButton").connect("clicked",
...@@ -66,24 +68,30 @@ class ModelExtrusion(pycam.Plugins.PluginBase): ...@@ -66,24 +68,30 @@ class ModelExtrusion(pycam.Plugins.PluginBase):
self.core.unregister_event("model-change-after", self.core.unregister_event("model-change-after",
self._update_extrude_widgets) self._update_extrude_widgets)
def _get_extrudable_models(self):
models = self.core.get("models").get_selected()
extrudables = []
for model in models:
if (not model is None) and hasattr(model, "extrude"):
extrudables.append(model)
return extrudables
def _update_extrude_widgets(self): def _update_extrude_widgets(self):
model = self.core.get("model")
is_extrudable = (not model is None) \
and hasattr(model, "extrude")
extrude_widget = self.gui.get_object("ModelExtrusionFrame") extrude_widget = self.gui.get_object("ModelExtrusionFrame")
if is_extrudable: if self._get_extrudable_models():
extrude_widget.show() extrude_widget.show()
else: else:
extrude_widget.hide() extrude_widget.hide()
def _extrude_model(self, widget=None): def _extrude_model(self, widget=None):
model = self.core.get("model") models = self._get_extrudable_models()
if not model: if not models:
return return
self.core.get("update_progress")("Extruding model") self.core.get("update_progress")("Extruding models")
extrusion_type_selector = self.gui.get_object("ExtrusionTypeSelector") extrusion_type_selector = self.gui.get_object("ExtrusionTypeSelector")
type_model = extrusion_type_selector.get_model() type_model = extrusion_type_selector.get_model()
type_active = extrusion_type_selector.get_active() type_active = extrusion_type_selector.get_active()
# TODO: progress bar for main/sub if more than one model is selected
if type_active >= 0: if type_active >= 0:
type_string = type_model[type_active][0] type_string = type_model[type_active][0]
height = self.gui.get_object("ExtrusionHeight").get_value() height = self.gui.get_object("ExtrusionHeight").get_value()
...@@ -102,8 +110,9 @@ class ModelExtrusion(pycam.Plugins.PluginBase): ...@@ -102,8 +110,9 @@ class ModelExtrusion(pycam.Plugins.PluginBase):
else: else:
self.log.error("Unknown extrusion type selected: %s" % type_string) self.log.error("Unknown extrusion type selected: %s" % type_string)
return return
new_model = model.extrude(stepping=grid_size, func=func, for model in models:
callback=self.core.get("update_progress")) new_model = model.extrude(stepping=grid_size, func=func,
if new_model: callback=self.core.get("update_progress"))
self.core.get("load_model")(new_model) if new_model:
self.core.get("load_model")(new_model)
...@@ -36,6 +36,9 @@ class ModelPlaneMirror(pycam.Plugins.PluginBase): ...@@ -36,6 +36,9 @@ class ModelPlaneMirror(pycam.Plugins.PluginBase):
self.core.register_ui("model_handling", "Mirror", mirror_box, 0) self.core.register_ui("model_handling", "Mirror", mirror_box, 0)
self.gui.get_object("PlaneMirrorButton").connect("clicked", self.gui.get_object("PlaneMirrorButton").connect("clicked",
self._plane_mirror) self._plane_mirror)
self.core.register_event("model-selection-changed",
self._update_plane_widgets)
self._update_plane_widgets()
return True return True
def teardown(self): def teardown(self):
...@@ -43,6 +46,13 @@ class ModelPlaneMirror(pycam.Plugins.PluginBase): ...@@ -43,6 +46,13 @@ class ModelPlaneMirror(pycam.Plugins.PluginBase):
self.core.unregister_ui("model_handling", self.core.unregister_ui("model_handling",
self.gui.get_object("ModelMirrorBox")) self.gui.get_object("ModelMirrorBox"))
def _update_plane_widgets(self):
plane_widget = self.gui.get_object("ModelMirrorBox")
if self.core.get("models").get_selected():
plane_widget.show()
else:
plane_widget.hide()
def _plane_mirror(self, widget=None): def _plane_mirror(self, widget=None):
model = self.core.get("model") model = self.core.get("model")
if not model: if not model:
......
...@@ -40,6 +40,9 @@ class ModelPolygons(pycam.Plugins.PluginBase): ...@@ -40,6 +40,9 @@ class ModelPolygons(pycam.Plugins.PluginBase):
self._toggle_direction) self._toggle_direction)
self.gui.get_object("DirectionsGuessButton").connect("clicked", self.gui.get_object("DirectionsGuessButton").connect("clicked",
self._revise_directions) self._revise_directions)
self.core.register_event("model-selection-changed",
self._update_polygon_controls)
self._update_polygon_controls()
return True return True
def teardown(self): def teardown(self):
...@@ -47,30 +50,39 @@ class ModelPolygons(pycam.Plugins.PluginBase): ...@@ -47,30 +50,39 @@ class ModelPolygons(pycam.Plugins.PluginBase):
self.core.unregister_ui("model_handling", self.core.unregister_ui("model_handling",
self.gui.get_object("ModelPolygonFrame")) self.gui.get_object("ModelPolygonFrame"))
def _get_polygon_models(self):
models = []
for model in self.core.get("models").get_selected():
if model and hasattr(model, "reverse_directions"):
models.append(model)
return models
def _update_polygon_controls(self): def _update_polygon_controls(self):
model = self.core.get("model") models = self._get_polygon_models()
is_reversible = model and hasattr(model, "reverse_directions")
frame = self.gui.get_object("ModelPolygonFrame") frame = self.gui.get_object("ModelPolygonFrame")
if is_reversible: if models:
frame.show() frame.show()
else: else:
frame.hide() frame.hide()
def _toggle_direction(self, widget=None): def _toggle_direction(self, widget=None):
model = self.core.get("model") models = self._get_polygon_models()
if not model or not hasattr(model, "reverse_directions"): if not models:
return return
self.core.emit_event("model-change-before") self.core.emit_event("model-change-before")
self.core.get("update_progress")("Reversing directions of contour model") self.core.get("update_progress")("Reversing directions of contour model")
model.reverse_directions(callback=self.core.get("update_progress")) # TODO: main/sub progress bar for multiple models
for model in models:
model.reverse_directions(callback=self.core.get("update_progress"))
self.core.emit_event("model-change-after") self.core.emit_event("model-change-after")
def _revise_directions(self, widget=None): def _revise_directions(self, widget=None):
model = self.core.get("model") models = self._get_polygon_models()
if not model or not hasattr(model, "revise_directions"): if not models:
return return
self.core.emit_event("model-change-before") self.core.emit_event("model-change-before")
self.core.get("update_progress")("Analyzing directions of contour model") self.core.get("update_progress")("Analyzing directions of contour model")
model.revise_directions(callback=self.core.get("update_progress")) for model in models:
model.revise_directions(callback=self.core.get("update_progress"))
self.core.emit_event("model-change-after") self.core.emit_event("model-change-after")
...@@ -53,6 +53,9 @@ class ModelPosition(pycam.Plugins.PluginBase): ...@@ -53,6 +53,9 @@ class ModelPosition(pycam.Plugins.PluginBase):
align_model_button.grab_default()) align_model_button.grab_default())
obj.connect("focus-out-event", lambda widget, data: \ obj.connect("focus-out-event", lambda widget, data: \
align_model_button.get_toplevel().set_default(None)) align_model_button.get_toplevel().set_default(None))
self.core.register_event("model-selection-changed",
self._update_position_widgets)
self._update_position_widgets()
return True return True
def teardown(self): def teardown(self):
...@@ -60,22 +63,31 @@ class ModelPosition(pycam.Plugins.PluginBase): ...@@ -60,22 +63,31 @@ class ModelPosition(pycam.Plugins.PluginBase):
self.core.unregister_ui("model_handling", self.core.unregister_ui("model_handling",
self.gui.get_object("ModelPositionBox")) self.gui.get_object("ModelPositionBox"))
def _update_position_widgets(self):
widget = self.gui.get_object("ModelPositionBox")
if self.core.get("models").get_selected():
widget.show()
else:
widget.hide()
def _shift_model(self, widget=None): def _shift_model(self, widget=None):
model = self.core.get("model") models = self.core.get("models").get_selected()
if not model: if not models:
return return
self.core.emit_event("model-change-before") self.core.emit_event("model-change-before")
self.core.get("update_progress")("Aligning model") self.core.get("update_progress")("Aligning model")
self.core.get("disable_progress_cancel_button")() self.core.get("disable_progress_cancel_button")()
shift = [self.gui.get_object("ShiftPosition%s" % axis).get_value() shift = [self.gui.get_object("ShiftPosition%s" % axis).get_value()
for axis in "XYZ"] for axis in "XYZ"]
model.shift(shift[0], shift[1], shift[2], # TODO: main/sub progress bar for multiple models
callback=self.core.get("update_progress")) for model in models:
model.shift(shift[0], shift[1], shift[2],
callback=self.core.get("update_progress"))
self.core.emit_event("model-change-after") self.core.emit_event("model-change-after")
def _align_model(self, widget=None): def _align_model(self, widget=None):
model = self.core.get("model") models = self.core.get("models").get_selected()
if not model: if not models:
return return
self.core.emit_event("model-change-before") self.core.emit_event("model-change-before")
self.core.get("update_progress")("Shifting model") self.core.get("update_progress")("Shifting model")
...@@ -98,8 +110,10 @@ class ModelPosition(pycam.Plugins.PluginBase): ...@@ -98,8 +110,10 @@ class ModelPosition(pycam.Plugins.PluginBase):
else: else:
shift = dest - max_axis shift = dest - max_axis
shift_values.append(shift) shift_values.append(shift)
model.shift(shift_values[0], shift_values[1], shift_values[2], # TODO: main/sub progress bar for multiple models
callback=self.core.get("update_progress")) for model in models:
model.shift(shift_values[0], shift_values[1], shift_values[2],
callback=self.core.get("update_progress"))
self.core.emit_event("model-change-after") self.core.emit_event("model-change-after")
...@@ -41,6 +41,9 @@ class ModelProjection(pycam.Plugins.PluginBase): ...@@ -41,6 +41,9 @@ class ModelProjection(pycam.Plugins.PluginBase):
self._update_controls) self._update_controls)
self.gui.get_object("ProjectionButton").connect("clicked", self.gui.get_object("ProjectionButton").connect("clicked",
self._projection) self._projection)
self.core.register_event("model-selection-changed",
self._update_controls)
self._update_controls()
return True return True
def teardown(self): def teardown(self):
...@@ -50,33 +53,42 @@ class ModelProjection(pycam.Plugins.PluginBase): ...@@ -50,33 +53,42 @@ class ModelProjection(pycam.Plugins.PluginBase):
self.core.unregister_event("model-change-after", self.core.unregister_event("model-change-after",
self._update_controls) self._update_controls)
def _get_projectable_models(self):
models = self.core.get("models").get_selected()
projectables = []
for model in models:
if (not model is None) and hasattr(model, "get_waterline_contour"):
projectables.append(model)
return projectables
def _update_controls(self): def _update_controls(self):
model = self.core.get("model") models = self._get_projectable_models()
is_projectable = model and hasattr(model, "get_waterline_contour")
control = self.gui.get_object("ModelProjectionFrame") control = self.gui.get_object("ModelProjectionFrame")
if is_projectable: if models:
control.show() control.show()
else: else:
control.hide() control.hide()
def _projection(self, widget=None): def _projection(self, widget=None):
model = self.core.get("model") models = self._get_projectable_models()
if not model or not hasattr(model, "get_waterline_contour"): if not models:
return return
self.core.get("update_progress")("Calculating 2D projection") self.core.get("update_progress")("Calculating 2D projection")
for objname, z_level in (("ProjectionModelTop", model.maxz), # TODO: main/sub progress for multiple models
("ProjectionModelMiddle", (model.minz + model.maxz) / 2.0), for model in models:
("ProjectionModelBottom", model.minz), for objname, z_level in (("ProjectionModelTop", model.maxz),
("ProjectionModelCustom", ("ProjectionModelMiddle", (model.minz + model.maxz) / 2.0),
self.gui.get_object("ProjectionZLevel").get_value())): ("ProjectionModelBottom", model.minz),
if self.gui.get_object(objname).get_active(): ("ProjectionModelCustom",
plane = Plane(Point(0, 0, z_level), Vector(0, 0, 1)) self.gui.get_object("ProjectionZLevel").get_value())):
self.log.info("Projecting 3D model at level z=%g" % plane.p.z) if self.gui.get_object(objname).get_active():
projection = model.get_waterline_contour(plane) plane = Plane(Point(0, 0, z_level), Vector(0, 0, 1))
if projection: self.log.info("Projecting 3D model at level z=%g" % plane.p.z)
self.core.get("load_model")(projection) projection = model.get_waterline_contour(plane)
else: if projection:
self.log.warn("The 2D projection at z=%g is empty. Aborted." % \ self.core.get("load_model")(projection)
plane.p.z) else:
break self.log.warn("The 2D projection at z=%g is empty. Aborted." % \
plane.p.z)
break
...@@ -38,6 +38,9 @@ class ModelRotation(pycam.Plugins.PluginBase): ...@@ -38,6 +38,9 @@ class ModelRotation(pycam.Plugins.PluginBase):
-10) -10)
self.gui.get_object("RotateModelButton").connect("clicked", self.gui.get_object("RotateModelButton").connect("clicked",
self._rotate_model) self._rotate_model)
self.core.register_event("model-selection-changed",
self._update_controls)
self._update_controls()
return True return True
def teardown(self): def teardown(self):
...@@ -45,9 +48,16 @@ class ModelRotation(pycam.Plugins.PluginBase): ...@@ -45,9 +48,16 @@ class ModelRotation(pycam.Plugins.PluginBase):
self.core.unregister_ui("model_handling", self.core.unregister_ui("model_handling",
self.gui.get_object("ModelRotationBox")) self.gui.get_object("ModelRotationBox"))
def _update_controls(self):
widget = self.gui.get_object("ModelRotationBox")
if self.core.get("models").get_selected():
widget.show()
else:
widget.hide()
def _rotate_model(self, widget=None): def _rotate_model(self, widget=None):
model = self.core.get("model") models = self.core.get("models").get_selected()
if not model: if not models:
return return
self.core.emit_event("model-change-before") self.core.emit_event("model-change-before")
self.core.get("update_progress")("Rotating model") self.core.get("update_progress")("Rotating model")
...@@ -65,7 +75,9 @@ class ModelRotation(pycam.Plugins.PluginBase): ...@@ -65,7 +75,9 @@ class ModelRotation(pycam.Plugins.PluginBase):
break break
matrix = pycam.Geometry.Matrix.get_rotation_matrix_axis_angle( matrix = pycam.Geometry.Matrix.get_rotation_matrix_axis_angle(
axis_vector, angle, use_radians=False) axis_vector, angle, use_radians=False)
model.transform_by_matrix(matrix, # TODO: main/sub progress for multiple models
callback=self.core.get("update_progress")) for model in models:
model.transform_by_matrix(matrix,
callback=self.core.get("update_progress"))
self.core.emit_event("model-change-after") self.core.emit_event("model-change-after")
...@@ -35,7 +35,7 @@ class ModelScaling(pycam.Plugins.PluginBase): ...@@ -35,7 +35,7 @@ class ModelScaling(pycam.Plugins.PluginBase):
scale_box.unparent() scale_box.unparent()
self.core.register_ui("model_handling", "Scale", scale_box, -5) self.core.register_ui("model_handling", "Scale", scale_box, -5)
self.core.register_event("model-change-after", self.core.register_event("model-change-after",
self._update_scale_dimensions) self._update_scale_controls)
update_model = lambda widget=None: self.core.emit_event( update_model = lambda widget=None: self.core.emit_event(
"model-change-after") "model-change-after")
scale_percent = self.gui.get_object("ScalePercent") scale_percent = self.gui.get_object("ScalePercent")
...@@ -65,6 +65,9 @@ class ModelScaling(pycam.Plugins.PluginBase): ...@@ -65,6 +65,9 @@ class ModelScaling(pycam.Plugins.PluginBase):
self._scale_model, 100 * 25.4) self._scale_model, 100 * 25.4)
self.gui.get_object("ScaleMMInch").connect("clicked", self.gui.get_object("ScaleMMInch").connect("clicked",
self._scale_model, 100 / 25.4) self._scale_model, 100 / 25.4)
self.core.register_event("model-selection-changed",
self._update_scale_controls)
self._update_scale_controls()
return True return True
def teardown(self): def teardown(self):
...@@ -72,27 +75,33 @@ class ModelScaling(pycam.Plugins.PluginBase): ...@@ -72,27 +75,33 @@ class ModelScaling(pycam.Plugins.PluginBase):
self.core.unregister_ui("model_handling", self.core.unregister_ui("model_handling",
self.gui.get_object("ModelScaleBox")) self.gui.get_object("ModelScaleBox"))
def _update_scale_dimensions(self): def _update_scale_controls(self):
model = self.core.get("model") models = self.core.get("models").get_selected()
if not model: scale_box = self.gui.get_object("ModelScaleBox")
if not models:
scale_box.hide()
return return
# scale controls else:
axis_control = self.gui.get_object("ScaleDimensionAxis") scale_box.show()
scale_button = self.gui.get_object("ScaleSelectedAxisButton") # scale controls
scale_value = self.gui.get_object("ScaleDimensionControl") axis_control = self.gui.get_object("ScaleDimensionAxis")
index = axis_control.get_active() scale_button = self.gui.get_object("ScaleSelectedAxisButton")
dims = (model.maxx - model.minx, model.maxy - model.miny, scale_value = self.gui.get_object("ScaleDimensionControl")
model.maxz - model.minz) index = axis_control.get_active()
value = dims[index] # TODO: get dimension of multiple models
non_zero_dimensions = [i for i, dim in enumerate(dims) if dim > 0] model = models[0]
enable_controls = index in non_zero_dimensions dims = (model.maxx - model.minx, model.maxy - model.miny,
scale_button.set_sensitive(enable_controls) model.maxz - model.minz)
scale_value.set_sensitive(enable_controls) value = dims[index]
scale_value.set_value(value) non_zero_dimensions = [i for i, dim in enumerate(dims) if dim > 0]
enable_controls = index in non_zero_dimensions
scale_button.set_sensitive(enable_controls)
scale_value.set_sensitive(enable_controls)
scale_value.set_value(value)
def _scale_model(self, widget=None, percent=None): def _scale_model(self, widget=None, percent=None):
model = self.core.get("model") models = self.core.get("models").get_selected()
if not model: if not models:
return return
if percent is None: if percent is None:
percent = self.gui.get_object("ScalePercent").get_value() percent = self.gui.get_object("ScalePercent").get_value()
...@@ -102,36 +111,41 @@ class ModelScaling(pycam.Plugins.PluginBase): ...@@ -102,36 +111,41 @@ class ModelScaling(pycam.Plugins.PluginBase):
self.core.emit_event("model-change-before") self.core.emit_event("model-change-before")
self.core.get("update_progress")("Scaling model") self.core.get("update_progress")("Scaling model")
self.core.get("disable_progress_cancel_button")() self.core.get("disable_progress_cancel_button")()
model.scale(factor, callback=self.core.get("update_progress")) # TODO: main/sub progress for multiple models
for model in models:
model.scale(factor, callback=self.core.get("update_progress"))
self.core.emit_event("model-change-after") self.core.emit_event("model-change-after")
def _scale_model_axis_fit(self, widget=None, proportionally=False): def _scale_model_axis_fit(self, widget=None, proportionally=False):
model = self.core.get("model") models = self.core.get("models").get_selected()
if not model: if not models:
return return
value = self.gui.get_object("ScaleDimensionValue").get_value() value = self.gui.get_object("ScaleDimensionValue").get_value()
index = self.gui.get_object("ScaleDimensionAxis").get_active() index = self.gui.get_object("ScaleDimensionAxis").get_active()
axes = "xyz" axes = "xyz"
axis_suffix = axes[index] axis_suffix = axes[index]
# TODO: use dimension of multiple models
model = models[0]
factor = value / (getattr(model, "max" + axis_suffix) - \ factor = value / (getattr(model, "max" + axis_suffix) - \
getattr(model, "min" + axis_suffix)) getattr(model, "min" + axis_suffix))
self.core.emit_event("model-change-before") self.core.emit_event("model-change-before")
self.core.get("update_progress")("Scaling model") self.core.get("update_progress")("Scaling model")
self.core.get("disable_progress_cancel_button")() self.core.get("disable_progress_cancel_button")()
if proportionally: # TODO: main/sub progress for multiple models
model.scale(factor, callback=self.core.get("update_progress")) for model in models:
else: if proportionally:
factor_x, factor_y, factor_z = (1, 1, 1) model.scale(factor, callback=self.core.get("update_progress"))
if index == 0:
factor_x = factor
elif index == 1:
factor_y = factor
elif index == 2:
factor_z = factor
else: else:
return factor_x, factor_y, factor_z = (1, 1, 1)
model.scale(factor_x, factor_y, factor_z, if index == 0:
callback=self.core.get("update_progress")) factor_x = factor
# move the model to its previous center elif index == 1:
factor_y = factor
elif index == 2:
factor_z = factor
else:
return
model.scale(factor_x, factor_y, factor_z,
callback=self.core.get("update_progress"))
self.core.emit_event("model-change-after") self.core.emit_event("model-change-after")
...@@ -36,6 +36,9 @@ class ModelSwapAxes(pycam.Plugins.PluginBase): ...@@ -36,6 +36,9 @@ class ModelSwapAxes(pycam.Plugins.PluginBase):
self.core.register_ui("model_handling", "Swap axes", swap_box, 0) self.core.register_ui("model_handling", "Swap axes", swap_box, 0)
self.gui.get_object("SwapAxesButton").connect("clicked", self.gui.get_object("SwapAxesButton").connect("clicked",
self._swap_axes) self._swap_axes)
self.core.register_event("model-selection-changed",
self._update_controls)
self._update_controls()
return True return True
def teardown(self): def teardown(self):
...@@ -43,9 +46,16 @@ class ModelSwapAxes(pycam.Plugins.PluginBase): ...@@ -43,9 +46,16 @@ class ModelSwapAxes(pycam.Plugins.PluginBase):
self.core.unregister_ui("model_handling", self.core.unregister_ui("model_handling",
self.gui.get_object("ModelSwapBox")) self.gui.get_object("ModelSwapBox"))
def _update_controls(self):
box = self.gui.get_object("ModelSwapBox")
if self.core.get("models").get_selected():
box.show()
else:
box.hide()
def _swap_axes(self, widget=None): def _swap_axes(self, widget=None):
model = self.core.get("model") models = self.core.get("models").get_selected()
if not model: if not models:
return return
self.core.emit_event("model-change-before") self.core.emit_event("model-change-before")
self.core.get("update_progress")("Swap axes of model") self.core.get("update_progress")("Swap axes of model")
...@@ -54,9 +64,9 @@ class ModelSwapAxes(pycam.Plugins.PluginBase): ...@@ -54,9 +64,9 @@ class ModelSwapAxes(pycam.Plugins.PluginBase):
("YZ", "y_swap_z")): ("YZ", "y_swap_z")):
if self.gui.get_object("SwapAxes%s" % axes).get_active(): if self.gui.get_object("SwapAxes%s" % axes).get_active():
break break
model.transform_by_template(template, # TODO: main/sub progress for multiple models
callback=self.core.get("update_progress")) for model in models:
model.transform_by_template(template,
callback=self.core.get("update_progress"))
self.core.emit_event("model-change-after") self.core.emit_event("model-change-after")
...@@ -61,6 +61,11 @@ class Models(pycam.Plugins.ListPluginBase): ...@@ -61,6 +61,11 @@ class Models(pycam.Plugins.ListPluginBase):
self._visualize_visible_state) self._visualize_visible_state)
self.gui.get_object("ModelNameColumn").connect("edited", self.gui.get_object("ModelNameColumn").connect("edited",
self._edit_model_name) self._edit_model_name)
selection = self._modelview.get_selection()
selection.connect("changed",
lambda widget, event: self.core.emit_event(event),
"model-selection-changed")
selection.set_mode(gtk.SELECTION_MULTIPLE)
self._treemodel = self.gui.get_object("ModelList") self._treemodel = self.gui.get_object("ModelList")
self._treemodel.clear() self._treemodel.clear()
def update_model(): def update_model():
......
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