def __init__(self, transition='inRight'):
        class EditSession:
            _sessionType = bs.FreeForAllSession

            def getSessionType(self): return self._sessionType

        self._editSession = EditSession()
        self._R = bs.getResource('addGameWindow')
        self._width = 650
        self._height = 346 if gSmallUI else 380 if gMedUI else 440
        topExtra = 30 if gSmallUI else 20

        self._scrollWidth = 210

        self._rootWidget = bs.containerWidget(size=(self._width, self._height+topExtra), transition=transition,
                                              scale=2.17 if gSmallUI else 1.5 if gMedUI else 1.0,
                                              stackOffset=(0, 1) if gSmallUI else (0, 0))

        self._backButton = bs.buttonWidget(parent=self._rootWidget, position=(58, self._height-53),
                                           size=(165, 70), scale=0.75, textScale=1.2, label=bs.getResource('backText'),
                                           autoSelect=True,
                                           buttonType='back', onActivateCall=self._back)
        self._selectButton = selectButton = bs.buttonWidget(parent=self._rootWidget, position=(self._width-172, self._height-50),
                                                            autoSelect=True, size=(160, 60), scale=0.75, textScale=1.2,
                                                            label=bs.getResource('selectText'), onActivateCall=self._add)
        bs.textWidget(parent=self._rootWidget, position=(self._width*0.5, self._height-28), size=(0, 0), scale=1.0,
                      text="Select Game", hAlign='center', color=gTitleColor, maxWidth=250, vAlign='center')
        v = self._height - 64

        self._selectedTitleText = bs.textWidget(parent=self._rootWidget, position=(self._scrollWidth+50+30, v-15), size=(0, 0),
                                                scale=1.0, color=(0.7, 1.0, 0.7, 1.0), maxWidth=self._width-self._scrollWidth-150,
                                                hAlign='left', vAlign='center')
        v -= 30

        self._selectedDescriptionText = bs.textWidget(parent=self._rootWidget, position=(self._scrollWidth+50+30, v), size=(0, 0),
                                                      scale=0.7, color=(0.5, 0.8, 0.5, 1.0), maxWidth=self._width-self._scrollWidth-150,
                                                      hAlign='left')

        scrollHeight = self._height-100

        v = self._height - 60

        self._scrollWidget = bs.scrollWidget(parent=self._rootWidget, position=(61, v-scrollHeight), size=(self._scrollWidth, scrollHeight))
        bs.widget(edit=self._scrollWidget, upWidget=self._backButton, leftWidget=self._backButton, rightWidget=selectButton)
        self._column = None

        v -= 35
        bs.containerWidget(edit=self._rootWidget, cancelButton=self._backButton, startButton=selectButton)
        self._selectedGameType = None

        bs.containerWidget(edit=self._rootWidget, selectedChild=self._scrollWidget)

        self._refresh()
        if config["selected"]:
            for gt in bsUtils.getGameTypes():
                if not gt.supportsSessionType(self._editSession._sessionType):
                    continue
                if gt.__name__ == config["selected"]:
                    self._refresh(selected=gt)
                    self._setSelectedGameType(gt)
