eric6/Network/IRC/IrcChannelEditDialog.py

Sat, 11 Apr 2020 14:13:25 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 11 Apr 2020 14:13:25 +0200
changeset 7522
e0e05a1b576f
parent 7360
9190402e4505
child 7780
41420f82c0ac
permissions
-rw-r--r--

Styles: added some Qt style sheets and some highlighter styles.

2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
3 # Copyright (c) 2012 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to edit channel data.
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
10
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
11 from PyQt5.QtCore import pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_IrcChannelEditDialog import Ui_IrcChannelEditDialog
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 class IrcChannelEditDialog(QDialog, Ui_IrcChannelEditDialog):
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 Class implementing a dialog to edit channel data.
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 def __init__(self, name, key, autoJoin, edit, parent=None):
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param name channel name (string)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @param key channel key (string)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param autoJoin flag indicating, that the channel should
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 be joined automatically (boolean)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param edit flag indicating an edit of an existing
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 channel (boolean)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @param parent reference to the parent widget (QWidget)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
33 super(IrcChannelEditDialog, self).__init__(parent)
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.setupUi(self)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.nameEdit.setText(name)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.keyEdit.setText(key)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.autoJoinCheckBox.setChecked(autoJoin)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.nameEdit.setReadOnly(edit)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(name != "")
3366
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
43
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
44 msh = self.minimumSizeHint()
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
45 self.resize(max(self.width(), msh.width()), msh.height())
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 @pyqtSlot(str)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 def on_nameEdit_textChanged(self, txt):
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 Private slot to handle changes of the given name.
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
51
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
52 @param txt text of the edit (string)
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(txt != "")
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 def getData(self):
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 Public method to get the channel data.
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 @return tuple giving the channel name, channel key and a flag
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 indicating, that the channel should be joined automatically
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 (string, string, boolean)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 return (self.nameEdit.text(),
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.keyEdit.text(),
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.autoJoinCheckBox.isChecked())

eric ide

mercurial