m DMc@sdZdkZdkZdkZdkZdkZdkZdkZdkZdk Z dk Z dk Z dk Z dk lZdklZlZdklZy,dkZdkZdkZdklZWnnXyeWnej o eZnXdZdZedd Z e i!i"Z#e i$d eee#fZ%ei&d d d ddgj o'dZ'e'ei&Z'ei(i)e'ne i*dZ+de,fdYZ-dZ.dZ/dZ0de,fdYZ1dZ2e3dZ4dS(s This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) The widget is called from web2py. N(sw2p_pack(srunstest(sglobal_settings(sweb2py_windows_service_handlersweb2py Enterprise Web Frameworks1Created by Massimo Di Pierro, Copyright 2007-2011tVERSIONtrs*%s %s %sis2.4s2.5s2.6s2.7sZWarning: web2py requires Python 2.4, 2.5 (recommended), 2.6 or 2.7 but you are running: %stweb2pytIOcBs tZdZdZdZRS(s cCsti|_dS(s N(t cStringIOtStringIOtselftbuffer(R((t6/home/camdpams_www/Products_Activation/gluon/widget.pyt__init__?scCsEtii|t|do|i|n|ii|dS(s tcallbackN(tsyst __stdout__twritetdatathasattrRR R(RR((RR Ds (t__name__t __module__t__doc__R R (((RR<s  cCs-ydk}|i|Wn dGHnXdS(s" Try to start the default browser Ns&warning: unable to detect your browser(t webbrowsertopenturl(RR((Rttry_start_browserNs  cCs1dGHd||fGHdGHtd||fdS(s Starts the default browser s please visit:s http://%s:%ssstarting browser...s http://%s:%sN(tiptportR(RR((Rt start_browserXs cs|i|i}|i}ti|dd}|i ddd|dd|ddf|i d |i ti |d dd dd di|itid d}tid|d ddd}|idddddd||_dddd d}|didd|tdddi|ti|ti|itid|id S(!s Draw the splash screen tbgtwhites %ix%i+%i+%iii,iiiit backgroundtwidththeighttfilessplashlogo.giftimagetbditsidettoptfilltbothtexpandtyess Change Mei s#195866csCtidddd|d|dd|fdtid |d d S( NtmasterRiRttexttfontt Helveticatanchort foregroundRR(tTkintertLabeltcanvasRR)t font_sizetCENTERR-(R)R1R-R(R0(Rt add_label{s   s Welcome to...is#FF5C1FiN(troottwithdrawtwinfo_screenwidthtdxtwinfo_screenheighttdyR.tTopleveltdialogtgeometrytoverrideredirectt focus_forcetCanvasR0tpacktupdatet PhotoImagetimgR/tpnlR R3t ProgramNamet ProgramAuthortProgramVersionttimetsleeptdestroy(R4R0R7RCRDR;R9R3((R0Rt presentation`s6   -      !     t web2pyDialogcBsbtZdZdZdZdZdZedZdZ dZ dZ d Z RS( s Main window dialog c s|idti|_|_tii_tiidd}t i i ii dd}|iddd||idd t idiiidd d |tiidd_iidd d itiidd}d }|iddd|d}|iddd|iiddd |iid i|ioiiddniiditi}tiidddtiiddddd|tii_iiti iiiiddddd|tiidddtiiddddd|tii_!i!iti ii"i!iddddd|tiidddtiiddddd|tiidd_#i#i$d d!i#i%i#iddddd|ti&id"d#d$d%d&d'_'i'idd(ddd)di'i(d*i)ti*i}|idd+ddd)dti,|dd,di-_.i.iddddti,|dd-di/_0i0iddddi0i1d.d/|ioat2i3i4_5i6|i#d0jo1i#id|i#i-ii7qn d1_5d1S(2s web2pyDialog constructor s web2py serverttearoffishttpserver.logcs tS(N(Rthttplog((RN(RtstlabelsView httpserver.logtcommands Quit (pid:%i)tServertmenutPagescCs tdS(Nshttp://www.web2py.com(R(((RROss Home PagecCstidtS(Ns About web2py(t tkMessageBoxtshowinfot ProgramInfo(((RROstAbouttInfotWM_DELETE_WINDOWcs itS(N(RtquittTrue((R(RROsR)s Server IP:tjustifytrowtcolumntstickyis Server Port:sChoose Password:itshowt*scs iS(N(Rtstart(te(R(RROsRi,RidRtblackit columnspaniis start servers stop servertstatetdisabledsN(9R4ttitleR.R:RtoptionstMenuRSt servermenutostpathtjointfolderRNtitemt add_commandtgetpidR[t add_cascadet pagesmenuthelpmenutconfigttaskbartprotocoltNWR`R/tLEFTtgridtEntryRtinserttENDt port_numberRtpasswordtbindR>R?R0taftert update_canvastFrametframetButtonRct button_starttstopt button_stopt configuretcontribttaskbar_widgett TaskBarIconttbt checkTaskBarR5tNone( RR4RjRNRlR`RqRvR((RRNRR s                            cCsR|iio+|iid|iiijo|in|iid|iiijo8|iidjo|ii q'|ii n|iid|iii jo|i ng|iid|iii jo|in9|iid|iiijo|i |in|iid=n|iid|idS(s Check taskbar status it withdrawniN(RRtstatust EnumStatustQUITR[tTOGGLER4Rgt deiconifyR5tSTOPRtSTARTRctRESTARTRR(R((RR s"       cCsKy=|iidd|iid||iiddWnnXdS(s Update app text RgtnormaltendRhN(RR)RR~(RR)((RRA!scCsoxhtidD]W}tiid|o:|id|}|d}|ii d|d|qqWdS(s Connect pages s applications/sapplications/%s/__init__.pyt/cCs t|S(N(Rtu(R((RRO1sRPRQN( RmtlistdirtarqRntexistsRRRRuRr(RRRR((Rt connect_pages+s cCsi|o|iinNy|iiWnnXy|iiWnnX|iit i dS(s Finish the program execution N( tjustHideRR4R5tserverRRtDestroyRJR texit(RR((RR[5s cCstid|dS(s Show error message sweb2py start serverN(RUt showerrortmessage(RR((RterrorHscCsQ|ii}|p|idn|ii}d}|o+ti|i| o|idSnyt |i i}Wn|idSnXd||f|_ |i |iiddy|i}|i}ti|||d|id |id |id |id |id |id|id|id|d|id|id|id|i  |_!t"i#|i!i$fWn;t%j o/}|iidd|it'|SnX|i(idd|i)pt"i#t*||fn|iidd|iidd|i idd|i+o|i+i,ndS(s Start web2py server s#no password, no web admin interfaces"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}sinvalid host ip addresssinvalid port numbers http://%s:%sRgRht pid_filenamet log_filenametprofiler_filenametssl_certificatetssl_private_keyt min_threadst max_threadst server_nametrequest_queue_sizettimeouttshutdown_timeoutRnt interfacesRtreadonlyN(-RRtgetRRtregexptretcompiletmatchtintRRRRRRRjRtreq_queue_sizetmaint HttpServerRRRRRt minthreadst maxthreadsRRRRpRRtthreadtstart_new_threadRct ExceptionRdtstrRRxRRtSetServerRunning(RRdRRjRRRR((RRcMs\!                 cCs|iidd|iidd|iidd|iidd|iidd|ii|i o|i i ndS(s Stop web2py server RgRRhN( RRRRRRRRRRtSetServerStopped(R((RRs  c Csytiid}Wn!|iid|idSnXytdd}|i |i |i ||i }|i|idddtid|idg}||_xztt|idD]_}|ii|i|}|ii|i||d |i||d |i|dfqW||_ Wntj oti|_ ||_ d gd |_g}tt|idD],}||ii|d |dd d dq~|_nX|iid|idS(s Update canvas shttpserver.logiNRii f90.0s iiidi,R$tgreen(RmRntgetsizett1RR0RRRtfptseektt0treadRtclosetp0tmathtsqrttcounttvaluetxrangetlentitcoordstq0tct BaseExceptionRHt_[1]t create_line(RRRRRRRR((RRs4 2 1  @( RRRR RRARtFalseR[RRcRR(((RRLs  v    = c Cs dk}dk}d} d}|i|}|i| d|it}||_|i dddddd d d |i d d ddddddd dd}|d7}|i ddddddd ||i ddddddd d|i dddddd d d!|i d"d#dd$dd%d d&|i d'd(dd)dd*d d+|i d,d-dddddd.d d/|i d0dddddd1d d2|i d3dddddd4d d5|i d6d7dt i dd8d d9d:}|i d;d<dd=dddd>d ||i d?d@ddAddddBd dC|i dDdEdd=ddddFd dG|i dHdIdtiddJd dK|i dLdMdNdOddPdtd dQ|i dRdSdNdOddTdtd dUdV}|dW7}|i dXdYddZdd[ddd |d\}|d]7}|i d^d_dd`dadbd |dc}|d]7}|dd7}|i dedfdNdOdtddgd |dh}|i didjdNdOdtddkd |dl}|dm7}|i dndodNdOdtddpd |dq}|dr7}|i dsdtddudadvddd |dwdx}|i dydzdd{dad|ddd ||i d}d~ddddd dd}|i dddNdOdddtd |d}|i ddNdOdddtd ||i dddNdOdddtd d|i dddNdOdddtd d|i ddddddd d|i ddddddd d|i dddNdOdddtd d|i dddNdOdtddd d|i dddNdddddd dd}|i ddNdddddd |dtijotiid} n6dtijotiid} ntti} ti| ti| dt_}|i\} }| ig|| _| t_|t_| io-ti }|t_"t#i$t%i&dnt#i$| i'| i(ddjo| i(d | _(n| i)ot*t_)t*| _+t*| _,nti-i.| i/| _/t0| i1t2og} | i1i4dD]} | | i4dq~ | _1x%| i1D]} t6| d| dnti-i:d pti-i:doByt?ddti@dWqd}tiAi=|qXq n| |fS(s6 Defines the behavior of the console web2py execution Nspython web2py.pys web2py Web Framework startup script. ATTENTION: unless a password is specified (-a 'passwd') web2py will attempt to run a GUI. In this case command line options are ignored.s-is--iptdefaults 127.0.0.1tdestRthelps$ip address of the server (127.0.0.1)s-ps--portt8000RttypeRsport of server (8000)s&password to be used for administrations1 (use -a "" to reuse the last password))s-as --passwordsRs-cs--ssl_certificatetRs"file that contains ssl certificates-ks--ssl_private_keyRs"file that contains ssl private keys-ds--pid_filenameshttpserver.pidRs#file to store the pid of the servers-ls--log_filenameshttpserver.logRsfile to log connectionss-ns --numthreadst numthreadssnumber of threads (deprecated)s --minthreadsRs minimum number of server threadss --maxthreadsRs maximum number of server threadss-ss --server_nameRsserver name for the web servers5max number of queued requests when server unavailables-qs--request_queue_sizet5Rs-os --timeoutt10Rs+timeout for individual request (10 seconds)s-zs--shutdown_timeoutRs)timeout on shutdown of server (5 seconds)s-fs--folderRpsfolder from which to run web2pys-vs --verbosetactiont store_truetverbosesincrease --test verbositys-Qs--quiettquietsdisable all outputs;set debug output level (0-100, 0 means all, 100 means none;s default is 30)s-Ds--debugt debuglevelis>run web2py in interactive shell or IPython (if installed) withs> specified appname (if app does not exist it will be created).s-Ss--shelltshelltmetavartAPPNAMEs>run web2py in interactive shell or bpython (if installed) withs Use combined with --shells-Bs --bpythontbpythons?only use plain python shell; should be used with --shell options-Ps--plaintplains9auto import model files; default is False; should be useds with --shell options-Ms--import_modelst import_modelss&run PYTHON_FILE in web2py environment;s# should be used with --shell options-Rs--runtrunt PYTHON_FILEs$run doctests in web2py environment; s#TEST_PATH like a/c/f (c,f optional)s-Ts--testttestt TEST_PATHs-Ws --winservicet winservices(-W install|start|stop as Windows servicesBtrigger a cron run manually; usually invoked from a system crontabs-Cs--crontextcronstriggers the use of softcrons --softcrontsoftcrons-Ns --no-crontnocronsdo not start cron automaticallys-Js --cronjobtcronjobsidentify cron-initiated commands-Ls--configRws config files-Fs --profilerRsprofiler filenames-ts --taskbarRxs/use web2py gui and run in taskbar (system tray)s--noguitnoguistext-only, no GUIs-As--argststoretargsspshould be followed by a list of arguments to be passed to script, to be used with -S, -A must be the last optionsilisten on multiple addresses: "ip:port:cert:key;ip2:port2:cert2:key2;..." (:cert:key optional; no spaces)s --interfacesRiis.pyt;t:sapplications/__init__.pytws welcome.w2pt NEWINSTALLsapplications/welcomes3New installation: unable to create welcome.w2p file(Btoptparsettextwraptusaget descriptiontdedentt OptionParserRtOptionRGtparsert add_optiontmsgtsockett gethostnameRmtgetcwdRR targvtindextkRt other_argst parse_argsRjRRtglobal_settingst cmd_optionstcmd_argsRRRtcapturetstdouttloggertsetLeveltloggingtCRITICALRRwRR\RRRntabspathRpt isinstanceRRRtsplitt interfaceRttupleRRRRRR Rtw2p_packtunlinktstderr(R RRRR RRRRRR!RRRj((Rtconsoles                                                                                   "         9 1   ' c!sOt\} }tGHtGHtGHdkl}ddi|GH| i oyt | i ggd} WnUt j oIyt | i } Wqt j o d| i GHt idqXnXxEt| D]3} t| | ot| | t| | qqWnt| do(| iot| id| id Sn| ioZ| id jo| it i(nt| id | id | id | id | id Sn| io<dGHdt_t i| i!}|i"|id Sni|o'| i$ o| i%odGHdt_n;|o3| i$ o(dGHdt_t i&| i!i"n| i'oGt(i)djot*d| i'g| i ndGHt idd Sny | i+Wnt,| _+nX| i+o&t(i)djodGHt idnd } | i.pyd k/} t0}Wn&t2j ot3i4dt,}nX| i5djo|p| i+o%|oy| i6} Wq~q~Xqn| oz| i7| i8pt9| nt:| | t<i<t<i=dy| i>Wni?nXt in| o#| i5djot@d| _5n| i5p dGHn| iAtB| iC}}dGHd||fGHdt(iDGHtEiFd|d |d!| i5d"| iGd#| iHd$| iId%| iJd&| iKd'| iLd(| iMd)| iNd*| iOd+| iPd,| iQd-| i!d.| iR}y|i"WntTj o|iUnXtViWd S(/s Start server (sdriverssDatabase drivers available: %ss, RsCannot import config file [%s]iRRNRRRt startfilesStarting extcron...texternals/Using softcron (but this is not very efficient)tsoftsStarting hardcron...thardtnts6Error: Windows services not supported on this platforms-Error: taskbar not supported on this platforms5GUI not available because Tk library is not installedscs iS(N(R(R[(tatb(R((RROesschoose a password:sno password, no admin interfaces please visit:s http://%s:%ss4use "kill -SIGTERM %i" to shutdown the web2py serverRRRRRRRRRRRRRRRnR(XR&RjRRERFRGtdaltdriversRoRwt __import__toptions2RR RtdirtkeyRtsetattrtgetattrRRRRRRRRRRRtweb2py_crontypetnewcronRpRctcronRRthardcronRRmtnametweb2py_windows_service_handlerRxRR4RR.R\thavetkt ImportErrorRtwarnRtTkR>RRKRLR(tsignaltSIGTERMtmainloopR[t raw_inputRRRRsRRRRRRRRRRRRRRRtKeyboardInterruptRRtshutdown(R8RRR/R<RR(RRR1R3R.R4Rj((R(RRcs    %                (                   (5RR RRHRRRmR R@RRR7Rt fileutilsR#RRRtsettingsRR.RUtcontrib.taskbar_widgetRRR;Rt NameErrorRRERFRt versioninfoRtstripRGRRWtversionR R%R t getLoggerRtobjectRRRRKRLR&R\Rc(#RFRRR7RRR&RcRGRR#RRRRKRR.RR R RR;RWRR RRR@RURERHRJRmRLR((Rt? sZ                 !   2) C