- Reverted a patch for the fonts.
This commit is contained in:
parent
ef2af6b097
commit
ee5d0cbfe8
@ -153,13 +153,6 @@ class AttackThread(threading.Thread):
|
|||||||
return
|
return
|
||||||
graphLine("%s [%s]" % (edge,atxt))
|
graphLine("%s [%s]" % (edge,atxt))
|
||||||
|
|
||||||
# Precompute font name
|
|
||||||
# Set a font with sans
|
|
||||||
# We only retrieve the name, so the size '9' here is
|
|
||||||
# irrelevant.
|
|
||||||
font = wx.Font(9,wx.SWISS,wx.NORMAL,wx.NORMAL)
|
|
||||||
self.fontname = font.GetFaceName()
|
|
||||||
|
|
||||||
# write all graph lines but add layout modifiers
|
# write all graph lines but add layout modifiers
|
||||||
for l in txt.splitlines():
|
for l in txt.splitlines():
|
||||||
fp.write(l)
|
fp.write(l)
|
||||||
@ -172,22 +165,23 @@ class AttackThread(threading.Thread):
|
|||||||
#graphLine("nodesep=0.1")
|
#graphLine("nodesep=0.1")
|
||||||
#graphLine("ranksep=0.001")
|
#graphLine("ranksep=0.001")
|
||||||
#graphLine("mindist=0.1")
|
#graphLine("mindist=0.1")
|
||||||
|
if sys.platform.startswith("lin"):
|
||||||
# Set fontname
|
# For Linux, choose Helvetica
|
||||||
fontstring = "fontname=%s" % (self.fontname)
|
# TODO
|
||||||
setAttr(fontstring,EDGE)
|
# This is really a Mac font so it might not be
|
||||||
|
# available. Still, it works better on my Ubuntu
|
||||||
# Stupid Mac <> Graphviz bug fix
|
# than Verdana, and finding a good sans default for
|
||||||
if (sys.platform.startswith("mac")) or (sys.platform.startswith("darwin")):
|
# linux seems problematic.
|
||||||
# Note that dot on Mac cannot find the fonts by default,
|
setAttr("fontname=\"Helvetica\"")
|
||||||
# and we have to set them accordingly.
|
if sys.platform.startswith("mac"):
|
||||||
os.environ["DOTFONTPATH"]="~/Library/Fonts:/Library/Fonts:/System/Library/Fonts"
|
# For Mac choose Helvetica
|
||||||
|
setAttr("fontname=\"Helvetica\"")
|
||||||
# Select font size
|
if sys.platform.startswith("win"):
|
||||||
|
# For Windows choose Verdana
|
||||||
|
setAttr("fontname=\"Verdana\"")
|
||||||
if self.parent and self.parent.mainwin:
|
if self.parent and self.parent.mainwin:
|
||||||
fontsize = self.parent.mainwin.settings.fontsize
|
fontsize = self.parent.mainwin.settings.fontsize
|
||||||
setAttr("fontsize=%s" % fontsize)
|
setAttr("fontsize=%s" % fontsize)
|
||||||
|
|
||||||
#setAttr("height=\"0.1\"",NODE)
|
#setAttr("height=\"0.1\"",NODE)
|
||||||
#setAttr("width=\"1.0\"",NODE)
|
#setAttr("width=\"1.0\"",NODE)
|
||||||
#setAttr("margin=\"0.3,0.03\"",NODE)
|
#setAttr("margin=\"0.3,0.03\"",NODE)
|
||||||
@ -208,29 +202,25 @@ class AttackThread(threading.Thread):
|
|||||||
(fd2,fpname2) = Tempfile.tempcleaned(ext)
|
(fd2,fpname2) = Tempfile.tempcleaned(ext)
|
||||||
f = os.fdopen(fd2,'w')
|
f = os.fdopen(fd2,'w')
|
||||||
|
|
||||||
cmd = "dot -T%s >%s" % (type,fpname2)
|
cmd = "dot -T%s" % (type)
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
cin,cout = os.popen2(cmd,'b')
|
cin,cout = os.popen2(cmd,'b')
|
||||||
|
|
||||||
self.writeGraph(attack.scytherDot,cin)
|
self.writeGraph(attack.scytherDot,cin)
|
||||||
cin.flush()
|
|
||||||
cin.close()
|
cin.close()
|
||||||
cout.close()
|
|
||||||
|
|
||||||
|
for l in cout.read():
|
||||||
|
f.write(l)
|
||||||
|
|
||||||
|
cout.close()
|
||||||
f.flush()
|
f.flush()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
# Print
|
|
||||||
print fpname2
|
|
||||||
raw_input()
|
|
||||||
|
|
||||||
# if this is done, store and report
|
# if this is done, store and report
|
||||||
attack.filetype = type
|
attack.filetype = type
|
||||||
attack.file = fpname2 # this is where the file name is stored
|
attack.file = fpname2 # this is where the file name is stored
|
||||||
|
|
||||||
# Maybe we should remove the temporary file... TODO
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class VerificationWindow(wx.Dialog):
|
class VerificationWindow(wx.Dialog):
|
||||||
|
Loading…
Reference in New Issue
Block a user