<commit_before># -*- coding: utf-8 -*-
####################################################
##                                                ##
##           Image Occlusion Enhanced             ##
##                                                ##
##        Copyright (c) Glutanimate 2016          ##
##       (https://github.com/Glutanimate)         ##
##                                                ##
##     Original Image Occlusion 2.0 add-on is     ##
##         Copyright (c) 2012-2015 tmbb           ##
##           (https://github.com/tmbb)            ##
##                                                ##
####################################################

import os
import sys
import re
import tempfile

from PyQt4 import QtCore, QtGui

from aqt import mw, utils, webview, deckchooser, tagedit
from aqt.qt import *
from anki import hooks
from anki.utils import json

import etree.ElementTree as etree

import svgutils
from notes_from_svg import add_notes_non_overlapping, add_notes_overlapping
# import the icons
from resources import *

image_occlusion_help_link = "https://github.com/Glutanimate/image-occlusion-enhanced/wiki"

# get default file system encoding
encoding = sys.getfilesystemencoding()

# set various paths
os_home_dir = os.path.expanduser('~').decode(encoding)
addons_folder = mw.pm.addonFolder().encode('utf-8')
prefs_path = os.path.join(addons_folder, "image_occlusion_2", 
                          ".image_occlusion_2_prefs").decode('utf-8')

svg_edit_dir = os.path.join(os.path.dirname(__file__),
                            'svg-edit',
                            'svg-edit-2.6')
svg_edit_path = os.path.join(svg_edit_dir,
                            'svg-editor.html')
svg_edit_url = QtCore.QUrl.fromLocalFile(svg_edit_path)
svg_edit_url_string = svg_edit_url.toString()

#Add all configuration options we know at this point:
svg_edit_extensions = "ext-image-occlusion.js,ext-arrows.js,ext-markers.js,ext-shapes.js,ext-eyedropper.js"
svg_edit_url.setQueryItems([('initStroke[opacity]', '1'),
                            ('initStroke[color]', '2D2D2D'),
                            ('initStroke[width]', '0'),
                            ('initTool', 'rect'),
                            ('text[font_family]', 'sans-serif'),
                            ('extensions', svg_edit_extensions)])

FILE_DIALOG_MESSAGE = "Choose Image"
FILE_DIALOG_FILTER = "Image Files (*.png *jpg *.jpeg *.gif)"

IMAGE_QA_MODEL_NAME = "Image Q/A - 2.0 Enhanced"

default_conf = {'initFill[color]': '00AA7F',
                'mask_fill_color': 'FF0000',
                'io-version': '2.0-enhanced'}

default_prefs = {"prev_image_dir": os_home_dir}


def load_prefs(self):

    # check if synced configuration exists
    if not 'image_occlusion_conf' in mw.col.conf:
        self.mw.col.conf['image_occlusion_conf'] = default_conf

    # upgrade from Image Occlusion 2.0
    self.io_conf = mw.col.conf['image_occlusion_conf']
    if not 'io-version' in self.io_conf:
        # set io version
        self.io_conf['io-version'] = default_conf['io-version']
        # change default colours
        if self.io_conf['initFill[color]'] == "FFFFFF":
            self.io_conf['initFill[color]'] = default_conf['initFill[color]']
            self.io_conf['mask_fill_color'] = default_conf['mask_fill_color']
<commit_msg>Change default font of the text tool<commit_after># -*- coding: utf-8 -*-
####################################################
##                                                ##
##           Image Occlusion Enhanced             ##
##                                                ##
##        Copyright (c) Glutanimate 2016          ##
##       (https://github.com/Glutanimate)         ##
##                                                ##
##     Original Image Occlusion 2.0 add-on is     ##
##         Copyright (c) 2012-2015 tmbb           ##
##           (https://github.com/tmbb)            ##
##                                                ##
####################################################

import os
import sys
import re
import tempfile

from PyQt4 import QtCore, QtGui

from aqt import mw, utils, webview, deckchooser, tagedit
from aqt.qt import *
from anki import hooks
from anki.utils import json

import etree.ElementTree as etree

import svgutils
from notes_from_svg import add_notes_non_overlapping, add_notes_overlapping
# import the icons
from resources import *

image_occlusion_help_link = "https://github.com/Glutanimate/image-occlusion-enhanced/wiki"

# get default file system encoding
encoding = sys.getfilesystemencoding()

# set various paths
os_home_dir = os.path.expanduser('~').decode(encoding)
addons_folder = mw.pm.addonFolder().encode('utf-8')
prefs_path = os.path.join(addons_folder, "image_occlusion_2", 
                          ".image_occlusion_2_prefs").decode('utf-8')

svg_edit_dir = os.path.join(os.path.dirname(__file__),
                            'svg-edit',
                            'svg-edit-2.6')
svg_edit_path = os.path.join(svg_edit_dir,
                            'svg-editor.html')
svg_edit_url = QtCore.QUrl.fromLocalFile(svg_edit_path)
svg_edit_url_string = svg_edit_url.toString()

#Add all configuration options we know at this point:
svg_edit_extensions = "ext-image-occlusion.js,ext-arrows.js,ext-markers.js,ext-shapes.js,ext-eyedropper.js"
svg_edit_url.setQueryItems([('initStroke[opacity]', '1'),
                            ('initStroke[color]', '2D2D2D'),
                            ('initStroke[width]', '0'),
                            ('initTool', 'rect'),
                            ('text[font_family]', "'Helvetica LT Std', Arial, sans-serif"),
                            ('extensions', svg_edit_extensions)])

FILE_DIALOG_MESSAGE = "Choose Image"
FILE_DIALOG_FILTER = "Image Files (*.png *jpg *.jpeg *.gif)"

IMAGE_QA_MODEL_NAME = "Image Q/A - 2.0 Enhanced"

default_conf = {'initFill[color]': '00AA7F',
                'mask_fill_color': 'FF0000',
                'io-version': '2.0-enhanced'}

default_prefs = {"prev_image_dir": os_home_dir}


def load_prefs(self):

    # check if synced configuration exists
    if not 'image_occlusion_conf' in mw.col.conf:
        self.mw.col.conf['image_occlusion_conf'] = default_conf

    # upgrade from Image Occlusion 2.0
    self.io_conf = mw.col.conf['image_occlusion_conf']
    if not 'io-version' in self.io_conf:
        # set io version
        self.io_conf['io-version'] = default_conf['io-version']
        # change default colours
        if self.io_conf['initFill[color]'] == "FFFFFF":
            self.io_conf['initFill[color]'] = default_conf['initFill[color]']
            self.io_conf['mask_fill_color'] = default_conf['mask_fill_color']

{'fraction_non_alphanumeric': 0.1488095238095238, 'fraction_numerical': 0.011904761904761904, 'mean_word_length': 2.3027027027027027, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6327597', 'n_tokens_mistral': 2081, 'n_tokens_neox': 2001, 'n_words': 392}