Exemple #1
0
    def __init__(self, root, game, config, serviceLocator):
        self.game = game
        self.columnSpan = 4
        self.currentRow = 0
        self.root = root
        self.window = tk.Toplevel(root, bg=Color.darkBackground)
        self.window.title("Game Launcher " + game)
        self.window.geometry("460x470")
        self.window.resizable(0, 0)
        config.setValue("appName", game)
        self.config = config
        self.serviceLocator = serviceLocator
        self.runner = RunnerFactory.getRunner(self.config)
        try:
            appTitle = config.getValue(["title"])
        except:
            appTitle = game

        gameName = Label(self.window, text=appTitle)
        Color.paintDark(gameName)
        self._addWidgetFullWidth(gameName)
        gameName.config(font=("Impact", 20))
        try:
            self.window.gameImage = getImageOrException(game)
            panel = tk.Label(self.window, image = self.window.gameImage)
        except AssetException:
            invisiblePixel = tk.PhotoImage(width=460, height=1)
            self.window.gameImage = invisiblePixel
            panel = tk.Label(self.window, image = self.window.gameImage)
        Color.paint(panel)
        panel.grid(column=0,row=self.currentRow, sticky='ns', columnspan=self.columnSpan)
        self.currentRow += 1

        try:
            appDescription = config.getValue(["description"])
            gameDescription = Label(self.window, heigh=5, text=appDescription)
            Color.paintBox(gameDescription)
            gameDescription.config(relief='flat', borderwidth=20)
            self._addWidgetFullWidth(gameDescription)
        except:
            pass
        self._createPlayButton()
        self._createTopBarButtons(self.window, game, config.getData())

        try:
            appTitle = config.getValue(["mods"])
            self._createModSelector(self.window, config.getData())
            self.currentRow += 1
        except:
            self._createEmptyModSelector(self.window, config.getData())
            self.currentRow += 1
        self.currentRow += 1
        self._createFooterButtons(self.window)
        self.currentRow += 1
Exemple #2
0
 def _createButtons(self, root, game, data):
     if "linux-tweaks" in data:
         detailData = data['linux-tweaks']
         for index, content in enumerate(detailData):
             if "title" in detailData[content]:
                 spaceItem = Label(self.window)
                 spaceItem.config(font=("Impact", 15))
                 Color.paint(spaceItem)
                 self._addWidget(spaceItem)
                 itemTitle = Label(self.window,
                                   text=detailData[content]["title"])
                 Color.paint(itemTitle)
                 itemTitle.config(font=("Impact", 15))
                 self._addWidget(itemTitle)
             runFunction = getRunFunction(game, detailData[content])
             button = tk.Button(self.window,
                                text=content,
                                command=runFunction)
             removeBorders(button)
             Style.styleButton(button)
             self._addWidget(button)
             if "description" in detailData[content]:
                 itemDescription = Label(
                     self.window, text=detailData[content]["description"])
                 Color.paint(itemDescription)
                 self._addWidget(itemDescription)