more implementations for pyside gui

This commit is contained in:
2023-01-03 22:32:36 +01:00
parent 1f63d814ac
commit e96ec3eaec
3 changed files with 37 additions and 19 deletions

View File

@@ -1,10 +1,10 @@
import sys
sys.path.append('d:/PoeTrader')
from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QTabWidget
from PySide6 import QtCore
from trade_widget import TradeCollection
from src.data import Message
from src import config
from src.data import Message
from trade_widget import TradeCollection
from PySide6 import QtCore
from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QTabWidget
class MainWindow(QMainWindow):
@@ -12,27 +12,38 @@ class MainWindow(QMainWindow):
super().__init__()
config.read_config(r'config.yaml')
self.button_is_checked = True
self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
# self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.trades = {}
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From Sinusal: 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)'
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)'
message = Message.from_text(text)
message2 = Message.from_text(text2)
self.setWindowTitle("My App")
self.main_widget = QTabWidget()
# self.main_layout = QVBoxLayout()
if message:
trade_collection = TradeCollection(message)
trade_collection.add_trade(message)
self.main_widget.addTab(trade_collection, 'Hello')
self.main_widget.addTab(TradeCollection(message), 'Hello2')
# self.main_layout.addWidget(TradeWidget(message))
self.new_trade(message)
self.new_trade(message)
self.new_trade(message2)
self.setCentralWidget(self.main_widget)
def new_trade(self, message: Message):
if message.trade:
unique_item = message.trade.unique_item()
if unique_item in self.trades:
self.trades[unique_item].add_trade(message)
else:
collection = TradeCollection(message)
self.trades[message.trade.unique_item()] = collection
self.main_widget.addTab(collection, message.trade.item)
if __name__ == "__main__":
pass