Network/IRC/IrcNetworkEditDialog.py

changeset 2233
26b34180a943
child 2234
1e33501a0d33
equal deleted inserted replaced
2232:47290dad6d0b 2233:26b34180a943
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog for editing IRC network definitions.
8 """
9
10 from PyQt4.QtCore import pyqtSlot
11 from PyQt4.QtGui import QDialog, QDialogButtonBox, QTreeWidgetItem
12
13 from .Ui_IrcNetworkEditDialog import Ui_IrcNetworkEditDialog
14
15 from .IrcNetworkManager import IrcIdentity
16
17 import UI.PixmapCache
18
19
20 class IrcNetworkEditDialog(QDialog, Ui_IrcNetworkEditDialog):
21 """
22 Class implementing a dialog for editing IRC network definitions.
23 """
24 def __init__(self, manager, networkName, parent=None):
25 """
26 Constructor
27
28 @param manager reference to the IRC network manager object (IrcNetworkManager)
29 @param networkName name of the network to work on (string)
30 @param parent reference to the parent widget (QWidget)
31 """
32 super().__init__(parent)
33 self.setupUi(self)
34
35 self.__manager = manager
36
37 self.editIdentitiesButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png"))
38 self.editServersButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png"))
39 self.editChannelButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png"))
40 self.addChannelButton.setIcon(UI.PixmapCache.getIcon("plus.png"))
41 self.deleteChannelButton.setIcon(UI.PixmapCache.getIcon("minus.png"))
42
43 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok)
44
45 self.networkEdit.setText(networkName)
46 identities = list(sorted(self.__manager.getIdentityNames()))
47 identities[identities.index(IrcIdentity.DefaultIdentityName)] = \
48 IrcIdentity.DefaultIdentityDisplay
49 self.identityCombo.addItems(identities)
50
51 self.__updateOkButton()
52
53 def __updateOkButton(self):
54 """
55 Private method to update the OK button state.
56 """
57 enable = True
58 enable &= self.networkEdit.text() != ""
59 enable &= self.serverCombo.currentText() != ""
60
61 self.__okButton.setEnabled(enable)
62
63 @pyqtSlot(str)
64 def on_networkEdit_textChanged(self, txt):
65 """
66 Private slot to handle changes of the network name.
67
68 @param txt text entered into the network name edit (string)
69 """
70 self.__updateOkButton()
71
72 @pyqtSlot()
73 def on_editIdentitiesButton_clicked(self):
74 """
75 Slot documentation goes here.
76 """
77 # TODO: not implemented yet
78 raise NotImplementedError
79
80 @pyqtSlot(str)
81 def on_serverCombo_activated(self, txt):
82 """
83 Private slot to handle the selection of a server.
84
85 @param txt selected server (string)
86 """
87 self.__updateOkButton()
88
89 @pyqtSlot()
90 def on_editServersButton_clicked(self):
91 """
92 Slot documentation goes here.
93 """
94 # TODO: not implemented yet
95 raise NotImplementedError
96
97 @pyqtSlot()
98 def on_addChannelButton_clicked(self):
99 """
100 Slot documentation goes here.
101 """
102 # TODO: not implemented yet
103 raise NotImplementedError
104
105 @pyqtSlot()
106 def on_editChannelButton_clicked(self):
107 """
108 Slot documentation goes here.
109 """
110 # TODO: not implemented yet
111 raise NotImplementedError
112
113 @pyqtSlot()
114 def on_deleteChannelButton_clicked(self):
115 """
116 Slot documentation goes here.
117 """
118 # TODO: not implemented yet
119 raise NotImplementedError
120
121 @pyqtSlot(QTreeWidgetItem, int)
122 def on_channelList_itemActivated(self, item, column):
123 """
124 Slot documentation goes here.
125 """
126 # TODO: not implemented yet
127 raise NotImplementedError
128
129 @pyqtSlot()
130 def on_channelList_itemSelectionChanged(self):
131 """
132 Slot documentation goes here.
133 """
134 # TODO: not implemented yet
135 raise NotImplementedError

eric ide

mercurial