From d6ee07d7c2ddb5d25283e796a6d9d28a84bfd6d8 Mon Sep 17 00:00:00 2001 From: Taka Date: Wed, 3 May 2017 10:17:29 +0000 Subject: [PATCH] Made the nationality combox box sorted. --- add_card_widget.py | 3 ++- ui/add_card_widget.ui | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/add_card_widget.py b/add_card_widget.py index ec5cc5e..42939df 100644 --- a/add_card_widget.py +++ b/add_card_widget.py @@ -30,7 +30,8 @@ class AddCardWidget( QWidget ) : uic.loadUi( os.path.join(globals.base_dir,"ui/add_card_widget.ui") , self ) self.lb_cards.setSortingEnabled( True ) # load the widget - for nat in globals.cards : + sorted_nats = sorted( globals.cards.keys() , key=lambda n: n.lower() ) + for nat in sorted_nats : fname = natinfo.get_flag( nat ) if fname : self.cbo_nationality.addItem( QIcon(fname) , nat ) diff --git a/ui/add_card_widget.ui b/ui/add_card_widget.ui index 383a48a..79b4fea 100644 --- a/ui/add_card_widget.ui +++ b/ui/add_card_widget.ui @@ -80,6 +80,9 @@ 16777215 + + QComboBox::InsertAlphabetically +