Commit c10383ec authored by sumpfralle's avatar sumpfralle

moved the font dialog to a separate plugin


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1113 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 5abd9bb6
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<object class="GtkListStore" id="ModelList"> <object class="GtkListStore" id="ModelList">
<columns> <columns>
<!-- column-name id --> <!-- column-name id -->
<column type="gint"/> <column type="gulong"/>
<!-- column-name name --> <!-- column-name name -->
<column type="gchararray"/> <column type="gchararray"/>
<!-- column-name state --> <!-- column-name state -->
......
This diff is collapsed.
This diff is collapsed.
...@@ -94,9 +94,14 @@ class Settings(object): ...@@ -94,9 +94,14 @@ class Settings(object):
def get(self, key, default=None): def get(self, key, default=None):
if self.items.has_key(key): if self.items.has_key(key):
return self.items[key][self.GET_INDEX]() try:
result = self.items[key][self.GET_INDEX]()
except TypeError, err_msg:
log.info("Failed to retrieve setting '%s': %s" % (key, err_msg))
result = None
else: else:
return default result = default
return result
def set(self, key, value): def set(self, key, value):
if not self.items.has_key(key): if not self.items.has_key(key):
......
This diff is collapsed.
...@@ -35,6 +35,7 @@ class Models(pycam.Plugins.ListPluginBase): ...@@ -35,6 +35,7 @@ class Models(pycam.Plugins.ListPluginBase):
ATTRIBUTE_MAP = {"name": COLUMN_NAME, "visible": COLUMN_VISIBLE, ATTRIBUTE_MAP = {"name": COLUMN_NAME, "visible": COLUMN_VISIBLE,
"color": COLUMN_COLOR, "alpha": COLUMN_ALPHA} "color": COLUMN_COLOR, "alpha": COLUMN_ALPHA}
ICONS = {"visible": "visible.svg", "hidden": "visible_off.svg"} ICONS = {"visible": "visible.svg", "hidden": "visible_off.svg"}
# TODO: move this to the preferences dialog
DEFAULT_COLOR = (0.5, 0.5, 1.0, 1.0) DEFAULT_COLOR = (0.5, 0.5, 1.0, 1.0)
def setup(self): def setup(self):
......
...@@ -26,7 +26,7 @@ import pycam.Plugins ...@@ -26,7 +26,7 @@ import pycam.Plugins
class Toolpaths(pycam.Plugins.ListPluginBase): class Toolpaths(pycam.Plugins.ListPluginBase):
def setup(self): def setup(self):
self.core.add_item("toolpaths", self) self.core.add_item("toolpaths", lambda: self)
return True return True
def teardown(self): def teardown(self):
......
...@@ -99,11 +99,13 @@ class FontCache(object): ...@@ -99,11 +99,13 @@ class FontCache(object):
if self.core: if self.core:
progress = self.core.get("progress") progress = self.core.get("progress")
progress.set_multiple(len(self._unused_font_files), "Loading font") progress.set_multiple(len(self._unused_font_files), "Loading font")
else:
progress = None
while not self.is_loading_complete(): while not self.is_loading_complete():
if self.core:
progress.update_multiple()
self._load_next_file(progress=progress) self._load_next_file(progress=progress)
if self.core: if progress:
progress.update_multiple()
if progress:
progress.finish() progress.finish()
def _load_next_file(self, progress=None): def _load_next_file(self, progress=None):
...@@ -112,11 +114,11 @@ class FontCache(object): ...@@ -112,11 +114,11 @@ class FontCache(object):
filename = self._unused_font_files.pop(0) filename = self._unused_font_files.pop(0)
if progress: if progress:
callback = progress.update callback = progress.update
progress.update(text="Loading font file %s" % \
os.path.basename(filename))
else: else:
callback = None callback = None
charset = pycam.Importers.CXFImporter.import_font(filename, callback=callback) charset = pycam.Importers.CXFImporter.import_font(filename, callback=callback)
if progress:
progress.finish()
if not charset is None: if not charset is None:
for name in charset.get_names(): for name in charset.get_names():
self.fonts[name] = charset 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