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 __paintTextLabels(self): """ Paints text labels on screen. """ usernameLabel = guiobjects.OcempLabel("Versión no", ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelWaiting"])) usernameLabel.topleft = 650, 390 usernameLabel.border = 1 usernameLabel.set_minimum_size(230, 40) self.window.add_child(usernameLabel) passwordLabel = guiobjects.OcempLabel("compatible con", ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelWaiting"])) passwordLabel.topleft = 650, 435 passwordLabel.border = 1 passwordLabel.set_minimum_size(230, 40) self.window.add_child(passwordLabel) Label = guiobjects.OcempLabel("el servidor,", ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelWaiting"])) Label.topleft = 650, 480 Label.border = 1 Label.set_minimum_size(230, 40) self.window.add_child(Label) Label = guiobjects.OcempLabel("Actualize", ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelWaiting"])) Label.topleft = 650, 525 Label.border = 1 Label.set_minimum_size(230, 40) self.window.add_child(Label) Label = guiobjects.OcempLabel("GenteGuada", ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelWaiting"])) Label.topleft = 650, 570 Label.border = 1 Label.set_minimum_size(230, 40) self.window.add_child(Label)
def __paintTextLabels(self): """ Paints text labels on screen. """ usernameLabel = guiobjects.OcempLabel("No hay conexión", ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelWaiting"])) usernameLabel.topleft = 650, 390 usernameLabel.border = 1 usernameLabel.set_minimum_size(230, 40) self.window.add_child(usernameLabel) passwordLabel = guiobjects.OcempLabel("con el servidor", ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelWaiting"])) passwordLabel.topleft = 650, 450 passwordLabel.border = 1 passwordLabel.set_minimum_size(230, 40) self.window.add_child(passwordLabel)
def __paintBackground(self): """ Paints the background image. """ self.container = guiobjects.OcempPanel(373, 410, [1, 1], CREATE_ITEM_BACKGROUND) self.window.child = self.container itemsLabel = guiobjects.OcempLabel("Objetos", guiobjects.STYLES["pointLabel"]) itemsLabel.topleft = 20, 10 self.container.add_child(itemsLabel) itemsPropertiesLabel = guiobjects.OcempLabel( "Propiedades del objeto", guiobjects.STYLES["pointLabel"]) itemsPropertiesLabel.topleft = 160, 10 self.container.add_child(itemsPropertiesLabel)
def __paintTextLabels(self): """ Paints text labels on screen. """ self.__usernameLabel = guiobjects.OcempLabel("Usuario: ", ocempgui.widgets.WidgetStyle(guiobjects.STYLES["labelLogin"])) #self.__usernameLabel.topleft = 670,408 self.__usernameLabel.topleft = 670, 390 self.__usernameLabel.border = 1 self.__usernameLabel.set_minimum_size(230, 40) self.window.add_child(self.__usernameLabel) self.__passwordLabel = guiobjects.OcempLabel("Password:"******"labelLogin"])) #self.__passwordLabel.topleft = 670,518 self.__passwordLabel.topleft = 670, 500 self.__passwordLabel.border = 1 self.__passwordLabel.set_minimum_size(230, 40) self.window.add_child(self.__passwordLabel)
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 draw(self): """ Draws the item parts on screen. """ self.window = guiobjects.OcempPanel(150, 300, [GG.utils.SCREEN_SZ[0] - 151, 129], GG.utils.ADMIN_ACTIONS_BACKGROUND) titleLabel = guiobjects.OcempLabel(self.title, guiobjects.STYLES["teleportLabel"]) titleLabel.topleft = 4, 0 self.window.add_child(titleLabel) self.listItems = guiobjects.OcempImageObjectList( 110, 205, self.listItems) self.listItems.topleft = 20, 40 self.window.add_child(self.listItems) okButton = guiobjects.createButton( GG.utils.TINY_OK_IMAGE, [10, 262], [self.tooltipLabel, self.showTooltip, self.removeTooltip], self.accept) self.window.add_child(okButton) cancelButton = guiobjects.createButton( GG.utils.TINY_CANCEL_IMAGE, [80, 262], ["Cerrar menu", self.showTooltip, self.removeTooltip], self.showOrHide) self.window.add_child(cancelButton) self.window.zOrder = 10000
def __paintBackground(self): """ Paints the window background. """ filePath = GG.genteguada.GenteGuada.getInstance().getDataPath( PRIVATE_CHAT_BACKGROUND) imgBackground = guiobjects.OcempImageMapTransparent(filePath) imgBackground.topleft = 0, 0 self.container.add_child(imgBackground) self.window.child = self.container labelChat = guiobjects.OcempLabel("Contactos", guiobjects.STYLES["userName"]) labelChat.topleft = 20, 10 self.container.add_child(labelChat) labelContacts = guiobjects.OcempLabel("Chat", guiobjects.STYLES["userName"]) labelContacts.topleft = 160, 10 self.container.add_child(labelContacts)
def __paintLabel(self): """ Paints the exchangeWindow labels. """ self.__labelExchange = guiobjects.OcempLabel( "Selecciona los objetos del inventario que quieres intercambiar.", guiobjects.STYLES["dialogFont"]) self.__labelExchange.topleft = 20, 15 self.container.add_child(self.__labelExchange) self.__labelExchange = guiobjects.OcempLabel( "Bandeja de salida", guiobjects.STYLES["dialogFont"]) self.__labelExchange.topleft = 20, 44 self.container.add_child(self.__labelExchange) self.__labelExchange = guiobjects.OcempLabel( "Bandeja de entrada", guiobjects.STYLES["dialogFont"]) self.__labelExchange.topleft = 370, 44 self.container.add_child(self.__labelExchange)
def __paintBackground(self): """ Paints the window background. """ self.container = guiobjects.OcempPanel(303, 123, [1, 1], BROADCAST_BACKGROUND) self.window.child = self.container labelChat = guiobjects.OcempLabel("Mensaje", guiobjects.STYLES["userName"]) labelChat.topleft = 115, 10 self.container.add_child(labelChat)
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 __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)
def __paintTitleField(self, title, iPos): label = guiobjects.OcempLabel(title, guiobjects.STYLES["itemLabel"]) label.topleft = 10 + self.labelShift[ 0], 25 + iPos * self.spacing + self.labelShift[1] self.container.add_child(label) self.activeLabels.append(label)
def __paintAttributes(self): """ Paints the room attribute values. """ labelShift = [10, -15] spacing = 50 iPos = 0 label = guiobjects.OcempLabel("label", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + labelShift[0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.label = guiobjects.OcempEditLine() self.label.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) self.label.text = "habitacion 42" self.label.border = 1 self.label.topleft = 10 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.label.set_minimum_size(150, 20) self.container.add_child(self.label) iPos += 1 label = guiobjects.OcempLabel("size", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + labelShift[0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.sizeX = guiobjects.OcempEditLine() self.sizeX.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) self.sizeX.text = "8" self.sizeX.border = 1 self.sizeX.topleft = 10 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.sizeX.set_minimum_size(50, 20) self.container.add_child(self.sizeX) self.sizeY = guiobjects.OcempEditLine() self.sizeY.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) self.sizeY.text = "8" self.sizeY.border = 1 self.sizeY.topleft = 10 + 65 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.sizeY.set_minimum_size(50, 20) self.container.add_child(self.sizeY) label = guiobjects.OcempLabel("maxUsers", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + 130 + labelShift[ 0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.maxUsers = guiobjects.OcempEditLine() self.maxUsers.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) self.maxUsers.text = "10" self.maxUsers.border = 1 self.maxUsers.topleft = 10 + 130 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.maxUsers.set_minimum_size(50, 20) self.container.add_child(self.maxUsers) iPos += 1 label = guiobjects.OcempLabel("enabled", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + labelShift[0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.enabledChecker = ocempgui.widgets.CheckButton() self.enabledChecker.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) self.enabledChecker.activate() self.enabledChecker.border = 1 self.enabledChecker.topleft = 10 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.container.add_child(self.enabledChecker) label = guiobjects.OcempLabel("startRoom", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + 120 + labelShift[ 0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.startRoomChecker = ocempgui.widgets.CheckButton() self.startRoomChecker.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) self.startRoomChecker.border = 1 self.startRoomChecker.topleft = 10 + 120 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.container.add_child(self.startRoomChecker) iPos += 1 label = guiobjects.OcempLabel("images", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + labelShift[0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) height = 60 self.images = guiobjects.OcempImageList(240, height, GG.utils.TILES, "tiles") self.images.topleft = 10 + labelShift[ 0], 40 + iPos * spacing + 25 + labelShift[1] self.images.set_selectionmode( ocempgui.widgets.Constants.SELECTION_MULTIPLE) iPos += 1 self.container.add_child(self.images) self.activeLabels.append(self.images) label = guiobjects.OcempLabel("copy data...", guiobjects.STYLES["itemLabel"]) label.topleft = 275 + labelShift[0], 25 + labelShift[1] self.container.add_child(label)
def __paintFields(self): """ Paints data fields on the window. """ iPos = 0 spacing = 50 labelShift = [5, -20] label = guiobjects.OcempLabel("users", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + labelShift[0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.editRoomMaxUsers = guiobjects.OcempEditLine() self.editRoomMaxUsers.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) self.editRoomMaxUsers.text = str(self.roomMaxUser) self.editRoomMaxUsers.border = 1 self.editRoomMaxUsers.topleft = 10 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.editRoomMaxUsers.set_minimum_size(50, 20) self.container.add_child(self.editRoomMaxUsers) label = guiobjects.OcempLabel("label", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + 70 + labelShift[ 0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.roomLabel = guiobjects.OcempEditLine() self.roomLabel.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) self.roomLabel.text = self.roomLabelText self.roomLabel.border = 1 self.roomLabel.topleft = 10 + 70 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.roomLabel.set_minimum_size(90, 20) self.container.add_child(self.roomLabel) iPos += 1 label = guiobjects.OcempLabel("enabled", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + labelShift[0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.enabledChecker = ocempgui.widgets.CheckButton() self.enabledChecker.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) if self.room.getEnabled(): self.enabledChecker.activate() self.enabledChecker.border = 1 self.enabledChecker.topleft = 10 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.container.add_child(self.enabledChecker) label = guiobjects.OcempLabel("startRoom", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + 120 + labelShift[ 0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.startRoomChecker = ocempgui.widgets.CheckButton() self.startRoomChecker.set_style( ocempgui.widgets.WidgetStyle(guiobjects.STYLES["textFieldChat"])) if self.room.getStartRoom(): self.startRoomChecker.activate() self.startRoomChecker.border = 1 self.startRoomChecker.topleft = 10 + 120 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.container.add_child(self.startRoomChecker) iPos += 1 label = guiobjects.OcempLabel("tiles", guiobjects.STYLES["itemLabel"]) label.topleft = 10 + labelShift[0], 25 + iPos * spacing + labelShift[1] self.container.add_child(label) self.newTileImages = guiobjects.OcempImageList(240, 80, GG.utils.TILES, GG.utils.TILE) self.newTileImages.topleft = 10 + labelShift[ 0], 40 + iPos * spacing + 18 + labelShift[1] self.newTileImages.set_selectionmode( ocempgui.widgets.Constants.SELECTION_MULTIPLE) self.container.add_child(self.newTileImages) iPos += 1