Network/IRC/IrcNetworkWidget.py

changeset 2244
654aaddbc2b9
parent 2242
3fae9858ea69
child 2245
cbddacb4bc2e
equal deleted inserted replaced
2243:c0323a43d966 2244:654aaddbc2b9
50 self.setupUi(self) 50 self.setupUi(self)
51 51
52 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png")) 52 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png"))
53 self.editButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png")) 53 self.editButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png"))
54 self.joinButton.setIcon(UI.PixmapCache.getIcon("ircJoinChannel.png")) 54 self.joinButton.setIcon(UI.PixmapCache.getIcon("ircJoinChannel.png"))
55
55 self.joinButton.setEnabled(False) 56 self.joinButton.setEnabled(False)
57 self.nickCombo.setEnabled(False)
56 58
57 self.__manager = None 59 self.__manager = None
58 self.__connected = False 60 self.__connected = False
61 self.__registered = False
59 62
60 def initialize(self, manager): 63 def initialize(self, manager):
61 """ 64 """
62 Public method to initialize the widget. 65 Public method to initialize the widget.
63 66
118 """ 121 """
119 Private slot to react upon changes of the channel. 122 Private slot to react upon changes of the channel.
120 123
121 @param txt current text of the channel combo (string) 124 @param txt current text of the channel combo (string)
122 """ 125 """
123 on = bool(txt) and self.__connected 126 on = bool(txt) and self.__registered
124 self.joinButton.setEnabled(on) 127 self.joinButton.setEnabled(on)
125 128
126 @pyqtSlot() 129 @pyqtSlot()
127 def on_joinButton_clicked(self): 130 def on_joinButton_clicked(self):
128 """ 131 """
148 self.channelCombo.setEnabled(True) 151 self.channelCombo.setEnabled(True)
149 identity = self.__manager.getIdentity( 152 identity = self.__manager.getIdentity(
150 network.getIdentityName()) 153 network.getIdentityName())
151 if identity: 154 if identity:
152 self.nickCombo.addItems(identity.getNickNames()) 155 self.nickCombo.addItems(identity.getNickNames())
153 self.nickCombo.setEnabled(True)
154 else: 156 else:
155 self.channelCombo.setEnabled(False) 157 self.channelCombo.setEnabled(False)
156 self.nickCombo.setEnabled(False)
157 158
158 def getNetworkChannels(self): 159 def getNetworkChannels(self):
159 """ 160 """
160 Public method to get the list of channels associated with the 161 Public method to get the list of channels associated with the
161 selected network. 162 selected network.
250 if self.__connected: 251 if self.__connected:
251 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircDisconnect.png")) 252 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircDisconnect.png"))
252 else: 253 else:
253 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png")) 254 self.connectButton.setIcon(UI.PixmapCache.getIcon("ircConnect.png"))
254 255
255 on = bool(self.channelCombo.currentText()) and self.__connected 256 def setRegistered(self, registered):
257 """
258 Public slot to set the registered state.
259
260 @param connected flag indicating the connection state (boolean)
261 """
262 self.__registered = registered
263 on = bool(self.channelCombo.currentText()) and self.__registered
256 self.joinButton.setEnabled(on) 264 self.joinButton.setEnabled(on)
265 self.nickCombo.setEnabled(registered)

eric ide

mercurial