- Minor fixes.
This commit is contained in:
parent
4034e3a42e
commit
49fc9709d2
@ -49,24 +49,27 @@ class AttackDisplay(wx.ScrolledWindow):
|
||||
self.SetScrollbars(0,0,0,0,0,0)
|
||||
|
||||
bmp = self.original
|
||||
if self.win.fit:
|
||||
W = bmp.GetWidth()
|
||||
H = bmp.GetHeight()
|
||||
(sw,sh) = self.win.GetClientSizeTuple()
|
||||
if not bmp.Ok():
|
||||
bmp = wx.EmptyBitmap((1,1))
|
||||
else:
|
||||
if self.win.fit:
|
||||
W = bmp.GetWidth()
|
||||
H = bmp.GetHeight()
|
||||
(sw,sh) = self.win.GetClientSizeTuple()
|
||||
|
||||
if W > sw:
|
||||
# correct width
|
||||
factor = float(sw) / W
|
||||
W = sw
|
||||
H = H * factor
|
||||
if H > sh:
|
||||
# correct height
|
||||
factor = float(sh) / H
|
||||
H = sh
|
||||
W = W * factor
|
||||
if W > sw:
|
||||
# correct width
|
||||
factor = float(sw) / W
|
||||
W = sw
|
||||
H = H * factor
|
||||
if H > sh:
|
||||
# correct height
|
||||
factor = float(sh) / H
|
||||
H = sh
|
||||
W = W * factor
|
||||
|
||||
|
||||
bmp = self.original.Scale(W,H)
|
||||
bmp = self.original.Scale(W,H)
|
||||
|
||||
self.Image.SetBitmap(wx.BitmapFromImage(bmp))
|
||||
#self.box.SetItemMinSize(self.Image.GetContainingSizer())
|
||||
|
@ -152,20 +152,18 @@ class ResultWindow(wx.Frame):
|
||||
|
||||
def onViewButton(self,evt):
|
||||
btn = evt.GetEventObject()
|
||||
(y,x) = self.grid.GetItemPosition(btn)
|
||||
n = len(self.parent.claims)
|
||||
cln = n-y
|
||||
cl = self.parent.claims[cln]
|
||||
w = Attackwindow.AttackWindow(cl)
|
||||
w = Attackwindow.AttackWindow(btn.claim)
|
||||
w.Show(True)
|
||||
|
||||
def onCloseWindow(self,evt):
|
||||
# TODO we should kill self.thread
|
||||
|
||||
# Clean up
|
||||
for cl in self.parent.claims:
|
||||
if cl.pngfile:
|
||||
os.unlink(cl.pngfile)
|
||||
cl.pngfile = None
|
||||
for attack in cl.attacks:
|
||||
if attack.pngfile:
|
||||
os.unlink(attack.pngfile)
|
||||
attack.pngfile = None
|
||||
self.parent.claims = None
|
||||
|
||||
self.Destroy()
|
||||
@ -249,6 +247,7 @@ class ResultWindow(wx.Frame):
|
||||
# add view button (if needed)
|
||||
n = len(cl.attacks)
|
||||
cl.button = wx.Button(self,-1,"%i %s" % (n,cl.stateName(n)))
|
||||
cl.button.claim = cl
|
||||
grid.Add(cl.button,(ypos,5),(1,1),wx.ALIGN_CENTER_VERTICAL)
|
||||
cl.button.Disable()
|
||||
if n > 0:
|
||||
|
Loading…
Reference in New Issue
Block a user