|
18 | 18 | import ezui |
19 | 19 | import defcon |
20 | 20 |
|
21 | | -from mojo.roboFont import OpenFont |
| 21 | +from mojo.roboFont import OpenFont, AllFonts |
22 | 22 | from mojo.extensions import getExtensionDefault, setExtensionDefault, ExtensionBundle |
23 | 23 | from lib.tools.misc import walkDirectoryForFile |
24 | 24 |
|
@@ -85,7 +85,8 @@ def build(self, sources=[]): |
85 | 85 |
|
86 | 86 | #= ScrollingVerticalStack |
87 | 87 | |---| @sources |
88 | | -(+-) @sourcesAddRemoveButton |
| 88 | +> (+-) @sourcesAddRemoveButton |
| 89 | +> ( Add Open UFO's ) @sourcesAddOpenUFOsButton |
89 | 90 |
|
90 | 91 | * HorizontalStack |
91 | 92 | > * Box @desktopFontsBox |
@@ -119,9 +120,7 @@ def build(self, sources=[]): |
119 | 120 | performDropCallback=self.sourcesPerformDropCallback |
120 | 121 | ) |
121 | 122 | ), |
122 | | - sourcesAddOpenUFO=dict( |
123 | | - width="fill", |
124 | | - alignment="left", |
| 123 | + sourcesAddOpenUFOsButton=dict( |
125 | 124 | gravity="leading", |
126 | 125 | ), |
127 | 126 | help=dict( |
@@ -176,6 +175,11 @@ def sourcesAddRemoveButtonRemoveCallback(self, sender): |
176 | 175 | table = self.w.getItem("sources") |
177 | 176 | table.removeSelectedItems() |
178 | 177 |
|
| 178 | + def sourcesAddOpenUFOsButtonCallback(self, sender): |
| 179 | + # add open ufo's only when they are saved on disk |
| 180 | + paths = [font.path for font in AllFonts() if font.path is not None] |
| 181 | + tableAddPathItems(self.w.getItem("sources"), paths) |
| 182 | + |
179 | 183 | def sourcesDropCandidateCallback(self, info): |
180 | 184 | table = self.w.getItem("sources") |
181 | 185 | sender = info["sender"] |
|
0 commit comments