Network/IRC/IrcChannelEditDialog.py

changeset 2235
266800cbe7cc
child 2302
f29e9405c851
equal deleted inserted replaced
2234:1e33501a0d33 2235:266800cbe7cc
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to edit channel data.
8 """
9
10 from PyQt4.QtCore import pyqtSlot
11 from PyQt4.QtGui import QDialog, QDialogButtonBox
12
13 from .Ui_IrcChannelEditDialog import Ui_IrcChannelEditDialog
14
15
16 class IrcChannelEditDialog(QDialog, Ui_IrcChannelEditDialog):
17 """
18 Class implementing a dialog to edit channel data.
19 """
20 def __init__(self, name, key, autoJoin, edit, parent=None):
21 """
22 Constructor
23
24 @param name channel name (string)
25 @param key channel key (string)
26 @param autoJoin flag indicating, that the channel should
27 be joined automatically (boolean)
28 @param edit flag indicating an edit of an existing
29 channel (boolean)
30 @param parent reference to the parent widget (QWidget)
31 """
32 super().__init__(parent)
33 self.setupUi(self)
34
35 self.nameEdit.setText(name)
36 self.keyEdit.setText(key)
37 self.autoJoinCheckBox.setChecked(autoJoin)
38
39 self.nameEdit.setReadOnly(edit)
40
41 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(name != "")
42
43 @pyqtSlot(str)
44 def on_nameEdit_textChanged(self, txt):
45 """
46 Private slot to handle changes of the given name.
47 """
48 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(txt != "")
49
50 def getData(self):
51 """
52 Public method to get the channel data.
53
54 @return tuple giving the channel name, channel key and a flag
55 indicating, that the channel should be joined automatically
56 (string, string, boolean)
57 """
58 return (self.nameEdit.text(),
59 self.keyEdit.text(),
60 self.autoJoinCheckBox.isChecked())

eric ide

mercurial