Network/IRC/IrcNetworkWidget.py

changeset 2234
1e33501a0d33
parent 2232
47290dad6d0b
child 2237
baddb671c326
--- a/Network/IRC/IrcNetworkWidget.py	Tue Nov 27 20:05:59 2012 +0100
+++ b/Network/IRC/IrcNetworkWidget.py	Wed Nov 28 19:00:40 2012 +0100
@@ -45,6 +45,7 @@
         self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png"))
         self.editButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png"))
         self.joinButton.setIcon(UI.PixmapCache.getIcon("ircJoinChannel.png"))
+        self.joinButton.setEnabled(False)
         
         self.__manager = None
         self.__connected = False
@@ -101,7 +102,7 @@
         
         @param txt current text of the channel combo (string)
         """
-        on = bool(txt)
+        on = bool(txt) and self.__connected
         self.joinButton.setEnabled(on)
     
     @pyqtSlot()
@@ -124,7 +125,7 @@
         self.nickCombo.clear()
         self.channelCombo.clear()
         if network:
-            channels = network.getChannels()
+            channels = network.getChannelNames()
             self.channelCombo.addItems(channels)
             self.channelCombo.setEnabled(True)
             identity = self.__manager.getIdentity(
@@ -136,6 +137,17 @@
             self.channelCombo.setEnabled(False)
             self.nickCombo.setEnabled(False)
     
+    def getNetworkChannels(self):
+        """
+        Public method to get the list of channels associated with the
+        selected network.
+        
+        @return associated channels (list of IrcChannel)
+        """
+        networkName = self.networkCombo.currentText()
+        network = self.__manager.getNetwork(networkName)
+        return network.getChannels()
+    
     @pyqtSlot(str)
     def on_nickCombo_activated(self, nick):
         """
@@ -221,3 +233,6 @@
             self.connectButton.setIcon(UI.PixmapCache.getIcon("ircDisconnect.png"))
         else:
             self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png"))
+        
+        on = bool(self.channelCombo.currentText()) and self.__connected
+        self.joinButton.setEnabled(on)

eric ide

mercurial