Esempio n. 1
0
 def __init__(self, race_props, players):
     rpr = race_props
     GameObject.__init__(self)
     self.fsm = self.fsm_cls(self, rpr.shaders_dev, rpr.pbr)
     self.gui = self.gui_cls(self, rpr, players)
     self.logic = self.logic_cls(self, rpr)
     self.event = self.event_cls(self, rpr.ingame_menu, rpr.keys, players)
Esempio n. 2
0
 def __init__(self, menu_args, joystick, keys, menu):
     self.menu_args = menu_args
     self.menu = menu
     init_lst = [[('event', self.event_cls, [self])],
                 [('gui', self.gui_cls,
                   [self, self.menu_args, joystick, keys])]]
     GameObject.__init__(self, init_lst)
Esempio n. 3
0
 def __init__(self, menu_props, from_, roomname):
     Subject.__init__(self)
     GameObject.__init__(self)
     self.from_ = from_
     self.roomname = roomname
     self.dialog = YesNoDialog(
         base.a2dBottomLeft,
         text=_('%s has invited you to a match, do you agree?') % from_,
         text_wordwrap=16,
         text_fg=menu_props.text_active_col,
         text_font=menu_props.font,
         pad=(.03, .03),
         topPad=0,
         midPad=.01,
         relief=FLAT,
         frameColor=(.8, .8, .8, .9),
         button_relief=FLAT,
         button_frameColor=(.2, .2, .2, .2),
         button_text_fg=menu_props.text_active_col,
         button_text_font=menu_props.font,
         buttonValueList=['yes', 'no'],
         command=self.on_btn)
     size = self.dialog['frameSize']
     self.dialog.set_pos(-size[0] + .05, 1, -size[2] + .05)
     self.eng.log('created dialog ' + self.dialog['text'])
Esempio n. 4
0
 def __init__(self, menu_args):
     GameObject.__init__(self)
     self.eng.log('created match form (init)')
     self.room = ''
     self.invited_users = [self.eng.xmpp.client.boundjid.bare]
     self.menu_args = menu_args
     lab_args = menu_args.label_args
     lab_args['scale'] = .046
     self.match_frm = DirectFrame(frameSize=(-.02, 2.5, 0, .45),
                                  frameColor=(.2, .2, .2, .5),
                                  pos=(.04, 1, -.46),
                                  parent=base.a2dTopLeft)
     usr = [
         usr for usr in self.eng.xmpp.users
         if usr.name == self.eng.xmpp.client.boundjid.bare
     ][0]
     frm = UserFrmMe(self.eng.xmpp.client.boundjid.bare,
                     self.eng.xmpp.client.boundjid.bare, usr.is_supporter,
                     True, (.1, 1, .38), self.match_frm, self.menu_args,
                     .32)
     self.forms = [frm]
     for i in range(0, 8):
         row, col = i % 4, i / 4
         DirectLabel(text=str(i + 1) + '.',
                     pos=(.06 + 1.24 * col, 1, .38 - .08 * row),
                     parent=self.match_frm,
                     **lab_args)
Esempio n. 5
0
 def __init__(self, tuning_props):
     t_p = tuning_props
     tuninggui_props = TuningGuiProps(t_p.player_car, t_p.background,
                                      t_p.tuning_imgs)
     init_lst = [[('gui', TuningGui, [self, tuninggui_props])],
                 [('logic', TuningLogic, [self, t_p.cars])]]
     GameObject.__init__(self, init_lst)
Esempio n. 6
0
File: menu.py Progetto: oriolrg/yorg
 def __init__(self, menu_props):
     self.menu_props = menu_props
     comps = [
         [('logic', self.logic_cls, [self])],
         [('gui', self.gui_cls, [self, menu_props])]]
     GameObject.__init__(self, comps)
     MenuFacade.__init__(self)
Esempio n. 7
0
 def __init__(self, rprops, sprops, menu_props, ranking, players):
     self.rprops = rprops
     self.menu_props = menu_props
     GameObject.__init__(self)
     self.event = PageEvent(self)
     self.gui = RankingPageGui(self, menu_props, rprops, sprops, ranking,
                               players)
Esempio n. 8
0
 def __init__(self, menu_args, carpage_props, menu):
     self.menu_args = menu_args
     self.menu = menu
     init_lst = [[('event', self.event_cls, [self])],
                 [('gui', self.gui_cls,
                   [self, self.menu_args, carpage_props])]]
     GameObject.__init__(self, init_lst)
