Mercurial > libervia-backend
comparison frontends/wix/profile_manager.py @ 70:8f2ed279784b
i18n
- gettext support added in frontends
- first draft of frontends french translation
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 05 Mar 2010 20:33:10 +1100 |
parents | 9b842086d915 |
children | f271fff3a713 |
comparison
equal
deleted
inserted
replaced
69:86f1f7f6d332 | 70:8f2ed279784b |
---|---|
42 self.__refillProfiles() | 42 self.__refillProfiles() |
43 self.Bind(wx.EVT_COMBOBOX, self.onProfileChange) | 43 self.Bind(wx.EVT_COMBOBOX, self.onProfileChange) |
44 self.panel_id = wx | 44 self.panel_id = wx |
45 | 45 |
46 self.sizer.Add(wx.Window(self, -1), 1) | 46 self.sizer.Add(wx.Window(self, -1), 1) |
47 self.sizer.Add(wx.StaticText(self, -1, "Profile:"), 0, flag=wx.ALIGN_CENTER) | 47 self.sizer.Add(wx.StaticText(self, -1, _("Profile:")), 0, flag=wx.ALIGN_CENTER) |
48 self.sizer.Add(self.profile_name, 0, flag=wx.ALIGN_CENTER) | 48 self.sizer.Add(self.profile_name, 0, flag=wx.ALIGN_CENTER) |
49 button_panel = wx.Panel(self) | 49 button_panel = wx.Panel(self) |
50 button_panel.sizer = wx.BoxSizer(wx.HORIZONTAL) | 50 button_panel.sizer = wx.BoxSizer(wx.HORIZONTAL) |
51 button_panel.SetSizer(button_panel.sizer) | 51 button_panel.SetSizer(button_panel.sizer) |
52 button_new = wx.Button(button_panel, -1, "New") | 52 button_new = wx.Button(button_panel, -1, _("New")) |
53 button_del = wx.Button(button_panel, -1, "Delete") | 53 button_del = wx.Button(button_panel, -1, _("Delete")) |
54 button_panel.sizer.Add(button_new) | 54 button_panel.sizer.Add(button_new) |
55 button_panel.sizer.Add(button_del) | 55 button_panel.sizer.Add(button_del) |
56 self.sizer.Add(button_panel, flag=wx.CENTER) | 56 self.sizer.Add(button_panel, flag=wx.CENTER) |
57 self.Bind(wx.EVT_BUTTON, self.onNewProfile, button_new) | 57 self.Bind(wx.EVT_BUTTON, self.onNewProfile, button_new) |
58 self.Bind(wx.EVT_BUTTON, self.onDeleteProfile, button_del) | 58 self.Bind(wx.EVT_BUTTON, self.onDeleteProfile, button_del) |
59 | 59 |
60 login_box = wx.StaticBox(self, -1, "Login") | 60 login_box = wx.StaticBox(self, -1, _("Login")) |
61 self.login_sizer = wx.StaticBoxSizer(login_box, wx.VERTICAL) | 61 self.login_sizer = wx.StaticBoxSizer(login_box, wx.VERTICAL) |
62 self.sizer.Add(self.login_sizer, 1, wx.EXPAND | wx.ALL) | 62 self.sizer.Add(self.login_sizer, 1, wx.EXPAND | wx.ALL) |
63 self.login_jid = wx.TextCtrl(self, -1) | 63 self.login_jid = wx.TextCtrl(self, -1) |
64 self.login_sizer.Add(wx.StaticText(self, -1, "JID:"), 0, flag=wx.ALIGN_CENTER) | 64 self.login_sizer.Add(wx.StaticText(self, -1, "JID:"), 0, flag=wx.ALIGN_CENTER) |
65 self.login_sizer.Add(self.login_jid, flag=wx.EXPAND) | 65 self.login_sizer.Add(self.login_jid, flag=wx.EXPAND) |
66 self.login_pass = wx.TextCtrl(self, -1, style = wx.TE_PASSWORD) | 66 self.login_pass = wx.TextCtrl(self, -1, style = wx.TE_PASSWORD) |
67 self.login_sizer.Add(wx.StaticText(self, -1, "Password:"), 0, flag=wx.ALIGN_CENTER) | 67 self.login_sizer.Add(wx.StaticText(self, -1, _("Password:")), 0, flag=wx.ALIGN_CENTER) |
68 self.login_sizer.Add(self.login_pass, flag=wx.EXPAND) | 68 self.login_sizer.Add(self.login_pass, flag=wx.EXPAND) |
69 | 69 |
70 loggin_button = wx.Button(self, -1, "Connect") | 70 loggin_button = wx.Button(self, -1, _("Connect")) |
71 self.Bind(wx.EVT_BUTTON, self.onConnectButton, loggin_button) | 71 self.Bind(wx.EVT_BUTTON, self.onConnectButton, loggin_button) |
72 self.login_sizer.Add(loggin_button, flag=wx.ALIGN_CENTER) | 72 self.login_sizer.Add(loggin_button, flag=wx.ALIGN_CENTER) |
73 | 73 |
74 self.sizer.Add(wx.Window(self, -1), 1) | 74 self.sizer.Add(wx.Window(self, -1), 1) |
75 | 75 |
91 for profile in profiles: | 91 for profile in profiles: |
92 self.profile_name.Append(profile) | 92 self.profile_name.Append(profile) |
93 | 93 |
94 | 94 |
95 def onNewProfile(self, event): | 95 def onNewProfile(self, event): |
96 dlg = wx.TextEntryDialog(self, "Please enter the new profile name", "New profile", style = wx.OK | wx.CANCEL) | 96 dlg = wx.TextEntryDialog(self, _("Please enter the new profile name"), _("New profile"), style = wx.OK | wx.CANCEL) |
97 if dlg.ShowModal() == wx.ID_OK: | 97 if dlg.ShowModal() == wx.ID_OK: |
98 name = dlg.GetValue() | 98 name = dlg.GetValue() |
99 if name: | 99 if name: |
100 if name[0]=='@': | 100 if name[0]=='@': |
101 wx.MessageDialog(self, "A profile name can't start with a @", "Bad profile name", wx.ICON_ERROR).ShowModal() | 101 wx.MessageDialog(self, _("A profile name can't start with a @"), _("Bad profile name"), wx.ICON_ERROR).ShowModal() |
102 else: | 102 else: |
103 profile = self.host.bridge.createProfile(name) | 103 profile = self.host.bridge.createProfile(name) |
104 self.__refillProfiles() | 104 self.__refillProfiles() |
105 self.profile_name.SetValue(name) | 105 self.profile_name.SetValue(name) |
106 dlg.Destroy() | 106 dlg.Destroy() |
107 | 107 |
108 def onDeleteProfile(self, event): | 108 def onDeleteProfile(self, event): |
109 name = self.profile_name.GetValue() | 109 name = self.profile_name.GetValue() |
110 if not name: | 110 if not name: |
111 return | 111 return |
112 dlg = wx.MessageDialog(self, "Are you sure to delete the profile [%s]" % name, "Confirmation", wx.ICON_QUESTION | wx.YES_NO) | 112 dlg = wx.MessageDialog(self, _("Are you sure to delete the profile [%s]") % name, _("Confirmation"), wx.ICON_QUESTION | wx.YES_NO) |
113 if dlg.ShowModal() == wx.ID_YES: | 113 if dlg.ShowModal() == wx.ID_YES: |
114 self.host.bridge.deleteProfile(name) | 114 self.host.bridge.deleteProfile(name) |
115 self.__refillProfiles() | 115 self.__refillProfiles() |
116 self.__setDefault() | 116 self.__setDefault() |
117 dlg.Destroy() | 117 dlg.Destroy() |
125 | 125 |
126 def onConnectButton(self, event): | 126 def onConnectButton(self, event): |
127 """Called when the Connect button is pressed""" | 127 """Called when the Connect button is pressed""" |
128 name = self.profile_name.GetValue() | 128 name = self.profile_name.GetValue() |
129 if not name: | 129 if not name: |
130 wx.MessageDialog(self, "You must select a profile a create a new one before connecting", "No profile selected", wx.ICON_ERROR).ShowModal() | 130 wx.MessageDialog(self, _("You must select a profile or create a new one before connecting"), _("No profile selected"), wx.ICON_ERROR).ShowModal() |
131 return | 131 return |
132 if name[0]=='@': | 132 if name[0]=='@': |
133 wx.MessageDialog(self, "A profile name can't start with a @", "Bad profile name", wx.ICON_ERROR).ShowModal() | 133 wx.MessageDialog(self, _("A profile name can't start with a @"), _("Bad profile name"), wx.ICON_ERROR).ShowModal() |
134 return | 134 return |
135 profile = None # gof | 135 profile = None # gof |
136 profile = self.host.bridge.getProfileName(name) | 136 profile = self.host.bridge.getProfileName(name) |
137 if not profile: | 137 if not profile: |
138 debug("The profile is new, we create it") | 138 debug(_("The profile is new, we create it")) |
139 old_jid = self.host.bridge.getParamA("JabberID", "Connection", profile_key=profile) | 139 old_jid = self.host.bridge.getParamA("JabberID", "Connection", profile_key=profile) |
140 old_pass = self.host.bridge.getParamA("Password", "Connection", profile_key=profile) | 140 old_pass = self.host.bridge.getParamA("Password", "Connection", profile_key=profile) |
141 new_jid = self.login_jid.GetValue() | 141 new_jid = self.login_jid.GetValue() |
142 new_pass = self.login_pass.GetValue() | 142 new_pass = self.login_pass.GetValue() |
143 if old_jid != new_jid: | 143 if old_jid != new_jid: |
144 debug('Saving new JID') | 144 debug(_('Saving new JID')) |
145 self.host.bridge.setParam("JabberID", new_jid, "Connection", profile) | 145 self.host.bridge.setParam("JabberID", new_jid, "Connection", profile) |
146 if old_pass != new_pass: | 146 if old_pass != new_pass: |
147 debug('Saving new password') | 147 debug(_('Saving new password')) |
148 self.host.bridge.setParam("JabberID", new_pass, "Connection", profile) | 148 self.host.bridge.setParam("JabberID", new_pass, "Connection", profile) |
149 self.host.plug_profile(name) | 149 self.host.plug_profile(name) |
150 | 150 |