def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) argparser = fse_patcher.makeArgParser() self.logger = _logging.getLogger(__name__) self.checkboxargs = [] self.valueargs = [] for action in argparser._actions: if isinstance(action, argparse._HelpAction): pass elif isinstance(action, argparse._StoreTrueAction): self.checkboxargs.append( CheckboxArg(self, action.dest, action.help)) elif isinstance(action, argparse._StoreAction): self.valueargs.append( ValueArg(self, action.dest, action.help, action.nargs)) else: self.logger.error("Unknown type", type(action)) self.argstr_vis = tk.StringVar() self.argstr = [] self.initwindow() self.mainloop()
from PIL import Image from PIL import ImageChops import os import re import glob import math import _logging import yaml logger = _logging.getLogger(__name__) SEP = "_" REPLACE_THRESHHOLD = 0.5 # How much more efficient the patch needs to be than just using the image outright. def distance(t1, t2): """Returns the distance between two points in n-dimensional space. Used for determining the difference between two RGBA colors. Coordinate length must match. Args: t1 (tuple): Coordinates t2 (tuple): Coordinates Returns: float: Distance """ e2 = 0 for a, b in zip(t1, t2): e2 += (a - b)**2 return math.sqrt(e2)
def getLogger(*args): """getLogger() -> Logger""" return _logging.getLogger(*args)