Commit 5abd9bb6 authored by sumpfralle's avatar sumpfralle

moved all references to progress bar handling to a new plugin


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1112 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 3a8e8027
......@@ -2,6 +2,29 @@
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="ModelList">
<columns>
<!-- column-name id -->
<column type="gint"/>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name state -->
<column type="gboolean"/>
<!-- column-name color -->
<column type="gchararray"/>
<!-- column-name alpha -->
<column type="guint"/>
</columns>
<data>
<row>
<col id="0">0</col>
<col id="1" translatable="yes">Model #1</col>
<col id="2">False</col>
<col id="3" translatable="yes">#ffff00000000</col>
<col id="4">0</col>
</row>
</data>
</object>
<object class="GtkWindow" id="window1">
<child>
<object class="GtkVPaned" id="ModelBox">
......@@ -173,33 +196,10 @@
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
<property name="shrink">False</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkListStore" id="ModelList">
<columns>
<!-- column-name id -->
<column type="gint"/>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name state -->
<column type="gboolean"/>
<!-- column-name color -->
<column type="gchararray"/>
<!-- column-name alpha -->
<column type="guint"/>
</columns>
<data>
<row>
<col id="0">0</col>
<col id="1" translatable="yes">Model #1</col>
<col id="2">False</col>
<col id="3" translatable="yes">#ffff00000000</col>
<col id="4">0</col>
</row>
</data>
</object>
</interface>
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="DummyWindow">
<child>
<object class="GtkVBox" id="ProgressBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkProgressBar" id="MultipleProgressBar">
<property name="ellipsize">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="ProgressWidget">
<property name="spacing">3</property>
<child>
<object class="GtkProgressBar" id="ProgressBar">
<property name="visible">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox13">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToggleButton" id="ShowToolpathProgressButton">
<property name="label" translatable="yes">Show Progress</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ProgressCancelButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
This diff is collapsed.
......@@ -103,6 +103,9 @@ class BaseModel(TransformableContainer):
def to_OpenGL(self, visible_filter=None, show_directions=False):
if not GL_enabled:
return
gl_color = tuple([float(val) for val in GL.glGetFloatv(GL.GL_CURRENT_COLOR)])
# the index should contain all relevant context details
cache_index = (show_directions, gl_color)
if not visible_filter is None:
for item in self.next():
# ignore invisble things like the normal of a ContourModel
......@@ -110,17 +113,17 @@ class BaseModel(TransformableContainer):
do_paint, color = visible_filter(item)
if do_paint:
item.to_OpenGL(color, show_directions=show_directions)
elif not show_directions in self._opengl_display_cache:
elif not cache_index in self._opengl_display_cache:
# compile an OpenGL display list
# Rendering a display list takes less than 5% of the time for a
# complete rebuild.
list_index = GL.glGenLists(1)
if list_index > 0:
self._opengl_display_cache[show_directions] = list_index
self._opengl_display_cache[cache_index] = list_index
# somehow "GL_COMPILE_AND_EXECUTE" fails - we render it later
GL.glNewList(list_index, GL.GL_COMPILE)
for item in self.next():
# ignore invisble things like the normal of a ContourModel
# ignore invisible things like the normal of a ContourModel
if hasattr(item, "to_OpenGL"):
item.to_OpenGL(show_directions=show_directions)
if list_index > 0:
......@@ -128,7 +131,7 @@ class BaseModel(TransformableContainer):
GL.glCallList(list_index)
else:
# render a previously compiled display list
GL.glCallList(self._opengl_display_cache[show_directions])
GL.glCallList(self._opengl_display_cache[cache_index])
def is_export_supported(self):
return not self._export_function is None
......@@ -289,16 +292,26 @@ class Model(BaseModel):
return self._t_kdtree.Search(minx, maxx, miny, maxy)
return self._triangles
def get_waterline_contour(self, plane):
def get_waterline_contour(self, plane, callback=None):
collision_lines = []
progress_max = 2 * len(self._triangles)
counter = 0
for t in self._triangles:
if callback and callback(percent=100.0 * counter / progress_max):
return
collision_line = plane.intersect_triangle(t, counter_clockwise=True)
if not collision_line is None:
collision_lines.append(collision_line)
else:
counter += 1
counter += 1
# combine these lines into polygons
contour = ContourModel(plane=plane)
for line in collision_lines:
if callback and callback(percent=100.0 * counter / progress_max):
return
contour.append(line)
counter += 1
log.debug("Waterline: %f - %d - %s" % (plane.p.z,
len(contour.get_polygons()),
[len(p.get_lines()) for p in contour.get_polygons()]))
......
This diff is collapsed.
......@@ -21,16 +21,19 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""
import pycam.Importers.DXFImporter
from pycam.Utils.locations import get_external_program_location
import pycam.Utils
import tempfile
import subprocess
import os
log = pycam.Utils.log.get_logger()
def convert_svg2eps(svg_filename, eps_filename, location=None):
if location is None:
location = pycam.Utils.get_external_program_location("inkscape")
location = get_external_program_location("inkscape")
if location is None:
location = "inkscape"
try:
......@@ -54,7 +57,7 @@ def convert_svg2eps(svg_filename, eps_filename, location=None):
def convert_eps2dxf(eps_filename, dxf_filename, location=None, unit="mm"):
if location is None:
location = pycam.Utils.get_external_program_location("pstoedit")
location = get_external_program_location("pstoedit")
if location is None:
location = "pstoedit"
args = [location, "-dt", "-nc", "-f", "dxf:-polyaslines"]
......
......@@ -84,14 +84,12 @@ class ModelExtrusion(pycam.Plugins.PluginBase):
extrude_widget.hide()
def _extrude_model(self, widget=None):
models = self._get_extrudable_models()
if not models:
selected_models = self._get_extrudable_models()
if not selected_models:
return
self.core.get("update_progress")("Extruding models")
extrusion_type_selector = self.gui.get_object("ExtrusionTypeSelector")
type_model = extrusion_type_selector.get_model()
type_active = extrusion_type_selector.get_active()
# TODO: progress bar for main/sub if more than one model is selected
if type_active >= 0:
type_string = type_model[type_active][0]
height = self.gui.get_object("ExtrusionHeight").get_value()
......@@ -111,9 +109,12 @@ class ModelExtrusion(pycam.Plugins.PluginBase):
self.log.error("Unknown extrusion type selected: %s" % type_string)
return
model_manager = self.core.get("models")
for model in models:
progress = self.core.get("progress")
progress.update(text="Extruding models")
progress.set_multiple(len(selected_models), "Model")
for model in selected_models:
new_model = model.extrude(stepping=grid_size, func=func,
callback=self.core.get("update_progress"))
callback=progress.update)
if new_model:
self.core.get("load_model")(new_model)
try:
......@@ -126,4 +127,6 @@ class ModelExtrusion(pycam.Plugins.PluginBase):
(new_name, original_name))
except LookupError:
pass
progress.update_multiple()
progress.finish()
......@@ -54,16 +54,21 @@ class ModelPlaneMirror(pycam.Plugins.PluginBase):
plane_widget.hide()
def _plane_mirror(self, widget=None):
model = self.core.get("model")
if not model:
models = self.core.get("models").get_selected()
if not models:
return
self.core.emit_event("model-change-before")
self.core.get("update_progress")("Mirroring model")
self.core.get("disable_progress_cancel_button")()
progress = self.core.get("progress")
progress.update(text="Mirroring model")
progress.disable_cancel()
progress.set_multiple(len(models), "Model")
for plane in ("XY", "XZ", "YZ"):
if self.gui.get_object("MirrorPlane%s" % plane).get_active():
break
model.transform_by_template("%s_mirror" % plane.lower(),
callback=self.core.get("update_progress"))
for model in models:
model.transform_by_template("%s_mirror" % plane.lower(),
callback=progress.update)
progress.update_multiple()
progress.finish()
self.core.emit_event("model-change-after")
......@@ -81,8 +81,12 @@ class ModelPolygons(pycam.Plugins.PluginBase):
if not models:
return
self.core.emit_event("model-change-before")
self.core.get("update_progress")("Analyzing directions of contour model")
progress = self.core.get("progress")
progress.update(text="Analyzing directions of contour model")
progress.set_multiple(len(models), "Model")
for model in models:
model.revise_directions(callback=self.core.get("update_progress"))
model.revise_directions(callback=progress.update)
progress.update_multiple()
progress.finish()
self.core.emit_event("model-change-after")
......@@ -75,14 +75,17 @@ class ModelPosition(pycam.Plugins.PluginBase):
if not models:
return
self.core.emit_event("model-change-before")
self.core.get("update_progress")("Aligning model")
self.core.get("disable_progress_cancel_button")()
progress = self.core.get("progress")
progress.update(text="Aligning model")
progress.disable_cancel()
progress.set_multiple(len(models), "Model")
shift = [self.gui.get_object("ShiftPosition%s" % axis).get_value()
for axis in "XYZ"]
# TODO: main/sub progress bar for multiple models
for model in models:
model.shift(shift[0], shift[1], shift[2],
callback=self.core.get("update_progress"))
callback=progress.update)
progress.update_multiple()
progress.finish()
self.core.emit_event("model-change-after")
def _align_model(self, widget=None):
......@@ -90,8 +93,6 @@ class ModelPosition(pycam.Plugins.PluginBase):
if not models:
return
self.core.emit_event("model-change-before")
self.core.get("update_progress")("Shifting model")
self.core.get("disable_progress_cancel_button")()
dest = [self.gui.get_object("AlignPosition%s" % axis).get_value()
for axis in "XYZ"]
shift_values = []
......@@ -110,10 +111,14 @@ class ModelPosition(pycam.Plugins.PluginBase):
else:
shift = dest - max_axis
shift_values.append(shift)
# TODO: main/sub progress bar for multiple models
progress = self.core.get("progress")
progress.update(text="Shifting model")
progress.disable_cancel()
progress.set_multiple(len(models), "Model")
for model in models:
model.shift(shift_values[0], shift_values[1], shift_values[2],
callback=self.core.get("update_progress"))
callback=progress.update)
progress.update_multiple()
progress.finish()
self.core.emit_event("model-change-after")
......@@ -73,8 +73,9 @@ class ModelProjection(pycam.Plugins.PluginBase):
models = self._get_projectable_models()
if not models:
return
self.core.get("update_progress")("Calculating 2D projection")
# TODO: main/sub progress for multiple models
progress = self.core.get("progress")
progress.update(text="Calculating 2D projection")
progress.set_multiple(len(models), "Model")
for model in models:
for objname, z_level in (("ProjectionModelTop", model.maxz),
("ProjectionModelMiddle", (model.minz + model.maxz) / 2.0),
......@@ -84,7 +85,8 @@ class ModelProjection(pycam.Plugins.PluginBase):
if self.gui.get_object(objname).get_active():
plane = Plane(Point(0, 0, z_level), Vector(0, 0, 1))
self.log.info("Projecting 3D model at level z=%g" % plane.p.z)
new_model = model.get_waterline_contour(plane)
new_model = model.get_waterline_contour(plane,
callback=progress.update)
if new_model:
self.core.get("load_model")(new_model)
model_manager = self.core.get("models")
......@@ -102,4 +104,6 @@ class ModelProjection(pycam.Plugins.PluginBase):
self.log.warn("The 2D projection at z=%g is empty. Aborted." % \
plane.p.z)
break
progress.update_multiple()
progress.finish()
......@@ -60,8 +60,6 @@ class ModelRotation(pycam.Plugins.PluginBase):
if not models:
return
self.core.emit_event("model-change-before")
self.core.get("update_progress")("Rotating model")
self.core.get("disable_progress_cancel_button")()
for axis in "XYZ":
if self.gui.get_object("RotationAxis%s" % axis).get_active():
break
......@@ -75,9 +73,13 @@ class ModelRotation(pycam.Plugins.PluginBase):
break
matrix = pycam.Geometry.Matrix.get_rotation_matrix_axis_angle(
axis_vector, angle, use_radians=False)
# TODO: main/sub progress for multiple models
progress = self.core.get("progress")
progress.update(text="Rotating model")
progress.disable_cancel()
progress.set_multiple(len(models), "Model")
for model in models:
model.transform_by_matrix(matrix,
callback=self.core.get("update_progress"))
model.transform_by_matrix(matrix, callback=progress.update)
progress.update_multiple()
self.core.emit_event("model-change-after")
progress.finish()
......@@ -109,11 +109,14 @@ class ModelScaling(pycam.Plugins.PluginBase):
if (factor <= 0) or (factor == 1):
return
self.core.emit_event("model-change-before")
self.core.get("update_progress")("Scaling model")
self.core.get("disable_progress_cancel_button")()
# TODO: main/sub progress for multiple models
progress = self.core.get("progress")
progress.update(text="Scaling model")
progress.disable_cancel()
progress.set_multiple(len(models), "Model")
for model in models:
model.scale(factor, callback=self.core.get("update_progress"))
model.scale(factor, callback=progress.update)
progress.update_multiple()
progress.finish()
self.core.emit_event("model-change-after")
def _scale_model_axis_fit(self, widget=None, proportionally=False):
......@@ -129,12 +132,14 @@ class ModelScaling(pycam.Plugins.PluginBase):
factor = value / (getattr(model, "max" + axis_suffix) - \
getattr(model, "min" + axis_suffix))
self.core.emit_event("model-change-before")
self.core.get("update_progress")("Scaling model")
self.core.get("disable_progress_cancel_button")()
# TODO: main/sub progress for multiple models
progress = self.core.get("progress")
progress.update(text="Scaling model")
progress.disable_cancel()
progress.set_multiple(len(models), "Model")
for model in models:
# TODO: use different scaling for multiple models
if proportionally:
model.scale(factor, callback=self.core.get("update_progress"))
model.scale(factor, callback=progress.update)
else:
factor_x, factor_y, factor_z = (1, 1, 1)
if index == 0:
......@@ -146,6 +151,8 @@ class ModelScaling(pycam.Plugins.PluginBase):
else:
return
model.scale(factor_x, factor_y, factor_z,
callback=self.core.get("update_progress"))
callback=progress.update)
progress.update_multiple()
progress.finish()
self.core.emit_event("model-change-after")
......@@ -58,15 +58,18 @@ class ModelSwapAxes(pycam.Plugins.PluginBase):
if not models:
return
self.core.emit_event("model-change-before")
self.core.get("update_progress")("Swap axes of model")
self.core.get("disable_progress_cancel_button")()
for axes, template in (("XY", "x_swap_y"), ("XZ", "x_swap_z"),
("YZ", "y_swap_z")):
if self.gui.get_object("SwapAxes%s" % axes).get_active():
break
# TODO: main/sub progress for multiple models
progress = self.core.get("progress")
progress.update(text="Swap axes of model")
progress.disable_cancel()
progress.set_multiple(len(models), "Model")
for model in models:
model.transform_by_template(template,
callback=self.core.get("update_progress"))
callback=progress.update)
progress.update_multiple()
progress.finish()
self.core.emit_event("model-change-after")
# -*- coding: utf-8 -*-
"""
$Id: __init__.py 1061 2011-04-12 13:14:12Z sumpfralle $
$Id$
Copyright 2011 Lars Kruse <devel@sumpfralle.de>
......@@ -43,7 +43,7 @@ class Models(pycam.Plugins.ListPluginBase):
self._gtk = gtk
model_frame = self.gui.get_object("ModelBox")
model_frame.unparent()
self.core.register_ui("main", "Models", model_frame, -50)
self.core.register_ui("main", "Models", model_frame, weight=-50)
model_handling_obj = self.gui.get_object("ModelHandlingNotebook")
def clear_model_handling_obj():
for index in range(model_handling_obj.get_n_pages()):
......
# -*- coding: utf-8 -*-
"""
$Id$
Copyright 2011 Lars Kruse <devel@sumpfralle.de>
This file is part of PyCAM.
PyCAM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PyCAM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import time
import datetime
import pycam.Plugins
class ProgressBar(pycam.Plugins.PluginBase):
UI_FILE = "progress_bar.ui"
def setup(self):
if self.gui:
box = self.gui.get_object("ProgressBox")
box.unparent()
self.core.register_ui("main_window", "Progress", box, 50)
self.core.add_item("progress", lambda: ProgressGTK(self.core, self.gui))
show_progress_button = self.gui.get_object("ShowToolpathProgressButton")
self.core.add_item("show_drill_progress",
show_progress_button.get_active,
show_progress_button.set_active)
return True
def teardown(self):
self.core.set("progress", None)
class ProgressGTK(object):
def __init__(self, core, gui):
import gtk
self._gtk = gtk
self._gui = gui
self.core = core
self._cancel_requested = False
self._start_time = 0
self._multi_maximum = 0
self._multi_counter = 0
self._multi_base_text = ""
self._last_gtk_events_time = None
self._main_widget = self._gui.get_object("ProgressWidget")
self._multi_widget = self._gui.get_object("MultipleProgressBar")
self._cancel_button = self._gui.get_object("ProgressCancelButton")
self._cancel_button.connect("clicked", self.cancel)
self._progress_bar = self._gui.get_object("ProgressBar")
self._progress_button = self._gui.get_object("ShowToolpathProgressButton")
self._start_time = time.time()
self._progress_button.show()
self.update(text="", percent=0)
self._cancel_button.set_sensitive(True)
self._progress_button.hide()
# enable "pulse" mode for a start (in case of unknown ETA)
self._progress_bar.pulse()
self._main_widget.show()
self._multi_widget.hide()
self._multi_widget.set_text("")
self._multi_widget.set_fraction(0)
self.core.emit_event("gui-disable")
def set_multiple(self, count, base_text=None):
if base_text:
self._multi_base_text = base_text
else:
self._multi_base_text = ""
self._multi_counter = 1
if count > 1:
self._multi_maximum = count
self.update_multiple(increment=False)
self._multi_widget.show()
else:
self._multi_maximum = 0
def update_multiple(self, increment=True):
if self._multi_maximum <= 1:
return
if increment:
self._multi_counter += 1
self._progress_bar.set_fraction(0)
if self._multi_base_text:
text = "%s %d/%d" % (self._multi_base_text, self._multi_counter,
self._multi_maximum)
else:
text = "%d/%d" % (self._multi_counter, self._multi_maximum)
self._multi_widget.set_text(text)
self._multi_widget.set_fraction(
float(self._multi_counter) / self._multi_maximum)
def disable_cancel(self):
self._cancel_button.set_sensitive(False)
def cancel(self):
self._cancel_requested = True
def finish(self):
self._main_widget.hide()
self._multi_widget.hide()
widget = self._main_widget
while widget:
if hasattr(widget, "resize_children"):
widget.resize_children()
if hasattr(widget, "check_resize"):
widget.check_resize()
widget = widget.get_parent()
self.core.emit_event("gui-enable")
def __del__(self):
self.finish()
def update(self, text=None, percent=None):
if not percent is None:
percent = min(max(percent, 0.0), 100.0)
self._progress_bar.set_fraction(percent/100.0)
if (not percent) and (self._progress_bar.get_fraction() == 0):
# use "pulse" mode until we reach 1% of the work to be done
self._progress_bar.pulse()
# update the GUI
current_time = time.time()
# Don't update the GUI more often than once per second.
# Exception: text-only updates
# This restriction improves performance and reduces the
# "snappiness" of the GUI.
if (self._last_gtk_events_time is None) \
or text \
or (self._last_gtk_events_time + 0.5 <= current_time):
# "estimated time of arrival" text
time_estimation_suffix = " remaining ..."
if self._progress_bar.get_fraction() > 0:
total_fraction = (self._progress_bar.get_fraction() + self._multi_counter) / max(1, self._multi_maximum)
eta_full = (time.time() - self._start_time) / total_fraction
if eta_full > 0:
eta_delta = eta_full - (time.time() - self._start_time)
eta_delta = int(round(eta_delta))
if hasattr(self, "_last_eta_delta"):
previous_eta_delta = self._last_eta_delta
if eta_delta == previous_eta_delta + 1:
# We are currently toggling between two numbers.
# We want to avoid screen flicker, thus we just live
# with the slight inaccuracy.
eta_delta = self._last_eta_delta
self._last_eta_delta = eta_delta
eta_delta_obj = datetime.timedelta(seconds=eta_delta)
eta_text = "%s%s" % (eta_delta_obj, time_estimation_suffix)
else:
eta_text = None
else:
eta_text = None
if not text is None:
lines = [text]
else:
old_lines = self._progress_bar.get_text().split(os.linesep)
# skip the time estimation line
lines = [line for line in old_lines
if not line.endswith(time_estimation_suffix)]
if eta_text:
lines.append(eta_text)
self._progress_bar.set_text(os.linesep.join(lines))
# show the "show_tool_button" ("hide" is called in the progress decorator)
# TODO: move "in_progress" somewhere else
if self.core.get("toolpath_in_progress"):
self._progress_button.show()
while self._gtk.events_pending():
self._gtk.main_iteration()
if not text or (self._start_time + 5 < current_time):
# We don't store the timining if the text was changed.
# This is especially nice for the snappines during font
# initialization. This exception is only valid for the first
# five seconds of the operation.
self._last_gtk_events_time = current_time
# return if the user requested a break
return self._cancel_requested
# -*- coding: utf-8 -*-
"""
$Id: __init__.py 1061 2011-04-12 13:14:12Z sumpfralle $
$Id$
Copyright 2011 Lars Kruse <devel@sumpfralle.de>
......
......@@ -142,7 +142,7 @@ class PluginManager(object):
_log.debug("Initializing module %s (%s)" % (plugin_name, filename))
new_plugin = obj(self.core, plugin_name)
if not new_plugin.setup():
raise RuntimeError("Failed to load plugin '%s'" % str(name))
raise RuntimeError("Failed to load plugin '%s'" % str(plugin_name))
else:
self.modules[plugin_name] = new_plugin
......
......@@ -40,10 +40,10 @@ class FontCache(object):
of all available fonts.
"""
def __init__(self, font_dir=None, callback=None):
def __init__(self, font_dir=None, core=None):
self.font_dir = font_dir
self.fonts = {}
self.callback = callback
self.core = core
self._unused_font_files = list(self._get_font_files())
def is_loading_complete(self):
......@@ -96,15 +96,27 @@ class FontCache(object):
return self.fonts.values()[0]
def _load_all_files(self):
if self.core:
progress = self.core.get("progress")
progress.set_multiple(len(self._unused_font_files), "Loading font")
while not self.is_loading_complete():
self._load_next_file()
if self.core:
progress.update_multiple()
self._load_next_file(progress=progress)
if self.core:
progress.finish()
def _load_next_file(self):
def _load_next_file(self, progress=None):
if self.is_loading_complete():
return
filename = self._unused_font_files.pop(0)
charset = pycam.Importers.CXFImporter.import_font(filename,
callback=self.callback)
if progress:
callback = progress.update
else:
callback = None
charset = pycam.Importers.CXFImporter.import_font(filename, callback=callback)
if progress:
progress.finish()
if not charset is None:
for name in charset.get_names():
self.fonts[name] = charset
......
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