mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
When re-ordering tabs, save the correct order in settings so they open in the correct order again later
This commit is contained in:
parent
3fe6d43d9d
commit
695fecd21e
@ -164,8 +164,10 @@ class TabWidget(QtWidgets.QTabWidget):
|
|||||||
tab = self.widget(index)
|
tab = self.widget(index)
|
||||||
if tab.settings.get("persistent", "enabled"):
|
if tab.settings.get("persistent", "enabled"):
|
||||||
persistent_tabs.append(tab.settings.id)
|
persistent_tabs.append(tab.settings.id)
|
||||||
self.common.settings.set("persistent_tabs", persistent_tabs)
|
# Only save if tabs have actually moved
|
||||||
self.common.settings.save()
|
if persistent_tabs != self.common.settings.get("persistent_tabs"):
|
||||||
|
self.common.settings.set("persistent_tabs", persistent_tabs)
|
||||||
|
self.common.settings.save()
|
||||||
|
|
||||||
def close_tab(self, index):
|
def close_tab(self, index):
|
||||||
self.common.log("TabWidget", "close_tab", f"{index}")
|
self.common.log("TabWidget", "close_tab", f"{index}")
|
||||||
@ -196,11 +198,11 @@ class TabWidget(QtWidgets.QTabWidget):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def changeEvent(self, event):
|
def paintEvent(self, event):
|
||||||
# TODO: later when I have internet, figure out the right event for re-ordering tabs
|
super(TabWidget, self).paintEvent(event)
|
||||||
|
# Save the order of persistent tabs whenever a new tab is switched to -- ideally we would
|
||||||
# If tabs get move
|
# do this whenever tabs gets moved, but paintEvent is the only event that seems to get triggered
|
||||||
super(TabWidget, self).changeEvent(event)
|
# when this happens
|
||||||
self.save_persistent_tabs()
|
self.save_persistent_tabs()
|
||||||
|
|
||||||
def resizeEvent(self, event):
|
def resizeEvent(self, event):
|
||||||
|
Loading…
Reference in New Issue
Block a user