Commit 6bd3a71d authored by sumpfralle's avatar sumpfralle

keep active tab labels enabled during simulation

increased maximum FPS up to 50


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1235 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 5e6acf1b
......@@ -163,7 +163,7 @@
<object class="GtkAdjustment" id="DrillProgressMaxFPS">
<property name="value">1</property>
<property name="lower">1</property>
<property name="upper">25</property>
<property name="upper">50</property>
<property name="step_increment">1</property>
</object>
<object class="GtkFrame" id="ColorPrefTab">
......
......@@ -53,6 +53,7 @@ WINDOWS_GTK_REGISTRY_PATH = r"SOFTWARE\Gtk+"
WINDOWS_GTK_REGISTRY_KEY = "Path"
WINDOWS_GTK_LIB_SUBDIR = "bin"
def import_gtk_carefully():
""" especially for windows: try to locate required libraries manually, if
the import of GTK fails
......@@ -94,6 +95,7 @@ def import_gtk_carefully():
# everything should be prepared - now we try to import it again
import gtk
def requirements_details_gtk():
result = {}
try:
......@@ -104,6 +106,7 @@ def requirements_details_gtk():
result["gtk"] = False
return result
def recommends_details_gtk():
result = {}
try:
......@@ -125,6 +128,7 @@ def recommends_details_gtk():
log.warn("Failed to import OpenGL: %s" % str(err_msg))
result["opengl"] = False
def check_dependencies(details):
"""you can feed this function with the output of
'(requirements|recommends)_details_*'.
......@@ -133,6 +137,7 @@ def check_dependencies(details):
failed = [key for (key, state) in details.items() if not state]
return len(failed) == 0
def get_dependency_report(details, prefix=""):
result = []
DESC_COL = 0
......@@ -150,6 +155,30 @@ def get_dependency_report(details, prefix=""):
return os.linesep.join(result)
def set_parent_controls_sensitivity(widget, new_state):
""" go through all widgets above the given one and change their
"sensitivity" state. This effects everything besides the single
given widget, its direct line of ancestors and all attached
labels (e.g for notebook tabs).
Useful for disabling the screen while an action is going on.
"""
child = widget
parent = widget.get_parent()
def disable_if_different(obj, (parent, active)):
if hasattr(parent, "get_tab_label") and \
(obj is parent.get_tab_label(active)):
# skip the label of the current tab (in a notebook)
return
if not obj is active:
obj.set_sensitive(new_state)
while parent:
# Use "forall" instead of "foreach" - this also catches all tab
# labels.
parent.forall(disable_if_different, (parent, child))
child = parent
parent = parent.get_parent()
class EmergencyDialog(object):
""" This graphical message window requires no external dependencies.
The Tk interface package is part of the main python distribution.
......
......@@ -25,6 +25,7 @@ import datetime
import gobject
import pycam.Plugins
import pycam.Gui.common
# this requires ODE - we import it later, if necessary
#import pycam.Simulation.ODEBlocks
......@@ -105,7 +106,7 @@ class ToolpathSimulation(pycam.Plugins.PluginBase):
self.core.set("show_simulation", True)
self._running = True
interval_ms = int(1000 / self.core.get("drill_progress_max_fps"))
self._set_sensitive_others(self._frame, False)
pycam.Gui.common.set_parent_controls_sensitivity(self._frame, False)
gobject.timeout_add(interval_ms, self._next_timestep)
else:
self._running = True
......@@ -113,24 +114,6 @@ class ToolpathSimulation(pycam.Plugins.PluginBase):
self._pause_button.set_sensitive(True)
self._stop_button.set_sensitive(True)
def _set_sensitive_others(self, widget, new_state):
""" go through all widgets above the given one and change their
"sensitivity" state. This effects everything besides the one
given widget (and its direct line of ancestors).
Useful for disabling the screen while an action is going on.
"""
child = widget
parent = widget.get_parent()
def disable_if_different(obj, current):
if not obj is current:
obj.set_sensitive(new_state)
while parent:
# Use "forall" instead of "foreach" - this also catches all tab
# labels.
parent.forall(disable_if_different, child)
child = parent
parent = parent.get_parent()
def _pause_simulation(self, widget=None):
self._start_button.set_sensitive(True)
self._pause_button.set_sensitive(False)
......@@ -145,7 +128,7 @@ class ToolpathSimulation(pycam.Plugins.PluginBase):
self._start_button.set_sensitive(True)
self._pause_button.set_sensitive(False)
self._stop_button.set_sensitive(False)
self._set_sensitive_others(self._frame, True)
pycam.Gui.common.set_parent_controls_sensitivity(self._frame, True)
self.core.emit_event("visual-item-updated")
def _next_timestep(self):
......
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