From 69a04199c12715d747181985d7a41180d75b799b Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Tue, 3 Jan 2023 23:19:55 +0100 Subject: [PATCH] hide the windows after all collections are done --- src/pyside6/gui_pyside6.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/pyside6/gui_pyside6.py b/src/pyside6/gui_pyside6.py index 595e465..aec6a57 100644 --- a/src/pyside6/gui_pyside6.py +++ b/src/pyside6/gui_pyside6.py @@ -1,7 +1,7 @@ import sys sys.path.append('d:/PoeTrader') from src import config -from src.data import Message +from src.data import Message, compile_regex from trade_widget import TradeCollection from PySide6 import QtCore from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QTabWidget @@ -11,7 +11,8 @@ class MainWindow(QMainWindow): def __init__(self): super().__init__() - config.read_config(r'config.yaml') + conf = config.read_config(r'config.yaml') + compile_regex(conf) self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) @@ -21,8 +22,10 @@ class MainWindow(QMainWindow): 'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)' text2 = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From NiceGuy: Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \ 'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)' + text3 = '2023/01/02 23:57:26 15123437 cffb0734 [INFO Client 16668] @From LASTTRYPOEenjoyer: Hi, I would like to buy your Watcher\'s Eye, Prismatic Jewel listed for 2.5 divine in Sanctum (stash tab "$2"; position: left 8, top 7)' message = Message.from_text(text) message2 = Message.from_text(text2) + message3 = Message.from_text(text3) self.setWindowTitle("My App") self.main_widget = QTabWidget() @@ -31,6 +34,7 @@ class MainWindow(QMainWindow): self.new_trade(message) self.new_trade(message) self.new_trade(message2) + self.new_trade(message3) self.setCentralWidget(self.main_widget) @@ -40,9 +44,15 @@ class MainWindow(QMainWindow): if unique_item in self.trades: self.trades[unique_item].add_trade(message) else: - collection = TradeCollection(message) + collection = TradeCollection(message, self) self.trades[message.trade.unique_item()] = collection self.main_widget.addTab(collection, message.trade.item) + self.show() + + def del_collection(self, unique_item: str): + del self.trades[unique_item] + if not self.trades: + self.hide() if __name__ == "__main__": @@ -51,6 +61,5 @@ if __name__ == "__main__": app.setStyle('Material') window = MainWindow() - window.show() app.exec()