AboutDlg.py
Go to the documentation of this file.
00001 ###############################################################################
00002 #
00003 #
00004 # Package:   RoadNarrows Hekateros Robotic Manipulator Package
00005 #
00006 # Link:      https://github.com/roadnarrows-robotics/hekateros
00007 #
00008 # ROS Node:  hek_*
00009 #
00010 # File:      AboutDlg.py
00011 #
00012 ## \file 
00013 ##
00014 ## $LastChangedDate$
00015 ## $Rev$
00016 ##
00017 ## \brief Hekateros about dialog.
00018 ##
00019 ## \author Daniel Packard (daniel@roadnarrows.com)
00020 ## \author Robin Knight (robin.knight@roadnarrows.com)
00021 ##  
00022 ## \par Copyright:
00023 ##   (C) 2013-2014.  RoadNarrows LLC.\n
00024 ##   (http://www.roadnarrows.com)\n
00025 ##   All Rights Reserved
00026 ##
00027 # @EulaBegin@
00028 # @EulaEnd@
00029 #
00030 ###############################################################################
00031 
00032 import sys
00033 import os
00034 import time
00035 
00036 from Tkinter import *
00037 from Tkconstants import *
00038 from tkFileDialog import *
00039 import tkFont
00040 
00041 import webbrowser
00042 
00043 from hekateros_control.Utils import *
00044 
00045 
00046 # ------------------------------------------------------------------------------
00047 # Class AboutDlg
00048 # ------------------------------------------------------------------------------
00049 
00050 #
00051 ## \brief Hekateros about dialog.
00052 ##
00053 class AboutDlg(Toplevel):
00054   #
00055   ## \brief Constructor.
00056   ##
00057   ## \param cnf     Configuration dictionary.
00058   ## \param kw      Keyword options.
00059   #
00060   def __init__(self, master=None, cnf={}, **kw):
00061     # initialize dialog data
00062     kw = self.initData(kw)
00063 
00064     Toplevel.__init__(self, master=master, cnf=cnf, **kw)
00065     self.title("About Hekateros")
00066 
00067     # create and show widgets
00068     self.createWidgets()
00069 
00070     # allows the enter button to fire either button's action
00071     self.m_bttnOk.bind('<KeyPress-Return>', func=self.close)
00072 
00073     # center the dialog over parent panel
00074     if master is not None:
00075       self.update_idletasks()
00076       x0 = master.winfo_rootx()
00077       y0 = master.winfo_rooty()
00078       xp = x0 + (master.winfo_width() - self.winfo_width()) / 2 - 8
00079       yp = y0 + (master.winfo_height() - self.winfo_height()) / 2 - 20
00080       glist = [self.winfo_width(), self.winfo_height(), xp, yp]
00081       #self.withdraw() # hide the dialog until position and size is set
00082       self.geometry('{0}x{1}+{2}+{3}'.format(*glist))
00083       #self.deiconify() # now show
00084 
00085     # start with ok button focused
00086     #self.m_bttnOk.focus_set()
00087 
00088     # allows us to customize what happens when the close button is pressed
00089     self.protocol("WM_DELETE_WINDOW", self.close)
00090 
00091     #
00092     # Modal diagle settings.
00093     #
00094     # set the focus on dialog window (needed on Windows)
00095     self.focus_set()
00096 
00097     # make sure events only go to our dialog
00098     self.grab_set()
00099 
00100     # make sure dialog stays on top of its parent window (if needed)
00101     self.transient(master)
00102 
00103     # display the window and wait for it to close
00104     self.wait_window(self)
00105 
00106   #
00107   ## \brief Initialize class state data.
00108   ##
00109   ## \param kw      Keyword options.
00110   ##
00111   ## \return Modified keywords sans this specific class.
00112   ##
00113   def initData(self, kw):
00114     self.m_icons          = {}    # must keep loaded icons referenced
00115     self.m_prodName       = "Hekateros"
00116     self.m_hwVer          = "1.0.0"
00117     self.m_prodId         = 0x00
00118     self.m_prodBrief      = "Hekateros Robotic Manipulator"
00119     self.m_rnUrl          = "http://www.roadnarrows.com/Hekateros"
00120     self.m_appVer         = "0.0.0"
00121     self.m_rnEmail        = "support@roadnarrows.com"
00122     self.m_rnTel          = "+1.800.275.9568"
00123     if kw.has_key('info'):
00124       info = kw['info']
00125       if info is not None:
00126         self.m_hwVer = info.version_string
00127         self.m_prodName = info.product_name
00128         self.m_prodId = info.product_id
00129         self.m_prodBrief = info.desc
00130       del kw['info']
00131     if kw.has_key('app_ver'):
00132       self.m_appVer = kw['app_ver']
00133       del kw['app_ver']
00134     return kw
00135 
00136   #
00137   ## \brief Create gui widgets with supporting data and show.
00138   #
00139   def createWidgets(self):
00140     imageLoader = ImageLoader(py_pkg="hekateros_control.images")
00141 
00142     frame = Frame(self)
00143     frame.grid(row=0, column=0)
00144 
00145     self.m_icons['pan_tilt_logo'] = imageLoader.load("HekaterosLogo.png")
00146 
00147     # top heading
00148     w = Label(frame)
00149     times32 = tkFont.Font(family="Times",size=32,weight="bold")
00150     w['font']   = times32
00151     w['text']   = 'Hekateros'
00152     w['anchor'] = W
00153     w.grid(row=0, column=1, columnspan=2, sticky=E+W)
00154 
00155     bg      = w['bg']
00156     lwidth  = 10
00157     rwidth  = 26
00158 
00159     row = 1
00160 
00161     # product brief
00162     w = Text(frame)
00163     w['wrap']   = WORD
00164     w['width']  = lwidth + rwidth + 5
00165     w['height']  = 3
00166     w['relief']  = 'flat'
00167     w['bg']  = bg
00168     w.insert(END, self.m_prodBrief)
00169     w['state']  = 'disabled'
00170     w.grid(row=row, column=1, columnspan=2, padx=2, sticky=W)
00171 
00172     row += 1
00173 
00174     # product name
00175     w = Label(frame)
00176     w['text']   = 'Product:'
00177     w['anchor'] = W
00178     w['width'] = lwidth
00179     w.grid(row=row, column=1, padx=2, sticky=W)
00180 
00181     w = Label(frame)
00182     w['text']   = self.m_prodName
00183     w['anchor'] = W
00184     w['width']  = rwidth
00185     w.grid(row=row, column=2, padx=2, sticky=W)
00186 
00187     row += 1
00188 
00189     # product id
00190     w = Label(frame)
00191     w['text']   = 'Product Id:'
00192     w['anchor'] = W
00193     w['width'] = lwidth
00194     w.grid(row=row, column=1, padx=2, sticky=W)
00195 
00196     w = Label(frame)
00197     w['text']   = "%08x" % (self.m_prodId)
00198     w['anchor'] = W
00199     w['width']  = rwidth
00200     w.grid(row=row, column=2, padx=2, sticky=W)
00201 
00202     row += 1
00203 
00204     # hw version
00205     w = Label(frame)
00206     w['text']   = 'HW Version:'
00207     w['anchor'] = W
00208     w['width'] = lwidth
00209     w.grid(row=row, column=1, padx=2, sticky=W)
00210 
00211     w = Label(frame)
00212     w['text']   = self.m_hwVer
00213     w['anchor'] = W
00214     w['width']  = rwidth
00215     w.grid(row=row, column=2, padx=2, sticky=W)
00216 
00217     row += 1
00218 
00219     # app version
00220     w = Label(frame)
00221     w['text']   = 'App Version:'
00222     w['anchor'] = W
00223     w['width'] = lwidth
00224     w.grid(row=row, column=1, padx=2, sticky=W)
00225 
00226     w = Label(frame)
00227     w['text']   = self.m_appVer
00228     w['anchor'] = W
00229     w['width']  = rwidth
00230     w.grid(row=row, column=2, padx=2, sticky=W)
00231 
00232     row += 1
00233 
00234     # url
00235     w = Label(frame)
00236     w['text']   = 'URL:'
00237     w['anchor'] = W
00238     w['width'] = lwidth
00239     w.grid(row=row, column=1, padx=2, sticky=W)
00240 
00241     w = Button(frame)
00242     w['text']   = 'www.roadnarrows.com/'
00243     w['fg']   = '#aa0000'
00244     w['activeforeground']   = '#cc0033'
00245     w['activebackground']   = w['bg']
00246     w['cursor'] = 'hand1'
00247     w['anchor'] = W
00248     w['justify'] = LEFT
00249     w['relief']   = 'flat'
00250     w['borderwidth']   = 0
00251     w['padx']   = 0
00252     w['pady']   = 0
00253     w['width']  = rwidth
00254     w['command']  = lambda aurl=self.m_rnUrl:webbrowser.open_new(self.m_rnUrl)
00255     w.grid(row=row, column=2, ipadx=0, ipady=0, padx=2, pady=0, sticky=W)
00256 
00257     row += 1
00258 
00259     # support email
00260     w = Label(frame)
00261     w['text']   = 'Email:'
00262     w['anchor'] = W
00263     w['width'] = lwidth
00264     w.grid(row=row, column=1, padx=2, sticky=W)
00265 
00266     w = Label(frame)
00267     w['text']   = self.m_rnEmail
00268     w['anchor'] = W
00269     w['width']  = rwidth
00270     w.grid(row=row, column=2, padx=2, sticky=W)
00271 
00272     row += 1
00273 
00274     # telephone
00275     w = Label(frame)
00276     w['text']   = 'Tel:'
00277     w['anchor'] = W
00278     w['width'] = lwidth
00279     w.grid(row=row, column=1, padx=2, sticky=W)
00280 
00281     w = Label(frame)
00282     w['text']   = self.m_rnTel
00283     w['anchor'] = W
00284     w['width']  = rwidth
00285     w.grid(row=row, column=2, padx=2, sticky=W)
00286 
00287     row += 1
00288 
00289     # product logo
00290     w = Label(frame)
00291     if self.m_icons['pan_tilt_logo'] is not None:
00292       w['image']  = self.m_icons['pan_tilt_logo']
00293     w['anchor'] = CENTER
00294     w.grid(row=0, column=0, rowspan=row, sticky=W+N+S)
00295 
00296     # who
00297     w = Label(frame)
00298     w['text']   = """
00299 Hekateros is designed and developed by RoadNarrows, a robotics and intelligent systems
00300 company base in Colorado USA. We are dedictated to supporting open software and
00301 hardware interfaces to foster a global community of users and developers."""
00302     w['justify'] = CENTER
00303     w['anchor'] = CENTER
00304     w.grid(row=row, column=0, columnspan=3, padx=5, sticky=W)
00305 
00306     row += 1
00307 
00308     # ok button
00309     w = Button(frame, width=10, text='OK', command=self.close)
00310     w.grid(row=row, column=0, columnspan=3, pady=5)
00311     w['anchor']  = CENTER
00312     self.m_bttnOk = w
00313 
00314     row += 1
00315 
00316     # legal
00317     w = Label(frame)
00318     helv8 = tkFont.Font(family="Helvetica",size=8)
00319     w['font']   = helv8
00320     w['anchor'] = W
00321     w['fg']     = '#666666'
00322     w['text']   = "Hekateros and the Hekateros logos are the trademarks of " \
00323                   "RoadNarrows LLC"
00324     w.grid(row=row, column=0, columnspan=3, pady=5)
00325 
00326   #
00327   ## \brief Destroy window callback.
00328   #
00329   def close(self):
00330     self.destroy()


hekateros_control
Author(s): Robin Knight , Daniel Packard
autogenerated on Mon Oct 6 2014 00:36:42