def openFileDialog(self): """ Opens the OpenFile dialog. """ self.dialog = ocempgui.widgets.Box(373, 372) self.dialog.topleft = 528, 205 background = guiobjects.OcempImageMapTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(WINDOW_UPLOAD)) self.dialog.add_child(background) self.listDir = guiobjects.OcempImageFileList(310, 239) self.listDir.topleft = 31, 60 self.dialog.add_child(self.listDir) buttonOK = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_OK), self.buttonTooltips["ok"], self.parent.showTooltip, self.parent.removeTooltip) buttonOK.topleft = [233, 308] buttonOK.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.closeFileDialog, "OK") self.dialog.add_child(buttonOK) buttonCancel = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_CANCEL), self.buttonTooltips["cancel"], self.parent.showTooltip, self.parent.removeTooltip) buttonCancel.topleft = [122, 308] buttonCancel.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.closeFileDialog, "KO") self.dialog.add_child(buttonCancel) self.window.add_child(self.dialog)
def __showPolicyDialog(self): if self.dialog: return self.container = ocempgui.widgets.Box(516, 197) filePath = GG.genteguada.GenteGuada.getInstance().getDataPath(os.path.join(GG.utils.BACKGROUNDS, "alertWindow.png")) imgBackground = guiobjects.OcempImageMapTransparent(filePath) imgBackground.topleft = 0, 0 self.container.add_child(imgBackground) self.dialog = ocempgui.widgets.DialogWindow("Error") self.dialog.topleft = 254, 50 self.dialog.child = self.container self.widgetContainer.add_widget(self.dialog) buttonCancel = guiobjects.OcempImageButtonTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_CANCEL)) buttonCancel.topleft = [400, 140] buttonCancel.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.__closeDialog) self.container.add_child(buttonCancel) buttonOK = guiobjects.OcempImageButtonTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_OK)) buttonOK.topleft = [280, 140] buttonOK.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.__showPolicy) self.container.add_child(buttonOK) labelAlert = guiobjects.OcempLabel("Debe aceptar las normas del juego", guiobjects.STYLES["dialogFont"]) labelAlert.topleft = 160, 50 labelAlert2 = guiobjects.OcempLabel("antes de poder acceder", guiobjects.STYLES["dialogFont"]) labelAlert2.topleft = 160, 65 labelAlert3 = guiobjects.OcempLabel("Continuar .... ", guiobjects.STYLES["dialogFont"]) labelAlert3.topleft = 160, 100 self.container.add_child(labelAlert) self.container.add_child(labelAlert2) self.container.add_child(labelAlert3) return self.dialog
def drawAccessMode(self): """ Draws the admin access screen. """ self.__finish = False self.widgetContainer = ocempgui.widgets.Renderer() self.widgetContainer.set_screen(self.__screen) self.window = ocempgui.widgets.Box(GG.utils.SCREEN_SZ[0], GG.utils.SCREEN_SZ[1]) imgBackgroundRight = guiobjects.OcempImageMapTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(os.path.join(GG.utils.BACKGROUNDS, "TEMP_accessMode.png"))) imgBackgroundRight.topleft = 0, 0 self.window.add_child(imgBackgroundRight) cad = "¿Desea entrar como administrador?" notificationLabel = guiobjects.OcempLabel(cad, ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelLogin"])) notificationLabel.topleft = 100, 300 notificationLabel.border = 1 notificationLabel.set_minimum_size(230, 40) self.window.add_child(notificationLabel) imgPath = os.path.join(GG.utils.EDITOR, "ok_button.png") buttonOK = guiobjects.OcempImageButtonTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(imgPath)) buttonOK.topleft = [370, 450] buttonOK.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.accessModeAdmin) self.window.add_child(buttonOK) imgPath = os.path.join(GG.utils.EDITOR, "cancel_button.png") buttonCancel = guiobjects.OcempImageButtonTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(imgPath)) buttonCancel.topleft = [550, 450] buttonCancel.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.accessModeNormal) self.window.add_child(buttonCancel) self.widgetContainer.add_widget(self.window) return self.__startAccessMode()
def __paintButtons(self): """ Paints accept and cancel buttons on screen. """ imgPath = os.path.join(GG.utils.EDITOR, "ok_button.png") buttonOK = guiobjects.OcempImageButtonTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(imgPath)) buttonOK.topleft = [750, 690] buttonOK.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.acceptLogin) self.window.add_child(buttonOK) imgPath = os.path.join(GG.utils.EDITOR, "cancel_button.png") buttonCancel = guiobjects.OcempImageButtonTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(imgPath)) buttonCancel.topleft = [870, 690] buttonCancel.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.cancelLogin) self.window.add_child(buttonCancel)
def paintColorPalette(self, method, paletteType, tag): """ Paints the color palette on screen. method: method used to paint. paletteType: palette type. tag: active tag. """ baseX = 35 sizeX = 70 if paletteType == "hair": baseY = 515 else: baseY = 510 sizeY = 45 offset = 10 buttons = self.getPaletteButtons(paletteType) for i in range(len(buttons)): for j in range(len(buttons[0])): button = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath( os.path.join(GG.utils.PATH_EDITOR_INTERFACE, buttons[i][j]))) button.topleft = [ baseX + sizeX * j + offset * j, baseY + sizeY * i + offset * i ] button.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, method, j + 1 + (i * 3)) self.window.add_child(button) self.activeWidget.append(button) self.paintSelectionItem(tag)
def __paintButtons(self): """ Paints accept and cancel buttons on screen. """ imgPath = os.path.join(GG.utils.INIT_IMAGE_PATH, "cancel_button.png") buttonCancel = guiobjects.OcempImageButtonTransparent(imgPath) buttonCancel.topleft = [870, 690] buttonCancel.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.cancelLogin) self.window.add_child(buttonCancel)
def paintMaskOptions(self): """ Paints the mask options on screen. """ buttonMask = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_UNDO), self.buttonTooltips["undo"], self.showTooltip, self.removeTooltip) buttonMask.topleft = 30, 500 buttonMask.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.changeMask, "mask") self.window.add_child(buttonMask) self.activeWidget.append(buttonMask) buttonFileChooser = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_FILE), self.buttonTooltips["file"], self.showTooltip, self.removeTooltip) buttonFileChooser.topleft = 150, 500 buttonFileChooser.connect_signal( ocempgui.widgets.Constants.SIG_CLICKED, self.changeMask, "file") self.window.add_child(buttonFileChooser) self.activeWidget.append(buttonFileChooser)
def paintOptions(self, options, tag): """ Paints the tag options on screen. options: active options. tag: active tag. """ if len(options) > 1: img = options[int(self.avatarConfiguration[tag]) - 1] buttonLeft = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath( BUTTON_LEFT), self.buttonTooltips["before"], self.showTooltip, self.removeTooltip) buttonLeft.topleft = 30, 400 buttonLeft.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.moveOptions, "left", options, tag) self.window.add_child(buttonLeft) self.activeWidget.append(buttonLeft) buttonRight = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath( BUTTON_RIGHT), self.buttonTooltips["next"], self.showTooltip, self.removeTooltip) buttonRight.topleft = 200, 400 buttonRight.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.moveOptions, "right", options, tag) self.window.add_child(buttonRight) self.activeWidget.append(buttonRight) else: img = options[0] if tag == "mask" and self.avatarConfiguration["mask"]: if not os.path.isfile(IMG_UPLOAD): image = self.parent.getPlayer().getImageLabel() filePath = GG.genteguada.GenteGuada.getInstance().getDataPath( image) guiobjects.generateImageSize(filePath, [244, 244], IMG_UPLOAD) self.imgOptionsTab = guiobjects.OcempImageMapTransparent( IMG_UPLOAD) else: self.imgOptionsTab = guiobjects.OcempImageMapTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath( os.path.join(GG.utils.PATH_EDITOR_INTERFACE, img))) self.imgOptionsTab.topleft = 30, 150 self.activeWidget.append(self.imgOptionsTab) self.window.add_child(self.imgOptionsTab)
def paintGenderFrame(self): """ Paints the gender frames on screen. """ maleButton = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_BOY), self.buttonTooltips["boy"], self.showTooltip, self.removeTooltip) maleButton.topleft = [73, 191] maleButton.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.updateGender, "boy") self.window.add_child(maleButton) self.activeWidget.append(maleButton) femaleButton = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_GIRL), self.buttonTooltips["girl"], self.showTooltip, self.removeTooltip) femaleButton.topleft = [73, 441] femaleButton.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.updateGender, "girl") self.window.add_child(femaleButton) self.activeWidget.append(femaleButton)
def paintButtons(self): """ Paints the editor buttons. """ imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_OK) buttonOK = guiobjects.OcempImageButtonTransparent( imgPath, self.buttonTooltips["ok"], self.showTooltip, self.removeTooltip) buttonOK.topleft = [770, 30] buttonOK.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.changeConfiguration) self.window.add_child(buttonOK) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( BUTTON_CANCEL) buttonCancel = guiobjects.OcempImageButtonTransparent( imgPath, self.buttonTooltips["cancel"], self.showTooltip, self.removeTooltip) buttonCancel.topleft = [890, 30] buttonCancel.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.closeConfiguration) self.window.add_child(buttonCancel)
def paintWinterSelection(self, tag): """ Paints the winter mode for the selected tag items. tag: selected tag. """ buttonWinter = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_WINTER), self.buttonTooltips["winter"], self.showTooltip, self.removeTooltip) buttonWinter.topleft = 20, 20 buttonWinter.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.changeCloth, "long", tag) self.window.add_child(buttonWinter) self.activeWidget.append(buttonWinter) buttonSummer = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_SUMMER), self.buttonTooltips["summer"], self.showTooltip, self.removeTooltip) buttonSummer.topleft = 150, 20 buttonSummer.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.changeCloth, "short", tag) self.window.add_child(buttonSummer) self.activeWidget.append(buttonSummer)
def paintSizePalette(self, method): """ Paints the avatar size palette. method: method used to paint the palette. """ baseX = 70 baseY = 70 sizeY = 150 offset = 10 buttons = ["s", "m", "l", "xl"] for i in range(len(buttons)): button = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath( os.path.join(GG.utils.PATH_EDITOR_INTERFACE, buttons[i] + ".png")), self.buttonTooltips[buttons[i]], self.showTooltip, self.removeTooltip) button.topleft = [baseX, baseY + sizeY * i + offset * i] button.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, method, buttons[i].upper()) self.window.add_child(button) self.activeWidget.append(button)
def __showErrorDialog (self): """ Shows an error dialog. """ if self.dialog: return self.container = ocempgui.widgets.Box(516, 197) filePath = GG.genteguada.GenteGuada.getInstance().getDataPath(os.path.join(GG.utils.BACKGROUNDS, "alertWindow.png")) imgBackground = guiobjects.OcempImageMapTransparent(filePath) imgBackground.topleft = 0, 0 self.container.add_child(imgBackground) self.dialog = ocempgui.widgets.DialogWindow("Error") self.dialog.topleft = 254, 50 self.dialog.child = self.container self.widgetContainer.add_widget(self.dialog) buttonCancel = guiobjects.OcempImageButtonTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(BUTTON_CANCEL)) buttonCancel.topleft = [400, 140] buttonCancel.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.__closeDialog) self.container.add_child(buttonCancel) labelAlert = guiobjects.OcempLabel("Error: Usuario o password incorrectos.", guiobjects.STYLES["dialogFont"]) labelAlert.topleft = 160, 80 self.container.add_child(labelAlert) return self.dialog
def loadImagesTag(self): """ Loads the editor images. """ dictionary = {} imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( GENDER_FRONT) dictionary["gender"] = guiobjects.OcempImageButtonTransparent(imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath(SKIN_BACK) dictionary["skin"] = guiobjects.OcempImageButtonTransparent(imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath(HEAD_BACK) dictionary["head"] = guiobjects.OcempImageButtonTransparent(imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath(BODY_BACK) dictionary["body"] = guiobjects.OcempImageButtonTransparent(imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath(MASK_BACK) dictionary["mask"] = guiobjects.OcempImageButtonTransparent(imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath(HAIR_BACK) dictionary["hair"] = guiobjects.OcempImageButtonTransparent(imgPath) if self.avatarConfiguration["gender"] == "boy": imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( SHIRT_BACK) dictionary["shirt"] = guiobjects.OcempImageButtonTransparent( imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( TROUSERS_BACK) dictionary["trousers"] = guiobjects.OcempImageButtonTransparent( imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( SKIRT_BACK) dictionary["skirt"] = guiobjects.OcempImageButtonTransparent( imgPath) else: imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( SHIRT_DISABLED) dictionary["shirt"] = guiobjects.OcempImageButtonTransparent( imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( TROUSERS_DISABLED) dictionary["trousers"] = guiobjects.OcempImageButtonTransparent( imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( SKIRT_BACK) dictionary["skirt"] = guiobjects.OcempImageButtonTransparent( imgPath) imgPath = GG.genteguada.GenteGuada.getInstance().getDataPath( SHOES_BACK) dictionary["shoes"] = guiobjects.OcempImageButtonTransparent(imgPath) return dictionary
def __init__(self, model, screen, isohud): """ Class constructor. model: chat message model. screen: screen handler. isohud: isoview_hud handler. """ self.__isohud = isohud infoPackage = model.getInfoPackage() self.__answers = infoPackage["answers"] self.__position = infoPackage["position"] positioned_view.PositionedView.__init__(self, model, screen) self.container = ocempgui.widgets.Box(585, 258) filePath = GG.genteguada.GenteGuada.getInstance().getDataPath( os.path.join(GG.utils.BACKGROUNDS, "trivialWindow2.png")) imgBackground = guiobjects.OcempImageMapTransparent(filePath) imgBackground.topleft = 0, 0 self.container.add_child(imgBackground) label = guiobjects.OcempLabel(infoPackage["message"], guiobjects.STYLES["quizLabel"]) label.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["quizLabel"])) label.topleft = 20, 40 self.container.add_child(label) i = 0 for answer in self.__answers: label = guiobjects.OcempLabel(answer, guiobjects.STYLES["quizLabel"]) label.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["quizLabel"])) label.topleft = 80, 85 + i * 50 self.container.add_child(label) i = i + 1 buttonA = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath( os.path.join(GG.utils.HUD_PATH, "answerA.png"))) buttonA.topleft = [22, 70] buttonA.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.actionButton, 1) buttonB = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath( os.path.join(GG.utils.HUD_PATH, "answerB.png"))) buttonB.topleft = [22, 120] buttonB.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.actionButton, 2) buttonC = guiobjects.OcempImageButtonTransparent( GG.genteguada.GenteGuada.getInstance().getDataPath( os.path.join(GG.utils.HUD_PATH, "answerC.png"))) buttonC.topleft = [22, 170] buttonC.connect_signal(ocempgui.widgets.Constants.SIG_CLICKED, self.actionButton, 3) self.container.add_child(buttonA) self.container.add_child(buttonB) self.container.add_child(buttonC) self.container.topleft = [20, 20] self.container.border = 0 self.container.zOrder = 20000 self.__isohud.addSprite(self.container) self.__isohud.widgetContainer.add_widget(self.container) self.__isohud.setActiveWindow(True)