<commit_before>import objc
from Foundation import *
from AppKit import *
from PyObjCTools import AppHelper
import ofxclient.server, webbrowser, ofxclient

class MyApp(NSApplication):

    def finishLaunching(self):
        # Make statusbar item
        statusbar = NSStatusBar.systemStatusBar()
        self.statusitem = statusbar.statusItemWithLength_(NSVariableStatusItemLength)
        self.icon = NSImage.alloc().initByReferencingFile_('image128.png')
        self.icon.setScalesWhenResized_(True)
        self.icon.setSize_((16, 16))
        self.statusitem.setImage_(self.icon)

        #make the menu
        self.menubarMenu = NSMenu.alloc().init()


        accounts = [ i.__json__() for i in ofxclient.Account.list() ]

        self.accountsMain = NSMenuItem.alloc().init()
        self.accountsMain.setTitle_('Download')
        if not accounts:
            self.accountsMain.setEnabled_(False)

            error = NSMenuItem.alloc().init()
            error.setTitle_('No Accounts Configured')
            error.setEnabled_(False)
            self.menubarMenu.addItem_(error)
            self.menubarMenu.addItem_(NSMenuItem.separatorItem())


        if accounts:
            self.accountsSubMenu = NSMenu.alloc().init()
            for a in accounts:
                item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(a['long_description'],'download:','')
                item.setRepresentedObject_(a['guid'])
                self.accountsSubMenu.addItem_(item)
            self.accountsMain.setSubmenu_(self.accountsSubMenu)

        self.menubarMenu.addItem_(self.accountsMain)

        self.menubarMenu.addItem_(NSMenuItem.separatorItem())

        self.menuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('Configure...', 'open:', '')<commit_msg>UX usability enhancements<commit_after>import objc
from Foundation import *
from AppKit import *
from PyObjCTools import AppHelper
import ofxclient.server, webbrowser, ofxclient

class MyApp(NSApplication):

    def finishLaunching(self):
        # Make statusbar item
        statusbar = NSStatusBar.systemStatusBar()
        self.statusitem = statusbar.statusItemWithLength_(NSVariableStatusItemLength)
        self.icon = NSImage.alloc().initByReferencingFile_('image128.png')
        self.icon.setScalesWhenResized_(True)
        self.icon.setSize_((16, 16))
        self.statusitem.setImage_(self.icon)
        self.statusitem.setHighlightMode_(True)

        #make the menu
        self.menubarMenu = NSMenu.alloc().init()

        unsorted = [ i.__json__() for i in ofxclient.Account.list() ]
        accounts = sorted(unsorted,key=lambda a: str(a['long_description']).lower())

        self.accountsMain = NSMenuItem.alloc().init()
        self.accountsMain.setTitle_('Download')
        if not accounts:
            self.accountsMain.setEnabled_(False)

            error = NSMenuItem.alloc().init()
            error.setTitle_('No Accounts Configured')
            error.setEnabled_(False)
            self.menubarMenu.addItem_(error)
            self.menubarMenu.addItem_(NSMenuItem.separatorItem())


        if accounts:
            self.accountsSubMenu = NSMenu.alloc().init()
            for a in accounts:
                item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(a['long_description'],'download:','')
                item.setRepresentedObject_(a['guid'])
                self.accountsSubMenu.addItem_(item)
            self.accountsMain.setSubmenu_(self.accountsSubMenu)

        self.menubarMenu.addItem_(self.accountsMain)

        self.menubarMenu.addItem_(NSMenuItem.separatorItem())

        self.menuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('Configure...', 'open:', '')
{'fraction_non_alphanumeric': 0.10773777538957549, 'fraction_numerical': 0.0037614185921547557, 'mean_word_length': 2.9313621964097147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '572439', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1043, 'n_words': 161}