Commit b9b29e39 authored by sumpfralle's avatar sumpfralle

r678@erker: lars | 2010-02-17 13:44:19 +0100

 configure maximum Frames per Second for drill updates (before: fixed number of skips)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@136 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 6f20d950
...@@ -347,8 +347,8 @@ class ProjectGui: ...@@ -347,8 +347,8 @@ class ProjectGui:
self.settings.set("show_bounding_box", True) self.settings.set("show_bounding_box", True)
self.settings.set("show_axes", True) self.settings.set("show_axes", True)
skip_obj = self.gui.get_object("DrillProgressFrameSkipControl") skip_obj = self.gui.get_object("DrillProgressFrameSkipControl")
self.settings.add_item("drill_progress_frame_skip", skip_obj.get_value, skip_obj.set_value) self.settings.add_item("drill_progress_max_fps", skip_obj.get_value, skip_obj.set_value)
self.settings.set("drill_progress_frame_skip", 20) self.settings.set("drill_progress_max_fps", 2)
# cutter shapes # cutter shapes
def get_cutter_shape_name(): def get_cutter_shape_name():
for name in ("SphericalCutter", "CylindricalCutter", "ToroidalCutter"): for name in ("SphericalCutter", "CylindricalCutter", "ToroidalCutter"):
...@@ -639,16 +639,16 @@ class ProjectGui: ...@@ -639,16 +639,16 @@ class ProjectGui:
def generate_toolpath(self, widget, data=None): def generate_toolpath(self, widget, data=None):
start_time = time.time() start_time = time.time()
class UpdateView: class UpdateView:
def __init__(self, func, skip=10): def __init__(self, func, max_fps=1):
self.count = 0 self.last_update = time.time()
self.freq = skip + 1 self.max_fps = max_fps
self.func = func self.func = func
def update(self): def update(self):
if self.count % self.freq == 0: if (time.time() - self.last_update) > 1.0/self.max_fps:
self.last_update = time.time()
self.func() self.func()
self.count += 1
if self.settings.get("show_drill_progress"): if self.settings.get("show_drill_progress"):
draw_callback = UpdateView(self.update_view, self.settings.get("drill_progress_frame_skip")).update draw_callback = UpdateView(self.update_view, self.settings.get("drill_progress_max_fps")).update
else: else:
draw_callback = None draw_callback = None
radius = self.settings.get("tool_radius") radius = self.settings.get("tool_radius")
......
...@@ -1940,9 +1940,9 @@ ...@@ -1940,9 +1940,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">2</property> <property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="DrillUpdateSkipLabel"> <object class="GtkLabel" id="DrillUpdateFPSLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Skip Drill Progress Frames:</property> <property name="label" translatable="yes">Maximum Frames per Second:</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -1954,7 +1954,7 @@ ...@@ -1954,7 +1954,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property> <property name="invisible_char">&#x2022;</property>
<property name="adjustment">DrillProgressFrameSkip</property> <property name="adjustment">DrillProgressMaxFPS</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -2260,8 +2260,9 @@ ...@@ -2260,8 +2260,9 @@
<property name="page_increment">10</property> <property name="page_increment">10</property>
<property name="page_size">10</property> <property name="page_size">10</property>
</object> </object>
<object class="GtkAdjustment" id="DrillProgressFrameSkip"> <object class="GtkAdjustment" id="DrillProgressMaxFPS">
<property name="upper">1000</property> <property name="lower">1</property>
<property name="upper">25</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
<property name="page_increment">10</property> <property name="page_increment">10</property>
<property name="page_size">10</property> <property name="page_size">10</property>
......
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