Esempio n. 9
0
 def __init__(self,
              attr_name,
              init_val,
              pos,
              val_range,
              callback,
              args=None):
     # unused val_range
     GameObject.__init__(self)
     self.__callback = callback
     self.__args = args or []
     self.__lab = OnscreenText(text=attr_name,
                               pos=pos,
                               align=TextNode.ARight,
                               fg=(1, 1, 1, 1),
                               parent=base.a2dTopLeft,
                               scale=.046)
     slider_pos = LVector3f(pos[0], 1, pos[1]) + (.05, 0, .01)
     self.__slider = Entry(pos=slider_pos,
                           initial_text=str(init_val),
                           cmd=self.__set_attr,
                           parent=base.a2dTopLeft,
                           scale=.05,
                           frame_col=(0, 0, 0, .2),
                           text_fg=(1, 1, 1, 1))
     # txt_pos = LVector3f(pos[0], pos[1], 1) + (.6, 0, 0)
     self.widgets = [self.__slider, self.__lab]
     self.toggle()
Esempio n. 10
0
 def destroy(self):
     self.car = None
     if self.__debug:
         self.debug_lines_gnd.destroy()
         self.debug_lines_obst.destroy()
     ComputerProxy.destroy(self)
     GameObject.destroy(self)
Esempio n. 11
0
 def __init__(self, img_idx, name, speed, adherence, stability):
     GameObject.__init__(self)
     self.img_idx = img_idx
     self.name = name
     self.speed = speed
     self.adherence = adherence
     self.stability = stability
Esempio n. 12
0
 def __init__(self, parent, owner, menu_props, img_path, msg_btn_x, cb,
              usr_name, tooltip):
     GameObject.__init__(self)
     self.owner = owner
     lab_args = menu_props.label_args
     lab_args['scale'] = .046
     #lab_args['text_fg'] = menu_props.text_normal_col
     self.btn = ImgBtn(parent=parent,
                       scale=(.024, .024),
                       pos=(msg_btn_x, .01),
                       frame_col=(1, 1, 1, 1),
                       frame_texture=img_path,
                       cmd=cb,
                       extra_args=[usr_name],
                       **menu_props.imgbtn_args)
     self.btn.bind(ENTER, self.on_enter)
     self.btn.bind(EXIT, self.on_exit)
     self.tooltip_btn = Btn(parent=parent,
                            scale=(.024, .024),
                            pos=(msg_btn_x, .01),
                            frame_col=(1, 1, 1, 0),
                            frame_size=(-1, 1, -1, 1),
                            cmd=None,
                            **menu_props.imgbtn_args)
     self.tooltip_btn.bind(ENTER, self.on_enter)
     self.tooltip_btn.bind(EXIT, self.on_exit)
     self.on_create()
     self.tooltip = Label(text=tooltip,
                          pos=self.btn.get_pos() + self.tooltip_offset,
                          parent=parent,
                          text_wordwrap=10,
                          text_align=self.tooltip_align,
                          **lab_args)
     self.tooltip.set_bin('gui-popup', 10)
     self.tooltip.hide()
Esempio n. 13
0
 def __init__(self, race_props):
     r_p = race_props
     racelogic_props = RaceLogicProps(
         r_p.shaders, r_p.music_path, r_p.coll_track_path, r_p.unmerged,
         r_p.merged, r_p.ghosts, r_p.corner_names, r_p.waypoint_names,
         r_p.show_waypoints, r_p.weapons, r_p.weapon_names, r_p.start,
         r_p.track_name, r_p.track_path, r_p.track_model_name,
         r_p.empty_name, r_p.anim_name, r_p.omni_tag, r_p.sign_cb,
         r_p.sign_name, r_p.camera_vec, r_p.shadow_src, r_p.laps,
         r_p.bonus_model, r_p.bonus_suff, r_p.cars, r_p.a_i, r_p.drivers,
         r_p.coll_path, r_p.coll_name, r_p.keys, r_p.joystick, r_p.sounds,
         r_p.color_main, r_p.color, r_p.font, r_p.car_path, r_p.phys_file,
         r_p.wheel_names, r_p.tuning_engine, r_p.tuning_tires,
         r_p.tuning_suspensions, r_p.road_name, r_p.model_name,
         r_p.damage_paths, r_p.wheel_gfx_names, r_p.particle_path,
         r_p.rocket_path, r_p.respawn_name, r_p.pitstop_name, r_p.wall_name,
         r_p.goal_name, r_p.bonus_name, r_p.roads_names, r_p.grid)
     racegui_props = RaceGuiProps(
         r_p.minimap_path, r_p.minimap_image, r_p.col_dct, r_p.font,
         r_p.cars, r_p.menu_args, r_p.drivers_img, r_p.cars_imgs,
         r_p.share_urls, r_p.share_imgs, r_p.track_name,
         r_p.player_car_name)
     init_lst = [
         [('fsm', RaceFsm, [self, race_props.shaders])],
         [('gui', RaceGui, [self, racegui_props])],
         [('logic', self.logic_cls, [self, racelogic_props])],
         [('event', self.event_cls, [self, race_props.ingame_menu])]]
     GameObject.__init__(self, init_lst)
