Description
openedon Feb 29, 2024
File
'New Font...'
'Open...'
'Duplicate as...'
Notes:
The file open dialog at least needs to filter by accepted file type. It currently allows selecting of any file, which will lead to confusing errors. I am considering declaring .fontra and .rcjk as packages, then at least on macOS we can treat them as files. On Windows we would still need the "open font project folder" menu, and we probably need some error checking: what if the user selects a folder that is not a valid project? (not .ufo, .fontra or .rcjk).
The New font and Open (file) menu's need shortcuts: command-N and command-O respectively. Not sure how that can map to control-N and control-O on non-macOS.
Maybe add 'Duplidate as' to the file menu, which would allow the user to duplicate the current project (also TTF or OTF) as a .ufo, .fontra or .rcjk.
This would be useful for testing, and for creating a new project based on an existing one.
Maybe implemented by Fontra Pak, but triggered by the front end.
fileMenu = self.menuBar().addMenu("File")
newAction = fileMenu.addAction("New Font...")
newAction.triggered.connect(self.newFont)
openMenu = fileMenu.addMenu("Open...")
openFolderAction = openMenu.addAction("Open .fontra, .ufo or .rcjk ...")
openFolderAction.triggered.connect(self.openFolder)
openFileAction = openMenu.addAction(
"Open TTF, OTF, Designspace or GlyphsApp..."
)
openFileAction.triggered.connect(self.openFile)
def openFolder(self):
projectPath = QFileDialog.getExistingDirectory(
self, "Open Fontra Folder", "/home/user/", QFileDialog.Option.ShowDirsOnly
)
if os.path.exists(projectPath):
openFile(projectPath, self.port)
def openFile(self):
dialog = QFileDialog.getOpenFileName(self, "Open File")
projectPath = dialog[0]
if os.path.exists(projectPath):
openFile(projectPath, self.port)