diff --git a/snowberry/lang/english.lang b/snowberry/lang/english.lang index 6ca4a9ddb3..b4c92ad0f0 100644 --- a/snowberry/lang/english.lang +++ b/snowberry/lang/english.lang @@ -316,6 +316,11 @@ category-gamedata: Game Data category-gamedata-doomsday: Doomsday Game Files category-gamedata-primary: Primary Data Files category-gamedata-maps: Maps +category-gamedata-maps-ag: A-G +category-gamedata-maps-hm: H-M +category-gamedata-maps-ns: N-S +category-gamedata-maps-tz: T-Z +category-gamedata-maps-09: 0-9 category-gamedata-lumps: Data Lumps category-patches: DeHackEd Patches category-definitions: Doomsday Engine Definitions @@ -458,6 +463,7 @@ addon-paths-add-prompt: Add to My Addon Paths ui-parts: User Interface main-hide-title: Hide title banner main-hide-help: Hide help panel +profile-hide-buttons: Hide profile buttons summary-profile-change-autoselect: Profile change shows Summary profile-large-icons: Large profile icons diff --git a/snowberry/plugins/preferences.py b/snowberry/plugins/preferences.py index daaa33bd07..c7220adaf4 100644 --- a/snowberry/plugins/preferences.py +++ b/snowberry/plugins/preferences.py @@ -109,8 +109,9 @@ def removeAddonPath(): # TODO: Create widgets for all system settings? box.createSetting(st.getSystemSetting('main-hide-title')) box.createSetting(st.getSystemSetting('main-hide-help')) - box.createSetting(st.getSystemSetting('summary-profile-change-autoselect')) + box.createSetting(st.getSystemSetting('profile-hide-buttons')) box.createSetting(st.getSystemSetting('profile-large-icons')) + box.createSetting(st.getSystemSetting('summary-profile-change-autoselect')) box.createText('restart-required', align=wt.Text.RIGHT).setSmallStyle() diff --git a/snowberry/plugins/profilelist.py b/snowberry/plugins/profilelist.py index 0a3a7cd052..925e481c9b 100644 --- a/snowberry/plugins/profilelist.py +++ b/snowberry/plugins/profilelist.py @@ -33,6 +33,8 @@ from ui import ALIGN_HORIZONTAL profileList = None +deleteButton = None +dupeButton = None # If set to true, the profile list won't be updated on notifications. profileListDisabled = False @@ -123,22 +125,23 @@ def init(): global profileList profileList = area.createFormattedList("profile-list") - # 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) + 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 deleteButton + deleteButton = controls.createButton('delete-profile', + wg.Button.STYLE_MINI) - global dupeButton - dupeButton = controls.createButton('duplicate-profile', - wg.Button.STYLE_MINI) + global dupeButton + dupeButton = controls.createButton('duplicate-profile', + wg.Button.STYLE_MINI) # Set the title graphics. global bannerImage @@ -225,8 +228,8 @@ def notifyHandler(event): profileList.selectItem(pr.getActive().getId()) if pr.getActive() is pr.getDefaults(): - deleteButton.disable() - dupeButton.disable() + if deleteButton: deleteButton.disable() + if dupeButton: dupeButton.disable() ui.disableMenuCommand('rename-profile') ui.disableMenuCommand('delete-profile') ui.disableMenuCommand('hide-profile') @@ -234,8 +237,8 @@ def notifyHandler(event): profileList.setPopupMenu(defaultsMenu) else: isSystem = pr.getActive().isSystemProfile() - deleteButton.enable(not isSystem) - dupeButton.enable() + if deleteButton: deleteButton.enable(not isSystem) + if dupeButton: dupeButton.enable() ui.enableMenuCommand('rename-profile') ui.enableMenuCommand('delete-profile', not isSystem) ui.enableMenuCommand('hide-profile') diff --git a/snowberry/plugins/tab30.plugin/Contents/tab30/main.py b/snowberry/plugins/tab30.plugin/Contents/tab30/main.py index a22369b15e..58ab5d408d 100644 --- a/snowberry/plugins/tab30.plugin/Contents/tab30/main.py +++ b/snowberry/plugins/tab30.plugin/Contents/tab30/main.py @@ -200,6 +200,7 @@ def refreshCategories(): tree.clear() # Start populating from the root category. buildCategories(tree, 'category-tree-root', ao.getRootCategory()) + tree.expandItem('category-tree-root') tree.unfreeze() @@ -211,6 +212,8 @@ def buildCategories(tree, parentId, parentCategory): tree.addItem(id, parentId) buildCategories(tree, id, cat) + tree.sortItemChildren(parentId) + def refreshListIfVisible(): global mustRefreshList diff --git a/snowberry/sb/addon.py b/snowberry/sb/addon.py index 61503c2f6e..ab35a02c4f 100644 --- a/snowberry/sb/addon.py +++ b/snowberry/sb/addon.py @@ -649,6 +649,9 @@ def readMetaData(self): # Look at the path where the WAD file is located. path = self.getContentPath().lower() + # But ignore the user addon path. + if path.find(paths.getUserPath(paths.ADDONS).lower()) == 0: + path = path[len(paths.getUserPath(paths.ADDONS)) + 1:] if 'heretic' in path or 'htic' in path: game = 'jheretic' @@ -726,7 +729,21 @@ def readMetaData(self): if maps or episodic: category += 'maps/' - + + # Category based on the name. + base = paths.getBase(self.getContentPath()).lower() + + if base[0] in string.digits: + category += '09/' + if base[0] in 'abcdefg': + category += 'ag/' + if base[0] in 'hijklm': + category += 'hm/' + if base[0] in 'nopqrs': + category += 'ns/' + if base[0] in 'tuvwxyz': + category += 'tz/' + metadata += "category: %s\n" % category # Game component. diff --git a/snowberry/sb/confdb.py b/snowberry/sb/confdb.py index a3170adb6c..a2828a95af 100644 --- a/snowberry/sb/confdb.py +++ b/snowberry/sb/confdb.py @@ -592,6 +592,8 @@ def init(): _newSystemSetting(tog) tog = conf.ToggleSetting('profile-large-icons', '', 'no', '') _newSystemSetting(tog) + tog = conf.ToggleSetting('profile-hide-buttons', '', 'no', '') + _newSystemSetting(tog) # Load all .conf files. for path in paths.listPaths(paths.CONF, False): diff --git a/snowberry/sb/widget/tree.py b/snowberry/sb/widget/tree.py index 2977d8a272..e893fef637 100644 --- a/snowberry/sb/widget/tree.py +++ b/snowberry/sb/widget/tree.py @@ -98,8 +98,7 @@ def addItem(self, identifier, parentId=None): w = self.getWxWidget() try: parentItem = self.items[parentId] - item = w.AppendItem(parentItem, - language.translate(identifier)) + item = w.AppendItem(parentItem, language.translate(identifier)) except: item = w.AddRoot(language.translate(identifier)) @@ -183,3 +182,16 @@ def selectItem(self, identifier): """ tree = self.getWxWidget() tree.SelectItem(self.items[identifier]) + + def expandItem(self, identifier, doExpand=True): + tree = self.getWxWidget() + if doExpand: + tree.Expand(self.items[identifier]) + else: + tree.Collapse(self.items[identifier]) + + def collapseItem(self, identifier): + self.expandItem(identifier, False) + + def sortItemChildren(self, identifier): + self.getWxWidget().SortChildren(self.items[identifier])