Esempio n. 14
0
 def __init__(self, car, path):
     init_lst = [
         [('gfx', self.gfx_cls, [self, car.gfx.nodepath, path])],
         [('phys', self.phys_cls, [self, car.gfx.nodepath])],
         [('audio', self.audio_cls, [self])],
         [('logic', self.logic_cls, [self])]]
     GameObject.__init__(self, init_lst)
Esempio n. 15
0
 def __init__(self, menu_args, keys):
     PageFacade.__init__(self)
     self.menu_args = menu_args
     init_lst = [
         [('event', self.event_cls, [self])],
         [('gui', self.gui_cls, [self, self.menu_args, keys])]]
     GameObject.__init__(self, init_lst)
Esempio n. 16
0
 def __init__(self, parent, owner, menu_props, img_path, msg_btn_x, cb,
              usr_name, tooltip):
     GameObject.__init__(self)
     self.owner = owner
     lab_args = menu_props.label_args
     lab_args['scale'] = .046
     #lab_args['text_fg'] = menu_props.text_normal_col
     self.btn = ImgBtn(
         parent=parent, scale=(.024, .024), pos=(msg_btn_x, .01),
         frame_col=(1, 1, 1, 1), frame_texture=img_path, cmd=cb,
         extra_args=[usr_name], **menu_props.imgbtn_args)
     self.btn.bind(ENTER, self.on_enter)
     self.btn.bind(EXIT, self.on_exit)
     self.tooltip_btn = Btn(
         parent=parent, scale=(.024, .024), pos=(msg_btn_x, .01),
         frame_col=(1, 1, 1, 0), frame_size=(-1, 1, -1, 1), cmd=None,
         **menu_props.imgbtn_args)
     self.tooltip_btn.bind(ENTER, self.on_enter)
     self.tooltip_btn.bind(EXIT, self.on_exit)
     self.on_create()
     self.tooltip = Label(
         text=tooltip, pos=self.btn.get_pos() + self.tooltip_offset,
         parent=parent, text_wordwrap=10, text_align=self.tooltip_align,
         **lab_args)
     self.tooltip.set_bin('gui-popup', 10)
     self.tooltip.hide()
Esempio n. 17
0
 def __init__(self, track, car, driverpage_props):
     self.track = track
     self.car = car
     init_lst = [[('event', self.event_cls, [self])],
                 [('gui', self.gui_cls, [self, driverpage_props])]]
     GameObject.__init__(self, init_lst)
     PageFacade.__init__(self)
Esempio n. 18
0
 def __init__(self, car, path, cars, part_path, wpn_id, players):
     # unused part_path, players
     GameObject.__init__(self)
     self.gfx = self.gfx_cls(self, car.gfx.nodepath, path)
     self.audio = self.audio_cls(self)
     self.logic = self.logic_cls(self, car, cars, wpn_id)
     self.ai = self.ai_cls(self, car)
Esempio n. 19
0
    def __init__(self, whl_pos, whl_radius, car_h):
        GameObject.__init__(self)
        self.radius = whl_radius
        v_f = GeomVertexFormat.getV3()
        vdata = GeomVertexData('skid', v_f, Geom.UHDynamic)
        prim = GeomTriangles(Geom.UHStatic)
        self.vtx_cnt = 1
        self.last_pos = whl_pos
        geom = Geom(vdata)
        geom.add_primitive(prim)
        self.node = GeomNode('gnode')
        self.node.add_geom(geom)
        nodepath = self.eng.gfx.root.attach_node(self.node)
        nodepath.set_transparency(True)
        nodepath.set_depth_offset(1)
        nodepath.node.set_two_sided(True)  # for self-shadowing issues
        self.__set_material(nodepath)
        nodepath.p3dnode.set_bounds(OmniBoundingVolume())
        self.add_vertices(whl_radius, car_h)
        self.add_vertices(whl_radius, car_h)

        def alpha(time, n_p):
            if not n_p.is_empty:
                n_p.node.set_shader_input('alpha', time)
            # this if seems necessary since, if there are skidmarks and you
            # exit from the race (e.g. back to the menu), then alpha is being
            # called from the interval manager even if the interval manager
            # correctly says that there are 0 intervals.

        self.remove_seq = Sequence(
            Wait(8), LerpFunc(alpha, 8, .5, 0, 'easeInOut', [nodepath]),
            Func(nodepath.remove_node))
        self.remove_seq.start()
