Commit a9dbe5bf authored by sumpfralle's avatar sumpfralle

moved "ProgressCounter" to pycam.Utils


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@515 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent aaa7dc1f
......@@ -23,8 +23,8 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
from pycam.Geometry import Point
from pycam.Geometry.utils import INFINITE
from pycam.PathGenerators import get_max_height_triangles, get_max_height_ode, \
ProgressCounter
from pycam.PathGenerators import get_max_height_triangles, get_max_height_ode
from pycam.Utils import ProgressCounter
import pycam.Utils.log
import math
......
......@@ -25,7 +25,8 @@ import pycam.PathProcessors.PathAccumulator
from pycam.Geometry.Point import Point
from pycam.Geometry.utils import INFINITE
from pycam.PathGenerators import get_max_height_triangles, get_max_height_ode, \
get_free_paths_ode, get_free_paths_triangles, ProgressCounter
get_free_paths_ode, get_free_paths_triangles
from pycam.Utils import ProgressCounter
import pycam.Utils.log
import math
......
......@@ -22,8 +22,8 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""
from pycam.Geometry.Point import Point
from pycam.PathGenerators import get_free_paths_ode, get_free_paths_triangles, \
ProgressCounter
from pycam.PathGenerators import get_free_paths_ode, get_free_paths_triangles
from pycam.Utils import ProgressCounter
import math
......
......@@ -23,29 +23,10 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
__all__ = ["DropCutter", "PushCutter", "EngraveCutter"]
from pycam.Geometry.utils import INFINITE, epsilon
from pycam.Geometry import Point
from pycam.Geometry.Point import Point
import math
class ProgressCounter:
def __init__(self, max_value, update_callback):
self.max_value = max_value
self.current_value = 0
self.update_callback = update_callback
def increment(self):
self.current_value += 1
if self.update_callback:
# "True" means: "quit requested via GUI"
return self.update_callback(percent=self.get_percent())
else:
return False
def get_percent(self):
return 100.0 * self.current_value / self.max_value
class Hit:
def __init__(self, cl, t, d, direction):
self.cl = cl
......
......@@ -20,4 +20,24 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""
__all__ = [ "iterators", "polynomials"]
__all__ = [ "iterators", "polynomials", "ProgressCounter"]
class ProgressCounter:
def __init__(self, max_value, update_callback):
self.max_value = max_value
self.current_value = 0
self.update_callback = update_callback
def increment(self):
self.current_value += 1
if self.update_callback:
# "True" means: "quit requested via GUI"
return self.update_callback(percent=self.get_percent())
else:
return False
def get_percent(self):
return 100.0 * self.current_value / self.max_value
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