592 brokerList = self.__plugin.getPreferences("RecentBrokersWithPort") |
592 brokerList = self.__plugin.getPreferences("RecentBrokersWithPort") |
593 hostAndPort = [host, port] |
593 hostAndPort = [host, port] |
594 if hostAndPort in brokerList: |
594 if hostAndPort in brokerList: |
595 brokerList.remove(hostAndPort) |
595 brokerList.remove(hostAndPort) |
596 brokerList.insert(0, hostAndPort) |
596 brokerList.insert(0, hostAndPort) |
|
597 # TODO: limit to most recently used 20 entries |
597 self.__plugin.setPreferences("RecentBrokersWithPort", brokerList) |
598 self.__plugin.setPreferences("RecentBrokersWithPort", brokerList) |
598 |
599 |
599 self.__populateBrokerComboBoxes() |
600 self.__populateBrokerComboBoxes() |
600 |
601 |
601 def __populateBrokerComboBoxes(self): |
602 def __populateBrokerComboBoxes(self): |
607 # step 1: clear combo boxes |
608 # step 1: clear combo boxes |
608 self.brokerComboBox.clear() |
609 self.brokerComboBox.clear() |
609 self.brokerPortComboBox.clear() |
610 self.brokerPortComboBox.clear() |
610 |
611 |
611 # step 2a: populate the broker name list |
612 # step 2a: populate the broker name list |
|
613 # TODO: make list unique and sorted |
612 self.brokerComboBox.addItems([b[0].strip() for b in brokerList]) |
614 self.brokerComboBox.addItems([b[0].strip() for b in brokerList]) |
613 |
615 |
614 self.__setConnectButtonState() |
616 self.__setConnectButtonState() |
615 |
617 |
616 # step 2b: populate the broker ports list |
618 # step 2b: populate the broker ports list |