NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

skinNameDialogue.py (2946B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\cosmetics\ship\pages\studio\skinNameDialogue.py
      2 import eveicon
      3 from carbonui import uiconst
      4 from carbonui.control.forms import formComponent, formValidators
      5 from carbonui.control.forms.form import Form, FormActionSubmit, FormActionCancel
      6 from carbonui.control.forms.formWindow import FormWindow
      7 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      8 from cosmetics.client.ships.skins.live_data import current_skin_design
      9 from cosmetics.common.ships.skins.static_data import skin_const
     10 from localization import GetByLabel
     11 from signals import Signal
     12 
     13 class SkinNameDialogue(FormWindow):
     14     default_windowID = 'SkinNameDialogue'
     15     COMPONENT_NAME = 'name'
     16     COMPONENT_LINE = 'line'
     17 
     18     def ApplyAttributes(self, attributes):
     19         super(FormWindow, self).ApplyAttributes(attributes)
     20         self.window_name = attributes.window_name
     21         self.on_submit = Signal('on_submit')
     22         self.on_submit_failed = Signal('on_submit_failed')
     23         components = [formComponent.Text(name=self.COMPONENT_NAME, label=GetByLabel('UI/Personalization/ShipSkins/SKINR/Studio/SKINName'), value=current_skin_design.get().name, validators=[formValidators.Length(skin_const.name_min_length, skin_const.name_max_length), formValidators.IllegalCharacters()]), formComponent.Text(name=self.COMPONENT_LINE, label=GetByLabel('UI/Personalization/ShipSkins/SKINR/Studio/SKINLineNameOptional'), value=current_skin_design.get().line_name, validators=[formValidators.Length(skin_const.line_name_min_length, skin_const.line_name_max_length), formValidators.IllegalCharacters()])]
     24         self.form = Form(name=self.window_name, icon=eveicon.load, components=components, actions=[FormActionSubmit(label=self.get_action_button_name(), func=self.on_form_submit), FormActionCancel()])
     25         self.SetCaption(self.form.name)
     26         if self.form.icon:
     27             self.icon = self.form.icon
     28         self.formCont = ContainerAutoSize(name='formCont', parent=self.content, align=uiconst.TOTOP, callback=self.OnFormContHeightChanged)
     29         self.ConstructLayout()
     30         self.ConnectSignals()
     31 
     32     def get_action_button_name(self):
     33         return GetByLabel('UI/Common/Buttons/Save')
     34 
     35     def on_form_submit(self, form):
     36         current_skin_design.get().name = form.get_component(self.COMPONENT_NAME).get_value()
     37         current_skin_design.get().line_name = form.get_component(self.COMPONENT_LINE).get_value()
     38         current_skin_design.add_to_undo_history()
     39 
     40     def OnSubmitActionFailed(self, action):
     41         self.on_submit_failed(self.form.get_submit_failed_reasons_text())
     42 
     43     def OnSubmitActionExecuted(self, action):
     44         self.on_submit()
     45         self.SetModalResult(self.form.get_value())
     46         self.Close()
     47 
     48 
     49 class RenameSkinDialogue(SkinNameDialogue):
     50 
     51     def get_action_button_name(self):
     52         return GetByLabel('UI/Common/Buttons/Apply')