ui.py aç // arat elif Type == "radio_button": parent.Children[Index] = RadioButton() parent.Children[Index].SetParent(parent) self.LoadElementButton(parent.Children[Index], ElementValue, parent) // altına ekle elif Type == "radio_button2": parent.Children[Index] = RadioButton2() parent.Children[Index].SetParent(parent) self.LoadElementButton(parent.Children[Index], ElementValue, parent) // arat class RadioButton(Button): def __init__(self): Button.__init__(self) def __del__(self): Button.__del__(self) def RegisterWindow(self, layer): self.hWnd = wndMgr.RegisterRadioButton(self, layer) // altına ekle class RadioButton2(Button2): def __init__(self): Button2.__init__(self) def __del__(self): Button2.__del__(self) def RegisterWindow(self, layer): self.hWnd = wndMgr.RegisterRadioButton(self, layer) class Button2(Window): def __init__(self, layer = "UI"): Window.__init__(self, layer) self.eventFunc = None self.eventArgs = None self.eventFuncList = [] self.eventArgsList = [] self.ButtonText = None self.ToolTipText = None def __del__(self): self.eventFunc = None self.eventArgs = None #self.eventFuncList = None #self.eventArgsList = None Window.__del__(self) def RegisterWindow(self, layer): self.hWnd = wndMgr.RegisterButton(self, layer) def SetUpVisual(self, filename): wndMgr.SetUpVisual(self.hWnd, filename) def SetOverVisual(self, filename): wndMgr.SetOverVisual(self.hWnd, filename) def SetDownVisual(self, filename): wndMgr.SetDownVisual(self.hWnd, filename) def SetDisableVisual(self, filename): wndMgr.SetDisableVisual(self.hWnd, filename) def GetUpVisualFileName(self): return wndMgr.GetUpVisualFileName(self.hWnd) def GetOverVisualFileName(self): return wndMgr.GetOverVisualFileName(self.hWnd) def GetDownVisualFileName(self): return wndMgr.GetDownVisualFileName(self.hWnd) def GetText(self): if not self.ButtonText: return "" return self.ButtonText.GetText() def Flash(self): wndMgr.Flash(self.hWnd) def Enable(self): wndMgr.Enable(self.hWnd) def Disable(self): wndMgr.Disable(self.hWnd) def Down(self): wndMgr.Down(self.hWnd) def SetUp(self): wndMgr.SetUp(self.hWnd) def SAFE_SetEvent(self, func, *args): self.eventFunc = __mem_func__(func) self.eventArgs = args self.eventFuncList.append(__mem_func__(func)) self.eventArgsList.append(args) def SetEvent(self, func, *args): if func == 0: # similar to the old behaviour of SetEvent(0) self.Hide() return self.eventFunc = func self.eventArgs = args self.eventFuncList.append(func) self.eventArgsList.append(args) def SetTextColor(self, color): if not self.ButtonText: return self.ButtonText.SetPackedFontColor(color) def SetText(self, text, height = 4): if not self.ButtonText: textLine = TextLine() textLine.SetParent(self) textLine.SetPosition(26, self.GetHeight()/2-2) textLine.SetPackedFontColor(0xffc3a777) textLine.SetVerticalAlignCenter() textLine.Show() self.ButtonText = textLine self.ButtonText.SetText(text) def SetTextAlignLeft(self, text, height = 4): if not self.ButtonText: textLine = TextLine() textLine.SetParent(self) textLine.SetPosition(4, self.GetHeight()/2) textLine.SetVerticalAlignCenter() textLine.SetHorizontalAlignLeft() textLine.Show() self.ButtonText = textLine #Äù½ºÆ® ¸®½ºÆ® UI¿¡ ¸ÂÃç À§Ä¡ ÀâÀ½ self.ButtonText.SetText(text) self.ButtonText.SetPosition(27, self.GetHeight()/2) self.ButtonText.SetVerticalAlignCenter() self.ButtonText.SetHorizontalAlignLeft() def SetFormToolTipText(self, type, text, x, y): if not self.ToolTipText: toolTip=createToolTipWindowDict[type]() toolTip.SetParent(self) toolTip.SetSize(0, 0) toolTip.SetHorizontalAlignCenter() toolTip.SetOutline() toolTip.Hide() toolTip.SetPosition(x + self.GetWidth()/2, y) self.ToolTipText=toolTip self.ToolTipText.SetText(text) def SetToolTipWindow(self, toolTip): self.ToolTipText=toolTip self.ToolTipText.SetParentProxy(self) def SetToolTipText(self, text, x=0, y = -19): self.SetFormToolTipText("TEXT", text, x, y) def CallEvent(self, *arg): snd.PlaySound("sound/ui/click.wav") if not arg: if self.eventFunc: apply(self.eventFunc, self.eventArgs) else: if self.eventFuncList: for i in xrange(len(self.eventFuncList)): apply(self.eventFuncList[i], self.eventArgsList[i]) def ShowToolTip(self): if self.ToolTipText: self.ToolTipText.Show() def HideToolTip(self): if self.ToolTipText: self.ToolTipText.Hide() def IsDown(self): return wndMgr.IsDown(self.hWnd)