- Minor fixes.

This commit is contained in:
ccremers 2006-08-04 22:08:00 +00:00
parent 4034e3a42e
commit 49fc9709d2
2 changed files with 25 additions and 23 deletions

View File

@ -49,24 +49,27 @@ class AttackDisplay(wx.ScrolledWindow):
self.SetScrollbars(0,0,0,0,0,0) self.SetScrollbars(0,0,0,0,0,0)
bmp = self.original bmp = self.original
if self.win.fit: if not bmp.Ok():
W = bmp.GetWidth() bmp = wx.EmptyBitmap((1,1))
H = bmp.GetHeight() else:
(sw,sh) = self.win.GetClientSizeTuple() if self.win.fit:
W = bmp.GetWidth()
H = bmp.GetHeight()
(sw,sh) = self.win.GetClientSizeTuple()
if W > sw: if W > sw:
# correct width # correct width
factor = float(sw) / W factor = float(sw) / W
W = sw W = sw
H = H * factor H = H * factor
if H > sh: if H > sh:
# correct height # correct height
factor = float(sh) / H factor = float(sh) / H
H = sh H = sh
W = W * factor W = W * factor
bmp = self.original.Scale(W,H) bmp = self.original.Scale(W,H)
self.Image.SetBitmap(wx.BitmapFromImage(bmp)) self.Image.SetBitmap(wx.BitmapFromImage(bmp))
#self.box.SetItemMinSize(self.Image.GetContainingSizer()) #self.box.SetItemMinSize(self.Image.GetContainingSizer())

View File

@ -152,20 +152,18 @@ class ResultWindow(wx.Frame):
def onViewButton(self,evt): def onViewButton(self,evt):
btn = evt.GetEventObject() btn = evt.GetEventObject()
(y,x) = self.grid.GetItemPosition(btn) w = Attackwindow.AttackWindow(btn.claim)
n = len(self.parent.claims) w.Show(True)
cln = n-y
cl = self.parent.claims[cln]
w = Attackwindow.AttackWindow(cl)
def onCloseWindow(self,evt): def onCloseWindow(self,evt):
# TODO we should kill self.thread # TODO we should kill self.thread
# Clean up # Clean up
for cl in self.parent.claims: for cl in self.parent.claims:
if cl.pngfile: for attack in cl.attacks:
os.unlink(cl.pngfile) if attack.pngfile:
cl.pngfile = None os.unlink(attack.pngfile)
attack.pngfile = None
self.parent.claims = None self.parent.claims = None
self.Destroy() self.Destroy()
@ -249,6 +247,7 @@ class ResultWindow(wx.Frame):
# add view button (if needed) # add view button (if needed)
n = len(cl.attacks) n = len(cl.attacks)
cl.button = wx.Button(self,-1,"%i %s" % (n,cl.stateName(n))) 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) grid.Add(cl.button,(ypos,5),(1,1),wx.ALIGN_CENTER_VERTICAL)
cl.button.Disable() cl.button.Disable()
if n > 0: if n > 0: