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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
class NetworkDialog(GameObject, Subject): 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']) 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)