Use a better FloatCtrl in patternEditor

This commit is contained in:
HomeWorld
2010-11-28 12:09:36 +02:00
parent c06e164fb1
commit ae34992acf
2 changed files with 231 additions and 17 deletions

View File

@@ -19,10 +19,9 @@
import wx
import bitmapLoader
from wx.lib.intctrl import IntCtrl
from wx.lib.masked.numctrl import NumCtrl
import service
from util import toClipboard, fromClipboard
from util import toClipboard, fromClipboard, FloatCtrl
###########################################################################
## Class DmgPatternEditorDlg
###########################################################################
@@ -104,26 +103,26 @@ class DmgPatternEditorDlg (wx.Dialog):
self.bmpEM = wx.StaticBitmap(self, wx.ID_ANY, self.embitmap)
dmgeditSizer.Add(self.bmpEM, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 5)
self.editEm = NumCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize)
self.editEm.SetFractionWidth(2)
self.editEm = FloatCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize)
self.editEm.SetPrecision(2)
dmgeditSizer.Add(self.editEm, 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5)
self.bmpTHERM = wx.StaticBitmap(self, wx.ID_ANY, self.thermbitmap)
dmgeditSizer.Add(self.bmpTHERM, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT, 25)
self.editThermal = NumCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize, 0)
self.editThermal.SetFractionWidth(2)
self.editThermal = FloatCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize, 0)
self.editThermal.SetPrecision(2)
dmgeditSizer.Add(self.editThermal, 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5)
self.bmpKIN = wx.StaticBitmap(self, wx.ID_ANY, self.kinbitmap)
dmgeditSizer.Add(self.bmpKIN, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 5)
self.editKinetic = NumCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize)
self.editKinetic.SetFractionWidth(2)
self.editKinetic = FloatCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize)
self.editKinetic.SetPrecision(2)
dmgeditSizer.Add(self.editKinetic, 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5)
self.bmpEXP = wx.StaticBitmap(self, wx.ID_ANY, self.expbitmap)
dmgeditSizer.Add(self.bmpEXP, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT, 25)
self.editExplosive = NumCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize, 0)
self.editExplosive.SetFractionWidth(2)
self.editExplosive = FloatCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize, 0)
self.editExplosive.SetPrecision(2)
dmgeditSizer.Add(self.editExplosive, 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5)
contentSizer.Add(dmgeditSizer, 1, wx.EXPAND | wx.ALL, 5)
@@ -166,12 +165,6 @@ class DmgPatternEditorDlg (wx.Dialog):
bsize = self.GetBestSize()
self.SetSize((-1,bsize.height))
self.editEm.SetLimited(True)
self.editThermal.SetLimited(True)
self.editKinetic.SetLimited(True)
self.editExplosive.SetLimited(True)
self.editEm.SetMin(0)
self.editThermal.SetMin(0)
self.editKinetic.SetMin(0)