コード例 #1
0
    def __init__(self, wxWidget):
        """Constructor.
        @param wxWidget The wxWidget this Widget manages.
        """
        self.wxWidget = wxWidget
        self.menuItems = None
        self.focusId = ''
        self.menuId = None

        # Callback functions for listening directly to changes.
        self.reactors = []

        self.setNormalStyle()

        # Listen for right mouse clicks in case a popup menu should be
        # displayed.
        wx.EVT_RIGHT_DOWN(wxWidget, self.onRightClick)
        wx.EVT_RIGHT_UP(wxWidget, self.onRightClick)

        # A notification is sent when the widget is entered.
        wx.EVT_ENTER_WINDOW(wxWidget, self.onEnterWidget)

        # Listen for focus changes.
        wx.EVT_SET_FOCUS(wxWidget, self.onFocus)

        # Register a notification listener. These notifications are expected
        # to be handled by all widgets.
        events.addNotifyListener(self.onNotify,
                                 ['language-changed', 'focus-request'])
コード例 #2
0
ファイル: base.py プロジェクト: cmbruns/Doomsday-Engine
    def __init__(self, wxWidget):
        """Constructor.
        @param wxWidget The wxWidget this Widget manages.
        """
        self.wxWidget = wxWidget
        self.menuItems = None
        self.focusId = ''
        self.menuId = None

        # Callback functions for listening directly to changes.
        self.reactors = []

        self.setNormalStyle()

        # Listen for right mouse clicks in case a popup menu should be
        # displayed.
        wx.EVT_RIGHT_DOWN(wxWidget, self.onRightClick)
        wx.EVT_RIGHT_UP(wxWidget, self.onRightClick)

        # A notification is sent when the widget is entered.
        wx.EVT_ENTER_WINDOW(wxWidget, self.onEnterWidget)

        # Listen for focus changes.
        wx.EVT_SET_FOCUS(wxWidget, self.onFocus)

        # Register a notification listener. These notifications are expected
        # to be handled by all widgets.
        events.addNotifyListener(self.onNotify, ['language-changed',
                                                 'focus-request'])
コード例 #3
0
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)
コード例 #4
0
    def __init__(self, id, parentArea):
        Area.__init__(self, id, parentArea.panel, parentArea=parentArea)

        self.currentPage = None
        self.pages = {}

        events.addNotifyListener(self.onNotify, ['preparing-windows'])
コード例 #5
0
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)    
コード例 #6
0
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)
コード例 #7
0
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)
コード例 #8
0
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'
    ])
コード例 #9
0
ファイル: tab20_maps.py プロジェクト: cmbruns/Doomsday-Engine
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'])
コード例 #10
0
ファイル: help.py プロジェクト: cmbruns/Doomsday-Engine
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'] )
コード例 #11
0
def init():
    """Initialize the module."""
    
    # Built-in settings.
    allLangs = language.getLanguages()
    lang = conf.ChoiceSetting('language', '', allLangs, [], 'english')
    lang.setGroup('general-options')
    lang.setSorted(True)
    _newSetting(lang)

    quitLaunch = conf.ToggleSetting('quit-on-launch', '', 'yes', '')
    quitLaunch.setGroup('general-options')
    _newSetting(quitLaunch)

    # System settings.
    tog = conf.ToggleSetting('main-hide-title', '', 'yes', '')
    _newSystemSetting(tog)
    tog = conf.ToggleSetting('main-hide-help', '', 'yes', '')
    _newSystemSetting(tog)
    tog = conf.ToggleSetting('summary-profile-change-autoselect', '', 'no', '')
    _newSystemSetting(tog)
    tog = conf.ToggleSetting('profile-large-icons', '', 'no', '')
    _newSystemSetting(tog)
    tog = conf.ToggleSetting('profile-hide-buttons', '', 'no', '')
    _newSystemSetting(tog)
    tog = conf.ToggleSetting('profile-minimal-mode', '', 'no', '')
    _newSystemSetting(tog)

    # Load all .conf files.
    for path in paths.listPaths(paths.CONF, False):
        readConfigPath(path)

    # Any custom paths?
    if isDefined('doomsday-runtime'):
        paths.setCustomPath(paths.RUNTIME, getSystemString('doomsday-runtime'))

    # Check against previous version to detect upgrades.
    checkUpgrade()

    # Listen for the quit notification so we can save some settings.
    events.addNotifyListener(handleNotify, ['quit', 'widget-edited'])
コード例 #12
0
ファイル: help.py プロジェクト: RomanHargrave/Doomsday-Engine
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'
    ])
コード例 #13
0
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'])
コード例 #14
0
ファイル: base.py プロジェクト: cmbruns/Doomsday-Engine
 def addProfileChangeListener(self):
     """Adds a listener callback that listens to changes of the active
     profile. Only those widgets that manage a setting should need this."""
     
     events.addNotifyListener(self.onNotify, ['active-profile-changed'])                                 
コード例 #15
0
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)
コード例 #16
0
def saveAddonPaths():
    """Write the custom addon paths to a configuration file."""

    fileName = os.path.join(getUserPath(CONF), 'addon-paths.conf')
    try:
        f = file(fileName, 'w')
        f.write('# This file is generated automatically.\n')
        f.write('configure addon-path (\n')
        for p in addonPaths:
            f.write('  readonly: %s\n' % p)
        f.write(')\n')
    except: 
        # Paths not saved.
        pass


def handleNotify(event):
    """When the <code>quit</code> notification is sent, save the
    custom addon paths."""

    if event.hasId('quit'):
        saveAddonPaths()


## When this module is initialized, check for the home directory.
## It is created automatically if it doesn't exist yet.
_checkSnowberryHome()

events.addNotifyListener(handleNotify, ['quit'])
コード例 #17
0
    def addValueChangeListener(self):
        """Adds a listener callback that listens to value change notifications
        sent with this widget's identifier."""

        events.addNotifyListener(self.onNotify,
                                 [self.widgetId + '-value-changed'])
コード例 #18
0
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'])
コード例 #19
0
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)
コード例 #20
0
ファイル: main.py プロジェクト: RomanHargrave/Doomsday-Engine
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)
コード例 #21
0
ファイル: main.py プロジェクト: RomanHargrave/Doomsday-Engine
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)
コード例 #22
0
def init():
    events.addNotifyListener(handleNotify)
    events.addCommandListener(handleCommand)
コード例 #23
0
    def addProfileChangeListener(self):
        """Adds a listener callback that listens to changes of the active
        profile. Only those widgets that manage a setting should need this."""

        events.addNotifyListener(self.onNotify, ['active-profile-changed'])
コード例 #24
0
ファイル: main.py プロジェクト: cmbruns/Doomsday-Engine
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)         
コード例 #25
0
ファイル: base.py プロジェクト: cmbruns/Doomsday-Engine
    def addValueChangeListener(self):
        """Adds a listener callback that listens to value change notifications
        sent with this widget's identifier."""

        events.addNotifyListener(self.onNotify, 
                                 [self.widgetId + '-value-changed'])
コード例 #26
0
ファイル: main.py プロジェクト: cmbruns/Doomsday-Engine
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)