def __init__(self, title, nameLists, showClose=False, allowEscape=True): GuiPanel.GuiPanel.__init__(self, title, self.width, self.height, showClose) self.initialiseoptions(NamePanelGui) self.nameLists = nameLists self.tumblerList = [] self.name = '' self.nameIndices = [0, 0] self.isTypedName = 0 charGui = loader.loadModel('models/gui/char_gui') if PICK_A_NAME_ENABLED: self.nameModeButton = GuiButton.GuiButton(helpText=PLocalizer.TypeANameHelp, command=self.toggleNameMode, borderWidth=PiratesGuiGlobals.BorderWidth, text=PLocalizer.TypeAName, frameColor=PiratesGuiGlobals.ButtonColor1, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -0.01), frameSize=(-0.09, 0.09, -0.015, 0.065), text_scale=PiratesGuiGlobals.TextScaleLarge, pad=(0.01, 0.01), parent=self, pos=(0.12, 0, 0.06)) self.commitButton = DialogButton.DialogButton(command=self.handleCommit, text=PLocalizer.Submit, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -0.01), frameSize=(-0.09, 0.09, -0.015, 0.065), text_scale=PiratesGuiGlobals.TextScaleLarge, parent=self, pos=(self.width - 0.15, 0, 0.07)) if showClose: self.cancelButton = DialogButton.DialogButton(command=self.closePanel, text=PLocalizer.lClose, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -0.01), frameSize=(-0.09, 0.09, -0.015, 0.065), text_scale=PiratesGuiGlobals.TextScaleLarge, parent=self, pos=(0.15, 0, 0.07)) if allowEscape: self.acceptOnce('escape', self.closePanel) self.accept('updateNameResult', self.__updateNameResult) self.pickAName = DirectFrame(parent=self, relief=None) self.nameResult = DirectFrame(parent=self.pickAName, relief=DGG.FLAT, text='', text_align=TextNode.ACenter, text_scale=PiratesGuiGlobals.TextScaleTitleMed, text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, frameColor=(0, 0, 0, 0.5), text_pos=(0, 0.007), frameSize=(-0.3, 0.3, -0.015, 0.065), text_font=PiratesGlobals.getPirateOutlineFont(), textMayChange=1) self.nameResult.setPos(self.width / 2, 0, self.height - 0.14) for i in range(len(self.nameLists)): tPos = (i + 1) * (self.width / (len(self.nameLists) + 1)) tumbler = PNameTumbler.PNameTumbler(self.nameLists[i], '') tumbler.reparentTo(self.pickAName) tumbler.setPos(tPos, 0, self.height * 0.55) tumbler.setScale(0.7) self.tumblerList.append(tumbler) self.randomButton = GuiButton.GuiButton(command=self.randomName, text=PLocalizer.Random, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -0.01), frameSize=(-0.09, 0.09, -0.015, 0.065), text_scale=PiratesGuiGlobals.TextScaleLarge, parent=self.pickAName, pos=(self.width / 2.0, 0, 0.12)) self.randomName() self.typeAName = DirectFrame(parent=self, relief=None) self.typeAName.hide() self.nameEntry = DirectEntry(parent=self.typeAName, relief=DGG.FLAT, text='', entryFont=PiratesGlobals.getPirateOutlineFont(), text_scale=PiratesGuiGlobals.TextScaleLarge, text_shadow=PiratesGuiGlobals.TextShadow, text_fg=PiratesGuiGlobals.TextFG1, width=MAX_NAME_WIDTH, frameColor=(0, 0, 0, 0.5), text_pos=(0, 0.007), frameSize=(-0.3, 0.3, -0.015, 0.065), numLines=1, focus=1, cursorKeys=1, text_align=TextNode.ACenter, command=self.handleCommit) self.nameEntry.setPos(self.width / 2, 0, self.height - 0.25) self.instructions = DirectFrame(parent=self.typeAName, relief=None, text=PLocalizer.TypeANameInstructions, text_align=TextNode.ACenter, text_scale=PiratesGuiGlobals.TextScaleLarge, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, frameColor=(0, 0, 0, 0.5), text_pos=(0, 0.007), frameSize=(-0.3, 0.3, -0.015, 0.065), textMayChange=1, text_wordwrap=15) self.instructions.setPos(self.width / 2, 0, self.height - 0.35) charGui.removeNode() return
def __init__(self): if hasattr(base, 'localAvatar'): if base.localAvatar.guiMgr.feedbackFormActive: return None else: base.localAvatar.guiMgr.feedbackFormActive = True title = PLocalizer.FeedbackFormTitle self.hasEmbedded = hasEmbedded currentInteraction = base.cr.interactionMgr.getCurrent() if not hasattr(currentInteraction, 'storeType'): GuiPanel.GuiPanel.__init__(self, title, 0.79000000000000004, 1.1499999999999999, 0, 1.5, pos = (0.40000000000000002, 0, -0.82999999999999996)) elif currentInteraction.storeType in [ InteractGlobals.ACCESSORIES_STORE, InteractGlobals.CATALOG_STORE, InteractGlobals.TATTOO_STORE, InteractGlobals.JEWELRY_STORE, InteractGlobals.BARBER_STORE]: GuiPanel.GuiPanel.__init__(self, title, 0.79000000000000004, 1.1499999999999999, 0, 1.5, pos = (-1.25, 0, -0.82999999999999996)) else: GuiPanel.GuiPanel.__init__(self, title, 0.79000000000000004, 1.1499999999999999, 0, 1.5, pos = (0.40000000000000002, 0, -0.82999999999999996)) self.initialiseoptions(FeedbackPanel) self.charGui = loader.loadModel('models/gui/char_gui') message = PLocalizer.FeedbackFormMessage self.message = DirectLabel(parent = self, relief = None, text = message, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 10, pos = (0.2225, 0, 0.93000000000000005), textMayChange = 1) self.categoryItems = PLocalizer.FeedbackFormCatItems self.categoryItems.sort() self.tumbler = PNameTumbler.PNameTumbler(self.categoryItems, '') self.tumbler.reparentTo(self) self.tumbler.setPos(0.57799999999999996, 0, 0.90000000000000002) self.tumbler.setScale(0.75) self.feedbackObj = FeedbackInput(self._typedAComment) self.feedbackInput = self.feedbackObj.generateFeedbackPanel(self._typedAComment) self.feedbackInput.reparentTo(self.feedbackObj) self.feedbackObj.setBin('gui-popup', 0) self.bOk = FeedbackConfirmButton(text = PLocalizer.FeedbackFormSend, command = self._FeedbackPanel__handleOk) self.bOk.reparentTo(self) self.bOk.setPos(0.074999999999999997, 0, 0.025000000000000001) self.bCancel = FeedbackCancelButton(text = PLocalizer.GenericConfirmCancel, command = self._FeedbackPanel__handleCancel) self.bCancel.reparentTo(self) self.bCancel.setPos(0.26800000000000002, 0, 0.025000000000000001) self.bManageAccount = FeedbackAccountButton(text = PLocalizer.FeedbackManageButton, command = self._FeedbackPanel__handleAccountWeb) self.bManageAccount.reparentTo(self) self.bManageAccount.setPos(0.54000000000000004, 0, 0.025000000000000001) self.accept('clientLogout', self.destroy) self.accept('destroyFeedbackPanel', self.destroy)