Esempio n. 20
0
 def __init__(self, model, geom_names, is_ghost):
     GameObject.__init__(self)
     self.model = model
     self.rigid_bodies = []
     self.ghosts = []
     self.nodes = []
     list(map(lambda name: self.__set_mesh(name, is_ghost), geom_names))
Esempio n. 21
0
 def __init__(self, menu_args, option_props):
     self.menu_args = menu_args
     init_lst = [[('event', self.event_cls, [self])],
                 [('gui', self.gui_cls,
                   [self, self.menu_args, option_props])]]
     GameObject.__init__(self, init_lst)
     PageFacade.__init__(self)
Esempio n. 22
0
 def destroy(self):
     if self.particles:
         list(map(lambda part: part.destroy(), self.particles))
     self.particles = None
     list(map(lambda skd: skd.destroy(), self.skidmarks))
     self.car = self.skidmarks = None
     GameObject.destroy(self)
Esempio n. 23
0
 def __init__(self, mainpage_props):
     init_lst = [
         [('event', self.event_cls, [self])],
         [('gui', self.gui_cls, [self, mainpage_props])]]
     GameObject.__init__(self, init_lst)
     # don't construct it using GameObject
     PageFacade.__init__(self)
Esempio n. 24
0
 def __init__(self, menu_args, user):
     Subject.__init__(self)
     GameObject.__init__(self)
     self.user = user
     self.dialog = YesNoDialog(
         base.a2dBottomLeft,
         text=_('%s wants to be a (XMPP) friend of you, do you agree?') %
         user,
         text_wordwrap=16,
         text_fg=menu_args.text_active,
         text_font=menu_args.font,
         pad=(.03, .03),
         topPad=0,
         midPad=.01,
         relief=FLAT,
         frameColor=(.8, .8, .8, .9),
         button_relief=FLAT,
         button_frameColor=(.2, .2, .2, .2),
         button_text_fg=menu_args.text_active,
         button_text_font=menu_args.font,
         buttonValueList=['yes', 'no'],
         command=self.on_btn)
     size = self.dialog['frameSize']
     self.dialog.set_pos(-size[0] + .05, 1, -size[2] + .05)
     self.eng.log('created dialog ' + self.dialog['text'])
Esempio n. 25
0
 def __init__(self, menu, track, car, driverpage_props):
     self.track = track
     self.car = car
     self.menu = menu
     init_lst = [[('event', self.event_cls, [self])],
                 [('gui', self.gui_cls, [self, self.menu,
                                         driverpage_props])]]
     GameObject.__init__(self, init_lst)
Esempio n. 26
0
 def __init__(self, car_props, player_car_idx, tuning, players):
     info('init car ' + car_props.name)
     self.player_car_idx = player_car_idx
     self._tuning = tuning
     self._car_props = car_props
     self._players = players
     GameObject.__init__(self)
     taskMgr.add(self._build_comps())
Esempio n. 27
0
 def __init__(self, car, path, cars, part_path, wpn_id, players):
     GameObject.__init__(self)
     self.gfx = self.gfx_cls(self, car.gfx.nodepath, path)
     self.phys = self.phys_cls(self, car, cars, players)
     self.audio = self.audio_cls(self)
     self.logic = self.logic_cls(self, car, cars, wpn_id)
     self.event = self.event_cls(self, part_path)
     self.ai = self.ai_cls(self, car)
     WeaponFacade.__init__(self)
Esempio n. 28
0
 def __init__(self, fpath, parent):
     GameObject.__init__(self)
     anim_dct = {'anim': fpath + '-Anim'}
     self.gfx_np = self.eng.load_model(fpath, anim=anim_dct)
     self.gfx_np.loop('anim')
     # self.gfx_np.flatten_light()
     self.gfx_np.reparent_to(parent)
     self.gfx_np.set_scale(1.5)
     self.gfx_np.set_pos(Vec(0, 0, 1.5))
Esempio n. 29
0
 def __init__(self, loadingmenu_props):
     l_p = loadingmenu_props
     loadinggui_props = LoadingGuiProps(
         l_p.loading, l_p.track_path, l_p.car_path, l_p.drivers, l_p.tracks,
         l_p.track_name_transl, l_p.single_race, l_p.grid, l_p.cars_path,
         l_p.drivers_path, l_p.joystick, l_p.keys, l_p.menu_args)
     init_lst = [[('gui', LoadingGui, [self, loadinggui_props])],
                 [('logic', MenuLogic, [self])]]
     GameObject.__init__(self, init_lst)  # NB doesn't invoke Menu's
Esempio n. 30
0
 def __init__(self, rprops):
     GameObject.__init__(self)
     self.__res_txts = []
     self._buttons = []
     self.players = self.result_frm = None
     self.rprops = rprops
     self.font = rprops.season_props.gameprops.menu_props.font
     self.text_fg = rprops.season_props.gameprops.menu_props.text_active_col
     self.text_bg = rprops.season_props.gameprops.menu_props.text_normal_col
