File: aboutbox.py

package info (click to toggle)
gausssum 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 556 kB
  • sloc: python: 1,970; makefile: 22
file content (87 lines) | stat: -rw-r--r-- 3,188 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#
# GaussSum (http://gausssum.sf.net)
# Copyright (C) 2006-2015 Noel O'Boyle <baoilleach@gmail.com>
#
# This program is free software; you can redistribute and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.

from tkinter import *   # GUI stuff
import webbrowser
import tkinter.simpledialog
import traceback
import copy             # For deepcopy...until I find a better way of doing this

from cclib.parser import ADF, GAMESS, Gaussian
import os, sys
if hasattr(sys, "frozen"): # i.e. if using py2exe
    installlocation = os.path.dirname(sys.executable)
else:
    import gausssum
    installlocation = gausssum.__path__[0]

class AboutPopupBox(tkinter.simpledialog.Dialog):

    def __init__(self, parent, title = None): # Override (just to set the geometry!)

        Toplevel.__init__(self, parent)
        self.transient(parent)

        if title:
            self.title(title)

        self.parent = parent
        self.result = None
        body = Frame(self)
        self.initial_focus = self.body(body)
        body.pack(padx=5, pady=5)

        self.buttonbox()
        self.grab_set()

        if not self.initial_focus:
            self.initial_focus = self

        self.protocol("WM_DELETE_WINDOW", self.cancel)

        self.initial_focus.focus_set()
        self.wait_window(self)


    def body(self,master): # Override

        self.resizable(False,False)
        self.canvas2 = Canvas(master,width=340,height=260)
        self.canvas2.pack(side=TOP)

        self.photo2 = PhotoImage(file=os.path.join('/usr/share/gausssum',"mesh.gif"))
        self.item2 = self.canvas2.create_image(11,11,anchor=NW,image=self.photo2)

        Label(master,text="(c) 2006-2016 Noel O'Boyle").pack(side=TOP)
        Label(master,text="http://gausssum.sf.net").pack(side=TOP)
        Label(master,text="").pack(side=TOP) # Creates a bit of spacing at the bottom
        Label(master,text="Support GaussSum by citing:").pack(side=TOP)
        Label(master,text="N.M. O'Boyle, A.L. Tenderholt and K.M. Langner.",font=("Times",10,"bold")).pack(side=TOP)
        Label(master,text="J. Comp. Chem. 2008, 29, 839-845.",font=("Times",10,"bold")).pack(side=TOP)
        # Label(master,text="").pack(side=TOP) # Creates a bit of spacing at the bottom

        width, height = 354, 455
        x = (652-width)//2 + self.parent.winfo_rootx()
        y = (480-height)//2 + self.parent.winfo_rooty()
        self.geometry("%dx%d+%d+%d" % (width, height, x, y)) # Place it in the centre of the root window

    def openmybrowser(self): # New
        webbrowser.open("http://gausssum.sf.net")

    def buttonbox(self): # Override
        box = Frame(self)
        w = Button(box, text="OK", width=10, command=self.ok, default=ACTIVE)
        w.pack(side=LEFT, padx=5, pady=5)
        self.bind("<Return>", self.ok)
        box.pack()