def __init__(self):
        self.w = vanilla.FloatingWindow((250, 300), "Ramsay St. Settings", minSize=(250, 250), maxSize=(400, 700))
        
        self.w.showPreview = vanilla.CheckBox((10, 10, -10, 22), "Show Preview", value=RamsayStData.showPreview, callback=self.showPreviewCallback)

        self.w.fillColorText = vanilla.TextBox((10, 40, 110, 22), "Fill Color:")
        self.w.fillColor = vanilla.ColorWell((10, 60, 110, 40), color=RamsayStData.fillColor, callback=self.fillColorCallback)
        
        self.w.strokeColorText = vanilla.TextBox((130, 40, -10, 22), "Stroke Color:")
        self.w.strokeColor = vanilla.ColorWell((130, 60, -10, 40), color=RamsayStData.strokeColor, callback=self.strokeColorCallback)
        
        items = RamsayStData.getItems()
        columnDescriptions = [
                              dict(title="Glyph Name", key="glyphName"), 
                              dict(title="Left", key="left"), 
                              dict(title="Right", key="right"),
                              ]
        
        self.w.dataList = vanilla.List((10, 110, -10, -40), items, columnDescriptions=columnDescriptions, editCallback=self.dataListEditCallback)
        
        
        segmentDescriptions = [dict(title="+"), dict(title="-")]    
        self.w.addDel = vanilla.SegmentedButton((12, -30, 60, 20), segmentDescriptions, selectionStyle="momentary", callback=self.addDelCallback)
        self.w.addDel.getNSSegmentedButton().setSegmentStyle_(NSSegmentStyleSmallSquare)
        
        self.w.okButton = vanilla.Button((-70, -30, -15, 20), "Apply", callback=self.okCallback, sizeStyle="small")
        
        self.w.setDefaultButton(self.w.okButton)
        
        self.w.closeButton = vanilla.Button((-140, -30, -80, 20), "Cancel", callback=self.closeCallback, sizeStyle="small")
        self.w.closeButton.bind(".", ["command"])
        self.w.closeButton.bind(unichr(27), [])
        
        self.w.open()
    def __init__(self):
        self.w = vanilla.FloatingWindow((250, 300),
                                        "Ramsay St. Settings",
                                        minSize=(250, 250),
                                        maxSize=(400, 700))

        self.w.showPreview = vanilla.CheckBox(
            (10, 10, -10, 22),
            "Show Preview",
            value=RamsayStData.showPreview,
            callback=self.showPreviewCallback)

        self.w.fillColorText = vanilla.TextBox((10, 40, 110, 22),
                                               "Fill Color:")
        self.w.fillColor = vanilla.ColorWell((10, 60, 110, 40),
                                             color=RamsayStData.fillColor,
                                             callback=self.fillColorCallback)

        self.w.strokeColorText = vanilla.TextBox((130, 40, -10, 22),
                                                 "Stroke Color:")
        self.w.strokeColor = vanilla.ColorWell(
            (130, 60, -10, 40),
            color=RamsayStData.strokeColor,
            callback=self.strokeColorCallback)

        items = RamsayStData.getItems()
        columnDescriptions = [
            dict(title="Glyph Name", key="glyphName"),
            dict(title="Left", key="left"),
            dict(title="Right", key="right"),
        ]

        self.w.dataList = vanilla.List((10, 110, -10, -40),
                                       items,
                                       columnDescriptions=columnDescriptions,
                                       editCallback=self.dataListEditCallback)

        segmentDescriptions = [dict(title="+"), dict(title="-")]
        self.w.addDel = vanilla.SegmentedButton((12, -30, 60, 20),
                                                segmentDescriptions,
                                                selectionStyle="momentary",
                                                callback=self.addDelCallback)
        self.w.addDel.getNSSegmentedButton().setSegmentStyle_(
            NSSegmentStyleSmallSquare)

        self.w.okButton = vanilla.Button((-70, -30, -15, 20),
                                         "Apply",
                                         callback=self.okCallback,
                                         sizeStyle="small")

        self.w.setDefaultButton(self.w.okButton)

        self.w.closeButton = vanilla.Button((-140, -30, -80, 20),
                                            "Cancel",
                                            callback=self.closeCallback,
                                            sizeStyle="small")
        self.w.closeButton.bind(".", ["command"])
        self.w.closeButton.bind(unichr(27), [])

        self.w.open()
    def _importGlyphNames(self, path):
        if path:
            path = path[0]
            f = open(path, "r")
            lines = f.readlines()
            f.close()

            data = dict()
            for line in lines:
                if line.startswith("#"):
                    continue
                items = line.split()
                if len(items) != 3:
                    continue
                leftGlyphName, glyphName, rightGlyphName = items
                data[glyphName] = leftGlyphName, rightGlyphName

            RamsayStData.clear()
            RamsayStData.update(data)
            self.w.dataList.set(RamsayStData.getItems())
            self.updateView()
 def _importGlyphNames(self, path):
     if path:
         path = path[0]
         f = open(path, "r")
         lines = f.readlines()
         f.close()
         
         data = dict()
         for line in lines:
             if line.startswith("#"):
                 continue
             items = line.split()
             if len(items) != 3:
                 continue                
             glyphName, leftGlyphName, rightGlyphName = items
             data[glyphName] = leftGlyphName, rightGlyphName
         
         RamsayStData.clear()
         RamsayStData.update(data)
         self.w.dataList.set(RamsayStData.getItems())
         self.updateView()