Network/IRC/IrcNetworkEditDialog.py

Tue, 27 Nov 2012 20:05:59 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 27 Nov 2012 20:05:59 +0100
changeset 2233
26b34180a943
child 2234
1e33501a0d33
permissions
-rw-r--r--

Started implementing the IRC network edit dialog.

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

eric ide

mercurial