Esempio n. 31
0
 def __init__(self, rprops, menu, track_name_transl, ranking, players):
     self.rprops = rprops
     self.menu = menu
     gui_cls = LoadingPageLocalMPGui \
         if rprops.season_props.kind == 'localmp' else LoadingPageGui
     GameObject.__init__(self)
     self.event = EventColleague(self)
     self.gui = gui_cls(self, menu, rprops, track_name_transl, ranking,
                        players)
Esempio n. 32
0
 def __init__(self, menu_args):
     GameObject.__init__(self)
     self.eng.log('created match message form')
     self.chat = None
     self.msg_frm = DirectFrame(
         frameSize=(-.02, 2.5, 0, 1.22),
         frameColor=(.2, .2, .2, .5),
         pos=(.04, 1, -1.69), parent=base.a2dTopLeft)
     t_a = menu_args.text_args
     t_a['scale'] = .05
     t_a['fg'] = menu_args.text_normal
     self.dst_txt = OnscreenText(
         text='', pos=(0, 1.16), parent=self.msg_frm, align=TextNode.A_left,
         **t_a)
     self.ent = Entry(
         scale=.04, pos=(0, 1, .03), entryFont=menu_args.font, width=62,
         frameColor=menu_args.btn_color, parent=self.msg_frm,
         initialText=_('write here your message'),
         command=self.on_typed_msg, focusInCommand=self.on_focus,
         focusInExtraArgs=['in'], focusOutCommand=self.on_focus,
         focusOutExtraArgs=['out'], text_fg=menu_args.text_active)
     self.ent['state'] = DISABLED
     self.txt_frm = DirectScrolledFrame(
         frameSize=(-.02, 2.46, -.02, 1.02),
         canvasSize=(-.02, 2.42, -.02, 1.02),
         scrollBarWidth=.036,
         verticalScroll_relief=FLAT,
         verticalScroll_frameColor=(.2, .2, .2, .4),
         verticalScroll_thumb_relief=FLAT,
         verticalScroll_thumb_frameColor=(.8, .8, .8, .6),
         verticalScroll_incButton_relief=FLAT,
         verticalScroll_incButton_frameColor=(.8, .8, .8, .6),
         verticalScroll_decButton_relief=FLAT,
         verticalScroll_decButton_frameColor=(.8, .8, .8, .6),
         horizontalScroll_relief=FLAT,
         frameColor=(1, 1, 1, .0),
         pos=(.02, 1, .11), parent=self.msg_frm)
     t_a['scale'] = .046
     self.msg_txt = OnscreenText(
         text='', pos=(0, .24), parent=self.txt_frm.getCanvas(),
         align=TextNode.A_left, wordwrap=52, **t_a)
     lab_args = menu_args.label_args
     lab_args['scale'] = .046
     lab_args['text_fg'] = menu_args.text_normal
     self.lab_frm = Btn(
         frameSize=(-.02, 2.5, -.01, .05),
         frameColor=(1, 1, 1, 0),
         pos=(0, 1, 1.15), parent=self.msg_frm)
     self.lab_frm.bind(ENTER, self.on_enter)
     self.lab_frm.bind(EXIT, self.on_exit)
     self.tooltip = DirectLabel(
         text='', pos=(2.4, 1, -.06),
         parent=self.lab_frm, text_wordwrap=50, text_bg=(.2, .2, .2, .8),
         text_align=TextNode.A_right, **lab_args)
     self.tooltip.set_bin('gui-popup', 10)
     self.tooltip.hide()
Esempio n. 33
0
 def __init__(self, uid, is_supporter, pos, parent, menu_props,
              msg_btn_x=.58):
     Subject.__init__(self)
     GameObject.__init__(self)
     self.menu_props = menu_props
     self.frm = Btn(
         frame_size=(-.01, 2.54, .05, -.03), frame_col=(1, 1, 1, 0),
         pos=pos, parent=parent, cmd=self.on_cmd, extra_args=[uid])
     self.lab = UserLabel(uid, self.frm, menu_props, is_supporter)
     self.frm.bind(ENTER, self.on_enter)
     self.frm.bind(EXIT, self.on_exit)
Esempio n. 34
0
 def __init__(self, name, parent, menu_props, is_supporter):
     GameObject.__init__(self)
     self.menu_props = menu_props
     self.name = name
     self.parent = parent
     lab_args = menu_props.label_args
     lab_args['scale'] = .046
     self.lab = Label(text=name, pos=(0, 0), parent=parent,
                      text_wordwrap=64, text_align=TextNode.A_left, **lab_args)
     self.supp_btn = None
     self.set_supporter(is_supporter)
     self.set_online(True)
