Package nMOLDYN :: Package GUI :: Module GeneralInformationsDialog |
[hide private]
[frames] | no frames]

# Source Code for Module nMOLDYN.GUI.GeneralInformationsDialog

      1  # -*- coding: iso-8859-1 -*-
      2  """This modules implements I{Help-->About nMOLDYN} dialog.
      3
      4  Classes:
      5      * CheckJobsStatusDialog: creates I{Help-->About nMOLDYN} dialog used to
      6      display some general informations about nMOLDYN.
      7  """
      8
      9  import os
     10  import webbrowser
     11
     12  # The Tcl/Tk modules
     13  from Tkinter import *
     14
     15  # Package path
     16  nmoldyn_package_path = os.path.dirname(os.path.split(__file__)[0])
     17
     18  # Some global variables used for the 'about nMOLDYN' generation.
     19  aboutAuthors = """
     20  nMOLDYN program v3.0 written by:\n
     21  Eric Pellegrini (email: pellegrini@ill.fr)\n\n
     22
     23  nMOLDYN project supervisors:\n
     24  Gerald Kneller (email: kneller@cnrs-orleans.fr)
     25  Konrad Hinsen (email: hinsen@cnrs-orleans.fr)
     26  """
     27
     28  aboutHistory = """
     29               HISTORY
     30
     31               30.06.1999 nMOLDYN v0.5
     32               Tomasz Róg releases the first version of
     33               the program. nMoldyn has fully functional
     34               * scattering functions * and routines for
     35               calculation (auto)correlation functions.
     36               It also have a simple GUI. * Dynamics *
     37               menu partially works (there are
     38               problems with RCF and AVACF, MSD and DOS.
     39               Routines in * Results * menu work and is
     40               almost complete. Atom selection is very
     41               primitive yet, group selection does not exist.
     42
     43
     44               01.12.2000 nMOLDYN v1.2
     45               Krzysztof Murzyn works on the existing code,
     46               brushing it up and patching in a few places.
     47               The code is rewritten to form a Python site
     48               package and it is organised in a bunch of
     49               modules. The functions of crucial importance
     50               are grouped in * nMoldyn.core * module,
     51               auxilliary functions and classes in
     52               * nMoldyn.calc * and so on ... (for a full
     53               description see the program documentation).
     54               In * Dynamics * menu, AVACF and RCF are now
     55               fully functional. Konrad Hinsen fixes a bug
     56               in MSD. Basic changes and new features in
     57               this version:
     58               (1) rewritten GUI (xMoldyn program),
     59               (2) a new way to run calculation handled by
     60               pMoldyn program (command line switches..),
     61               input files are now Python programs
     62               executed in the nMoldyn environment,
     63               (3) flexible and powerful group and atom
     64               selection (including PDB files processing
     65               (reference structure, selection), graphical
     66               interface, selection via external user
     67               defined Python program),
     68               (4) parallelism of a few functions
     69               (thanks to Konrad)
     70               (5) new core functions: SAVACF, MPCF, DF, AT,
     71               RBT, FT (for abreviations see program
     72               documentation) and lots of a new code in
     73               nMoldyn.calc and nMoldyn.misc modules
     74               12.08.2001 nMOLDYN v1.3
     75               A few buglets were fixed. A GUI was slightly
     76               reorgenized. Many minor improvements...
     77               12.12.2005 nMOLDYN v2.2.6
     78               Paolo Calligari rewrote all modules previously
     79               contained in core.py, calc.py in a more library-like
     80               style. He adds more methods in calculation for Scattering
     81               Functions: Anisotropic, Isotropic and Explicit List
     82               cases. DLPOLY open trajectory tool added in FileMenu.
     83               01.01.2008 nMOLDYN v2.2.7
     84               Eric Pellegrini rewrote all modules previously
     85               contained in core.py, calc.py
     86               with a special care for commenting the code and deriving
     87               a technical note.
     88               01.07.2008 nMOLDYN v3.0.0
     89               Brand new GUI.
     90               Some new functionalities such as:
     91                   - partial CSF, ISF
     92                   - static structure factor
     93                   - pair distribution function
     94                   - center of mass trajectory
     95                   - quasi-harmonic analysis
     96                   - rigid-body filtered trajectory
     97                   - configuration file editor
     98                   - scattering file conversion
     99               New plotting engine.
    100  """
    101
    102  logo = """\
    103  R0lGODlheABTAMYAABoabI6OjFJWlL7K1KaytEJCRG52fLK+zHqCrCYqfEpKTJKevGZqbHZ6hKq2
    104  vDY6hL6+vJqmvB4idC4yfD5ChF5eXEZKjF5mnP7+/LrGzIKKrHJ6pE5SjGZunI6WtMbS3KKuxKam
    105  pFZelMbO3GpypLrC1LK6zCYmdDY2hEZGjHp+rKqyxF5inBoedMLO1LbCzIKGrC4ufJqivK66zD4+
    106  hJ6qxDI2fEJGjE5OjGZqnHZ+rFpinHJ2pIaOtH6GrCoufJaivKq2zDo+hL7G1J6mvCImdEJChEpO
    107  jGJqnIaKtHZ6pFJSlGpupJKavKayxFpelG52pBoadFZalMLK1La+zH6CrCoqfJaevH5+fDo6hCIi
    108  dDIyfEpKjGJmnLrG1IKKtE5SlGZupI6WvKauxKKqxG5ypCYmfKqyzB4edMLO3LbC1DI2hIqStK62
    109  zMbGxJ6mxEJCjHZ6rFpenP///////////////////////////////////////////////////yH+
    110  Dk1hZGUgd2l0aCBHSU1QACwAAAAAeABTAAAH/oAYgoOEhYaHiImKi4yNjo+QkZKTlJWWl5iZmo1u
    111  IZ6foKGio6SlpqeoqaqibocKBg2xsrO0tba3uLm6u7y9swwVri8fxMXGx8jJysvMzc7P0MYOwYYK
    112  w8ku2drb3N3e397R4uPM064Z2x/a5OzILurw7/Lx9PP29fj3+sQjBNSFCjIUezcQXDqDCLvlW7iv
    113  IcOH2YiZq4aO2DqCzjC2MxZxo8dnK/4RCghvoLqEFhOqNPmx2YABGRz00EBCh0ZlEwEK3JfxZruI
    114  DoNCVKdhh5AJLQAoVTrsXsoP/oQRnHrSW4erV5lgxepEpYsIV0lgJSFWrA+haOEN2LI0ylKm/vU6
    115  ShQ5iCS9ku7eun2rFAk0AXwD22hZEAGSH3uj7BW47F3Ic1SBdkuTJozRpIozu43hJeEBK0r3vrXA
    116  AgFhkyOaKA4Nt1nOkTvFjRgARvTbFguc6QCwmnfosybT8jwGArNbt7E5zntMUaM9yXjZ+D6+VMDT
    117  ePJutPXNm4zFoUH1jdHC2m3TdMde12VMFW9kYl8UY+bt9seMqfPUOZEQpQV1t1qAgNdHNxW32l7X
    118  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"""
    173
    174 -class GeneralInformationsDialog(Toplevel):
    175      """Sets up a dialog used to visualize some general informations about NMOLDYN.
    176      """
    177
    178 -    def __init__(self, parent, title = None):
    179          """The constructor.
    180
    181          @param parent: the parent widget.
    182
    183          @param title: a string specifying the title of the dialog.
    184          @type title: string
    185          """
    186
    187          Toplevel.__init__(self, parent)
    188          self.transient(parent)
    189
    190          if title:
    191              self.title(title)
    192
    193          self.parent = parent
    194
    195          body = Frame(self)
    196          self.initial_focus = self.body(body)
    197          body.grid(row = 0, column = 0, sticky = EW)
    198
    199          self.buttonbox()
    200
    201          self.grab_set()
    202
    203          if not self.initial_focus:
    204              self.initial_focus = self
    205
    206          self.protocol("WM_DELETE_WINDOW", self.cancel)
    207
    208          self.resizable(width = NO, height = NO)
    209
    210          self.geometry("+%d+%d" % (parent.winfo_rootx()+50, parent.winfo_rooty()+50))
    211
    212          self.initial_focus.focus_set()
    213
    214          self.wait_window(self)
    215
    216 -    def body(self, master):
    217          """
    218          Create dialog body. Return widget that should have initial focus.
    219          """
    220
    221          # The logo 'nMOLDYN'.
    222          self.nMOLDYNLogo = PhotoImage(data = logo)
    223
    224          # The logo 'WingIDE'.
    225          self.wingIDELogo = PhotoImage(file = os.path.join(nmoldyn_package_path,'GUI', 'Images', 'coded_w_wing_medium.gif'))
    226
    227          leftFrame = Frame(master)
    228          leftFrame.grid(row = 0, column = 0, padx = 10, sticky = NS)
    229          Label(leftFrame, image = self.nMOLDYNLogo).grid(row = 0, column = 0, pady = 10, sticky = N)
    230          Label(leftFrame, image = self.wingIDELogo).grid(row = 1, column = 0, pady = 10, sticky = N)
    231
    232          rightFrame = Frame(master, relief = GROOVE, bd = 2)
    233          rightFrame.grid(row = 0, column = 1)
    234          Label(rightFrame, text = aboutAuthors, justify = 'left').grid(row = 0, column = 0)
    235          Button(rightFrame, text = 'Visit nMOLDYN Homepage', width = 25, command = lambda : self.homepage('nMOLDYN')).grid(row = 1, column = 0)
    236          Button(rightFrame, text = 'Visit MMTK Homepage', width = 25, command = lambda : self.homepage('MMTK')).grid(row = 2, column = 0)
    237
    238          return None
    239
    240 -    def buttonbox(self):
    241          """
    242          Add standard button box.
    243          """
    244
    245          # The frame that contains the 'Cancel' and 'OK' buttons.
    246          box = LabelFrame(self, text = 'Actions', bd = 2, relief = GROOVE)
    247          box.grid(row = 1, column = 0, sticky = EW, padx = 3, pady = 3)
    248          box.grid_columnconfigure(0, weight = 1)
    249
    250          w = Button(box, text = "Cancel", width=10, command = self.cancel)
    251          w.grid(row = 0, column = 0, sticky = E)
    252          w = Button(box, text = "OK", width=10, command = self.ok, default=ACTIVE)
    253          w.grid(row = 0, column = 1, sticky = E)
    254
    255          self.bind("<Return>", self.ok)
    256          self.bind("<Escape>", self.cancel)
    257
    258      # Standard button semantics.
    259 -    def ok(self, event = None):
    260
    261          if not self.validate():
    262              self.initial_focus.focus_set()
    263              return
    264
    265          self.withdraw()
    266          self.update_idletasks()
    267
    268          self.apply()
    269
    270          self.cancel()
    271
    272 -    def cancel(self, event=None):
    273
    274          # Put focus back to the parent window
    275          self.parent.focus_set()
    276          self.destroy()
    277
    278      # Command hooks
    279 -    def validate(self):
    280          return True
    281
    282 -    def apply(self):
    283          pass
    284
    285 -    def homepage(self, website):
    286
    287          if website == 'nMOLDYN':
    288              webbrowser.open('http://dirac.cnrs-orleans.fr/plone/software/nmoldyn/')
    289
    290          elif website == 'MMTK':
    291              webbrowser.open('http://dirac.cnrs-orleans.fr/MMTK')
    292