Commit 3bc3fdd7 authored by sumpfralle's avatar sumpfralle

added a "--trace" output option (debug2)

added "unit_string" for human readable unit values
fixed ModelExtrusion visibility
fixed ModelSupport visibility
added "Models" dependency to OpenGLWindow (temporarily: until the offending calls are gone)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1141 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent f030f13f
...@@ -205,7 +205,9 @@ def execute(parser, opts, args, pycam): ...@@ -205,7 +205,9 @@ def execute(parser, opts, args, pycam):
else: else:
inputfile = None inputfile = None
if opts.debug: if opts.trace:
log.setLevel(logging.DEBUG / 2)
elif opts.debug:
log.setLevel(logging.DEBUG) log.setLevel(logging.DEBUG)
elif opts.quiet: elif opts.quiet:
log.setLevel(logging.WARNING) log.setLevel(logging.WARNING)
...@@ -563,6 +565,9 @@ if __name__ == "__main__": ...@@ -563,6 +565,9 @@ if __name__ == "__main__":
group_general.add_option("-d", "--debug", dest="debug", group_general.add_option("-d", "--debug", dest="debug",
default=False, action="store_true", help="enable output of debug " \ default=False, action="store_true", help="enable output of debug " \
+ "messages.") + "messages.")
group_general.add_option("", "--trace", dest="trace",
default=False, action="store_true", help="enable more verbose " + \
"debug messages.")
group_general.add_option("", "--progress", dest="progress", group_general.add_option("", "--progress", dest="progress",
default="text", action="store", type="choice", default="text", action="store", type="choice",
choices=["none", "text", "bar", "dot"], choices=["none", "text", "bar", "dot"],
......
...@@ -59,6 +59,7 @@ class ModelExtrusion(pycam.Plugins.PluginBase): ...@@ -59,6 +59,7 @@ class ModelExtrusion(pycam.Plugins.PluginBase):
extrusion_model.append((row[0], row[1], extrusion_model.append((row[0], row[1],
self.gui.get_object(row[2]).get_pixbuf())) self.gui.get_object(row[2]).get_pixbuf()))
self.gui.get_object("ExtrusionTypeSelector").set_active(0) self.gui.get_object("ExtrusionTypeSelector").set_active(0)
self._update_extrude_widgets()
return True return True
def teardown(self): def teardown(self):
......
...@@ -31,13 +31,16 @@ class ModelSupport(pycam.Plugins.PluginBase): ...@@ -31,13 +31,16 @@ class ModelSupport(pycam.Plugins.PluginBase):
def setup(self): def setup(self):
if self.gui: if self.gui:
support_frame = self.gui.get_object("ModelExtensionsFrame") self._support_frame = self.gui.get_object("ModelExtensionsFrame")
support_frame.unparent() self._support_frame.unparent()
self.core.register_ui("model_handling", "Support", support_frame, 0) self.core.register_ui("model_handling", "Support",
self._support_frame, 0)
self.core.register_event("model-change-after", self.core.register_event("model-change-after",
self._support_model_changed) self._support_model_changed)
self.core.register_event("bounds-changed", self.core.register_event("bounds-changed",
self._support_model_changed) self._support_model_changed)
self.core.register_event("model-selection-changed",
self._update_widgets)
self.core.register_event("support-model-changed", self.core.register_event("support-model-changed",
self.update_support_model) self.update_support_model)
support_model_type_selector = self.gui.get_object( support_model_type_selector = self.gui.get_object(
...@@ -94,6 +97,8 @@ class ModelSupport(pycam.Plugins.PluginBase): ...@@ -94,6 +97,8 @@ class ModelSupport(pycam.Plugins.PluginBase):
self.core.set("support_grid_thickness", 0.5) self.core.set("support_grid_thickness", 0.5)
self.core.set("support_grid_height", 0.5) self.core.set("support_grid_height", 0.5)
self.core.set("support_grid_type", "none") self.core.set("support_grid_type", "none")
# prepare GUI
self._update_widgets()
return True return True
def teardown(self): def teardown(self):
...@@ -108,6 +113,12 @@ class ModelSupport(pycam.Plugins.PluginBase): ...@@ -108,6 +113,12 @@ class ModelSupport(pycam.Plugins.PluginBase):
self.core.unregister_event("support-model-changed", self.core.unregister_event("support-model-changed",
self.update_support_model) self.update_support_model)
def _update_widgets(self):
if self.core.get("models").get_selected():
self._support_frame.show()
else:
self._support_frame.hide()
def _support_model_changed(self, widget=None): def _support_model_changed(self, widget=None):
self.core.emit_event("support-model-changed") self.core.emit_event("support-model-changed")
......
...@@ -71,6 +71,8 @@ BUTTON_RIGHT = 3 ...@@ -71,6 +71,8 @@ BUTTON_RIGHT = 3
class OpenGLWindow(pycam.Plugins.PluginBase): class OpenGLWindow(pycam.Plugins.PluginBase):
UI_FILE = "opengl.ui" UI_FILE = "opengl.ui"
# TODO: drop the dependecy on "Models" as soon as the calls for get("models") are gone
DEPENDS = ["Models"]
def setup(self): def setup(self):
if not GL_ENABLED: if not GL_ENABLED:
......
...@@ -40,6 +40,8 @@ class Units(pycam.Plugins.PluginBase): ...@@ -40,6 +40,8 @@ class Units(pycam.Plugins.PluginBase):
unit_field.set_active(0 if text == "mm" else 1) unit_field.set_active(0 if text == "mm" else 1)
self._last_unit = text self._last_unit = text
self.core.add_item("unit", unit_field.get_active_text, set_unit) self.core.add_item("unit", unit_field.get_active_text, set_unit)
# other plugins should use "unit_string" for human readable output
self.core.add_item("unit_string", unit_field.get_active_text)
self.gui.get_object("UnitChangeSelectAll").connect("clicked", self.gui.get_object("UnitChangeSelectAll").connect("clicked",
self.change_unit_set_selection, True) self.change_unit_set_selection, True)
self.gui.get_object("UnitChangeSelectNone").connect("clicked", self.gui.get_object("UnitChangeSelectNone").connect("clicked",
......
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