def newInit(self, transition='inRight', originWidget=None):
	if originWidget is not None:
		self._transitionOut = 'outScale'
		scaleOrigin = originWidget.getScreenSpaceCenter()
		transition = 'inScale'
	else:
		self._transitionOut = 'outRight'
		scaleOrigin = None

	width = 600 if gSmallUI else 600
	height = 360 if gSmallUI else 435
	self._gOnlyHeight = height
	if any([b.textOnly for b in buttons]):
		if len(textbuttonlayouts[sum([b.textOnly for b in buttons])]) > 1:
			height += 80 if gSmallUI else 120
		else:
			height += 60 if gSmallUI else 80
	self._width, self._height = width, height

	buttonHeight = 42

	R = bs.getResource('settingsWindow')

	topExtra = 20 if gSmallUI else 0
	if originWidget is not None:
		self._rootWidget = bs.containerWidget(size=(width,height+topExtra),transition=transition,
		                                      scaleOriginStackOffset=scaleOrigin,
		                                      scale=1.75 if gSmallUI else 1.35 if gMedUI else 1.0,
		                                      stackOffset=(0,-8) if gSmallUI else (0,0))
	else:
		self._rootWidget = bs.containerWidget(size=(width,height+topExtra),transition=transition,
		                                      scale=1.75 if gSmallUI else 1.35 if gMedUI else 1.0,
		                                      stackOffset=(0,-8) if gSmallUI else (0,0))

	self._backButton = b = bs.buttonWidget(parent=self._rootWidget,autoSelect=True,position=(40,height-55),size=(130,60),scale=0.8,textScale=1.2,
	                                       label=bs.getResource('backText'),buttonType='back',onActivateCall=self._doBack)
	bs.containerWidget(edit=self._rootWidget, cancelButton=b)

	t = bs.textWidget(parent=self._rootWidget, position=(0, height-44), size=(width,25), text=R.titleText, color=gTitleColor,
	                  hAlign="center", vAlign="center", maxWidth=130)

	if gDoAndroidNav:
		bs.buttonWidget(edit=b, buttonType='backSmall', size=(60, 60), label=bs.getSpecialChar('logoFlat'))
		bs.textWidget(edit=t, hAlign='left', position=(93, height-44))

	icon_buttons = sorted([b for b in buttons if b.icon], key=lambda b: b.sorting_position)
	for i, button in enumerate(icon_buttons):
		x, y = button._create_icon_button(self, i)
	text_buttons = sorted([b for b in buttons if b.textOnly], key=lambda b: b.sorting_position)
	for i, button in enumerate(text_buttons):
		button._create_text_button(self, i, y)

	for button in buttons:
		button.setLocals(self)

	self._restoreState()
def _setTab(self, tab):
	_setTabOld(self, tab)
	if hasattr(self, "_getMoreGamesButton"):
		if self._getMoreGamesButton.exists():
			self._getMoreGamesButton.delete()
	if tab == "minigames":
		self._getMoreGamesButton = bs.buttonWidget(parent=self._rootWidget, autoSelect=True,
												   label=bs.getResource("addGameWindow").getMoreGamesText,
												   color=(0.54, 0.52, 0.67),
												   textColor=(0.7, 0.65, 0.7),
												   onActivateCall=self._onGetMoreGamesPress,
												   size=(178,50), position=(70, 60))
    def __init__(self, transition='inRight'):
        class EditSession:
            _sessionType = bs.FreeForAllSession

            def getSessionType(self):
                return self._sessionType

        self._editSession = EditSession()
        self._R = bs.getResource('addGameWindow')
        self._width = 650
        self._height = 346 if gSmallUI else 380 if gMedUI else 440
        topExtra = 30 if gSmallUI else 20

        self._scrollWidth = 210

        self._rootWidget = bs.containerWidget(
            size=(self._width, self._height + topExtra),
            transition=transition,
            scale=2.17 if gSmallUI else 1.5 if gMedUI else 1.0,
            stackOffset=(0, 1) if gSmallUI else (0, 0))

        self._backButton = bs.buttonWidget(parent=self._rootWidget,
                                           position=(58, self._height - 53),
                                           size=(165, 70),
                                           scale=0.75,
                                           textScale=1.2,
                                           label=bs.getResource('backText'),
                                           autoSelect=True,
                                           buttonType='back',
                                           onActivateCall=self._back)
        self._selectButton = selectButton = bs.buttonWidget(
            parent=self._rootWidget,
            position=(self._width - 172, self._height - 50),
            autoSelect=True,
            size=(160, 60),
            scale=0.75,
            textScale=1.2,
            label=bs.getResource('selectText'),
            onActivateCall=self._add)
        bs.textWidget(parent=self._rootWidget,
                      position=(self._width * 0.5, self._height - 28),
                      size=(0, 0),
                      scale=1.0,
                      text="Select Game",
                      hAlign='center',
                      color=gTitleColor,
                      maxWidth=250,
                      vAlign='center')
        v = self._height - 64

        self._selectedTitleText = bs.textWidget(
            parent=self._rootWidget,
            position=(self._scrollWidth + 50 + 30, v - 15),
            size=(0, 0),
            scale=1.0,
            color=(0.7, 1.0, 0.7, 1.0),
            maxWidth=self._width - self._scrollWidth - 150,
            hAlign='left',
            vAlign='center')
        v -= 30

        self._selectedDescriptionText = bs.textWidget(
            parent=self._rootWidget,
            position=(self._scrollWidth + 50 + 30, v),
            size=(0, 0),
            scale=0.7,
            color=(0.5, 0.8, 0.5, 1.0),
            maxWidth=self._width - self._scrollWidth - 150,
            hAlign='left')

        scrollHeight = self._height - 100

        v = self._height - 60

        self._scrollWidget = bs.scrollWidget(parent=self._rootWidget,
                                             position=(61, v - scrollHeight),
                                             size=(self._scrollWidth,
                                                   scrollHeight))
        bs.widget(edit=self._scrollWidget,
                  upWidget=self._backButton,
                  leftWidget=self._backButton,
                  rightWidget=selectButton)
        self._column = None

        v -= 35
        bs.containerWidget(edit=self._rootWidget,
                           cancelButton=self._backButton,
                           startButton=selectButton)
        self._selectedGameType = None

        bs.containerWidget(edit=self._rootWidget,
                           selectedChild=self._scrollWidget)

        self._refresh()
        if config["selected"]:
            for gt in bsUtils.getGameTypes():
                if not gt.supportsSessionType(self._editSession._sessionType):
                    continue
                if gt.__name__ == config["selected"]:
                    self._refresh(selected=gt)
                    self._setSelectedGameType(gt)
