def init(): # Register a listener for detecting the completion of Snowberry # startup. events.addNotifyListener(handleNotify, ['init-done', 'wizard-selected']) # Listen for wizard commands. events.addCommandListener(handleCommand, ['run-setup-wizard']) # Commands for the popup menu. ui.addMenuCommand(ui.MENU_TOOLS, 'run-setup-wizard', group=ui.MENU_GROUP_APP)
def init(): # Register a listener for detecting the completion of Snowberry # startup. events.addNotifyListener(handleNotify, ['populating-area', 'addon-paths-changed']) # Listen for the About button. events.addCommandListener(handleCommand, ['show-addon-paths']) # Commands for the popup menu. ui.addMenuCommand(ui.MENU_TOOLS, 'show-snowberry-settings', group=ui.MENU_GROUP_APP)
def init(): "Create the HTML text widget into the help area." ui.addMenuCommand(ui.MENU_HELP, 'open-documentation', pos=0) try: helpArea = ui.getArea(ui.HELP) except KeyError: # The Help area does not exist. We don't have much to do here. events.addCommandListener(handleCommand, ['open-documentation']) return helpArea.setExpanding(True) helpArea.setWeight(1) # Create a HTML text widget. global helpText helpArea.setBorder(3) helpText = helpArea.createFormattedText() # Unfreeze the help text after a minor delay. This'll make the app # init a bit smoother. helpText.freeze() helpTextTimer.start(1000) # Set parameters suitable for the logo. helpArea.setWeight(0) helpArea.setBorder(0) # Register a listener. events.addCommandListener(handleCommand, ['help-addon-mode-brief', 'help-addon-mode-detailed', 'freeze', 'unfreeze', 'open-documentation']) events.addNotifyListener(handleNotify, ['show-help-text-now', 'init-done', 'active-profile-changed', 'tab-selected', 'addon-list-selected', 'maps-list-selected', 'focus-changed', 'value-changed', 'language-changed'] )
def init(): "Create the HTML text widget into the help area." ui.addMenuCommand(ui.MENU_HELP, 'open-documentation', pos=0) try: helpArea = ui.getArea(ui.HELP) except KeyError: # The Help area does not exist. We don't have much to do here. events.addCommandListener(handleCommand, ['open-documentation']) return helpArea.setExpanding(True) helpArea.setWeight(1) # Create a HTML text widget. global helpText helpArea.setBorder(3) helpText = helpArea.createFormattedText() # Unfreeze the help text after a minor delay. This'll make the app # init a bit smoother. helpText.freeze() helpTextTimer.start(1000) # Set parameters suitable for the logo. helpArea.setWeight(0) helpArea.setBorder(0) # Register a listener. events.addCommandListener(handleCommand, [ 'help-addon-mode-brief', 'help-addon-mode-detailed', 'freeze', 'unfreeze', 'open-documentation' ]) events.addNotifyListener(handleNotify, [ 'show-help-text-now', 'init-done', 'active-profile-changed', 'tab-selected', 'addon-list-selected', 'maps-list-selected', 'focus-changed', 'value-changed', 'language-changed' ])
def init(): """Create the Play button.""" area = ui.getArea(ui.COMMAND) area.addSpacer() global logFileName logFileName = os.path.join(paths.getUserPath(paths.RUNTIME), "Conflicts.log") global launchText launchText = area.createText('') #launch-message') global playButton playButton = area.createButton('play', wg.Button.STYLE_DEFAULT) global resolving resolving = ResolveStatus() playButton.setPopupMenu(['view-command-line']) # Register for listening to notifications. events.addNotifyListener(handleNotify, ['active-profile-changed']) # Register for listening to commands. events.addCommandListener(handleCommand, ['play', 'view-command-line', 'continue']) # Commands for the popup menu. ui.addMenuCommand(ui.MENU_APP, 'quit', group=ui.MENU_GROUP_APP) ui.addMenuCommand(ui.MENU_PROFILE, 'play', group=ui.MENU_GROUP_LAUNCH) ui.addMenuCommand(ui.MENU_TOOLS, 'view-command-line', group=ui.MENU_GROUP_LAUNCH)
def init(): # Listen for the About button. events.addCommandListener(handleCommand, ['about', 'show-credits']) # Commands for the popup menu. ui.addMenuCommand(ui.MENU_HELP, 'about')
def init(): # Create the profile list and the profile control buttons. area = ui.getArea(ui.PROFILES) global profileList area.setBorder(0) if USE_MINIMAL_MODE: area.setWeight(1) area.addSpacer() area.setWeight(3) profileList = area.createDropList("profile-list") profileList.setSorted() area.setWeight(1) area.addSpacer() else: # Normal profile list mode. area.setWeight(1) profileList = area.createFormattedList("profile-list") if not st.getSystemBoolean("profile-hide-buttons"): # This should be a small button. area.setWeight(0) area.setBorder(3) controls = area.createArea(alignment=ALIGN_HORIZONTAL, border=2) controls.setExpanding(False) # area.setExpanding(False) controls.setWeight(0) controls.createButton("new-profile", wg.Button.STYLE_MINI) global deleteButton deleteButton = controls.createButton("delete-profile", wg.Button.STYLE_MINI) global dupeButton dupeButton = controls.createButton("duplicate-profile", wg.Button.STYLE_MINI) # Set the title graphics. global bannerImage try: area = ui.getArea(ui.TITLE) bannerImage = area.createImage("banner-default") except: # There is no title area. bannerImage = None # Register a listener for notifications. events.addNotifyListener( notifyHandler, ["quit", "language-changed", "profile-updated", "active-profile-changed", "profile-list-selected"], ) # Register a listener for commands. events.addCommandListener( commandHandler, [ "freeze", "unfreeze", "new-profile", "rename-profile", "reset-profile", "delete-profile", "duplicate-profile", "hide-profile", "unhide-profiles", ], ) # Commands for the menu. ui.addMenuCommand(ui.MENU_PROFILE, "new-profile", group=ui.MENU_GROUP_PROFDB) ui.addMenuCommand(ui.MENU_PROFILE, "unhide-profiles", group=ui.MENU_GROUP_PROFDB) ui.addMenuCommand(ui.MENU_PROFILE, "reset-profile", group=ui.MENU_GROUP_PROFILE) ui.addMenuCommand(ui.MENU_PROFILE, "rename-profile", group=ui.MENU_GROUP_PROFILE) ui.addMenuCommand(ui.MENU_PROFILE, "duplicate-profile", group=ui.MENU_GROUP_PROFILE) ui.addMenuCommand(ui.MENU_PROFILE, "hide-profile", group=ui.MENU_GROUP_PROFILE) ui.addMenuCommand(ui.MENU_PROFILE, "delete-profile", group=ui.MENU_GROUP_PROFILE)
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 profile list and the profile control buttons. area = ui.getArea(ui.PROFILES) global profileList area.setBorder(0) if USE_MINIMAL_MODE: area.setWeight(1) area.addSpacer() area.setWeight(3) profileList = area.createDropList('profile-list') profileList.setSorted() area.setWeight(1) area.addSpacer() else: # Normal profile list mode. area.setWeight(1) profileList = area.createFormattedList("profile-list") if not st.getSystemBoolean('profile-hide-buttons'): # This should be a small button. area.setWeight(0) area.setBorder(3) controls = area.createArea(alignment=ALIGN_HORIZONTAL, border=2) controls.setExpanding(False) #area.setExpanding(False) controls.setWeight(0) controls.createButton('new-profile', wg.Button.STYLE_MINI) global deleteButton deleteButton = controls.createButton('delete-profile', wg.Button.STYLE_MINI) global dupeButton dupeButton = controls.createButton('duplicate-profile', wg.Button.STYLE_MINI) # Set the title graphics. global bannerImage try: area = ui.getArea(ui.TITLE) bannerImage = area.createImage('banner-default') except: # There is no title area. bannerImage = None # Register a listener for notifications. events.addNotifyListener(notifyHandler, [ 'quit', 'language-changed', 'profile-updated', 'active-profile-changed', 'profile-list-selected' ]) # Register a listener for commands. events.addCommandListener(commandHandler, [ 'freeze', 'unfreeze', 'new-profile', 'rename-profile', 'reset-profile', 'delete-profile', 'duplicate-profile', 'hide-profile', 'unhide-profiles' ]) # Commands for the menu. ui.addMenuCommand(ui.MENU_PROFILE, 'new-profile', group=ui.MENU_GROUP_PROFDB) ui.addMenuCommand(ui.MENU_PROFILE, 'unhide-profiles', group=ui.MENU_GROUP_PROFDB) ui.addMenuCommand(ui.MENU_PROFILE, 'reset-profile', group=ui.MENU_GROUP_PROFILE) ui.addMenuCommand(ui.MENU_PROFILE, 'rename-profile', group=ui.MENU_GROUP_PROFILE) ui.addMenuCommand(ui.MENU_PROFILE, 'duplicate-profile', group=ui.MENU_GROUP_PROFILE) ui.addMenuCommand(ui.MENU_PROFILE, 'hide-profile', group=ui.MENU_GROUP_PROFILE) ui.addMenuCommand(ui.MENU_PROFILE, 'delete-profile', group=ui.MENU_GROUP_PROFILE)
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)