Example #1
0
 def _createFooterButtons(self, root):
     modLabel = Label(self.window)
     removeBorders(modLabel)
     Color.paintDark(modLabel)
     modLabel.grid(column=0,row=self.currentRow, sticky='nswe', columnspan=4)
     self.currentRow += 1
     button = tk.Button(self.window, text="Savegame Config")
     removeBorders(button)
     Color.paintDark(button)
     button.grid(column=0,row=self.currentRow, sticky='sw')
     if self.config.hasValue("linux-tweaks"):
         linuxTweaks = lambda: SettingWindow(self.window, self.game, self.config)
         button = tk.Button(self.window, text="Linux Tweaks", command=linuxTweaks)
     else:
         button = tk.Button(self.window, text="Linux Tweaks")
     removeBorders(button)
     Color.paintDark(button)
     button.grid(column=1,row=self.currentRow, sticky='sw')
     button = tk.Button(self.window, text="Game Tools")
     removeBorders(button)
     Color.paintDark(button)
     button.grid(column=2,row=self.currentRow, sticky='sw')
     button = tk.Button(self.window, text="Game Info")
     removeBorders(button)
     Color.paintDark(button)
     button.grid(column=3,row=self.currentRow, sticky='sw')
Example #2
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
Example #3
0
def createButton(root, game, data):
    runFunction = getRunFunction(game, data)
    try:
        gameImage = getImageOrException(game)
        gameButton = tk.Button(root,
                               text=game,
                               image=gameImage,
                               command=runFunction)
        removeBorders(gameButton)
        Color.paintDark(gameButton)
        gameButton.image = gameImage
    except AssetException:
        gameButton = createButtonWithoutImage(root, game, data)
    return gameButton
Example #4
0
 def _createModSelector(self, root, data):
     modLabel = Label(self.window)
     removeBorders(modLabel)
     Color.paintDark(modLabel)
     modLabel.grid(column=3,row=self.currentRow, sticky='nswe', columnspan=1)
     variable = StringVar(self.window)
     variable.set("Standard") # default value
     options = self.config.getValue(["mods"])
     option = OptionMenu(self.window, variable, *options , command=self.modSelected)
     option.config(relief='flat')
     removeBorders(option)
     Color.paintDark(option)
     Color.paintDark(option["menu"])
     option.grid(column=1,row=self.currentRow, sticky='nsw', columnspan=2)
Example #5
0
    def createMenu(self, menuData):
        menubar = Menu(self.root, relief='flat')
        Color.paintDark(menubar)
        filemenu = Menu(menubar, tearoff=0, relief='flat')
        Color.paintDark(filemenu)
        helpmenu = Menu(menubar, tearoff=0, relief='flat')
        Color.paintDark(helpmenu)
        for index, content in enumerate(menuData):
            menuRunFunction = self.getMenuRunFunction("./", menuData[content])
            filemenu.add_command(label=content, command=menuRunFunction)

        filemenu.add_command(label="Quit", command=self.root.destroy)
        helpmenu.add_command(label="About", command=self.showAbout)
        menubar.add_cascade(label="File", menu=filemenu)
        menubar.add_cascade(label="Help", menu=helpmenu)
        menubar.add_command(label="System", command=self.showSystem)
        self.root.config(menu=menubar)
Example #6
0
 def _createEmptyModSelector(self, root, data):
     modLabel = Label(self.window)
     removeBorders(modLabel)
     Color.paintDark(modLabel)
     modLabel.grid(column=1,row=self.currentRow, sticky='nswe', columnspan=4)