summaryrefslogtreecommitdiff
path: root/IrcWindow.py
diff options
context:
space:
mode:
Diffstat (limited to 'IrcWindow.py')
-rw-r--r--IrcWindow.py46
1 files changed, 46 insertions, 0 deletions
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())