eric6/Network/IRC/IrcChannelEditDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

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
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2012 - 2021 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
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
10 from PyQt5.QtCore import pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_IrcChannelEditDialog import Ui_IrcChannelEditDialog
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
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 class IrcChannelEditDialog(QDialog, Ui_IrcChannelEditDialog):
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 Class implementing a dialog to edit channel data.
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 def __init__(self, name, key, autoJoin, edit, parent=None):
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Constructor
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 @param name channel name (string)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param key channel key (string)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @param autoJoin flag indicating, that the channel should
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 be joined automatically (boolean)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @param edit flag indicating an edit of an existing
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 channel (boolean)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @param parent reference to the parent widget (QWidget)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
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
32 super(IrcChannelEditDialog, self).__init__(parent)
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setupUi(self)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.nameEdit.setText(name)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.keyEdit.setText(key)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.autoJoinCheckBox.setChecked(autoJoin)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.nameEdit.setReadOnly(edit)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 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
42
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
43 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
44 self.resize(max(self.width(), msh.width()), msh.height())
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 @pyqtSlot(str)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 def on_nameEdit_textChanged(self, txt):
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 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
50
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
51 @param txt text of the edit (string)
2235
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(txt != "")
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 def getData(self):
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 Public method to get the channel data.
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 @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
60 indicating, that the channel should be joined automatically
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 (string, string, boolean)
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 """
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 return (self.nameEdit.text(),
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 self.keyEdit.text(),
266800cbe7cc Continued with IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.autoJoinCheckBox.isChecked())

eric ide

mercurial