inkex.utils.debug("Please restart Inkscape to let the changes take effect.")
else:
inkex.utils.debug("Nothing to do! MightyScape is already up to date!")
exceptgit.exc.GitCommandErrorase:
self.msg("Error: ")
self.msg(e)
returnFalse
returnTrue
defadd_arguments(self,pars):
pars.add_argument("--tab")
pars.add_argument("--convert_to_git",type=inkex.Boolean,default=False,help="If you downloaded MightyScape as .zip or .tar.gz you cannot upgrade using this extension. But you can convert your downloaded directory to a .git one by enabling this option")
pars.add_argument("--stash_untracked",type=inkex.Boolean,default=False,help="Stash untracked files and continue to upgrade")
defeffect(self):
warnings.simplefilter('ignore',ResourceWarning)#suppress "enable tracemalloc to get the object allocation traceback"
#get the directory of mightyscape
extension_dir=os.path.abspath(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../'))#go up to main dir /home/<user>/.config/inkscape/extensions/mightyscape-1.X/
main_dir=os.path.abspath(os.path.join(extension_dir,'../../'))#go up to main dir /home/<user>/.config/inkscape/extensions/mightyscape-1.X/
#create some statistics
totalFolders=0
forroot,folders,filesinos.walk(extension_dir):
totalFolders+=len(folders)
break#prevent descending into subfolders
totalInx=0
forroot,folders,filesinos.walk(extension_dir):
forfileinfiles:
iffile.endswith('.inx'):
totalInx+=1
inkex.utils.debug("Locally there are {} extension folders with {} .inx files!\n".format(totalFolders,totalInx))
self.msg("MightyScape .git directory was not found. It seems you installed MightyScape the traditional way (by downloading and extracting from archive). Please install MightyScape using the git clone method if you want to use the upgrade function. More details can be found in the official README.")