Esempio n. 35
0
 def __init__(self, menu_props):
     GameObject.__init__(self)
     self.eng.log('created match message form')
     self.chat = None
     self.msg_frm = Frame(
         frame_size=(-.02, 3.49, 0, 1.22),
         frame_col=(.2, .2, .2, .5),
         pos=(.04, -1.69), parent=base.a2dTopLeft)
     t_a = menu_props.text_args
     t_a['scale'] = .05
     t_a['fg'] = menu_props.text_normal_col
     self.dst_txt = Text(
         txt='', pos=(0, 1.16), parent=self.msg_frm, align='left',
         **t_a)
     self.ent = Entry(
         scale=.04, pos=(0, .03), entry_font=menu_props.font, width=86,
         frame_col=menu_props.btn_col, parent=self.msg_frm,
         initial_text=_('write here your message'),
         cmd=self.on_typed_msg, focus_in_cmd=self.on_focus,
         focus_in_args=['in'], focus_out_cmd=self.on_focus,
         focus_out_args=['out'], text_fg=menu_props.text_active_col)
     self.ent['state'] = DISABLED
     self.txt_frm = ScrolledFrame(
         frame_sz=(-.02, 2.46, -.02, 1.02),
         canvas_sz=(-.02, 2.42, -.02, 1.02),
         scrollbar_width=.036,
         frame_col=(1, 1, 1, .0),
         pos=(.02, .11), parent=self.msg_frm)
     t_a['scale'] = .046
     self.msg_txt = Text(
         txt='', pos=(0, .24), parent=self.txt_frm.canvas,
         align='left', wordwrap=52, **t_a)
     lab_args = menu_props.label_args
     lab_args['scale'] = .046
     lab_args['text_fg'] = menu_props.text_normal_col
     self.lab_frm = Btn(
         frame_size=(-.02, 2.5, -.01, .05),
         frame_col=(1, 1, 1, 0),
         pos=(0, 1.15), parent=self.msg_frm)
     self.lab_frm.bind(ENTER, self.on_enter)
     self.lab_frm.bind(EXIT, self.on_exit)
     self.tooltip = Label(
         text='', pos=(2.4, -.06), parent=self.lab_frm, text_wordwrap=50,
         text_align=TextNode.A_right, **lab_args)
     self.tooltip.set_bin('gui-popup', 10)
     self.tooltip.hide()
Esempio n. 36
0
 def __init__(self, menu_props, txt):
     Subject.__init__(self)
     GameObject.__init__(self)
     self.dialog = OkDialog(
         text=txt,
         text_wordwrap=16,
         text_fg=menu_props.text_active_col,
         text_font=menu_props.font,
         pad=(.03, .03),
         topPad=0,
         midPad=.01,
         relief=FLAT,
         frameColor=(.8, .8, .8, .9),
         button_relief=FLAT,
         button_frameColor=(.2, .2, .2, .2),
         button_text_fg=menu_props.text_active_col,
         button_text_font=menu_props.font,
         command=self.on_btn)
     self.eng.log('created dialog ' + self.dialog['text'])
Esempio n. 37
0
 def __init__(self, menu_props, key, player, cmd):
     Subject.__init__(self)
     GameObject.__init__(self)
     msg = _('The key %s is already used by player %s for %s.' % (
             key, player, cmd))
     self.dialog = OkDialog(
         text=msg,
         text_wordwrap=16,
         text_fg=menu_props.text_active_col,
         text_font=menu_props.font,
         pad=(.03, .03),
         topPad=0,
         midPad=.01,
         relief=FLAT,
         frameColor=(.8, .8, .8, .9),
         button_relief=FLAT,
         button_frameColor=(.2, .2, .2, .2),
         button_text_fg=menu_props.text_active_col,
         button_text_font=menu_props.font,
         command=self.on_btn)
     self.eng.log('created dialog ' + self.dialog['text'])
Esempio n. 38
0
 def __init__(self, menu_props, yorg_srv):
     GameObject.__init__(self)
     self.eng.log('created multiplayer form')
     self.dialog = self.server_dlg = None
     self.invite_dlg = None
     self.yorg_srv = yorg_srv
     self.ver_check = VersionChecker()
     self.labels = []
     self.invited_users = []
     self.curr_inviting_usr = None
     self.menu_props = menu_props
     self.users_frm = UsersFrm(menu_props, yorg_srv)
     self.users_frm.attach(self.on_invite)
     self.users_frm.attach(self.on_add_chat)
     self.users_frm.attach(self.on_add_groupchat)
     self.msg_frm = MessageFrm(menu_props)
     self.msg_frm.attach(self.on_msg_focus)
     self.msg_frm.attach(self.on_close_all_chats)
     self.match_frm = None
     #self.match_frm.hide()
     self.msg_frm.hide()
