From 02d26553806f4bb8858807afb061772af1cadfb8 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 23 Dec 2022 17:14:40 -0700 Subject: [PATCH] fixed MMR = -1 error, and a couple other bugs. --- src/DbHandler.py | 28 +++++++++++++-- src/Logger.py | 8 ++--- src/MainWindow/Chart/Bars.py | 43 +++++++++++++++-------- src/MainWindow/Chart/Chart.py | 4 +-- src/MainWindow/Chart/KdaData.py | 2 +- src/MainWindow/Chart/MmrData.py | 2 +- src/MainWindow/Chart/ScatterItem.py | 9 +++-- src/MainWindow/Chart/WinLoss.py | 27 +++++++++----- src/MainWindow/Hunters/FrequentHunters.py | 43 +++++++++-------------- src/MainWindow/Hunters/HunterSearch.py | 8 ++--- src/MainWindow/Hunters/TopKills.py | 6 +++- src/MainWindow/Hunts/TeamDetails.py | 2 +- src/SettingsWindow.py | 7 ++-- src/Widgets/MonstersWidget.py | 2 +- src/Widgets/Popup.py | 35 ++++++++++++++++-- src/Widgets/Toast.py | 4 ++- 16 files changed, 147 insertions(+), 83 deletions(-) diff --git a/src/DbHandler.py b/src/DbHandler.py index a9c3c7f..c91ee33 100644 --- a/src/DbHandler.py +++ b/src/DbHandler.py @@ -1,4 +1,5 @@ import sqlite3 +import ctypes from resources import * @@ -111,7 +112,9 @@ def GetTotalHuntCount(): return -1 return n[0][0] -def GetCurrentMmr(pid = settings.value("profileid")): +def GetCurrentMmr(pid = None): + if pid == None or pid < 0: + pid = settings.value("profileid") mmr = execute_query("select mmr from 'hunters' where profileid is '%s' and timestamp is %d" % (pid, GetLastHuntTimestamp())) if len(mmr) == 0: return -1 @@ -120,7 +123,9 @@ def GetCurrentMmr(pid = settings.value("profileid")): return -1 return mmr -def GetBestMmr(pid = settings.value("profileid")): +def GetBestMmr(pid = None): + if pid == None or pid < 0: + pid = settings.value("profileid") mmr = execute_query("select max(mmr) from 'hunters' where profileid is '%s'" % pid) if len(mmr) == 0: return -1 @@ -148,6 +153,7 @@ def GetTopKilled(): def GetTopNHunters(n): cols = ['frequency','name', 'profileid', 'mmr','killedme','killedbyme'] vals = execute_query("select count(profileid) as frequency, blood_line_name, profileid, mmr, killedme+downedme as killedme, killedbyme+downedbyme as killedbyme from 'hunters' where profileid is not '%s' group by profileid order by frequency desc limit %d" % (settings.value("profileid"), n)) + #vals = execute_query("select count(profileid) as frequency, blood_line_name, profileid, mmr, killedme+downedme as killedme, killedbyme+downedbyme as killedbyme from 'hunters' group by profileid order by frequency desc limit %d" % (n)) results = [] if len(vals) > 0: for v in vals: @@ -491,4 +497,20 @@ def getKillData(ts): "team_kills": team_kills, "your_deaths": your_deaths, "assists": assists - } \ No newline at end of file + } + + +def SameTeamCount(name): + res = execute_query("select count(*) from 'hunters' join 'teams' on 'teams'.ownteam = 'true' and 'hunters'.team_num = 'teams'.team_num and 'hunters'.timestamp = 'teams'.timestamp where 'hunters'.blood_line_name = '%s'" % name) + res = 0 if len(res) == 0 else res[0][0] + return res + +def getAllUsernames(pid): + allnamesarray = execute_query( + "select blood_line_name from 'hunters' where profileid is %d group by blood_line_name" % pid) + allnames = [] + if len(allnamesarray) <= 0: + return allnames + for n in allnamesarray: + allnames.append(n[0]) + return allnames \ No newline at end of file diff --git a/src/Logger.py b/src/Logger.py index d42f0d3..51e820b 100644 --- a/src/Logger.py +++ b/src/Logger.py @@ -9,7 +9,6 @@ from PyQt6.QtCore import QObject, pyqtSignal from resources import * from DbHandler import * -from Widgets.Toast import Toast def file_changed(ts): return os.stat(settings.value("xml_path")).st_mtime != ts @@ -33,7 +32,6 @@ def __init__(self,parent): if not tables_exist(): create_tables() self.running = False - self.toast = Toast("New Hunt Recorded.",parent=self.mainframe.window()) super().__init__() def run(self): @@ -73,10 +71,10 @@ def run(self): self.mainframe.setStatus("writing new record to database....") json_to_db(new_data) last_hunt = last_change + log('successfully recorded hunt') self.progress.emit() - self.toast.show() except Exception as e: - log('building json error') + log('building json error, trying again') log(e) continue @@ -180,7 +178,6 @@ def clean_data(obj): def build_json_from_xml(ts): - #print('building json object') with open(settings.value("xml_path"),'r',encoding='utf-8') as xf: teams = {} hunters = {} @@ -248,7 +245,6 @@ def build_json_from_xml(ts): if settings.value("HunterLevel","") != "" and int(val) < int(settings.value("HunterLevel")): log("prestiged") settings.setValue("HunterLevel",val) - return clean_data({ "teams":teams, "hunters":hunters, diff --git a/src/MainWindow/Chart/Bars.py b/src/MainWindow/Chart/Bars.py index 9b782d1..0188fd6 100644 --- a/src/MainWindow/Chart/Bars.py +++ b/src/MainWindow/Chart/Bars.py @@ -1,11 +1,11 @@ -from PyQt6.QtWidgets import QWidget, QLabel, QVBoxLayout -from PyQt6.QtCore import QRectF -from PyQt6.QtGui import QCursor, QColor +from PyQt6.QtWidgets import QWidget, QLabel, QVBoxLayout, QGraphicsItem, QGraphicsRectItem, QGraphicsOpacityEffect, QGraphicsObject +from PyQt6.QtCore import QRectF, QAbstractAnimation, QPropertyAnimation, QObject +from PyQt6.QtGui import QCursor, QColor, QBrush import pyqtgraph from Widgets.Popup import Popup -# for this to work I have to make sure the constructor contains: # x0 [], x1 [], height [], brushes [] +# y0 [] class Bars(pyqtgraph.BarGraphItem): def __init__(self, **opts): super().__init__(**opts) @@ -24,16 +24,17 @@ def __init__(self, **opts): if 'y0' not in opts: opts['y0'] = [0]*len(opts['x0']) for i in range(len(opts['x0'])): - self.bars.append(QRectF( + bar = Bar( opts['x0'][i], opts['y0'][i], self.width, opts['height'][i] - )) + ) + self.bars.append(bar) self.hoverable = True def hoverEnterEvent(self,ev): - return None#super().hoverEnterEvent(ev) + return super().hoverEnterEvent(ev) def hoverMoveEvent(self,ev): if not self.hoverable: @@ -43,6 +44,7 @@ def hoverMoveEvent(self,ev): b = self.bars[i] if b.contains(ev.pos()): contained = True + self.brushes[i].setAlpha(255) if self.popup == None or not self.popup.isVisible(): w = self.getViewWidget().window() self.brushes[i].setAlpha(255) @@ -58,23 +60,34 @@ def hoverMoveEvent(self,ev): self.popup.current = b w.raise_() w.activateWindow() - self.setOpts() elif self.popup.current != b: - self.popup.close() + self.popup.hide() else: self.brushes[i].setAlpha(200) - self.setOpts() + self.setOpts() if not contained: try: - self.popup.close() + self.popup.hide() except: self.popup = None self.scene().update() - return None#super().hoverEnterEvent(ev) + return super().hoverEnterEvent(ev) def hoverLeaveEvent(self,ev): + for i in range(len(self.bars)): + self.brushes[i].setAlpha(200) + self.setOpts() try: - self.popup.close() + self.popup.hide() except: - self.popup = None - return super().hoverEnterEvent(ev) \ No newline at end of file + return + return super().hoverEnterEvent(ev) + +class Bar(QGraphicsRectItem, QObject): + def __init__(self,*args): + super().__init__(*(args)) + self.setAcceptHoverEvents(True) + + def hoverEnterEvent(self, event): + print('h') + return super().hoverEnterEvent(event) \ No newline at end of file diff --git a/src/MainWindow/Chart/Chart.py b/src/MainWindow/Chart/Chart.py index 992e73d..2f18ff2 100644 --- a/src/MainWindow/Chart/Chart.py +++ b/src/MainWindow/Chart/Chart.py @@ -155,12 +155,12 @@ def setWinLoss(self): ) ) + 32 ''' - height = 120 + height = winLoss.ymax+10 self.plot.addItem(winLoss.bountyBars) self.plot.addItem(winLoss.quickplayBars) self.plot.addItem(winLoss.survivalBars) - self.plot.setLabel('left','Win/Loss %') + self.plot.setLabel('left','# of Hunts') self.plot.setLimits(xMin=0, xMax=80,yMin=0, yMax=height) self.plot.setXRange(0,80) self.plot.setYRange(0,height) diff --git a/src/MainWindow/Chart/KdaData.py b/src/MainWindow/Chart/KdaData.py index 734af18..4f31b7d 100644 --- a/src/MainWindow/Chart/KdaData.py +++ b/src/MainWindow/Chart/KdaData.py @@ -45,7 +45,7 @@ def __init__(self,parent=None): self.line = PlotDataItem(data,pen="#ffffff88") self.qpPoints = ScatterItem( - [{'x': pt['x'], 'y': pt['y'], 'data':unix_to_datetime(pt['ts'])} for pt in data if pt['qp'] == 'true'], + [{'x': pt['x'], 'y': pt['y'], 'data':pt['ts']} for pt in data if pt['qp'] == 'true'], pen="#000000",brush="#00ffff",name="Quick Play",tip="{data}
KDA: {y:.2f}".format, parent=self.parent ) self.bhPoints = ScatterItem( diff --git a/src/MainWindow/Chart/MmrData.py b/src/MainWindow/Chart/MmrData.py index b9ab0e4..d308261 100644 --- a/src/MainWindow/Chart/MmrData.py +++ b/src/MainWindow/Chart/MmrData.py @@ -41,7 +41,7 @@ def __init__(self,parent=None) -> None: ) lastTs = GetLastHuntTimestamp() spots = [{'x': GetTotalHuntCount(), 'y': prediction, - 'data': -1}] + 'data': lastTs}] self.nextPoint = ScatterItem( spots, symbol='t1', pen="#ffffff", brush="#000000", tip=("Predicted MMR: %d" % (prediction)).format) diff --git a/src/MainWindow/Chart/ScatterItem.py b/src/MainWindow/Chart/ScatterItem.py index d378b26..012e18f 100644 --- a/src/MainWindow/Chart/ScatterItem.py +++ b/src/MainWindow/Chart/ScatterItem.py @@ -59,14 +59,13 @@ def mouseOver(self,obj,pts,ev): elif self.isHovered and not ptHovered: self.isHovered = False - self.popup.close() + self.popup.hide() else: self.isHovered = False try: - self.popup.close() - self.popup.deleteLater() + self.popup.hide() except: - self.popup = None + return def handleClick(self,obj,pts,ev): if self.parent == None: @@ -77,6 +76,6 @@ def handleClick(self,obj,pts,ev): pt = pts[0] mainframe = self.parent.window().mainframe GoToHuntPage(pt.data(),mainframe) - self.popup.close() + self.popup.hide() self.popup = None self.stop = False \ No newline at end of file diff --git a/src/MainWindow/Chart/WinLoss.py b/src/MainWindow/Chart/WinLoss.py index d2b427d..e3cc114 100644 --- a/src/MainWindow/Chart/WinLoss.py +++ b/src/MainWindow/Chart/WinLoss.py @@ -10,19 +10,27 @@ def __init__(self) -> None: QColor("#c8ff0000") ] self.pen = None#QPen(QColor("#000000")) + self.ymax = 10 self.update() def update(self): self.data = self.GetData() + self.ymax = max( + self.data['winRate']['bounty']['total'], + max( + self.data['winRate']['qp']['total'], + self.data['survivalRate']['total'] + ) + ) self.bountyBars = Bars( x0 = [10,10], x1 = [20,20], height=[ - self.data['winRate']['bounty']['winPrc'], - self.data['winRate']['bounty']['lossPrc'] + self.data['winRate']['bounty']['wins'], + self.data['winRate']['bounty']['losses'] ], - y0 = [0,self.data['winRate']['bounty']['winPrc']], + y0 = [0,self.data['winRate']['bounty']['wins']], brushes=self.brushes, pens=[self.pen]*2 ) @@ -31,10 +39,10 @@ def update(self): x0 = [30,30], x1 = [40,40], height=[ - self.data['winRate']['qp']['winPrc'], - self.data['winRate']['qp']['lossPrc'] + self.data['winRate']['qp']['wins'], + self.data['winRate']['qp']['losses'] ], - y0 = [0,self.data['winRate']['qp']['winPrc']], + y0 = [0,self.data['winRate']['qp']['wins']], brushes=self.brushes, pens=[self.pen]*2 ) @@ -43,10 +51,10 @@ def update(self): x0 = [50,50], x1 = [60,60], height=[ - self.data['survivalRate']['winPrc'], - self.data['survivalRate']['lossPrc'] + self.data['survivalRate']['survived'], + self.data['survivalRate']['died'] ], - y0 = [0,self.data['survivalRate']['winPrc']], + y0 = [0,self.data['survivalRate']['survived']], brushes=self.brushes, pens=[self.pen]*2 ) @@ -123,6 +131,7 @@ def GetSurvival(self): survived = 0 if len(survived) == 0 else survived[0][0] total = execute_query("select count(*) from 'games' where MissionBagIsQuickPlay = 'false'") total = 0 if len(total) == 0 else total[0][0] + total = max(1,total) return { 'survived':survived, 'died':total - survived, diff --git a/src/MainWindow/Hunters/FrequentHunters.py b/src/MainWindow/Hunters/FrequentHunters.py index 15ac787..58f8fb5 100644 --- a/src/MainWindow/Hunters/FrequentHunters.py +++ b/src/MainWindow/Hunters/FrequentHunters.py @@ -1,12 +1,12 @@ -from PyQt6.QtWidgets import QWidget, QGridLayout, QVBoxLayout, QGroupBox, QLabel, QScrollArea +from PyQt6.QtWidgets import QWidget, QGridLayout, QVBoxLayout, QGroupBox, QLabel, QScrollArea, QSpacerItem, QSizePolicy from PyQt6.QtCore import Qt -from resources import settings, star_path, mmr_to_stars -from DbHandler import GetTopNHunters, GetHunterByName, execute_query +from resources import settings, star_path, mmr_to_stars, debug +from DbHandler import GetTopNHunters, GetHunterByName, SameTeamCount, getAllUsernames class FrequentHunters(QGroupBox): def __init__(self, parent=None): super().__init__(parent) - self.setTitle("Frequently Seen Hunters") + self.setTitle("Frequently Seen Hunters (Top 20)") self.layout = QVBoxLayout() self.setLayout(self.layout) @@ -26,6 +26,8 @@ def __init__(self, parent=None): self.layout.addWidget(self.area) def update(self): + if debug: + print('frequenthunters.update') for i in reversed(range(self.main.layout.count())): self.main.layout.itemAt(i).widget().setParent(None) hunters = GetTopNHunters(20) @@ -40,42 +42,31 @@ def update(self): mmr = hunter['mmr'] killedme = hunter['killedme'] killedbyme = hunter['killedbyme'] - sameTeamCount = self.SameTeamCount(data) + sameTeamCount = SameTeamCount(name) + pid = hunter['profileid'] + allnames = getAllUsernames(pid) stars = QLabel("%s
%s" % ("" % (star_path()) * mmr_to_stars(mmr), mmr)) hWidget.layout.addWidget(QLabel('%s' % name), 0, 0) hWidget.layout.addWidget(stars, 1, 0) hWidget.layout.addWidget(QLabel("Seen in %d hunts." % freq), 0, 1) + row = 1 if sameTeamCount > 0: hWidget.layout.addWidget( - QLabel("You've been on their team %d times." % sameTeamCount), 1, 1) + QLabel("You've been on their team %d times." % sameTeamCount), row, 1) + row += 1 killText = [] if killedme > 0: killText.append("Has killed you %d times." % killedme) if killedbyme > 0: killText.append("You've killed them %d times." % killedbyme) if len(killText) > 0: - hWidget.layout.addWidget(QLabel("
".join(killText)), 2, 1) + hWidget.layout.addWidget(QLabel("
".join(killText)), row, 1) + row += 1 + if len(allnames) > 1: + hWidget.layout.addWidget(QLabel("Other names:\n%s" % ("\n".join([n for n in allnames if n != name]))),row,1) + row += 1 hWidget.layout.setRowStretch(hWidget.layout.rowCount(), 1) self.main.layout.addWidget(hWidget) pass - - def SameTeamCount(self, data): - teamnums = {} - for d in data: - teamnums[d['game_id']] = d['team_num'] - teams = [] - for id in teamnums: - t = execute_query( - "select blood_line_name from 'hunters' where game_id is '%s' and team_num is %d" % (id, teamnums[id])) - team = [] - for n in t: - team.append(n[0]) - teams.append(team) - n = 0 - me = settings.value("steam_name") - for team in teams: - if me in team: - n += 1 - return n diff --git a/src/MainWindow/Hunters/HunterSearch.py b/src/MainWindow/Hunters/HunterSearch.py index 9c1a147..3d34002 100644 --- a/src/MainWindow/Hunters/HunterSearch.py +++ b/src/MainWindow/Hunters/HunterSearch.py @@ -1,7 +1,7 @@ from PyQt6.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QGroupBox, QLabel, QScrollArea, QLineEdit, QPushButton from PyQt6.QtCore import Qt from resources import settings, star_path, mmr_to_stars -from DbHandler import GetTopNHunters, GetHunterKills, GetHunterByName, execute_query +from DbHandler import GetTopNHunters, GetHunterKills, GetHunterByName, execute_query, getAllUsernames from Widgets.Modal import Modal class HunterSearch(QGroupBox): @@ -38,11 +38,7 @@ def ShowResults(self, data, name): resultsWindow.addWidget( QLabel("You've seen %s in %d hunts." % (name, len(data)))) - allnamesarray = execute_query( - "select blood_line_name from 'hunters' where profileid is %d group by blood_line_name" % pid) - allnames = [] - for n in allnamesarray: - allnames.append(n[0]) + allnames = getAllUsernames(pid) kills = GetHunterKills(pid) killedby = 0 killed = 0 diff --git a/src/MainWindow/Hunters/TopKills.py b/src/MainWindow/Hunters/TopKills.py index 906cf3d..f587fd2 100644 --- a/src/MainWindow/Hunters/TopKills.py +++ b/src/MainWindow/Hunters/TopKills.py @@ -1,5 +1,5 @@ from PyQt6.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QGroupBox, QLabel -from resources import settings +from resources import settings, debug from DbHandler import GetTopKilled, GetTopKiller, GetHunterByName, execute_query class TopKills(QWidget): @@ -24,6 +24,8 @@ def update(self): self.updateTopKiller() def updateTopKilled(self): + if debug: + print('topkilled.update') for i in reversed(range(self.killedBox.layout.count())): self.killedBox.layout.itemAt(i).widget().setParent(None) topKilled = GetTopKilled() @@ -42,6 +44,8 @@ def updateTopKilled(self): self.killedBox.adjustSize() def updateTopKiller(self): + if debug: + print('topkiller.update') for i in reversed(range(self.killerBox.layout.count())): self.killerBox.layout.itemAt(i).widget().setParent(None) topKiller = GetTopKiller() diff --git a/src/MainWindow/Hunts/TeamDetails.py b/src/MainWindow/Hunts/TeamDetails.py index 82a8141..fbf97c6 100644 --- a/src/MainWindow/Hunts/TeamDetails.py +++ b/src/MainWindow/Hunts/TeamDetails.py @@ -255,7 +255,7 @@ def eventFilter(self, obj, event) -> bool: self.activateWindow() elif event.type() == QEvent.Type.Leave: try: - self.popup.close() + self.popup.hide() except: self.popup = None return super().eventFilter(obj, event) diff --git a/src/SettingsWindow.py b/src/SettingsWindow.py index 93950b4..6b323cd 100644 --- a/src/SettingsWindow.py +++ b/src/SettingsWindow.py @@ -18,7 +18,7 @@ def __init__(self, parent=None) -> None: self.initUI() if int(settings.value("profileid","-1")) < 0 and len(settings.value("steam_name","")) > 0: - pid = execute_query("select profileid from 'hunters' where blood_line_name is %s'" % settings.value("steam_name")) + pid = execute_query("select profileid from 'hunters' where blood_line_name is '%s'" % settings.value("steam_name")) pid = -1 if len(pid) == 0 else pid[0][0] if pid > 0: settings.setValue("profileid",pid) @@ -129,6 +129,7 @@ def initSteamOptions(self): self.steamNameButton = QPushButton("Change Steam Name") self.steamNameButton.setSizePolicy(QSizePolicy.Policy.Fixed,QSizePolicy.Policy.Fixed) self.steamNameButton.clicked.connect(self.ChangeSteamName) + self.steamNameButton.clicked.connect(lambda : self.steamNameInput.setFocus()) self.steamName.layout.addWidget(self.steamNameInput) self.steamName.layout.addWidget(self.steamNameButton) self.main.layout.addWidget(self.steamName) @@ -152,10 +153,12 @@ def ChangeSteamName(self): log('steam name updated') log(settings.value('steam_name')) self.steamNameInput.setText(settings.value("steam_name")) - pid = execute_query("select profileid from 'hunters' where blood_line_name is '%s'" % settings.value("steam_name")) + pid = execute_query("select profileid from 'hunters' where blood_line_name is '%s'" % self.steamNameInput.text()) pid = -1 if len(pid) == 0 else pid[0][0] if pid > 0: settings.setValue("profileid",pid) + for i in range(10): + QApplication.processEvents() self.parent().update() self.steamNameInput.setDisabled(True) else: diff --git a/src/Widgets/MonstersWidget.py b/src/Widgets/MonstersWidget.py index e3693d0..c485932 100644 --- a/src/Widgets/MonstersWidget.py +++ b/src/Widgets/MonstersWidget.py @@ -58,7 +58,7 @@ def eventFilter(self, obj, event) -> bool: self.activateWindow() elif event.type() == QEvent.Type.Leave: try: - self.popup.close() + self.popup.hide() except: self.popup = None pass diff --git a/src/Widgets/Popup.py b/src/Widgets/Popup.py index a095512..d0c3d4f 100644 --- a/src/Widgets/Popup.py +++ b/src/Widgets/Popup.py @@ -1,17 +1,46 @@ -from PyQt6.QtWidgets import QMainWindow -from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import QMainWindow, QGraphicsOpacityEffect +from PyQt6.QtCore import Qt, QAbstractAnimation, QPropertyAnimation class Popup(QMainWindow): def __init__(self, widget,x,y,parent=None): super().__init__(parent) - self.setWindowFlags(Qt.WindowType.FramelessWindowHint | Qt.WindowType.WindowStaysOnTopHint) + self.setWindowFlags(Qt.WindowType.FramelessWindowHint | Qt.WindowType.WindowStaysOnTopHint | Qt.WindowType.SubWindow) self.setObjectName("popup") self.setCentralWidget(widget) self.setMaximumSize(self.sizeHint()) self.move(int(x+self.size().width()/4),int(y-self.size().height()/4)) + self.opacity = 1 + self.animation = QPropertyAnimation(self, b"windowOpacity",self) + self.animation.setStartValue(0.0) + self.animation.setTargetObject(self) + self.animation.setDuration(200) + self.animation.setEndValue(self.opacity) + self.animation.valueChanged.connect(self.setOpacity) + self.setGraphicsEffect(QGraphicsOpacityEffect(opacity=0.0)) + def keepAlive(self,keep): if(keep): self.setWindowFlag(Qt.WindowType.Popup) + def show(self) -> None: + self.animation.setDirection(QAbstractAnimation.Direction.Forward) + self.animation.start() + return super().show() + + def hide(self): + self.animation.setDirection(QAbstractAnimation.Direction.Backward) + self.animation.start() + + def close(self) -> bool: + return super().close() + + def setOpacity(self,opacity: float): + opacity_effect = QGraphicsOpacityEffect(opacity=opacity) + self.setGraphicsEffect(opacity_effect) + self.opacity = opacity + if self.opacity == 0.0: + self.close() + + diff --git a/src/Widgets/Toast.py b/src/Widgets/Toast.py index c61228e..bd6a18f 100644 --- a/src/Widgets/Toast.py +++ b/src/Widgets/Toast.py @@ -8,14 +8,16 @@ # class Toast(QWidget): - def __init__(self, text, duration=0, widgets=[],parent=None): + def __init__(self, text, duration=2, widgets=[],parent=None): super().__init__(parent) self.__initVal(parent, duration) self.__initUi(text,widgets) stylesheet = open(resource_path('./assets/MaterialDark.qss'), 'r').read() self.setStyleSheet(stylesheet) + def show(self): + print('showtoast') if self.__timer.isActive(): pass else: