00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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
00048
00049
00050
00051
00052
00053 class AboutDlg(Toplevel):
00054
00055
00056
00057
00058
00059
00060 def __init__(self, master=None, cnf={}, **kw):
00061
00062 kw = self.initData(kw)
00063
00064 Toplevel.__init__(self, master=master, cnf=cnf, **kw)
00065 self.title("About Hekateros")
00066
00067
00068 self.createWidgets()
00069
00070
00071 self.m_bttnOk.bind('<KeyPress-Return>', func=self.close)
00072
00073
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
00082 self.geometry('{0}x{1}+{2}+{3}'.format(*glist))
00083
00084
00085
00086
00087
00088
00089 self.protocol("WM_DELETE_WINDOW", self.close)
00090
00091
00092
00093
00094
00095 self.focus_set()
00096
00097
00098 self.grab_set()
00099
00100
00101 self.transient(master)
00102
00103
00104 self.wait_window(self)
00105
00106
00107
00108
00109
00110
00111
00112
00113 def initData(self, kw):
00114 self.m_icons = {}
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
00328
00329 def close(self):
00330 self.destroy()