mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-18 05:33:59 +00:00
Add an order to UserProfileGroups groups according to the display order
A bit hacky...
This commit is contained in:
@@ -23,7 +23,10 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
from collections import namedtuple
|
||||
from collections import (
|
||||
defaultdict,
|
||||
namedtuple,
|
||||
)
|
||||
|
||||
|
||||
SettingDesc = namedtuple('SettingDesc', ('name', 'fields'))
|
||||
@@ -35,6 +38,15 @@ class UserProfileGroups():
|
||||
"""
|
||||
_settings_groups = {}
|
||||
|
||||
_groups_order = defaultdict(lambda: -1)
|
||||
_groups_count = 0
|
||||
|
||||
@classmethod
|
||||
def order(cls, group):
|
||||
if cls._groups_order[group] == -1:
|
||||
cls._groups_order[group] = cls._groups_count
|
||||
cls._groups_count += 1
|
||||
|
||||
@classmethod
|
||||
def append_to_group(cls, group, option, highlights, title=None):
|
||||
if group not in cls._settings_groups:
|
||||
|
||||
@@ -104,6 +104,7 @@ class OptionsDialog(PicardDialog, SingletonDialog):
|
||||
self.item_to_page[item] = page
|
||||
self.page_to_item[page.NAME] = item
|
||||
self.ui.pages_stack.addWidget(page)
|
||||
UserProfileGroups.order(page.NAME)
|
||||
else:
|
||||
item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled)
|
||||
self.add_pages(page.NAME, default_page, item)
|
||||
|
||||
Reference in New Issue
Block a user