|
1 | | -from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot |
2 | | -from PyQt5.QtNetwork import QTcpSocket |
3 | | -from PyQt5.QtWidgets import QApplication, QVBoxLayout, QLineEdit, QDialogButtonBox, QDialog, QLabel |
4 | | - |
5 | | -class ConnectDialog(QDialog): |
6 | | - def __init__(self, parent=None): |
7 | | - super().__init__(parent) |
8 | | - |
9 | | - self.setWindowTitle("Connect to IRC Server") |
10 | | - |
11 | | - self.layout = QVBoxLayout(self) |
12 | | - |
13 | | - self.host_label = QLabel("Host:", self) |
14 | | - self.layout.addWidget(self.host_label) |
15 | | - self.host_input = QLineEdit(self) |
16 | | - self.host_input.setText("irc.rizon.net") |
17 | | - self.layout.addWidget(self.host_input) |
18 | | - |
19 | | - self.port_label = QLabel("Port:", self) |
20 | | - self.layout.addWidget(self.port_label) |
21 | | - self.port_input = QLineEdit(self) |
22 | | - self.port_input.setText("6667") |
23 | | - self.layout.addWidget(self.port_input) |
24 | | - |
25 | | - self.nick_label = QLabel("Nickname:", self) |
26 | | - self.layout.addWidget(self.nick_label) |
27 | | - self.nick_input = QLineEdit(self) |
28 | | - self.nick_input.setText("pyechat") |
29 | | - self.layout.addWidget(self.nick_input) |
30 | | - |
31 | | - self.realname_label = QLabel("Real name:", self) |
32 | | - self.layout.addWidget(self.realname_label) |
33 | | - self.realname_input = QLineEdit(self) |
34 | | - self.realname_input.setText("Pyechat: https://pyechat.github.io") |
35 | | - self.layout.addWidget(self.realname_input) |
36 | | - |
37 | | - self.channel_label = QLabel("Channel:", self) |
38 | | - self.layout.addWidget(self.channel_label) |
39 | | - self.channel_input = QLineEdit(self) |
40 | | - self.channel_input.setText("#pyechat") |
41 | | - self.layout.addWidget(self.channel_input) |
42 | | - |
43 | | - self.buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) |
44 | | - self.buttons.accepted.connect(self.accept) |
45 | | - self.buttons.rejected.connect(self.reject) |
46 | | - self.layout.addWidget(self.buttons) |
47 | | - |
48 | | - def get_values(self): |
49 | | - return self.host_input.text(), int(self.port_input.text()), self.nick_input.text(), self.realname_input.text(), self.channel_input.text() |
50 | | - |
51 | | - def closeEvent(self, event): |
52 | | - QApplication.quit() |
| 1 | +from PyQt6.QtCore import QObject, pyqtSignal, pyqtSlot |
| 2 | +from PyQt6.QtNetwork import QTcpSocket |
| 3 | +from PyQt6.QtWidgets import QApplication, QVBoxLayout, QLineEdit, QDialogButtonBox, QDialog, QLabel |
53 | 4 |
|
54 | 5 | class IRCClient(QObject): |
55 | 6 | received_message = pyqtSignal(str) |
|
0 commit comments