def __init__(self, parent, *args, **kwargs): BaseClass.__init__(self, *args, **kwargs) self.setupUi(self) self.parent = parent self.setStyleSheet(self.parent.client.styleSheet()) self.setWindowTitle("Ui Mod Manager") self.doneButton.clicked.connect(self.doneClicked) self.modList.itemEntered.connect(self.hoverOver) allmods = modvault.getInstalledMods() self.uimods = {} for mod in allmods: if mod.ui_only: self.uimods[mod.totalname] = mod self.modList.addItem(mod.totalname) names = [mod.totalname for mod in modvault.getActiveMods(uimods=True)] for name in names: l = self.modList.findItems(name, QtCore.Qt.MatchExactly) if l: l[0].setSelected(True) if len(self.uimods) != 0: self.hoverOver(self.modList.item(0))
def __init__(self, parent, item, *args, **kwargs): BaseClass.__init__(self, *args, **kwargs) self.setupUi(self) self.parent = parent self.parent.options = [] if len(item.options) == 0: self.optionGroup.setVisible(False) else: group_layout = QtGui.QVBoxLayout() self.optionGroup.setLayout(group_layout) for option in item.options: checkBox = QtGui.QCheckBox(self) checkBox.setText(option) checkBox.setChecked(True) group_layout.addWidget(checkBox) self.parent.options.append(checkBox) self.setStyleSheet(self.parent.client.styleSheet()) self.setWindowTitle("Hosting Game : " + item.name) self.titleEdit.setText(self.parent.gamename) self.passEdit.setText(self.parent.gamepassword) self.game = GameItem(0) self.gamePreview.setItemDelegate(GameItemDelegate(self)) self.gamePreview.addItem(self.game) self.message = {} self.message['title'] = self.parent.gamename self.message['host'] = self.parent.client.login self.message['teams'] = {1: [self.parent.client.login]} # self.message.get('access', 'public') self.message['featured_mod'] = "faf" self.message['mapname'] = self.parent.gamemap self.message['state'] = "open" self.game.update(self.message, self.parent.client) i = 0 index = 0 if self.parent.canChooseMap == True: allmaps = dict() for map in maps.maps.keys() + maps.getUserMaps(): allmaps[map] = maps.getDisplayName(map) for (map, name) in sorted(allmaps.iteritems(), key=lambda x: x[1]): if map == self.parent.gamemap: index = i self.mapList.addItem(name, map) i = i + 1 self.mapList.setCurrentIndex(index) else: self.mapList.hide() icon = maps.preview(self.parent.gamemap, True) if not icon: icon = util.icon("games/unknown_map.png", False, True) self.mods = {} #this makes it so you can select every non-ui_only mod for mod in modvault.getInstalledMods(): if mod.ui_only: continue self.mods[mod.totalname] = mod self.modList.addItem(mod.totalname) names = [mod.totalname for mod in modvault.getActiveMods(uimods=False)] logger.debug("Active Mods detected: %s" % str(names)) for name in names: l = self.modList.findItems(name, QtCore.Qt.MatchExactly) logger.debug("found item: %s" % l[0].text()) if l: l[0].setSelected(True) #self.mapPreview.setPixmap(icon) self.mapList.currentIndexChanged.connect(self.mapChanged) self.hostButton.released.connect(self.hosting) self.titleEdit.textChanged.connect(self.updateText) self.modList.itemClicked.connect(self.modclicked)
def __init__(self, parent, item, *args, **kwargs): BaseClass.__init__(self, *args, **kwargs) self.setupUi(self) self.parent = parent self.setStyleSheet(self.parent.client.styleSheet()) self.setWindowTitle ( "Hosting Game : " + item.name ) self.titleEdit.setText ( self.parent.gamename ) self.passEdit.setText ( self.parent.gamepassword ) self.game = GameItem(0) self.gamePreview.setItemDelegate(GameItemDelegate(self)) self.gamePreview.addItem(self.game) self.message = { "title": self.parent.gamename, "host": self.parent.client.login, "teams": {1:[self.parent.client.id]}, "featured_mod": "faf", "mapname": self.parent.gamemap, "state": "open", } self.game.update(self.message, self.parent.client) i = 0 index = 0 if self.parent.canChooseMap == True: allmaps = dict() for map in maps.maps.keys() + maps.getUserMaps(): allmaps[map] = maps.getDisplayName(map) for (map, name) in sorted(allmaps.iteritems(), key=lambda x: x[1]): if map == self.parent.gamemap : index = i self.mapList.addItem(name, map) i = i + 1 self.mapList.setCurrentIndex(index) else: self.mapList.hide() self.mods = {} #this makes it so you can select every non-ui_only mod for mod in modvault.getInstalledMods(): if mod.ui_only: continue self.mods[mod.totalname] = mod self.modList.addItem(mod.totalname) names = [mod.totalname for mod in modvault.getActiveMods(uimods=False)] logger.debug("Active Mods detected: %s" % str(names)) for name in names: l = self.modList.findItems(name, QtCore.Qt.MatchExactly) logger.debug("found item: %s" % l[0].text()) if l: l[0].setSelected(True) self.radioFriends.setChecked(self.parent.friends_only) self.mapList.currentIndexChanged.connect(self.mapChanged) self.hostButton.released.connect(self.hosting) self.titleEdit.textChanged.connect(self.updateText)
def __init__(self, parent, item, *args, **kwargs): BaseClass.__init__(self, *args, **kwargs) self.setupUi(self) self.parent = parent self.parent.options = [] if len(item.options) == 0 : self.optionGroup.setVisible(False) else : group_layout = QtGui.QVBoxLayout() self.optionGroup.setLayout(group_layout) for option in item.options : checkBox = QtGui.QCheckBox(self) checkBox.setText(option) checkBox.setChecked(True) group_layout.addWidget(checkBox) self.parent.options.append(checkBox) self.setStyleSheet(self.parent.client.styleSheet()) self.setWindowTitle ( "Hosting Game : " + item.name ) self.titleEdit.setText ( self.parent.gamename ) self.passEdit.setText ( self.parent.gamepassword ) self.game = GameItem(0) self.gamePreview.setItemDelegate(GameItemDelegate(self)); self.gamePreview.addItem(self.game) self.message = {} self.message['title'] = self.parent.gamename self.message['host'] = self.parent.client.login self.message['teams'] = {1:[self.parent.client.login]} # self.message.get('access', 'public') self.message['featured_mod'] = "faf" self.message['mapname'] = self.parent.gamemap self.message['state'] = "open" self.game.update(self.message, self.parent.client) i = 0 index = 0 if self.parent.canChooseMap == True: allmaps = dict() for map in maps.maps.keys() + maps.getUserMaps(): allmaps[map] = maps.getDisplayName(map) for (map, name) in sorted(allmaps.iteritems(), key=lambda x: x[1]): if map == self.parent.gamemap : index = i self.mapList.addItem(name, map) i = i + 1 self.mapList.setCurrentIndex(index) else: self.mapList.hide() icon = maps.preview(self.parent.gamemap, True) if not icon: icon = util.icon("games/unknown_map.png", False, True) self.mods = {} #this makes it so you can select every non-ui_only mod for mod in modvault.getInstalledMods(): if mod.ui_only: continue self.mods[mod.totalname] = mod self.modList.addItem(mod.totalname) names = [mod.totalname for mod in modvault.getActiveMods(uimods=False)] logger.debug("Active Mods detected: %s" % str(names)) for name in names: l = self.modList.findItems(name, QtCore.Qt.MatchExactly) logger.debug("found item: %s" % l[0].text()) if l: l[0].setSelected(True) #self.mapPreview.setPixmap(icon) self.mapList.currentIndexChanged.connect(self.mapChanged) self.hostButton.released.connect(self.hosting) self.titleEdit.textChanged.connect(self.updateText) self.modList.itemClicked.connect(self.modclicked)