Esempio n. 39
0
 def __init__(self, menu_props, room):
     GameObject.__init__(self)
     self.eng.log('created match form (init)')
     self.room = room
     self.invited_users = [self.eng.client.myid]
     self.menu_props = menu_props
     lab_args = menu_props.label_args
     lab_args['scale'] = .046
     self.match_frm = Frame(
         frame_size=(-.02, 3.49, 0, .45),
         frame_col=(.2, .2, .2, .5),
         pos=(.04, -.46), parent=base.a2dTopLeft)
     usr = [usr for usr in self.eng.client.users if usr.uid == self.eng.client.myid][0]
     frm = UserFrmMe(
         self.eng.client.myid, usr.is_supporter, (.1, .38), self.match_frm,
         self.menu_props, .32)
     self.forms = [frm]
     for i in range(0, 8):
         row, col = i % 4, i // 4
         Label(
             text=str(i + 1) + '.', pos=(.06 + 1.24 * col, .38 - .08 * row),
             parent=self.match_frm, **lab_args)
Esempio n. 40
0
 def __init__(self, menu_props, user):
     Subject.__init__(self)
     GameObject.__init__(self)
     self.user = user
     self.dialog = YesNoDialog(
         base.a2dBottomLeft,
         text=_('%s wants to be a (XMPP) friend of you, do you agree?') % user,
         text_wordwrap=16,
         text_fg=menu_props.text_active_col,
         text_font=menu_props.font,
         pad=(.03, .03),
         topPad=0,
         midPad=.01,
         relief=FLAT,
         frameColor=(.8, .8, .8, .9),
         button_relief=FLAT,
         button_frameColor=(.2, .2, .2, .2),
         button_text_fg=menu_props.text_active_col,
         button_text_font=menu_props.font,
         buttonValueList=['yes', 'no'],
         command=self.on_btn)
     size = self.dialog['frameSize']
     self.dialog.set_pos(-size[0] + .05, 1, -size[2] + .05)
     self.eng.log('created dialog ' + self.dialog['text'])
Esempio n. 41
0
 def __init__(self, menu_props):
     Subject.__init__(self)
     GameObject.__init__(self)
     net_msg = _(
         'Connection error. Please check that (i) your firewall allows '
         'traffic for Yorg on port 9099 and (ii) the server user has '
         'opened her port 9099 (here is a guide for checking it: '
         'https://www.ya2.it/pages/check-your-ports.html).')
     self.dialog = OkDialog(
         text=net_msg,
         text_wordwrap=16,
         text_fg=menu_props.text_active_col,
         text_font=menu_props.font,
         pad=(.03, .03),
         topPad=0,
         midPad=.01,
         relief=FLAT,
         frameColor=(.8, .8, .8, .9),
         button_relief=FLAT,
         button_frameColor=(.2, .2, .2, .2),
         button_text_fg=menu_props.text_active_col,
         button_text_font=menu_props.font,
         command=self.on_btn)
     self.eng.log('created dialog ' + self.dialog['text'])
Esempio n. 42
0
 def destroy(self):
     self.lab.destroy()
     if self.supp_btn: self.supp_btn.destroy()
     GameObject.destroy(self)
Esempio n. 43
0
 def __init__(self, mp_props):
     init_lst = [
         [('event', self.event_cls, [self])],
         [('gui', self.gui_cls, [self, mp_props])]]
     GameObject.__init__(self, init_lst)
     PageFacade.__init__(self)
Esempio n. 44
0
 def destroy(self):
     self.eng.log('match form: destroy')
     #self.match_frm.destroy()
     GameObject.destroy(self)
Esempio n. 45
0
 def destroy(self):
     self.lab.destroy()
     self.frm.destroy()
     Subject.destroy(self)
     GameObject.destroy(self)
Esempio n. 46
0
File: menu.py Progetto: cflavio/yorg
 def __init__(self, menu_props):
     comps = [
         [('logic', self.logic_cls, [self])],
         [('gui', self.gui_cls, [self, menu_props])]]
     GameObject.__init__(self, comps)
     MenuFacade.__init__(self)
Esempio n. 47
0
 def destroy(self):
     self.eng.log('multiplayer form: destroy')
     self.frm = self.frm.destroy()
     GameObject.destroy(self)
Esempio n. 48
0
 def destroy(self):
     GameObject.destroy(self)
     PageFacade.destroy(self)
Esempio n. 49
0
 def destroy(self):
     self.eng.log('destroyed dialog ' + self.dialog['text'])
     self.dialog = self.dialog.destroy()
     Subject.destroy(self)
     GameObject.destroy(self)
