Exemplo n.º 1
0
class AlreadyUsedDlg(GameObject, Subject):

    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'])

    def on_btn(self, val):
        self.eng.log('already used')
        self.notify('on_already_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 2
0
class ResetDialog(GameObject, Subject):

    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'])

    def on_btn(self, val):
        self.eng.log('reset button')
        self.notify('on_reset_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 3
0
class NetworkDialog(GameObject, Subject):
    def __init__(self, menu_args):
        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: '
            'http://www.ya2.it/pages/check-your-ports.html).')
        self.dialog = OkDialog(text=net_msg,
                               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,
                               command=self.on_btn)
        self.eng.log('created dialog ' + self.dialog['text'])

    def on_btn(self, val):
        self.eng.log('exit button')
        self.notify('on_network_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 4
0
class CheckDialog(GameObject, Subject):
    def __init__(self, menu_args):
        Subject.__init__(self)
        GameObject.__init__(self)
        self.dialog = OkDialog(text=_(
            "The jabber id that you've inserted is not correct: it "
            "should be something like [email protected] where "
            "nickname is your nickname and domainname.tld is a valid "
            "domain."),
                               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,
                               command=self.on_btn)
        self.eng.log('created dialog ' + self.dialog['text'])

    def on_btn(self, val):
        self.eng.log('check button')
        self.notify('on_check_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 5
0
class NetworkDialog(GameObject, Subject):
    def __init__(self, menu_args):
        Subject.__init__(self)
        GameObject.__init__(self)
        net_msg = _(
            'Connection error. Please check that your router is configured '
            'for doing port-forwarding for port 9099 on your host and your '
            'firewall allows traffic for Yorg on port 9099.')
        self.dialog = OkDialog(text=net_msg,
                               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,
                               command=self.on_btn)
        self.eng.log('created dialog ' + self.dialog['text'])

    def on_btn(self, val):
        self.eng.log('exit button')
        self.notify('on_network_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 6
0
class AlreadyUsedDlg(GameObject, Subject):
    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'])

    def on_btn(self, val):
        self.eng.log('already used')
        self.notify('on_already_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 7
0
class ExitDialog(GameObject, Subject):

    def __init__(self, menu_props, uid):
        Subject.__init__(self)
        GameObject.__init__(self)
        self.user = uid
        self.dialog = OkDialog(
            text=_('the server user %s has quit') % self.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,
            command=self.on_btn)
        self.eng.log('created dialog ' + self.dialog['text'])

    def on_btn(self, val):
        self.eng.client.register_rpc('leave_curr_room')
        self.eng.client.leave_curr_room()
        self.eng.log('exit button')
        self.notify('on_exit_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 8
0
class RegisterDialog(GameObject, Subject):
    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'])

    def on_btn(self, val):
        self.eng.log('register button')
        self.notify('on_register_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 9
0
class RemovedDialog(GameObject, Subject):
    def __init__(self, menu_args, msg):
        Subject.__init__(self)
        GameObject.__init__(self)
        self.msg = msg
        self.dialog = OkDialog(text=_('you have been removed from the match'),
                               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,
                               command=self.on_btn)
        self.eng.log('created dialog ' + self.dialog['text'])

    def on_btn(self, val):
        self.eng.log('exit button')
        self.notify('on_remove_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 10
0
class ExitDialog(GameObject, Subject):
    def __init__(self, menu_args, msg):
        Subject.__init__(self)
        GameObject.__init__(self)
        self.user = str(msg['muc']['nick'])
        self.msg = msg
        self.dialog = OkDialog(text=_('the server user %s has quitted') %
                               self.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,
                               command=self.on_btn)
        self.eng.log('created dialog ' + self.dialog['text'])

    def on_btn(self, val):
        self.eng.log('exit button')
        self.notify('on_exit_dlg')

    def destroy(self):
        self.eng.log('destroyed dialog ' + self.dialog['text'])
        self.dialog = self.dialog.destroy()
        Subject.destroy(self)
        GameObject.destroy(self)
Exemplo n.º 11
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'])
Exemplo n.º 12
0
 def createOkDialog(self, parent=None):
     parent = self.getEditorRootCanvas() if parent is None else parent
     pos = self.editorCenter if parent == self.getEditorRootCanvas() else (0,0,0)
     if self.visEditorInAspect2D:
         element = OkDialog(
             text="Ok Dialog",
             state = DGG.NORMAL,
             parent=parent)
     else:
         element = OkDialog(
             text="Ok Dialog",
             state=DGG.NORMAL,
             scale=300,
             pos=pos,
             parent=parent)
     elementInfo = ElementInfo(element, "OkDialog")
     self.setupBind(elementInfo)
     return elementInfo
Exemplo n.º 13
0
 def __init__(self, menu_props, key, cmd):
     Subject.__init__(self)
     GameObject.__init__(self)
     msg = _('The key %s is already used for %s.' % (key, 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'])
Exemplo n.º 14
0
 def __init__(self, menu_args, msg):
     Subject.__init__(self)
     GameObject.__init__(self)
     self.msg = msg
     self.dialog = OkDialog(text=_('you have been removed from the match'),
                            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,
                            command=self.on_btn)
     self.eng.log('created dialog ' + self.dialog['text'])
Exemplo n.º 15
0
 def __init__(self, menu_args, msg):
     Subject.__init__(self)
     GameObject.__init__(self)
     self.user = str(msg['muc']['nick'])
     self.msg = msg
     self.dialog = OkDialog(text=_('the server user %s has quitted') %
                            self.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,
                            command=self.on_btn)
     self.eng.log('created dialog ' + self.dialog['text'])
Exemplo n.º 16
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'])
Exemplo n.º 17
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'])
Exemplo n.º 18
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'])