# HG changeset patch # User souliane # Date 1394538931 -3600 # Node ID 6e38d317bc16e5fc86ed3f6f993f4c760621b1c0 # Parent 462fc3359ee38a9a0470d78d5088026e82727631 browser_side: RoomChooser small improvements: - hide "Already joined" row if no room has been joined - select by default the first joined room (if any) diff -r 462fc3359ee3 -r 6e38d317bc16 browser_side/dialog.py --- a/browser_side/dialog.py Tue Mar 11 12:31:29 2014 +0100 +++ b/browser_side/dialog.py Tue Mar 11 12:55:31 2014 +0100 @@ -50,22 +50,24 @@ Grid.__init__(self, 2, 2, Width='100%') self.host = host - self.exist_radio = RadioButton("room", "Already joined:") - self.rooms_list = ListBox(Width='95%') - self.setRooms() - self.new_radio = RadioButton("room", "Discussion room:") self.new_radio.setChecked(True) self.box = TextBox(Width='95%') self.box.setText(self.GENERATE_MUC if default_room == "" else default_room) + self.exist_radio = RadioButton("room", "Already joined:") + self.rooms_list = ListBox(Width='95%') self.add(self.new_radio, 0, 0) self.add(self.box, 0, 1) self.add(self.exist_radio, 1, 0) self.add(self.rooms_list, 1, 1) + self.box.addFocusListener(self) self.rooms_list.addFocusListener(self) - self.box.addFocusListener(self) + + self.exist_radio.setVisible(False) + self.rooms_list.setVisible(False) + self.setRooms() def onFocus(self, sender): if sender == self.rooms_list: @@ -80,9 +82,13 @@ if self.box.getText() == "": self.box.setText(self.GENERATE_MUC) - def setRooms(self, room_data): + def setRooms(self): for room in self.host.room_list: self.rooms_list.addItem(room.bare) + if len(self.host.room_list) > 0: + self.exist_radio.setVisible(True) + self.rooms_list.setVisible(True) + self.exist_radio.setChecked(True) def getRoom(self): if self.exist_radio.getChecked(): @@ -174,9 +180,12 @@ self.contact_panel = ContactsChooser(host, nb_contact, ok_button) self.stack_panel = ToggleStackPanel(Width="100%") - self.stack_panel.add(self.room_panel, title_room, visible=visible[0]) - self.stack_panel.add(self.contact_panel, title_invite, visible=visible[1]) + self.stack_panel.add(self.room_panel, visible=visible[0]) + self.stack_panel.add(self.contact_panel, visible=visible[1]) self.stack_panel.addStackChangeListener(self) + self.onStackChanged(self.stack_panel, 0, visible[0]) + self.onStackChanged(self.stack_panel, 1, visible[1]) + main_panel = VerticalPanel() main_panel.setStyleName("room-contact-chooser") main_panel.add(self.stack_panel)