Commit 52917436 authored by sumpfralle's avatar sumpfralle

added "view items" buttons to the 3D view

added wiki link for http://sourceforge.net/apps/mediawiki/pycam/index.php?title=3D_View


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@894 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 0565f3c2
......@@ -11,6 +11,7 @@ Version 0.4.1 - UNRELEASED
* unify DropCutter behaviour for models that are higher than the defined bounding box
* always move up to safety height in this case
* optional visualization of toolpath direction
* visibility of 3D view items is now configurable in the 3D window
Version 0.4.0.1 - 2010-10-24
* disabled parallel processing for Windows standalone executable
......
......@@ -33,6 +33,7 @@
<menuitem action="HelpModelTransformations"/>
<menuitem action="HelpGCodeExport"/>
<menuitem action="HelpSimulation"/>
<menuitem action="Help3DView"/>
<menuitem action="HelpServerMode"/>
<menuitem action="HelpCommandLine"/>
<menuitem action="HelpHotkeys"/>
......
This diff is collapsed.
......@@ -35,6 +35,7 @@ import pycam.Geometry.Matrix as Matrix
from pycam.Geometry.utils import sqrt, number, epsilon
import pycam.Utils.log
import gtk
import gobject
import pango
import math
import time
......@@ -247,7 +248,8 @@ class Camera:
class ModelViewWindowGL:
def __init__(self, gui, settings, notify_destroy=None, accel_group=None):
def __init__(self, gui, settings, notify_destroy=None, accel_group=None,
item_buttons=None):
# assume, that initialization will fail
self.gui = gui
self.window = self.gui.get_object("view3dwindow")
......@@ -320,6 +322,30 @@ class ModelViewWindowGL:
attributes.insert(color)
for name in names:
self.gui.get_object(name).set_attributes(attributes)
# add the items buttons (for configuring visible items)
if item_buttons:
items_button_container = self.gui.get_object("ViewItems")
for button in item_buttons:
new_checkbox = gtk.ToggleToolButton()
new_checkbox.set_label(button.get_label())
new_checkbox.set_visible(True)
new_checkbox.set_active(button.get_active())
# Configure the two buttons (in "Preferences" and in the 3D view
# widget) to toggle each other. This is required for a
# consistent view of the setting.
def checkbox_handler(widget, button=button):
button.set_active(not button.get_active())
checkbox_handler_id = new_checkbox.connect_object_after(
"toggled", checkbox_handler, new_checkbox)
def button_handler(widget, new_checkbox=new_checkbox,
checkbox_handler_id=checkbox_handler_id):
new_checkbox.handler_block(checkbox_handler_id)
# prevent any recursive handler-triggering
if new_checkbox.get_active() != widget.get_active():
new_checkbox.set_active(not new_checkbox.get_active())
new_checkbox.handler_unblock(checkbox_handler_id)
button.connect_object_after("toggled", button_handler, button)
items_button_container.insert(new_checkbox, -1)
# show the window
self.area.show()
self.container.show()
......
......@@ -312,6 +312,7 @@ class ProjectGui:
("HelpTaskSetup", self.show_help, "TaskSetup", None),
("HelpGCodeExport", self.show_help, "GCodeExport", None),
("HelpSimulation", self.show_help, "Simulation", None),
("Help3DView", self.show_help, "3D_View", None),
("HelpServerMode", self.show_help, "ServerMode", None),
# TODO: write a general wiki page about the commandline usage (not just examples)
("HelpCommandLine", self.show_help, "CommandlineExamples", None),
......@@ -1946,10 +1947,16 @@ class ProjectGui:
return
elif new_state:
if self.view3d is None:
# These buttons are replicated to appear in the 3D view - for
# easier configuration of visible items without the Preferences
# window.
item_buttons = self.gui.get_object(
"PreferencesVisibleItemsBox").get_children()
# do the gl initialization
self.view3d = ModelViewWindowGL(self.gui, self.settings,
notify_destroy=self.toggle_3d_view,
accel_group=self._accel_group)
accel_group=self._accel_group,
item_buttons=item_buttons)
if self.model and self.view3d.enabled:
self.view3d.reset_view()
# disable the "toggle" button, if the 3D view does not work
......
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