blob: 79ba06b3d6a1fb062fd70f2f9802e168e0ae8185 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# MenuTitle: TypArichive
__doc__="""
TODO
"""
from datetime import datetime
from os import path
import re
import shutil
def new_font_name(filename):
time_string = datetime.now().strftime('%Y%m%d%H%M')
return re.sub(r'\d{12}', time_string, filename)
font = Glyphs.font
filepath = font.filepath
# Glyphs.font.close()
font_directory = path.dirname(filepath)
archive_directory = path.join(font_directory, '_archive')
new_font_path = path.join(
font_directory,
new_font_name(
path.basename(filepath)))
shutil.copy2(filepath, new_font_path)
shutil.move(filepath, archive_directory)
font.close()
Glyphs.open(new_font_path)
Glyphs.font.familyName = new_font_name(Glyphs.font.familyName)
# Close font
# Copy font file to new file
# Move old file to archive
# Open new file
# Rename font name with current timestamp
|