Exemple #1
0
    def __init__(self, releases):
        tk.Toplevel.__init__(self)
        self.releases = releases
        self.wm_attributes("-topmost", True)
        self.wm_title("PELD Update Notification")

        try:
            self.iconbitmap(sys._MEIPASS + '\\app.ico')
        except Exception:
            try:
                self.iconbitmap("app.ico")
            except Exception:
                pass

        self.columnconfigure(0, weight=1)
        self.rowconfigure(3, weight=1)

        self.geometry("+%s+%s" %
                      (settings.getWindowX(), settings.getWindowY()))
        self.geometry("350x300")
        self.update_idletasks()

        windowHeader = tk.Label(self, text="Update Available")
        font = tkFont.Font(font=windowHeader['font'])
        font.config(size='16', weight='bold')
        windowHeader['font'] = font
        windowHeader.grid(row="0", column="0", columnspan="10")

        newVersionHeader = tk.Label(self, text=releases[0]['name'])
        font = tkFont.Font(font=newVersionHeader['font'])
        font.config(size='14', weight='bold')
        newVersionHeader['font'] = font
        newVersionHeader.grid(row="1", column="0", columnspan="10")

        oldVersionHeader = tk.Label(self,
                                    text="(current version: " +
                                    version.version + ")")
        font = tkFont.Font(font=oldVersionHeader['font'])
        font.config(slant='italic')
        oldVersionHeader['font'] = font
        oldVersionHeader.grid(row="2", column="0", columnspan="10")

        releaseNotesFrame = tk.Frame(self, padx="5")
        releaseNotesFrame.columnconfigure(0, weight=1)
        releaseNotesFrame.rowconfigure(0, weight=1)
        releaseNotesFrame.grid(row="3", column="0", columnspan="10")
        releaseNotes = tk.Text(releaseNotesFrame)
        for release in releases:
            if release['name'] != version.version.split('-')[0]:
                releaseNotes.insert(tk.END,
                                    'Version ' + release['name'] + ":\n")
                releaseNotes.insert(tk.END, release['body'] + "\n\n\n")
            else:
                break
        releaseNotes.config(state=tk.DISABLED, wrap='word')
        releaseNotes.grid(row="0", column="0")
        scrollbar = tk.Scrollbar(releaseNotesFrame, command=releaseNotes.yview)
        scrollbar.grid(row="0", column="1", sticky='nsew')
        releaseNotes['yscrollcommand'] = scrollbar.set

        tk.Frame(self, height="5", width="1").grid(row="4", column="0")

        checkboxValue = tk.IntVar()
        checkboxValue.set(0)
        self.reminderCheckbox = tk.Checkbutton(
            self,
            text="Don't remind me about this release again",
            variable=checkboxValue)
        self.reminderCheckbox.var = checkboxValue
        self.reminderCheckbox.grid(row="5",
                                   column="0",
                                   columnspan="10",
                                   sticky="w")

        tk.Frame(self, height="5", width="1").grid(row="6", column="0")

        buttonFrame = tk.Frame(self)
        buttonFrame.columnconfigure(0, weight=1)
        buttonFrame.grid(row="100", column="0", columnspan="10")
        cancelButton = tk.Button(buttonFrame,
                                 text="Download",
                                 command=self.downloadAction,
                                 padx="10")
        cancelButton.grid(row="0", column="0")
        tk.Frame(buttonFrame, height="1", width="120").grid(row="0",
                                                            column="1")
        cancelButton = tk.Button(buttonFrame,
                                 text="OK",
                                 command=self.okAction,
                                 padx="15")
        cancelButton.grid(row="0", column="2")

        tk.Frame(self, height="10", width="1").grid(row="101", column="0")
Exemple #2
0
    def __init__(self):
        tk.Tk.__init__(self)
        self.baseWindow = BaseWindow(self)
        self.minsize(175, 50)

        # Set title and icon for alt+tab and taskbar
        self.wm_title("PyEveLiveDPS Main Window")
        try:
            self.iconbitmap(sys._MEIPASS + '\\app.ico')
        except Exception:
            try:
                self.iconbitmap("app.ico")
            except Exception:
                pass

        self.addToTaskbar()

        # label that appears at the top of the window in special modes like simulation and playback modes
        self.topLabel = tk.Label(self,
                                 text="模拟模式",
                                 fg="white",
                                 background="black")
        font = tkFont.Font(font=self.topLabel['font'])
        font.config(slant='italic')
        self.topLabel['font'] = font
        self.topLabel.grid(row="5", column="5", columnspan="8")
        self.topLabel.grid_remove()
        self.makeDraggable(self.topLabel)

        # Other items for setting up the window
        self.addQuitButton()
        self.addCollapseButton(self, row="5", column="17")
        tk.Frame(self, height=1, width=5, background="black").grid(row="5",
                                                                   column="16")
        self.addMinimizeButton(self, row="5", column="15")

        self.addMenus()

        # Container for our "dps labels" and graph
        self.middleFrame = tk.Frame(self, background="black")
        self.middleFrame.columnconfigure(0, weight=1)
        self.middleFrame.rowconfigure(1, weight=1)
        self.middleFrame.grid(row="10",
                              column="1",
                              columnspan="19",
                              sticky="news")
        self.makeDraggable(self.middleFrame)
        self.middleFrame.bind("<Map>", self.showEvent)
        self.protocol("WM_TAKE_FOCUS", lambda: self.showEvent(None))

        self.labelHandler = labelHandler.LabelHandler(self.middleFrame,
                                                      background="black")
        self.labelHandler.grid(row="0", column="0", sticky="news")
        self.makeDraggable(self.labelHandler)

        # set the window size and position from the settings
        self.geometry("%sx%s+%s+%s" %
                      (settings.getWindowWidth(), settings.getWindowHeight(),
                       settings.getWindowX(), settings.getWindowY()))
        self.update_idletasks()

        # The hero of our app
        self.graphFrame = graph.DPSGraph(self.middleFrame,
                                         background="black",
                                         borderwidth="0")
        self.graphFrame.grid(row="1",
                             column="0",
                             columnspan="3",
                             sticky="nesw")
        self.makeDraggable(self.graphFrame.canvas.get_tk_widget())

        # details window is a child of the main window, but the window will be hidden based on the profile settings
        self.detailsWindow = DetailsWindow(self)

        self.fleetWindow = FleetWindow(self)

        # the animator is the main 'loop' of the program
        self.animator = animate.Animator(self)
        self.bind('<<ChangeSettings>>',
                  lambda e: self.animator.changeSettings())

        self.graphFrame.readjust(0)
        if settings.getGraphDisabled():
            self.graphFrame.grid_remove()
        else:
            self.graphFrame.grid()

        self.labelHandler.lift(self.graphFrame)
        self.makeAllChildrenDraggable(self.labelHandler)

        logging.info('main window (and subcomponents) initialized')