kopia lustrzana https://github.com/inkstitch/inkstitch
rodzic
097451eb8b
commit
bef98ef4eb
|
@ -6,7 +6,7 @@
|
|||
import json
|
||||
import os
|
||||
|
||||
import appdirs
|
||||
import platformdirs
|
||||
from inkex import errormsg
|
||||
|
||||
from ..i18n import _
|
||||
|
@ -31,7 +31,7 @@ class LetteringCustomFontDir(InkstitchExtension):
|
|||
data = {'custom_font_dir': '%s' % path}
|
||||
|
||||
try:
|
||||
config_path = appdirs.user_config_dir('inkstitch')
|
||||
config_path = platformdirs.user_config_dir('inkstitch')
|
||||
except ImportError:
|
||||
config_path = os.path.expanduser('~/.inkstitch')
|
||||
if not os.path.exists(config_path):
|
||||
|
@ -43,7 +43,7 @@ class LetteringCustomFontDir(InkstitchExtension):
|
|||
|
||||
|
||||
def get_custom_font_dir():
|
||||
custom_font_dir_path = os.path.join(appdirs.user_config_dir('inkstitch'), 'custom_dirs.json')
|
||||
custom_font_dir_path = os.path.join(platformdirs.user_config_dir('inkstitch'), 'custom_dirs.json')
|
||||
try:
|
||||
with open(custom_font_dir_path, 'r') as custom_dirs:
|
||||
custom_dir = json.load(custom_dirs)
|
||||
|
|
|
@ -14,7 +14,7 @@ from copy import deepcopy
|
|||
from datetime import date
|
||||
from threading import Thread
|
||||
|
||||
import appdirs
|
||||
import platformdirs
|
||||
import wx
|
||||
from flask import Flask, Response, jsonify, request, send_from_directory
|
||||
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
||||
|
@ -36,7 +36,7 @@ def datetimeformat(value, format='%Y/%m/%d'):
|
|||
|
||||
|
||||
def defaults_path():
|
||||
defaults_dir = appdirs.user_config_dir('inkstitch')
|
||||
defaults_dir = platformdirs.user_config_dir('inkstitch')
|
||||
|
||||
if not os.path.exists(defaults_dir):
|
||||
os.makedirs(defaults_dir)
|
||||
|
|
|
@ -89,8 +89,8 @@ class PresetsPanel(wx.Panel):
|
|||
@cache
|
||||
def presets_path(self):
|
||||
try:
|
||||
import appdirs
|
||||
config_path = appdirs.user_config_dir('inkstitch')
|
||||
import platformdirs
|
||||
config_path = platformdirs.user_config_dir('inkstitch')
|
||||
except ImportError:
|
||||
config_path = os.path.expanduser('~/.inkstitch')
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import os
|
||||
|
||||
import appdirs
|
||||
import platformdirs
|
||||
|
||||
from ..extensions.lettering_custom_font_dir import get_custom_font_dir
|
||||
from ..lettering import Font
|
||||
|
@ -36,7 +36,7 @@ def get_font_paths():
|
|||
font_paths = {
|
||||
get_bundled_dir("fonts"),
|
||||
os.path.expanduser("~/.inkstitch/fonts"),
|
||||
os.path.join(appdirs.user_config_dir('inkstitch'), 'fonts'),
|
||||
os.path.join(platformdirs.user_config_dir('inkstitch'), 'fonts'),
|
||||
get_custom_font_dir()
|
||||
}
|
||||
return font_paths
|
||||
|
|
|
@ -8,7 +8,7 @@ import os
|
|||
import pickle
|
||||
import sqlite3
|
||||
|
||||
import appdirs
|
||||
import platformdirs
|
||||
import diskcache
|
||||
|
||||
from lib.utils.settings import global_settings
|
||||
|
@ -31,13 +31,13 @@ def get_stitch_plan_cache():
|
|||
global __stitch_plan_cache
|
||||
|
||||
if __stitch_plan_cache is None:
|
||||
cache_dir = os.path.join(appdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan')
|
||||
cache_dir = os.path.join(platformdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan')
|
||||
size_limit = global_settings['cache_size'] * 1024 * 1024
|
||||
try:
|
||||
__stitch_plan_cache = diskcache.Cache(cache_dir, size=size_limit)
|
||||
except (sqlite3.DatabaseError, sqlite3.OperationalError):
|
||||
# reset cache database file if it couldn't parse correctly
|
||||
cache_file = os.path.join(appdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan', 'cache.db')
|
||||
cache_file = os.path.join(platformdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan', 'cache.db')
|
||||
if os.path.exists(cache_file):
|
||||
os.remove(cache_file)
|
||||
__stitch_plan_cache = diskcache.Cache(cache_dir, size=size_limit)
|
||||
|
|
|
@ -8,7 +8,7 @@ import sys
|
|||
from os.path import dirname, realpath
|
||||
from pathlib import Path
|
||||
|
||||
import appdirs
|
||||
import platformdirs
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
import tomllib # built-in in Python 3.11+
|
||||
|
@ -42,7 +42,7 @@ def get_resource_dir(name):
|
|||
|
||||
|
||||
def get_user_dir(name=None):
|
||||
path = appdirs.user_config_dir("inkstitch")
|
||||
path = platformdirs.user_config_dir("inkstitch")
|
||||
|
||||
if name is not None:
|
||||
path = os.path.join(path, name)
|
||||
|
|
|
@ -15,7 +15,7 @@ backports.functools_lru_cache
|
|||
networkx
|
||||
shapely>=2.0.0
|
||||
lxml
|
||||
appdirs
|
||||
platformdirs
|
||||
numpy
|
||||
jinja2>2.9
|
||||
requests
|
||||
|
|
Ładowanie…
Reference in New Issue