aboutsummaryrefslogtreecommitdiffstats
path: root/Lib/defconQt/fontView.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/defconQt/fontView.py')
-rw-r--r--Lib/defconQt/fontView.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/Lib/defconQt/fontView.py b/Lib/defconQt/fontView.py
index 0dbb9d1..80aabec 100644
--- a/Lib/defconQt/fontView.py
+++ b/Lib/defconQt/fontView.py
@@ -11,6 +11,7 @@ from defconQt.spaceCenter import MainSpaceWindow
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
+from collections import OrderedDict
import os, pickle, traceback
cannedDesign = [
@@ -194,6 +195,14 @@ class InspectorWindow(QWidget):
mainLayout.addWidget(transformGroup)
self.setLayout(mainLayout)
+ def showEvent(self, event):
+ super(InspectorWindow, self).showEvent(event)
+ screenRect = QApplication.desktop().screenGeometry()
+ widgetRect = self.frameGeometry()
+ x = screenRect.width() - (widgetRect.width() + 20)
+ y = screenRect.center().y() - widgetRect.height() / 2
+ self.move(x, y)
+
def hSymmetry(self):
xMin, yMin, xMax, yMax = self._glyph.controlPointBounds
for contour in self._glyph:
@@ -672,7 +681,7 @@ class MainWindow(QMainWindow):
fontPath = self.sender().toolTip()
self.openFile(fontPath)
- def saveFile(self, path=None):
+ def saveFile(self, path=None, ufoFormatVersion=3):
if path is None and self.font.path is None:
self.saveFileAs()
else:
@@ -684,7 +693,7 @@ class MainWindow(QMainWindow):
for glyph in glyphs:
glyphNames.append(glyph.name)
self.font.lib["public.glyphOrder"] = glyphNames
- self.font.save(path=path)
+ self.font.save(path, ufoFormatVersion)
self.font.dirty = False
for glyph in self.font:
glyph.dirty = False
@@ -692,10 +701,19 @@ class MainWindow(QMainWindow):
self.setWindowModified(False)
def saveFileAs(self):
- path, ok = QFileDialog.getSaveFileName(self, "Save File", '',
- "UFO Fonts (*.ufo)")
+ fileFormats = OrderedDict([
+ ("UFO Font version 3 (*.ufo)", 3),
+ ("UFO Fonts version 2 (*.ufo)", 2),
+ ])
+ # TODO: see if OSX works nicely with UFO as files, then switch to directory
+ # on platforms that need it
+ dialog = QFileDialog(self, "Save File", None, ";;".join(fileFormats.keys()))
+ dialog.setAcceptMode(QFileDialog.AcceptSave)
+ ok = dialog.exec_()
if ok:
- self.saveFile(path)
+ nameFilter = dialog.selectedNameFilter()
+ path = dialog.selectedFiles()[0]
+ self.saveFile(path, fileFormats[nameFilter])
self.setWindowTitle()
#return ok