Skip to content

Commit

Permalink
refactor: removed any 'os' module dependencies, improved datestring g…
Browse files Browse the repository at this point in the history
…eneration
  • Loading branch information
philip-harr committed Jul 10, 2019
1 parent 835adb5 commit b617040
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tools/drace-gui/drace-gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


import xml.etree.ElementTree as ET
import os
import shutil
import argparse
import pathlib
Expand Down Expand Up @@ -283,7 +282,8 @@ def __countTopStackOccurences(self, target):

fig.add_axes(ax)
#plt.show()
plt.savefig(os.path.join(target+'/'+self.__topStackGraphFileName), dpi=300, format='png', bbox_inches='tight', orientation='landscape') # use format='svg' or 'pdf' for vectorial pictures
figPath = pathlib.Path(target+'/'+self.__topStackGraphFileName)
plt.savefig(str(figPath), dpi=300, format='png', bbox_inches='tight', orientation='landscape') # use format='svg' or 'pdf' for vectorial pictures

def __createErrorList(self):
self.__strErrors = str()
Expand Down Expand Up @@ -496,7 +496,7 @@ def parseArgumentString(fileList, strEntries):

def returnDateString():
date = datetime.datetime.now()
return (str(date.year)+str(date.month)+str(date.day)+'_'+str(date.hour)+str(date.minute))
return date.strftime('%Y%m%d_%H%M')


def main():
Expand Down Expand Up @@ -563,10 +563,15 @@ def main():
output.close()

#copy needed files to destination
if os.path.isdir(str(targetDirectory)+"/css"):
shutil.rmtree(str(targetDirectory)+"/css")
if os.path.isdir(str(targetDirectory)+"/js"):
shutil.rmtree(str(targetDirectory)+"/js")
cssPath = pathlib.Path(str(targetDirectory)+"/css")
jsPath = pathlib.Path(str(targetDirectory)+"/js")

if cssPath.is_dir():
shutil.rmtree(str(cssPath))

if jsPath.is_dir():
shutil.rmtree(str(jsPath))

shutil.copytree(g_CSSPATH, str(targetDirectory)+"/css")
shutil.copytree(g_JSPATH, str(targetDirectory)+"/js")
shutil.copy('templates/legend.png', str(targetDirectory))
Expand Down

0 comments on commit b617040

Please sign in to comment.