def newInit(self, transition='inRight', originWidget=None):
    if originWidget is not None:
        self._transitionOut = 'outScale'
        scaleOrigin = originWidget.getScreenSpaceCenter()
        transition = 'inScale'
    else:
        self._transitionOut = 'outRight'
        scaleOrigin = None

    width = 600 if gSmallUI else 600
    height = 360 if gSmallUI else 435
    self._gOnlyHeight = height
    if any([b.textOnly for b in buttons]):
        if len(textbuttonlayouts[sum([b.textOnly for b in buttons])]) > 1:
            height += 80 if gSmallUI else 120
        else:
            height += 60 if gSmallUI else 80
    self._width, self._height = width, height

    R = bs.getResource('settingsWindow')

    topExtra = 20 if gSmallUI else 0
    if originWidget is not None:
        self._rootWidget = bs.containerWidget(
            size=(width, height + topExtra),
            transition=transition,
            scaleOriginStackOffset=scaleOrigin,
            scale=1.75 if gSmallUI else 1.35 if gMedUI else 1.0,
            stackOffset=(0, -8) if gSmallUI else (0, 0))
    else:
        self._rootWidget = bs.containerWidget(
            size=(width, height + topExtra),
            transition=transition,
            scale=1.75 if gSmallUI else 1.35 if gMedUI else 1.0,
            stackOffset=(0, -8) if gSmallUI else (0, 0))

    self._backButton = b = bs.buttonWidget(parent=self._rootWidget,
                                           autoSelect=True,
                                           position=(40, height - 55),
                                           size=(130, 60),
                                           scale=0.8,
                                           textScale=1.2,
                                           label=bs.getResource('backText'),
                                           buttonType='back',
                                           onActivateCall=self._doBack)
    bs.containerWidget(edit=self._rootWidget, cancelButton=b)

    t = bs.textWidget(parent=self._rootWidget,
                      position=(0, height - 44),
                      size=(width, 25),
                      text=R.titleText,
                      color=gTitleColor,
                      hAlign="center",
                      vAlign="center",
                      maxWidth=130)

    if gDoAndroidNav:
        bs.buttonWidget(edit=b,
                        buttonType='backSmall',
                        size=(60, 60),
                        label=bs.getSpecialChar('logoFlat'))
        bs.textWidget(edit=t, hAlign='left', position=(93, height - 44))

    icon_buttons = sorted([b for b in buttons if b.icon],
                          key=lambda b: b.sorting_position)
    for i, button in enumerate(icon_buttons):
        x, y = button._create_icon_button(self, i)
    text_buttons = sorted([b for b in buttons if b.textOnly],
                          key=lambda b: b.sorting_position)
    for i, button in enumerate(text_buttons):
        button._create_text_button(self, i, y)

    for button in buttons:
        button.setLocals(self)

    self._restoreState()
    6: [3, 3],
    7: [4, 3],
    8: [3, 3, 2],
    9: [3, 3, 3]
}
textbuttonlayouts = {
    1: [1],
    2: [2],
    3: [3],
    4: [2, 2],
    5: [3, 2],
    6: [3, 3],
    7: [4, 3]
}

