Fix flickering when first marking a track as next

Pre-create the infotabs as adding the first one caused the flicker.
This commit is contained in:
Keith Edmunds 2023-10-06 18:04:11 +01:00
parent b3905e062d
commit da8272b29b
4 changed files with 14 additions and 2 deletions

View File

@ -21,6 +21,14 @@ class InfoTabs(QTabWidget):
# re-use the oldest one later)
self.last_update: Dict[QWebEngineView, datetime] = {}
self.tabtitles: Dict[int, str] = {}
count = Config.MAX_INFO_TABS
while count:
widget = QWebEngineView()
widget.setZoomFactor(Config.WEB_ZOOM_FACTOR)
self.last_update[widget] = datetime.now()
tab_index = self.addTab(widget, "")
count -= 1
def open_in_songfacts(self, title):
"""Search Songfacts for title"""

View File

@ -1637,7 +1637,7 @@ class Window(QMainWindow, Ui_MainWindow):
# because it isn't quick
if self.next_track.title:
QTimer.singleShot(
1,
0,
lambda: self.tabInfolist.open_in_wikipedia(
self.next_track.title
),

View File

@ -363,6 +363,9 @@ padding-left: 8px;</string>
<property name="movable">
<bool>true</bool>
</property>
<property name="tabBarAutoHide">
<bool>false</bool>
</property>
</widget>
</widget>
</item>

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'app/ui/main_window.ui'
#
# Created by: PyQt6 UI code generator 6.5.1
# Created by: PyQt6 UI code generator 6.5.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
@ -183,6 +183,7 @@ class Ui_MainWindow(object):
self.tabInfolist.setDocumentMode(False)
self.tabInfolist.setTabsClosable(True)
self.tabInfolist.setMovable(True)
self.tabInfolist.setTabBarAutoHide(False)
self.tabInfolist.setObjectName("tabInfolist")
self.gridLayout_4.addWidget(self.splitter, 4, 0, 1, 1)
self.InfoFooterFrame = QtWidgets.QFrame(parent=self.centralwidget)