diff options
author | Joe Robinson <joe@lc8n.com> | 2017-04-15 16:08:40 +0200 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2017-04-15 16:08:40 +0200 |
commit | 166a8206a3747628182a97acbc25bf393e78eac9 (patch) | |
tree | 7725fbfd060ed4ac0e6ec698ab2eb20199b699b5 /IrcWindow.py | |
parent | cb1429328b11e1acef99e4c5730e55e3384b19fd (diff) |
Handle joining of channels, tab UI, probably some other things
Diffstat (limited to 'IrcWindow.py')
-rw-r--r-- | IrcWindow.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/IrcWindow.py b/IrcWindow.py index 77a61cd..4dc0d4c 100644 --- a/IrcWindow.py +++ b/IrcWindow.py @@ -1,5 +1,5 @@ from PyQt5.QtCore import QUrl, QThread, pyqtSignal, QObject, pyqtSlot, Qt -from PyQt5.QtWidgets import QApplication +from PyQt5.QtWidgets import QApplication, QTabBar from PyQt5.QtQuick import QQuickView, QQuickItem, QQuickWindow from PyQt5.QtQml import QQmlApplicationEngine from PyQt5.QtGui import QGuiApplication, QKeyEvent @@ -11,34 +11,43 @@ class IrcWindow(QQuickWindow): def __init__(self, view): super(self.__class__, self).__init__() self.view = view - self.handler = IrcHandler.IrcHandler() + self.handler = IrcHandler.IrcHandler(self) 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.nick_list = self.view.findChild(QQuickItem, "nick_list") + self.channel_tabs = self.view.findChild(QQuickItem, "channel_tabs") 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) + self.handler.handle_input() - def get_input(self): - return self.input_field.property("text") + def get_input(self, channel): + print(channel) + channel_tab = self.view.findChild(QQuickItem, "channel-" + channel) + channel_input = channel_tab.findChild(QQuickItem, "input") + return channel_input.property("text") - def reset_input(self): - self.input_field.setProperty("text", "") + def reset_input(self, channel): + channel_tab = self.view.findChild(QQuickItem, "channel-" + channel) + channel_input = channel_tab.findChild(QQuickItem, "input") + channel_input.setProperty("text", "") @pyqtSlot(str) - def update_chat(self, text): - self.chat_area.append(text) + def update_chat(self, channel, text): + channel_tab = self.view.findChild(QQuickItem, "channel-" + channel) + channel_chat_area = channel_tab.findChild(QQuickItem, "chat_area") + channel_chat_area.append(text) def dumpQMLComponents(self, root): children = root.findChildren(QObject) |