def run(self, pos=None): """Show the dialog as modal. Won't return until the dialog has been closed. @param pos Tuple (x, y). Position for the dialog. Defaults to None. @return The command that closed the dialog. """ self.area.getWxWidget().Fit(self) # We'll listen to the common dialog commands (ok, cancel) # ourselves. events.addCommandListener(self.handleCommand) # The command that closes the dialog. We'll assume the dialog # gets closed. self.closingCommand = 'cancel' if self.recommendedSize is not None: self.SetSize(self.recommendedSize) if pos: self.MoveXY(*pos) else: self.Centre() # Won't return until the dialog closes. self.ShowModal() # Stop listening. events.removeCommandListener(self.handleCommand) return self.closingCommand
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__(self, parent, wxId, id): """A slider widget for constrained selection of values.""" base.Widget.__init__( self, wx.Slider(parent, wxId, 50, 0, 100, style=(wx.SL_AUTOTICKS | wx.SL_LABELS | wx.SL_HORIZONTAL))) self.widgetId = id self.step = 1 # Listen for changes. Some platform-specific tweaks are needed: if host.isUnix(): wx.EVT_COMMAND_SCROLL_THUMBTRACK(parent, wxId, self.onThumbTrack) else: wx.EVT_COMMAND_SCROLL_THUMBRELEASE(parent, wxId, self.onThumbTrack) # We want focus notifications. self.setFocusId(id) # Add a command for reseting the slider. self.resetCommand = self.widgetId + '-reset-to-default' self.setPopupMenu([('reset-slider', self.resetCommand)]) # Listen to our reset command. events.addCommandListener(self.onCommand, [self.resetCommand]) self.addValueChangeListener() self.addProfileChangeListener() self.oldValue = None
def __init__(self, parent, wxId, id): """A slider widget for constrained selection of values.""" base.Widget.__init__(self, wx.Slider(parent, wxId, 50, 0, 100, style=(wx.SL_AUTOTICKS | wx.SL_LABELS | wx.SL_HORIZONTAL))) self.widgetId = id self.step = 1 # Listen for changes. Some platform-specific tweaks are needed: if host.isUnix(): wx.EVT_COMMAND_SCROLL_THUMBTRACK(parent, wxId, self.onThumbTrack) else: wx.EVT_COMMAND_SCROLL_THUMBRELEASE(parent, wxId, self.onThumbTrack) # We want focus notifications. self.setFocusId(id) # Add a command for reseting the slider. self.resetCommand = self.widgetId + '-reset-to-default' self.setPopupMenu([('reset-slider', self.resetCommand)]) # Listen to our reset command. events.addCommandListener(self.onCommand, [self.resetCommand]) self.addValueChangeListener() self.addProfileChangeListener() self.oldValue = None
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 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 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 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 __init__(self, title): """Initialize the main window. @param title Title for the main window. """ from sb.widget.area import Area # Commands for the popup menu. self.menuCommandMap = {} # FIXME: Layout is botched. Way too wide. if host.isMac(): initialSize = (769, 559) elif host.isUnix(): initialSize = (900, 610) else: initialSize = (733, 527) # The configuration may define a window size. if st.isDefined('main-width'): initialSize = (st.getSystemInteger('main-width'), initialSize[1]) if st.isDefined('main-height'): initialSize = (initialSize[0], st.getSystemInteger('main-height')) # The configuration can also specify the window position. if st.isDefined('main-x') and st.isDefined('main-y'): initialPos = (st.getSystemInteger('main-x'), st.getSystemInteger('main-y')) else: initialPos = None wx.Frame.__init__(self, None, -1, title, size=initialSize) #self.SetExtraStyle(wx.FRAME_EX_METAL) #self.Create(None, -1, title, size=initialSize) if initialPos is not None: self.MoveXY(*initialPos) else: self.Center() # Set the icon for the frame. icon = wx.Icon('graphics/snowberry.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(icon) #self.Iconize(True) #self.Hide() SPLITTER_ID = 9501 PROF_SPLITTER_ID = 9502 self.splitter = None self.profSplitter = None # The parentWin is where the profSplitter and the help panel # are inside. parentWin = self if USE_HELP_AREA: # The help area is in a splitter. self.splitter = wx.SplitterWindow(self, SPLITTER_ID, style=wx.SP_3DSASH) self.splitter.SetMinimumPaneSize(10) parentWin = self.splitter if not USE_MINIMAL_PROFILE: self.profSplitter = wx.SplitterWindow(parentWin, PROF_SPLITTER_ID, style=wx.SP_3DSASH) # | #wx.SP_NO_XP_THEME) self.profSplitter.SetMinimumPaneSize(100) # Profile panel. profilePanel = wx.Panel(self.profSplitter, -1, style=wx.NO_BORDER | wx.CLIP_CHILDREN) area = Area(PROFILES, profilePanel, ALIGN_VERTICAL, 10) _newArea(area) # Create panels inside the profile splitter. self.mainPanel = MainPanel(self.profSplitter) else: profilePanel = None self.mainPanel = MainPanel(parentWin) getArea(TABS).setWeight(0) profArea = getArea(TABS).createArea(alignment=ALIGN_HORIZONTAL, border=12) profArea.setId(PROFILES) _newArea(profArea) getArea(TABS).setWeight(1) getArea(TABS).setBorderDirs(BORDER_NOT_TOP) # Create a TabArea into the TABS area. self.mainPanel.tabs = getArea(TABS).createTabArea( 'tab', style=sb.widget.tab.TabArea.STYLE_BASIC) if st.isDefined('main-split-position'): self.splitPos = INITIAL_SASH_POS else: self.splitPos = None self.profSplitPos = INITIAL_PROFILE_SASH_POS # Create the help area. if self.splitter: self.helpPanel = wx.Panel(self.splitter, -1, style=wx.NO_BORDER | wx.CLIP_CHILDREN) self.helpPanel.SetBackgroundColour(wx.WHITE) _newArea(Area(HELP, self.helpPanel, ALIGN_VERTICAL, border=4)) # Init the splitter. leftSide = self.profSplitter if not leftSide: leftSide = self.mainPanel self.splitter.SplitVertically(leftSide, self.helpPanel, -INITIAL_SASH_POS) else: self.helpPanel = None if self.profSplitter: self.profSplitter.SplitVertically(profilePanel, self.mainPanel, self.profSplitPos) # Listen for changes in the sash position. wx.EVT_SPLITTER_SASH_POS_CHANGED(self, SPLITTER_ID, self.onSplitChange) wx.EVT_SPLITTER_SASH_POS_CHANGED(self, PROF_SPLITTER_ID, self.onProfSplitChange) # The main panel should be globally accessible. global mainPanel mainPanel = self.mainPanel # Intercept the window close event. wx.EVT_CLOSE(self, self.onWindowClose) # Maintain the splitter position. wx.EVT_SIZE(self, self.onWindowSize) # Listen to some commands. events.addCommandListener(self.handleCommand, ['quit']) # Create a menu bar. self.menuBar = wx.MenuBar()
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__(self, title): """Initialize the main window. @param title Title for the main window. """ from sb.widget.area import Area # Commands for the popup menu. self.menuCommandMap = {} # FIXME: Layout is botched. Way too wide. if host.isMac(): initialSize = (769, 559) elif host.isUnix(): initialSize = (900, 610) else: initialSize = (733, 527) # The configuration may define a window size. if st.isDefined('main-width'): initialSize = (st.getSystemInteger('main-width'), initialSize[1]) if st.isDefined('main-height'): initialSize = (initialSize[0], st.getSystemInteger('main-height')) # The configuration can also specify the window position. if st.isDefined('main-x') and st.isDefined('main-y'): initialPos = (st.getSystemInteger('main-x'), st.getSystemInteger('main-y')) else: initialPos = None wx.Frame.__init__(self, None, -1, title, size=initialSize) #self.SetExtraStyle(wx.FRAME_EX_METAL) #self.Create(None, -1, title, size=initialSize) if initialPos is not None: self.MoveXY(*initialPos) else: self.Center() # Set the icon for the frame. icon = wx.Icon('graphics/snowberry.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(icon) #self.Iconize(True) #self.Hide() SPLITTER_ID = 9501 PROF_SPLITTER_ID = 9502 self.splitter = None self.profSplitter = None # The parentWin is where the profSplitter and the help panel # are inside. parentWin = self if USE_HELP_AREA: # The help area is in a splitter. self.splitter = wx.SplitterWindow(self, SPLITTER_ID, style=wx.SP_3DSASH) self.splitter.SetMinimumPaneSize(10) parentWin = self.splitter if not USE_MINIMAL_PROFILE: self.profSplitter = wx.SplitterWindow(parentWin, PROF_SPLITTER_ID, style=wx.SP_3DSASH)# | #wx.SP_NO_XP_THEME) self.profSplitter.SetMinimumPaneSize(100) # Profile panel. profilePanel = wx.Panel(self.profSplitter, -1, style=wx.NO_BORDER | wx.CLIP_CHILDREN) area = Area(PROFILES, profilePanel, ALIGN_VERTICAL, 10) _newArea(area) # Create panels inside the profile splitter. self.mainPanel = MainPanel(self.profSplitter) else: profilePanel = None self.mainPanel = MainPanel(parentWin) getArea(TABS).setWeight(0) profArea = getArea(TABS).createArea(alignment=ALIGN_HORIZONTAL, border=12) profArea.setId(PROFILES) _newArea(profArea) getArea(TABS).setWeight(1) getArea(TABS).setBorderDirs(BORDER_NOT_TOP) # Create a TabArea into the TABS area. self.mainPanel.tabs = getArea(TABS).createTabArea( 'tab', style=sb.widget.tab.TabArea.STYLE_BASIC) if st.isDefined('main-split-position'): self.splitPos = INITIAL_SASH_POS else: self.splitPos = None self.profSplitPos = INITIAL_PROFILE_SASH_POS # Create the help area. if self.splitter: self.helpPanel = wx.Panel(self.splitter, -1, style = wx.NO_BORDER | wx.CLIP_CHILDREN) self.helpPanel.SetBackgroundColour(wx.WHITE) _newArea( Area(HELP, self.helpPanel, ALIGN_VERTICAL, border=4) ) # Init the splitter. leftSide = self.profSplitter if not leftSide: leftSide = self.mainPanel self.splitter.SplitVertically(leftSide, self.helpPanel, -INITIAL_SASH_POS) else: self.helpPanel = None if self.profSplitter: self.profSplitter.SplitVertically(profilePanel, self.mainPanel, self.profSplitPos) # Listen for changes in the sash position. wx.EVT_SPLITTER_SASH_POS_CHANGED(self, SPLITTER_ID, self.onSplitChange) wx.EVT_SPLITTER_SASH_POS_CHANGED(self, PROF_SPLITTER_ID, self.onProfSplitChange) # The main panel should be globally accessible. global mainPanel mainPanel = self.mainPanel # Intercept the window close event. wx.EVT_CLOSE(self, self.onWindowClose) # Maintain the splitter position. wx.EVT_SIZE(self, self.onWindowSize) # Listen to some commands. events.addCommandListener(self.handleCommand, ['quit']) # Create a menu bar. self.menuBar = wx.MenuBar()
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 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)
def init(): events.addNotifyListener(handleNotify) events.addCommandListener(handleCommand)
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(): # 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 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)