comparison src/browser/sat_browser/dialog.py @ 692:7a9c7b9f6a28

browser_side: use host.default_muc instead of C.DEFAULT_MUC
author souliane <souliane@mailoo.org>
date Thu, 09 Apr 2015 11:37:25 +0200
parents 90a5a5af2550
children e4ae8e2b0afd
comparison
equal deleted inserted replaced
691:16079280a39e 692:7a9c7b9f6a28
52 class RoomChooser(Grid): 52 class RoomChooser(Grid):
53 """Select a room from the rooms you already joined, or create a new one""" 53 """Select a room from the rooms you already joined, or create a new one"""
54 54
55 GENERATE_MUC = "<use random name>" 55 GENERATE_MUC = "<use random name>"
56 56
57 def __init__(self, host, default_room=C.DEFAULT_MUC): 57 def __init__(self, host, room_jid_s=None):
58 """ 58 """
59 59
60 @param host (SatWebFrontend) 60 @param host (SatWebFrontend)
61 @param room_jid_s (unicode): room JID
61 """ 62 """
62 Grid.__init__(self, 2, 2, Width='100%') 63 Grid.__init__(self, 2, 2, Width='100%')
63 self.host = host 64 self.host = host
64 65
65 self.new_radio = RadioButton("room", "Discussion room:") 66 self.new_radio = RadioButton("room", "Discussion room:")
66 self.new_radio.setChecked(True) 67 self.new_radio.setChecked(True)
67 self.box = TextBox(Width='95%') 68 self.box = TextBox(Width='95%')
68 self.box.setText(self.GENERATE_MUC if default_room == "" else default_room) 69 self.box.setText(room_jid_s if room_jid_s else self.GENERATE_MUC)
69 self.exist_radio = RadioButton("room", "Already joined:") 70 self.exist_radio = RadioButton("room", "Already joined:")
70 self.rooms_list = ListBox(Width='95%') 71 self.rooms_list = ListBox(Width='95%')
71 72
72 self.add(self.new_radio, 0, 0) 73 self.add(self.new_radio, 0, 0)
73 self.add(self.box, 0, 1) 74 self.add(self.box, 0, 1)
201 button_panel.addStyleName("marginAuto") 202 button_panel.addStyleName("marginAuto")
202 ok_button = Button("OK", self.onOK) 203 ok_button = Button("OK", self.onOK)
203 button_panel.add(ok_button) 204 button_panel.add(ok_button)
204 button_panel.add(Button("Cancel", self.onCancel)) 205 button_panel.add(Button("Cancel", self.onCancel))
205 206
206 self.room_panel = RoomChooser(host, "" if visible == (False, True) else C.DEFAULT_MUC) 207 self.room_panel = RoomChooser(host, None if visible == (False, True) else host.default_muc)
207 self.contact_panel = ContactsChooser(host, nb_contact, ok_button) 208 self.contact_panel = ContactsChooser(host, nb_contact, ok_button)
208 209
209 self.stack_panel = base_panel.ToggleStackPanel(Width="100%") 210 self.stack_panel = base_panel.ToggleStackPanel(Width="100%")
210 self.stack_panel.add(self.room_panel, visible=visible[0]) 211 self.stack_panel.add(self.room_panel, visible=visible[0])
211 self.stack_panel.add(self.contact_panel, visible=visible[1]) 212 self.stack_panel.add(self.contact_panel, visible=visible[1])