Esempio n. 50
0
File: menu.py Progetto: cflavio/yorg
 def __init__(self, menu_props, keys):
     init_lst = [[('gui', self.gui_cls, [self, menu_props, keys])]]
     GameObject.__init__(self, init_lst)
Esempio n. 51
0
 def destroy(self):
     self.eng.log('message form destroyed')
     #self.msg_frm.destroy()
     GameObject.destroy(self)
Esempio n. 52
0
 def __init__(self, menu_props):
     GameObject.__init__(self)
     self.eng.log('created message form')
     self.chats = []
     self.curr_chat = None
     self.curr_match_room = None
     self.msg_frm = DirectFrame(
         frameSize=(-.02, .8, 0, .45),
         frameColor=(.2, .2, .2, .5),
         pos=(-.82, 1, .02), parent=base.a2dBottomRight)
     self.presences_sent = []
     self.menu_props = menu_props
     t_a = menu_props.text_args
     t_a['scale'] = .05
     t_a['fg'] = menu_props.text_normal_col
     self.dst_txt = OnscreenText(
         text='', pos=(0, .4), parent=self.msg_frm, align=TextNode.A_left,
         **t_a)
     self.arrow_btn = ImgBtn(
         parent=self.msg_frm, scale=(.024, .024), pos=(.7, 1, .42),
         frame_col=(1, 1, 1, 1),
         frame_texture='assets/images/gui/arrow.txo',
         cmd=self.on_arrow,
         **menu_props.imgbtn_args)
     self.arrow_btn.disable()
     self.close_btn = ImgBtn(
         parent=self.msg_frm, scale=(.024, .024), pos=(.76, 1, .42),
         frame_col=(1, 1, 1, 1),
         frame_texture='assets/images/gui/close.txo',
         cmd=self.on_close,
         **menu_props.imgbtn_args)
     self.close_btn.disable()
     self.ent = Entry(
         scale=.04, pos=(0, .03), entry_font=menu_props.font, width=19.5,
         frame_col=menu_props.btn_col, parent=self.msg_frm,
         initial_text=_('write here your message'),
         cmd=self.on_typed_msg, focus_in_cmd=self.on_focus,
         focus_in_args=['in'], focus_out_cmd=self.on_focus,
         focus_out_args=['out'], text_fg=menu_props.text_active_col)
     self.ent['state'] = DISABLED
     self.txt_frm = DirectScrolledFrame(
         frameSize=(-.02, .76, -.02, .28),
         canvasSize=(-.02, .72, -.02, .28),
         scrollBarWidth=.036,
         verticalScroll_relief=FLAT,
         verticalScroll_frameColor=(.2, .2, .2, .4),
         verticalScroll_thumb_relief=FLAT,
         verticalScroll_thumb_frameColor=(.8, .8, .8, .6),
         verticalScroll_incButton_relief=FLAT,
         verticalScroll_incButton_frameColor=(.8, .8, .8, .6),
         verticalScroll_decButton_relief=FLAT,
         verticalScroll_decButton_frameColor=(.8, .8, .8, .6),
         horizontalScroll_relief=FLAT,
         frameColor=(1, 1, 1, 0),
         pos=(.02, 1, .11), parent=self.msg_frm)
     t_a['scale'] = .046
     self.msg_txt = OnscreenText(
         text='', pos=(0, .24), parent=self.txt_frm.getCanvas(),
         align=TextNode.A_left, wordwrap=14, **t_a)
     lab_args = menu_props.label_args
     lab_args['scale'] = .046
     lab_args['text_fg'] = menu_props.text_normal_col
     self.lab_frm = Btn(
         frame_size=(-.02, .64, -.01, .05),
         frame_col=(1, 1, 1, 0),
         pos=(0, 1, .4), parent=self.msg_frm)
     self.lab_frm.bind(ENTER, self.on_enter)
     self.lab_frm.bind(EXIT, self.on_exit)
     self.tooltip = Label(
         text='', pos=(.78, 1, -.06),
         parent=self.lab_frm, text_wordwrap=16,# text_bg=(.2, .2, .2, .8),
         text_align=TextNode.A_right, **lab_args)
     self.tooltip.set_bin('gui-popup', 10)
     self.tooltip.hide()
Esempio n. 53
0
 def __init__(self, dst):
     GameObject.__init__(self)
     self.dst = dst
     self.messages = []
     self.read = True
     self.closed = False
Esempio n. 54
0
File: menu.py Progetto: cflavio/yorg
 def __init__(self, menu_props):
     init_lst = [[('gui', ExitMenuGui, [self, menu_props])]]
     GameObject.__init__(self, init_lst)