From a75725425aaa29ad26d7f1225ec7e4e6c55a640d Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Fri, 14 Apr 2017 19:07:16 +0200 Subject: Initial commit, basic connection and message handling, some broken old code --- IrcWindow.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 IrcWindow.py (limited to 'IrcWindow.py') diff --git a/IrcWindow.py b/IrcWindow.py new file mode 100644 index 0000000..77a61cd --- /dev/null +++ b/IrcWindow.py @@ -0,0 +1,46 @@ +from PyQt5.QtCore import QUrl, QThread, pyqtSignal, QObject, pyqtSlot, Qt +from PyQt5.QtWidgets import QApplication +from PyQt5.QtQuick import QQuickView, QQuickItem, QQuickWindow +from PyQt5.QtQml import QQmlApplicationEngine +from PyQt5.QtGui import QGuiApplication, QKeyEvent + +import IrcHandler + +class IrcWindow(QQuickWindow): + + def __init__(self, view): + super(self.__class__, self).__init__() + self.view = view + self.handler = IrcHandler.IrcHandler() + + self.dumpQMLComponents(self.view) + self.connect_button = self.view.findChild(QQuickItem, "connect_button") + self.send_button = self.view.findChild(QQuickItem, "send_button") + self.input_field = self.view.findChild(QQuickItem, "input") + self.chat_area = self.view.findChild(QQuickItem, "chat_area") + + self.send_button.clicked.connect(self.handle_input) + self.connect_button.clicked.connect(self.connect_to_irc) + self.input_field.send_to_irc.connect(self.handle_input) + print(self.input_field) + + def connect_to_irc(self): + self.handler.connect_to_irc(self) + + def handle_input(self): + self.handler.handle_input(self) + + def get_input(self): + return self.input_field.property("text") + + def reset_input(self): + self.input_field.setProperty("text", "") + + @pyqtSlot(str) + def update_chat(self, text): + self.chat_area.append(text) + + def dumpQMLComponents(self, root): + children = root.findChildren(QObject) + for item in children: + print(item, item.objectName()) -- cgit v1.2.3