def createGeneralOptionsUI(self, type='basic'): for i in range(self.generalTabView.numberOfTabViewItems()): self.generalTabView.removeTabViewItem_( self.generalTabView.tabViewItemAtIndex_(0)) settings = SIPSimpleSettings() sections = [ section for section in dir(SIPSimpleSettings) if isinstance( getattr(SIPSimpleSettings, section, None), SettingsGroupMeta) ] frame = self.generalTabView.frame() frame.origin.x = 0 frame.origin.y = 0 if type == 'advanced': for section in AdvancedGeneralSectionOrder: view = self.createUIForSection( settings, frame, section, getattr(SIPSimpleSettings, section)) tabItem = NSTabViewItem.alloc().initWithIdentifier_(section) try: label = SectionNames[section] except KeyError: label = formatName(section) tabItem.setLabel_(label) tabItem.setView_(view) if section not in StaticPreferenceSections: self.generalTabView.addTabViewItem_(tabItem) if type == 'basic': for section in (section for section in sections if section not in DisabledPreferenceSections): view = self.createUIForSection( settings, frame, section, getattr(SIPSimpleSettings, section)) tabItem = NSTabViewItem.alloc().initWithIdentifier_(section) try: label = SectionNames[section] except KeyError: label = formatName(section) tabItem.setLabel_(label) tabItem.setView_(view) if section in StaticPreferenceSections: self.generalTabView.addTabViewItem_(tabItem)
def createGeneralOptionsUI(self, type='basic'): for i in range(self.generalTabView.numberOfTabViewItems()): self.generalTabView.removeTabViewItem_(self.generalTabView.tabViewItemAtIndex_(0)) settings = SIPSimpleSettings() sections = [section for section in dir(SIPSimpleSettings) if isinstance(getattr(SIPSimpleSettings, section, None), SettingsGroupMeta)] frame = self.generalTabView.frame() frame.origin.x = 0 frame.origin.y = 0 if type == 'advanced': for section in AdvancedGeneralSectionOrder: view = self.createUIForSection(settings, frame, section, getattr(SIPSimpleSettings, section)) tabItem = NSTabViewItem.alloc().initWithIdentifier_(section) try: label = SectionNames[section] except KeyError: label = formatName(section) tabItem.setLabel_(label) tabItem.setView_(view) if section not in StaticPreferenceSections: self.generalTabView.addTabViewItem_(tabItem) if type == 'basic': for section in (section for section in sections if section not in DisabledPreferenceSections): view = self.createUIForSection(settings, frame, section, getattr(SIPSimpleSettings, section)) tabItem = NSTabViewItem.alloc().initWithIdentifier_(section) try: label = SectionNames[section] except KeyError: label = formatName(section) tabItem.setLabel_(label) tabItem.setView_(view) if section in StaticPreferenceSections: self.generalTabView.addTabViewItem_(tabItem)
def createAccountOptionsUI(self, account): self.advancedPop.removeAllItems() for i in range(self.advancedTabView.numberOfTabViewItems()): self.advancedTabView.removeTabViewItem_( self.advancedTabView.tabViewItemAtIndex_(0)) #sections = [section for section in dir(account.__class__) if isinstance(getattr(account.__class__, section, None), SettingsGroupMeta)] sections = BonjourAccountSectionOrder if account is BonjourAccount( ) else AccountSectionOrder frame = self.advancedTabView.frame() for section in (section for section in sections if section not in DisabledAccountPreferenceSections): if NSApp.delegate( ).applicationName == 'Blink Lite' and section in ('audio', 'chat', 'pstn', 'ldap', 'web_alert'): continue if section == 'tls': continue if section == 'presence' and not ENABLE_PRESENCE: continue if section == 'dialog_event' and not ENABLE_DIALOG: continue view = self.createUIForSection(account, frame, section, getattr(account.__class__, section), True) tabItem = NSTabViewItem.alloc().initWithIdentifier_(section) try: label = SectionNames[section] except KeyError: label = formatName(section) self.advancedPop.addItemWithTitle_(label) self.advancedPop.lastItem().setRepresentedObject_(section) tabItem.setLabel_(label) tabItem.setView_(view) self.advancedTabView.addTabViewItem_(tabItem)
def createAccountOptionsUI(self, account): self.advancedPop.removeAllItems() for i in range(self.advancedTabView.numberOfTabViewItems()): self.advancedTabView.removeTabViewItem_(self.advancedTabView.tabViewItemAtIndex_(0)) #sections = [section for section in dir(account.__class__) if isinstance(getattr(account.__class__, section, None), SettingsGroupMeta)] sections = BonjourAccountSectionOrder if account is BonjourAccount() else AccountSectionOrder frame = self.advancedTabView.frame() for section in (section for section in sections if section not in DisabledAccountPreferenceSections): if NSApp.delegate().applicationName == 'Blink Lite' and section in ('audio', 'chat', 'pstn', 'ldap', 'web_alert'): continue if section == 'tls': continue if section == 'presence' and not ENABLE_PRESENCE: continue if section == 'dialog_event' and not ENABLE_DIALOG: continue view = self.createUIForSection(account, frame, section, getattr(account.__class__, section), True) tabItem = NSTabViewItem.alloc().initWithIdentifier_(section) try: label = SectionNames[section] except KeyError: label = formatName(section) self.advancedPop.addItemWithTitle_(label) self.advancedPop.lastItem().setRepresentedObject_(section) tabItem.setLabel_(label) tabItem.setView_(view) self.advancedTabView.addTabViewItem_(tabItem)