Mercurial > libervia-backend
comparison frontends/src/wix/gateways.py @ 587:952322b1d490
Remove trailing whitespaces.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 18 Jan 2013 17:55:34 +0100 |
parents | ca13633d3b6b |
children | 84a6e83157c2 |
comparison
equal
deleted
inserted
replaced
586:6a718ede8be1 | 587:952322b1d490 |
---|---|
34 wx.Frame.__init__(self, None, title=title) | 34 wx.Frame.__init__(self, None, title=title) |
35 QuickGatewaysManager.__init__(self, host, gateways, server) | 35 QuickGatewaysManager.__init__(self, host, gateways, server) |
36 | 36 |
37 if server: | 37 if server: |
38 self.SetTitle(title+" (%s)" % server) | 38 self.SetTitle(title+" (%s)" % server) |
39 | 39 |
40 #Fonts | 40 #Fonts |
41 self.normal_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL) | 41 self.normal_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL) |
42 self.bold_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD) | 42 self.bold_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD) |
43 self.italic_font = wx.Font(8, wx.DEFAULT, wx.FONTSTYLE_ITALIC, wx.NORMAL) | 43 self.italic_font = wx.Font(8, wx.DEFAULT, wx.FONTSTYLE_ITALIC, wx.NORMAL) |
44 self.button_font = wx.Font(6, wx.DEFAULT, wx.NORMAL, wx.BOLD) | 44 self.button_font = wx.Font(6, wx.DEFAULT, wx.NORMAL, wx.BOLD) |
59 self.panel.SetSizer(self.panel.sizer) | 59 self.panel.SetSizer(self.panel.sizer) |
60 self.panel.SetAutoLayout(True) | 60 self.panel.SetAutoLayout(True) |
61 self.sizer.Add(self.panel, 1, flag=wx.EXPAND) | 61 self.sizer.Add(self.panel, 1, flag=wx.EXPAND) |
62 self.SetSizer(self.sizer) | 62 self.SetSizer(self.sizer) |
63 self.SetAutoLayout(True) | 63 self.SetAutoLayout(True) |
64 | 64 |
65 #events | 65 #events |
66 self.Bind(wx.EVT_CLOSE, self.onClose, self) | 66 self.Bind(wx.EVT_CLOSE, self.onClose, self) |
67 | 67 |
68 self.MakeModal() | 68 self.MakeModal() |
69 self.panel.sizer.Add(wx.Window(self.panel, -1)) | 69 self.panel.sizer.Add(wx.Window(self.panel, -1)) |
70 title_name = wx.StaticText(self.panel, -1, "Name") | 70 title_name = wx.StaticText(self.panel, -1, "Name") |
71 title_name.SetFont(self.bold_font) | 71 title_name.SetFont(self.bold_font) |
72 title_type = wx.StaticText(self.panel, -1, "Type") | 72 title_type = wx.StaticText(self.panel, -1, "Type") |
73 title_type.SetFont(self.bold_font) | 73 title_type.SetFont(self.bold_font) |
74 self.panel.sizer.Add(title_name) | 74 self.panel.sizer.Add(title_name) |
75 self.panel.sizer.Add(title_type) | 75 self.panel.sizer.Add(title_type) |
76 self.panel.sizer.Add(wx.Window(self.panel, -1)) | 76 self.panel.sizer.Add(wx.Window(self.panel, -1)) |
77 self.panel.sizer.Add(wx.Window(self.panel, -1)) | 77 self.panel.sizer.Add(wx.Window(self.panel, -1)) |
78 | 78 |
79 for gateway in gateways: | 79 for gateway in gateways: |
80 self.addGateway(gateway, gateways[gateway]) | 80 self.addGateway(gateway, gateways[gateway]) |
81 | 81 |
82 self.ext_server_panel = wx.Panel(self) | 82 self.ext_server_panel = wx.Panel(self) |
83 self.ext_server_panel.sizer = wx.BoxSizer(wx.HORIZONTAL) | 83 self.ext_server_panel.sizer = wx.BoxSizer(wx.HORIZONTAL) |
92 self.ext_server_panel.Bind(wx.EVT_BUTTON, self.browseExternalServer, ext_server_button) | 92 self.ext_server_panel.Bind(wx.EVT_BUTTON, self.browseExternalServer, ext_server_button) |
93 | 93 |
94 self.ext_server_panel.sizer.Add(ext_server_label) | 94 self.ext_server_panel.sizer.Add(ext_server_label) |
95 self.ext_server_panel.sizer.Add(self.ext_server_text, 1, flag=wx.EXPAND) | 95 self.ext_server_panel.sizer.Add(self.ext_server_text, 1, flag=wx.EXPAND) |
96 self.ext_server_panel.sizer.Add(ext_server_button) | 96 self.ext_server_panel.sizer.Add(ext_server_button) |
97 | 97 |
98 #self.panel.sizer.Fit(self) | 98 #self.panel.sizer.Fit(self) |
99 self.sizer.Fit(self) | 99 self.sizer.Fit(self) |
100 | 100 |
101 self.Show() | 101 self.Show() |
102 | 102 |
103 def browseExternalServer(self, event): | 103 def browseExternalServer(self, event): |
104 """Open the gateway manager on given server""" | 104 """Open the gateway manager on given server""" |
105 server = self.ext_server_text.GetValue() | 105 server = self.ext_server_text.GetValue() |
106 debug(_("Opening gateways manager on [%s]") % server) | 106 debug(_("Opening gateways manager on [%s]") % server) |
107 id = self.host.bridge.findGateways(server, self.host.profile) | 107 id = self.host.bridge.findGateways(server, self.host.profile) |
108 self.host.current_action_ids.add(id) | 108 self.host.current_action_ids.add(id) |
109 self.host.current_action_ids_cb[id] = self.host.onGatewaysFound | 109 self.host.current_action_ids_cb[id] = self.host.onGatewaysFound |
110 self.MakeModal(False) | 110 self.MakeModal(False) |
111 self.Destroy() | 111 self.Destroy() |
112 | 112 |
113 | 113 |
114 def addGateway(self, gateway, param): | 114 def addGateway(self, gateway, param): |
115 | 115 |
119 | 119 |
120 #Then the name | 120 #Then the name |
121 | 121 |
122 label=wx.StaticText(self.panel, -1, param['name']) | 122 label=wx.StaticText(self.panel, -1, param['name']) |
123 label.SetFont(self.normal_font) | 123 label.SetFont(self.normal_font) |
124 | 124 |
125 #Then the transport type message | 125 #Then the transport type message |
126 type_label_txt = self.getGatewayDesc(param['type']) | 126 type_label_txt = self.getGatewayDesc(param['type']) |
127 | 127 |
128 type_label = wx.StaticText(self.panel, -1, type_label_txt) | 128 type_label = wx.StaticText(self.panel, -1, type_label_txt) |
129 type_label.SetFont(self.italic_font) | 129 type_label.SetFont(self.italic_font) |
132 def register_cb(event): | 132 def register_cb(event): |
133 """Called when register button is clicked""" | 133 """Called when register button is clicked""" |
134 gateway_jid = event.GetEventObject().gateway_jid | 134 gateway_jid = event.GetEventObject().gateway_jid |
135 id = self.host.bridge.in_band_register(gateway_jid, self.host.profile) | 135 id = self.host.bridge.in_band_register(gateway_jid, self.host.profile) |
136 self.host.current_action_ids.add(id) | 136 self.host.current_action_ids.add(id) |
137 self.MakeModal(False) | 137 self.MakeModal(False) |
138 self.Destroy() | 138 self.Destroy() |
139 | 139 |
140 def unregister_cb(event): | 140 def unregister_cb(event): |
141 """Called when unregister button is clicked""" | 141 """Called when unregister button is clicked""" |
142 gateway_jid = event.GetEventObject().gateway_jid | 142 gateway_jid = event.GetEventObject().gateway_jid |
143 id = self.host.bridge.gatewayRegister("CANCEL",gateway_jid, None, self.host.profile) | 143 id = self.host.bridge.gatewayRegister("CANCEL",gateway_jid, None, self.host.profile) |
144 self.host.current_action_ids.add(id) | 144 self.host.current_action_ids.add(id) |
145 self.MakeModal(False) | 145 self.MakeModal(False) |
146 self.Destroy() | 146 self.Destroy() |
147 | 147 |
148 reg_button = wx.Button(self.panel, -1, _("Register"), size=wx.Size(-1, 8)) | 148 reg_button = wx.Button(self.panel, -1, _("Register"), size=wx.Size(-1, 8)) |
149 reg_button.SetFont(self.button_font) | 149 reg_button.SetFont(self.button_font) |
150 reg_button.gateway_jid = JID(gateway) | 150 reg_button.gateway_jid = JID(gateway) |
151 self.panel.Bind(wx.EVT_BUTTON, register_cb, reg_button) | 151 self.panel.Bind(wx.EVT_BUTTON, register_cb, reg_button) |
152 unreg_button = wx.Button(self.panel, -1, _("Unregister"), size=wx.Size(-1, 8)) | 152 unreg_button = wx.Button(self.panel, -1, _("Unregister"), size=wx.Size(-1, 8)) |
153 unreg_button.SetFont(self.button_font) | 153 unreg_button.SetFont(self.button_font) |
154 unreg_button.gateway_jid = JID(gateway) | 154 unreg_button.gateway_jid = JID(gateway) |
155 self.panel.Bind(wx.EVT_BUTTON, unregister_cb, unreg_button) | 155 self.panel.Bind(wx.EVT_BUTTON, unregister_cb, unreg_button) |
156 | 156 |
157 self.panel.sizer.Add(im_icon) | 157 self.panel.sizer.Add(im_icon) |
158 self.panel.sizer.Add(label) | 158 self.panel.sizer.Add(label) |
159 self.panel.sizer.Add(type_label) | 159 self.panel.sizer.Add(type_label) |
160 self.panel.sizer.Add(reg_button, 1, wx.EXPAND) | 160 self.panel.sizer.Add(reg_button, 1, wx.EXPAND) |
161 self.panel.sizer.Add(unreg_button, 1, wx.EXPAND) | 161 self.panel.sizer.Add(unreg_button, 1, wx.EXPAND) |