def init(): # Create the Maps page. area = ui.createTab(MAPS) area.setBorderDirs(ui.BORDER_NOT_BOTTOM) area.setWeight(1) global mapListBox area.setBorderDirs(ui.BORDER_NOT_BOTTOM) mapListBox = area.createList('maps-list', sb.widget.list.List.STYLE_COLUMNS) # The columns. mapListBox.addColumn('maps-list-icon', 20) mapListBox.addColumn('maps-list-identifier', 180) mapListBox.addColumn('maps-list-count') # Prepare icons. global iconManager, mapIcons iconManager = widgets.IconManager(16, 16) mapIcons = [iconManager.get('unchecked'), iconManager.get('checked')] mapListBox.setImageList(iconManager.getImageList()) # Some buttons in the bottom. area.setWeight(0) area.setBorderDirs(ui.BORDER_NOT_TOP) buttonArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=4) buttonArea.setBorderDirs(ui.BORDER_TOP | ui.BORDER_RIGHT) buttonArea.setWeight(0) clearButton = buttonArea.createButton('maps-list-clear', wb.Button.STYLE_MINI) clearButton.resizeToBestSize() refreshButton = buttonArea.createButton('refresh-addon-database', wb.Button.STYLE_MINI) refreshButton.resizeToBestSize() buttonArea.setWeight(1) buttonArea.addSpacer() buttonArea.setWeight(0) buttonArea.setBorderDirs(ui.BORDER_TOP | ui.BORDER_LEFT) buttonArea.createButton('show-addon-paths') # Listen to our commands. events.addCommandListener(handleCommand, ['maps-list-clear']) events.addNotifyListener(handleNotify, [ 'active-profile-changed', 'maps-list-selected', 'maps-list-deselected', 'addon-attached', 'addon-detached', 'addon-database-reloaded', 'language-changed' ])
def init(): # Create the Maps page. area = ui.createTab(MAPS) area.setBorderDirs(ui.BORDER_NOT_BOTTOM) area.setWeight(1) global mapListBox area.setBorderDirs(ui.BORDER_NOT_BOTTOM) mapListBox = area.createList('maps-list', sb.widget.list.List.STYLE_COLUMNS) # The columns. mapListBox.addColumn('maps-list-icon', 20) mapListBox.addColumn('maps-list-identifier', 180) mapListBox.addColumn('maps-list-count') # Prepare icons. global iconManager, mapIcons iconManager = widgets.IconManager(16, 16) mapIcons = [iconManager.get('unchecked'), iconManager.get('checked')] mapListBox.setImageList(iconManager.getImageList()) # Some buttons in the bottom. area.setWeight(0) area.setBorderDirs(ui.BORDER_NOT_TOP) buttonArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=4) buttonArea.setBorderDirs(ui.BORDER_TOP | ui.BORDER_RIGHT) buttonArea.setWeight(0) clearButton = buttonArea.createButton('maps-list-clear', wb.Button.STYLE_MINI) clearButton.resizeToBestSize() refreshButton = buttonArea.createButton('refresh-addon-database', wb.Button.STYLE_MINI) refreshButton.resizeToBestSize() buttonArea.setWeight(1) buttonArea.addSpacer() buttonArea.setWeight(0) buttonArea.setBorderDirs(ui.BORDER_TOP | ui.BORDER_LEFT) buttonArea.createButton('show-addon-paths') # Listen to our commands. events.addCommandListener(handleCommand, ['maps-list-clear']) events.addNotifyListener(handleNotify, ['active-profile-changed', 'maps-list-selected', 'maps-list-deselected', 'addon-attached', 'addon-detached', 'addon-database-reloaded', 'language-changed'])
def init(): """Create the Settings page. No setting widgets are created until profiles have been loaded. """ # The setting categories tab area. global categoryArea area = ui.createTab(SETTINGS) # Create the area where all the setting categories are placed. categoryArea = area.createTabArea(CATEGORY_AREA, sb.widget.tab.TabArea.STYLE_FORMATTED) createWidgets() # Register a notification listener. events.addNotifyListener(handleNotify, ['init-done', 'value-changed', 'active-profile-changed', 'addon-database-reloaded']) # The addon-settings command is handled here. events.addCommandListener(handleCommand, ['show-addon-settings', 'show-snowberry-settings'])
def oldInit(): # Create the Addons page. area = ui.createTab(ADDONS) area.setBorderDirs(ui.BORDER_NOT_BOTTOM) # Let's create the addons tree... area.setWeight(1) global tree tree = area.createTree() # Add all the categories into the tree. tree.createCategories() # The addon control buttons. area.setWeight(0) area.setBorderDirs(ui.BORDER_NOT_TOP) buttonArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=4) buttonArea.setWeight(0) # Install (+) button for installing new addons. buttonArea.setBorderDirs(ui.BORDER_TOP | ui.BORDER_RIGHT) buttonArea.createButton('install-addon', wg.Button.STYLE_MINI) global uninstallButton uninstallButton = buttonArea.createButton('uninstall-addon', wg.Button.STYLE_MINI) uninstallButton.disable() # The Refresh button reloads all addons. button = buttonArea.createButton('refresh-addon-database', wg.Button.STYLE_MINI) button.resizeToBestSize() buttonArea.setWeight(3) buttonArea.addSpacer() buttonArea.setWeight(0) global settingsButton settingsButton = buttonArea.createButton('addon-settings') settingsButton.disable() buttonArea.setBorderDirs(ui.BORDER_TOP) buttonArea.createButton('show-addon-paths') ui.addMenuCommand(ui.MENU_TOOLS, 'load-order') # Registering a notification listener. events.addNotifyListener(handleNotification, [ 'active-profile-changed', 'addon-popup-request', 'addon-installed', 'addon-database-reloaded' ]) # Registering a command listener to handle the Command events sent # by the buttons created above. events.addCommandListener(handleCommand, [ 'install-addon', 'uninstall-addon', 'addon-info', 'addon-settings', 'load-order', 'expand-all-categories', 'collapse-all-categories', 'check-category', 'uncheck-category', 'refresh-addon-database' ]) # Changing the current addon in the tree is done using commands with # the name of the addon as an identifier. events.addCommandListener(handleAnyCommand)
def init(): # Manager for the addon list icons. global iconManager, addonIcons iconManager = widgets.IconManager(16, 16) addonIcons = [ iconManager.get('unchecked'), iconManager.get('checked'), iconManager.get('defcheck') ] # Create the Addons page. area = ui.createTab(ADDONS) WEIGHTS = [2, 3] # Top area for the filter controls. area.setWeight(0) topArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=0) topArea.setExpanding(False) # Counter text. global countText topArea.setWeight(WEIGHTS[0]) countText = topArea.createText('', align=wt.Text.LEFT) # Filter selection. topArea.setWeight(WEIGHTS[1]) filterArea = topArea.createArea(alignment=ui.ALIGN_HORIZONTAL, border=0) filterArea.setWeight(0) filterArea.setExpanding(False) global listFilter filterArea.createText('addon-list-filter').resizeToBestSize() filterArea.setWeight(1) filterArea.setBorder(4, ui.BORDER_LEFT) listFilter = filterArea.createDropList('addon-list-filter-mode') listFilter.addItem('addon-list-filter-mode-compatible') listFilter.addItem('addon-list-filter-mode-compatible-pwad') listFilter.addItem('addon-list-filter-mode-pwad') listFilter.addItem('addon-list-filter-mode-all') listFilter.addItem('addon-list-filter-mode-all-with-boxes') listFilter.selectItem('addon-list-filter-mode-compatible') # Middle area for the category tree and the addon list. area.setWeight(1) area.setBorderDirs(ui.BORDER_LEFT_RIGHT) middleArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=0) area.setBorderDirs(ui.BORDER_NOT_TOP) # On the left, there is the main addon database controls. middleArea.setWeight(WEIGHTS[0]) # Category tree. global tree middleArea.setBorder(8, ui.BORDER_RIGHT) tree = middleArea.createTree('category-tree') middleArea.setBorder(0) # Add all the categories into the tree. refreshCategories() # On the right, there is the filtered addon listing. middleArea.setWeight(WEIGHTS[1]) global addonList addonList = middleArea.createList('addon-list', style=wl.List.STYLE_COLUMNS) addonList.setImageList(iconManager.getImageList()) addonList.setPopupMenuId('addon-list-popup') # Setup the columns. addonList.addColumn('addon-list-check', 20) addonList.addColumn('addon-list-name') addonList.addColumn('addon-list-version', 50) # Button arae in the bottom. area.setWeight(0) buttonArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=4) # Install (+) button for installing new addons. buttonArea.setWeight(0) buttonArea.setBorderDirs(ui.BORDER_TOP | ui.BORDER_RIGHT) buttonArea.createButton('install-addon', wg.Button.STYLE_MINI) global uninstallButton uninstallButton = buttonArea.createButton('uninstall-addon', wg.Button.STYLE_MINI) uninstallButton.disable() # The Refresh button reloads all addons. button = buttonArea.createButton('refresh-addon-database', wg.Button.STYLE_MINI) button.resizeToBestSize() # Create addon listing controls. buttonArea.setWeight(1) buttonArea.addSpacer() buttonArea.setWeight(0) global infoButton infoButton = buttonArea.createButton('addon-info') infoButton.disable() global settingsButton settingsButton = buttonArea.createButton('addon-settings') settingsButton.disable() buttonArea.setBorderDirs(ui.BORDER_TOP) buttonArea.createButton('show-addon-paths') ui.addMenuCommand(ui.MENU_TOOLS, 'load-order', group=ui.MENU_GROUP_AODB) # Registering a notification listener. events.addNotifyListener(handleNotification, [ 'tab-selected', 'addon-list-icon-click', 'active-profile-changed', 'addon-list-popup-update-request', 'addon-attached', 'addon-detached', 'category-tree-selected', 'addon-installed', 'addon-database-reloaded', 'addon-list-selected', 'addon-list-deselected', 'addon-list-filter-mode-selected', 'addon-list-check-column-click', 'addon-list-name-column-click', 'addon-list-version-column-click' ]) # Registering a command listener to handle the Command events sent # by the buttons created above. events.addCommandListener(handleCommand, [ 'install-addon', 'uninstall-addon', 'addon-info', 'addon-settings', 'load-order', 'addon-list-check-selected', 'addon-list-uncheck-selected', 'addon-list-check-all', 'addon-list-uncheck-all', 'addon-show-parent-box', 'addon-show-box-category', 'refresh-addon-database' ]) # Changing the current addon in the tree is done using commands with # the name of the addon as an identifier. events.addCommandListener(handleAnyCommand) # Menu commands. ui.addMenuCommand(ui.MENU_TOOLS, 'install-addon', pos=0, group=ui.MENU_GROUP_AODB)
def init(): "Create the Summary page." area = ui.createTab(SUMMARY) # Partition the area into various info fields. #bottomHalf = area.createArea(border = 4) #topHalf = area.createArea(border = 4) # The profile title and the description. #area.setWeight(1) #global description #description = area.createFormattedText() # The bottom half contains a summary of the active profile's # settings. area.setBorder(6) area.setWeight(0) global titleLabel area.setBorder(16, ui.BORDER_NOT_BOTTOM) titleLabel = area.createText('') titleLabel.setTitleStyle() area.setBorder(2, ui.BORDER_ALL) area.setExpanding(False) area.addSpacer() area.setExpanding(True) area.setBorder(16, ui.BORDER_NOT_TOP) area.createLine() area.setBorder(8, ui.BORDER_ALL) addonInfo = area.createArea(alignment=ALIGN_HORIZONTAL) area.setWeight(0) #systemInfo = area.createArea(alignment=ALIGN_HORIZONTAL) valuesInfo = area.createArea(alignment=ALIGN_HORIZONTAL) # Information about addons selected into the profile. addonInfo.setBorder(4, ui.BORDER_LEFT_RIGHT) addonInfo.setWeight(1) addonInfo.createText('loaded-addons', ':', align=wt.Text.RIGHT).setBoldStyle() addonInfo.setWeight(2) global addonListing addonListing = addonInfo.createText() # Values for the most important system settings. #systemInfo.setBorder(4, ui.BORDER_LEFT_RIGHT) #systemInfo.setWeight(1) #systemInfo.createText('system-settings', ':', align=wt.Text.RIGHT).setBoldStyle() #systemInfo.setWeight(2) #global systemSummary #systemSummary = systemInfo.createText() #systemSummary.setText('800x600; run in window') # Information about settings that have a value in the profile. valuesInfo.setBorder(4, ui.BORDER_LEFT_RIGHT) valuesInfo.setWeight(1) valuesInfo.createText('custom-settings', ':', align=wt.Text.RIGHT).setBoldStyle() valuesInfo.setWeight(2) global valuesListing valuesListing = valuesInfo.createText() # Listen for active profile changes. events.addNotifyListener(notifyHandler, ['active-profile-changed', 'value-changed', 'addon-attached', 'addon-detached']) events.addCommandListener(commandHandler, ['freeze', 'unfreeze'])
def oldInit(): # Create the Addons page. area = ui.createTab(ADDONS) area.setBorderDirs(ui.BORDER_NOT_BOTTOM) # Let's create the addons tree... area.setWeight(1) global tree tree = area.createTree() # Add all the categories into the tree. tree.createCategories() # The addon control buttons. area.setWeight(0) area.setBorderDirs(ui.BORDER_NOT_TOP) buttonArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=4) buttonArea.setWeight(0) # Install (+) button for installing new addons. buttonArea.setBorderDirs(ui.BORDER_TOP | ui.BORDER_RIGHT) buttonArea.createButton('install-addon', wg.Button.STYLE_MINI) global uninstallButton uninstallButton = buttonArea.createButton('uninstall-addon', wg.Button.STYLE_MINI) uninstallButton.disable() # The Refresh button reloads all addons. button = buttonArea.createButton('refresh-addon-database', wg.Button.STYLE_MINI) button.resizeToBestSize() buttonArea.setWeight(3) buttonArea.addSpacer() buttonArea.setWeight(0) global settingsButton settingsButton = buttonArea.createButton('addon-settings') settingsButton.disable() buttonArea.setBorderDirs(ui.BORDER_TOP) buttonArea.createButton('show-addon-paths') ui.addMenuCommand(ui.MENU_TOOLS, 'load-order') # Registering a notification listener. events.addNotifyListener(handleNotification, ['active-profile-changed', 'addon-popup-request', 'addon-installed', 'addon-database-reloaded']) # Registering a command listener to handle the Command events sent # by the buttons created above. events.addCommandListener(handleCommand, ['install-addon', 'uninstall-addon', 'addon-info', 'addon-settings', 'load-order', 'expand-all-categories', 'collapse-all-categories', 'check-category', 'uncheck-category', 'refresh-addon-database']) # Changing the current addon in the tree is done using commands with # the name of the addon as an identifier. events.addCommandListener(handleAnyCommand)
def init(): # Manager for the addon list icons. global iconManager, addonIcons iconManager = widgets.IconManager(16, 16) addonIcons = [iconManager.get('unchecked'), iconManager.get('checked'), iconManager.get('defcheck')] # Create the Addons page. area = ui.createTab(ADDONS) WEIGHTS = [2, 3] # Top area for the filter controls. area.setWeight(0) topArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=0) topArea.setExpanding(False) # Counter text. global countText topArea.setWeight(WEIGHTS[0]) countText = topArea.createText('', align=wt.Text.LEFT) # Filter selection. topArea.setWeight(WEIGHTS[1]) filterArea = topArea.createArea(alignment=ui.ALIGN_HORIZONTAL, border=0) filterArea.setWeight(0) filterArea.setExpanding(False) global listFilter filterArea.createText('addon-list-filter').resizeToBestSize() filterArea.setWeight(1) filterArea.setBorder(4, ui.BORDER_LEFT) listFilter = filterArea.createDropList('addon-list-filter-mode') listFilter.addItem('addon-list-filter-mode-compatible') listFilter.addItem('addon-list-filter-mode-compatible-pwad') listFilter.addItem('addon-list-filter-mode-pwad') listFilter.addItem('addon-list-filter-mode-all') listFilter.addItem('addon-list-filter-mode-all-with-boxes') listFilter.selectItem('addon-list-filter-mode-compatible') # Middle area for the category tree and the addon list. area.setWeight(1) area.setBorderDirs(ui.BORDER_LEFT_RIGHT) middleArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=0) area.setBorderDirs(ui.BORDER_NOT_TOP) # On the left, there is the main addon database controls. middleArea.setWeight(WEIGHTS[0]) # Category tree. global tree middleArea.setBorder(8, ui.BORDER_RIGHT) tree = middleArea.createTree('category-tree') middleArea.setBorder(0) # Add all the categories into the tree. refreshCategories() # On the right, there is the filtered addon listing. middleArea.setWeight(WEIGHTS[1]) global addonList addonList = middleArea.createList('addon-list', style=wl.List.STYLE_COLUMNS) addonList.setImageList(iconManager.getImageList()) addonList.setPopupMenuId('addon-list-popup') # Setup the columns. addonList.addColumn('addon-list-check', 20) addonList.addColumn('addon-list-name') addonList.addColumn('addon-list-version', 50) # Button arae in the bottom. area.setWeight(0) buttonArea = area.createArea(alignment=ui.ALIGN_HORIZONTAL, border=4) # Install (+) button for installing new addons. buttonArea.setWeight(0) buttonArea.setBorderDirs(ui.BORDER_TOP | ui.BORDER_RIGHT) buttonArea.createButton('install-addon', wg.Button.STYLE_MINI) global uninstallButton uninstallButton = buttonArea.createButton('uninstall-addon', wg.Button.STYLE_MINI) uninstallButton.disable() # The Refresh button reloads all addons. button = buttonArea.createButton('refresh-addon-database', wg.Button.STYLE_MINI) button.resizeToBestSize() # Create addon listing controls. buttonArea.setWeight(1) buttonArea.addSpacer() buttonArea.setWeight(0) global infoButton infoButton = buttonArea.createButton('addon-info') infoButton.disable() global settingsButton settingsButton = buttonArea.createButton('addon-settings') settingsButton.disable() buttonArea.setBorderDirs(ui.BORDER_TOP) buttonArea.createButton('show-addon-paths') ui.addMenuCommand(ui.MENU_TOOLS, 'load-order', group=ui.MENU_GROUP_AODB) # Registering a notification listener. events.addNotifyListener(handleNotification, ['tab-selected', 'addon-list-icon-click', 'active-profile-changed', 'addon-list-popup-update-request', 'addon-attached', 'addon-detached', 'category-tree-selected', 'addon-installed', 'addon-database-reloaded', 'addon-list-selected', 'addon-list-deselected', 'addon-list-filter-mode-selected', 'addon-list-check-column-click', 'addon-list-name-column-click', 'addon-list-version-column-click']) # Registering a command listener to handle the Command events sent # by the buttons created above. events.addCommandListener(handleCommand, ['install-addon', 'uninstall-addon', 'addon-info', 'addon-settings', 'load-order', 'addon-list-check-selected', 'addon-list-uncheck-selected', 'addon-list-check-all', 'addon-list-uncheck-all', 'addon-show-parent-box', 'addon-show-box-category', 'refresh-addon-database']) # Changing the current addon in the tree is done using commands with # the name of the addon as an identifier. events.addCommandListener(handleAnyCommand) # Menu commands. ui.addMenuCommand(ui.MENU_TOOLS, 'install-addon', pos=0, group=ui.MENU_GROUP_AODB)