R = bs.getResource('settingsWindow')
if hasattr(SettingsWindow, "_doProfiles"):
    SettingsButton(id="Profiles", icon="cuteSpaz") \
        .setCallback(lambda swinstance: swinstance._doProfiles()) \
        .setText(R.playerProfilesText) \
        .add()

if hasattr(SettingsWindow, "_doControllers"):
    SettingsButton(id="Controllers", icon="controllerIcon") \
        .setCallback(lambda swinstance: swinstance._doControllers()) \
        .setText(R.controllersText) \
        .setLocals(button="_controllersButton") \
        .add()

if hasattr(SettingsWindow, "_doGraphics"):
    SettingsButton(id="Graphics", icon="graphicsIcon") \
	def __init__(self, mod, modManagerWindow, originWidget=None):
		self.modManagerWindow = modManagerWindow
		self.mod = mod
		s = 1.1 if gSmallUI else 1.27 if gMedUI else 1.57
		bColor = (0.6,0.53,0.63)
		bTextColor = (0.75,0.7,0.8)
		width  = 380 * s
		height = 240 * s
		textScale = 0.7 * s

		# if they provided an origin-widget, scale up from that
		if originWidget is not None:
			self._transitionOut = 'outScale'
			scaleOrigin = originWidget.getScreenSpaceCenter()
			transition = 'inScale'
		else:
			self._transitionOut = None
			scaleOrigin = None
			transition = 'inRight'

		self._rootWidget = ContainerWidget(size=(width, height), transition=transition,
		                                   scale=2.1 if gSmallUI else 1.5 if gMedUI else 1.0,
		                                   scaleOriginStackOffset=scaleOrigin)

		self._titleText = TextWidget(parent=self._rootWidget,position=(0, height - 52),
		                             size=(width, 30), text="ModManager Settings", color=(1.0, 1.0, 1.0),
		                             hAlign="center", vAlign="top", scale=1.5 * textScale)

		pos = height * 0.65
		branchLabel = TextWidget(parent=self._rootWidget, position=(width*0.35, pos), size=(0, 40),
		                         hAlign="right", vAlign="center",
		                         text="Branch:", scale=textScale,
		                         color=bTextColor, maxWidth=width*0.9, maxHeight=height-75)
		self.branch = TextWidget(parent=self._rootWidget, position=(width*0.4, pos),
		                         size=(width * 0.4, 40), text=config.get("branch", "master"),
		                         hAlign="left", vAlign="center",
		                         editable=True, padding=4,
		                         onReturnPressCall=self.setBranch)

		pos -= height * 0.15
		checkUpdatesValue = config.get("auto-check-updates", True)
		self.checkUpdates = CheckBoxWidget(parent=self._rootWidget, text="auto check for updates",
		                                   position=(width * 0.2, pos), size=(170, 30),
		                                   textColor=(0.8, 0.8, 0.8),
		                                   value=checkUpdatesValue,
		                                   onValueChangeCall=self.setCheckUpdate)

		pos -= height * 0.2
		autoUpdatesValue = config.get("auto-update-old-mods", True)
		self.autoUpdates = CheckBoxWidget(parent=self._rootWidget, text="auto-update old mods",
		                                  position=(width * 0.2, pos), size=(170, 30),
		                                  textColor=(0.8, 0.8, 0.8),
		                                  value=autoUpdatesValue,
		                                  onValueChangeCall=self.setAutoUpdate)
		self.checkAutoUpdateState()

		okButtonSize = (150, 50)
		okButtonPos = (width * 0.5 - okButtonSize[0]/2, 20)
		okText = bs.getResource('okText')
		b = ButtonWidget(parent=self._rootWidget, position=okButtonPos, size=okButtonSize, label=okText, onActivateCall=self._ok)

		# back on window = okbutton
		self._rootWidget.set(onCancelCall=b.activate, selectedChild=b, startButton=b)

		b.upWidget = self.autoUpdates
		self.autoUpdates.upWidget = self.checkUpdates
		self.checkUpdates.upWidget = self.branch
	def __init__(self, mod, modManagerWindow, originWidget=None):
		self.modManagerWindow = modManagerWindow
		self.mod = mod
		s = 1.1 if gSmallUI else 1.27 if gMedUI else 1.57
		bColor = (0.6,0.53,0.63)
		bTextColor = (0.75,0.7,0.8)
		width  = 360 * s
		height = 100 * s
		if mod.author:
			height += 25
		if not mod.isLocal:
			height += 50

		buttons = sum([(mod.checkUpdate() or not mod.isInstalled()), mod.isInstalled()])
		if buttons:
			height += 75

		color = (1, 1, 1)
		textScale = 0.7 * s
		height += 40

		# if they provided an origin-widget, scale up from that
		if originWidget is not None:
			self._transitionOut = 'outScale'
			scaleOrigin = originWidget.getScreenSpaceCenter()
			transition = 'inScale'
		else:
			self._transitionOut = None
			scaleOrigin = None
			transition = 'inRight'

		self._rootWidget = ContainerWidget(size=(width, height), transition=transition,
		                                   scale=2.1 if gSmallUI else 1.5 if gMedUI else 1.0,
		                                   scaleOriginStackOffset=scaleOrigin)

		#t = bs.textWidget(parent=self._rootWidget,position=(width*0.5,height-5-(height-75)*0.5),size=(0,0),
		#				  hAlign="center",vAlign="center",text=text,scale=textScale,color=color,maxWidth=width*0.9,maxHeight=height-75)
		pos = height * (0.9 if buttons else 0.8)
		labelspacing = height * (0.15 if buttons else 0.175)

		nameLabel = TextWidget(parent=self._rootWidget,position=(width*0.5, pos),size=(0,0),
							   hAlign="center",vAlign="center",text=mod.name,scale=textScale * 1.5,
							   color=color,maxWidth=width*0.9,maxHeight=height-75)
		pos -= labelspacing
		if mod.author:
			authorLabel = TextWidget(parent=self._rootWidget,position=(width*0.5, pos),size=(0,0),
			                         hAlign="center",vAlign="center",text="by "+mod.author,scale=textScale,
			                         color=color,maxWidth=width*0.9,maxHeight=height-75)
			pos -= labelspacing
		if not mod.isLocal:
			if mod.checkUpdate():
				if mod.is_old():
					status = "update available"
				else:
					status = "unrecognized version"
			else:
				status = "installed"
			if not mod.isInstalled(): status = "not installed"
			statusLabel = TextWidget(parent=self._rootWidget,position=(width*0.45, pos),size=(0,0),
			                         hAlign="right",vAlign="center",text="Status:",scale=textScale,
			                         color=color,maxWidth=width*0.9,maxHeight=height-75)
			status = TextWidget(parent=self._rootWidget,position=(width*0.55, pos),size=(0,0),
			                    hAlign="left",vAlign="center",text=status,scale=textScale,
			                    color=color,maxWidth=width*0.9,maxHeight=height-75)
			pos -= labelspacing * 0.8

		if not mod.author and mod.isLocal:
			pos -= labelspacing

		if not (gSmallUI or gMedUI):
			pos -= labelspacing * 0.25

		if buttons > 0:
			pos -= labelspacing * 2

		self.button_index = -1
		def button_pos():
			self.button_index += 1
			d = {
				1: [0.5],
				2: [0.35, 0.65]
			}
			x = width * d[buttons][self.button_index]
			y = pos
			sx, sy = button_size()
			x -= sx / 2
			y += sy / 2
			return x, y

		def button_size():
			sx = {1: 100, 2: 80}[buttons] * s
			sy = 58 * s
			return sx, sy

		def button_text_size():
			return {1: 0.8, 2: 1.0}[buttons]

		if mod.checkUpdate() or not mod.isInstalled():
			self.downloadButton = ButtonWidget(parent=self._rootWidget,
			                                   position=button_pos(), size=button_size(),
			                                   onActivateCall=bs.Call(self._download,),
			                                   color=bColor,
			                                   autoSelect=True,
			                                   textColor=bTextColor,
			                                   buttonType='square',
			                                   textScale=button_text_size(),
			                                   label="Update Mod" if mod.checkUpdate() else "Download Mod")

		if mod.isInstalled():
			self.deleteButton = ButtonWidget(parent=self._rootWidget,
			                                 position=button_pos(), size=button_size(),
			                                 onActivateCall=bs.Call(self._delete),
			                                 color=bColor,
			                                 autoSelect=True,
			                                 textColor=bTextColor,
			                                 buttonType='square',
			                                 textScale=button_text_size(),
			                                 label="Delete Mod")

		okButtonSize = (130 * s, 40 * s)
		okButtonPos = (width * 0.5 - okButtonSize[0]/2, 20)
		okText = bs.getResource('okText')
		b = ButtonWidget(parent=self._rootWidget, autoSelect=True, position=okButtonPos, size=okButtonSize, label=okText, onActivateCall=self._ok)

		self._rootWidget.onCancelCall = b.activate
		self._rootWidget.selectedChild = b
		self._rootWidget.startButton = b
	def __init__(self, transition='inRight', modal=False, showTab="all", onCloseCall=None, backLocationCls=None, originWidget=None):

		# if they provided an origin-widget, scale up from that
		if originWidget is not None:
			self._transitionOut = 'outScale'
			scaleOrigin = originWidget.getScreenSpaceCenter()
			transition = 'inScale'
		else:
			self._transitionOut = 'outRight'
			scaleOrigin = None


		self._backLocationCls = backLocationCls
		self._onCloseCall = onCloseCall
		self._showTab = showTab
		self._selectedTab = {'label': showTab}
		if showTab != "all":
			def check_tab_available():
				if not self._rootWidget.exists():
					return
				if any([mod.category == showTab for mod in self.mods]):
					return
				if "button" in self._selectedTab:
					return
				self._selectedTab = {"label": "all"}
				self._refresh()
			self.timers["check_tab_available"] = bs.Timer(300, check_tab_available, timeType='real')
		self._modal = modal

		self._windowTitleName = "Community Mod Manager"


		def sort_alphabetical(mods):
			return sorted(mods, key=lambda mod: mod.name.lower())

		def sort_playability(mods):
			mods = sorted(self.mods, key=lambda mod: mod.playability, reverse=True)
			if self._selectedTab["label"] == "minigames":
				bs.screenMessage('experimental minigames hidden.')
				return [mod for mod in mods if (mod.playability > 0 or mod.isLocal or mod.category != "minigames")]
			return mods

		self.sortModes = {
			'Alphabetical': {'func': sort_alphabetical, 'next': 'Playability'},
			'Playability': {'func': sort_playability, 'next': 'Alphabetical'}
		}

		smkeys = list(self.sortModes.keys())

		for i, key in enumerate(smkeys):
			self.sortModes[key]['index'] = i
			self.sortModes[key]['name'] = key
			self.sortModes[key]['next'] = smkeys[(i + 1) % len(smkeys)]

		sortMode = config.get('sortMode')
		if not sortMode or sortMode not in self.sortModes:
			sortMode = smkeys[0]
		self.sortMode = self.sortModes[sortMode]


		self._width = 650
		self._height = 380 if gSmallUI else 420 if gMedUI else 500
		spacing = 40
		buttonWidth = 350
		topExtra = 20 if gSmallUI else 0

		self._rootWidget = ContainerWidget(size=(self._width,self._height+topExtra),transition=transition,
		                                   scale = 2.05 if gSmallUI else 1.5 if gMedUI else 1.0,
		                                   stackOffset=(0,-10) if gSmallUI else (0,0))

		self._backButton = backButton = ButtonWidget(parent=self._rootWidget, position=(self._width-160,self._height-60),
		                                             size=(160,68), scale=0.77,
		                                             autoSelect=True, textScale=1.3,
		                                             label=bs.getResource('doneText' if self._modal else 'backText'),
		                                             onActivateCall=self._back)
		self._rootWidget.cancelButton = backButton
		TextWidget(parent=self._rootWidget, position=(0, self._height-47),
		           size=(self._width, 25),
		           text=self._windowTitleName, color=gHeadingColor,
		           maxWidth=290,
		           hAlign="center", vAlign="center")


		v = self._height - 59
		h = 41
		hspacing = 15
		bColor = (0.6,0.53,0.63)
		bTextColor = (0.75,0.7,0.8)

		s = 1.1 if gSmallUI else 1.27 if gMedUI else 1.57
		v -= 63.0*s
		self.refreshButton = ButtonWidget(parent=self._rootWidget,position=(h,v),size=(90,58.0*s),
										onActivateCall=bs.Call(self._cb_refresh, force=True),
										color=bColor,
										autoSelect=True,
										buttonType='square',
										textColor=bTextColor,
										textScale=0.7,
										label="Reload List")

		v -= 63.0*s
		self.modInfoButton = ButtonWidget(parent=self._rootWidget,position=(h,v),size=(90,58.0*s),
										   onActivateCall=bs.Call(self._cb_info),
										   color=bColor,
										   autoSelect=True,
										   textColor=bTextColor,
										   buttonType='square',
										   textScale=0.7,
										   label="Mod Info")

		v -= 63.0*s
		self.sortButtonData = {"s": s, "h": h, "v": v, "bColor": bColor, "bTextColor": bTextColor}
		self.sortButton = ButtonWidget(parent=self._rootWidget,position=(h,v),size=(90,58.0*s),
										   onActivateCall=bs.Call(self._cb_sorting),
										   color=bColor,
										   autoSelect=True,
										   textColor=bTextColor,
										   buttonType='square',
										   textScale=0.7,
										   label="Sorting:\n" + self.sortMode['name'])

		v -= 63.0*s
		self.settingsButton = ButtonWidget(parent=self._rootWidget,position=(h,v),size=(90,58.0*s),
										   onActivateCall=bs.Call(self._cb_settings),
										   color=bColor,
										   autoSelect=True,
										   textColor=bTextColor,
										   buttonType='square',
										   textScale=0.7,
										   label="Settings")

		v = self._height - 75
		self.columnPosY = self._height - 75 - self.tabheight
		self._scrollHeight = self._height - 119 - self.tabheight
		scrollWidget = ScrollWidget(parent=self._rootWidget, position=(140,self.columnPosY - self._scrollHeight), size=(self._width-180, self._scrollHeight+10))
		#bs.widget(edit=backButton, downWidget=scrollWidget, leftWidget=scrollWidget) # FIXME: select Tabs
		backButton.set(downWidget=scrollWidget, leftWidget=scrollWidget)
		self._columnWidget = ColumnWidget(parent=scrollWidget)

		for b in [self.refreshButton, self.modInfoButton, self.settingsButton]:
			#bs.widget(edit=b, rightWidget=scrollWidget)
			b.rightWidget = scrollWidget
		scrollWidget.leftWidget = self.refreshButton

		self._cb_refresh()

		backButton.onActivateCall = self._back
		self._rootWidget.startButton = backButton
		self._rootWidget.onCancelCall = backButton.activate
		self._rootWidget.selectedChild = scrollWidget
	6: [3, 3],
	7: [4, 3],
	8: [3, 3, 2],
	9: [3, 3, 3]
}
textbuttonlayouts = {
	1: [1],
	2: [2],
	3: [3],
	4: [2, 2],
	5: [3, 2],
	6: [3, 3],
	7: [4, 3]
}

R = bs.getResource('settingsWindow')
if hasattr(SettingsWindow, "_doProfiles"):
	SettingsButton(id="Profiles", icon="cuteSpaz") \
		.setCallback(lambda swinstance: swinstance._doProfiles()) \
		.setText(R.playerProfilesText) \
		.add()

if hasattr(SettingsWindow, "_doControllers"):
	SettingsButton(id="Controllers", icon="controllerIcon") \
		.setCallback(lambda swinstance: swinstance._doControllers()) \
		.setText(R.controllersText) \
		.setLocals(button="_controllersButton") \
		.add()

if hasattr(SettingsWindow, "_doGraphics"):
	SettingsButton(id="Graphics", icon="graphicsIcon") \