@Qc@sddlZddlZddlZddlZddlTddlZddlZeddddddZd d Z ej d d d de j gddej ejejjdZdZej dd dde jgddej ejejjdZejdkr^ejddZej ejdZnZejdkrej ejdZn-ejdkrej ejdZneZejdkrejdd ejd!ejd"ej \Z!Z"e!d#kreZqnesZej d$d d%d&d'gej ejd(Z#nd)ej$fd*YZ%e%a&ej d+d d,ej ejd-Z'dS(.iN(t*tnamet PyWbUtilstauthorsSun Microsystems Inc.tversions1.0t cCs4dGx(|D] \}}|j||GdGq WHdS(Nt|(tljust(tfieldstfillerttexttsize((s..\modules\wb_utils_grt.pytprintTableLine#sswb.catalog.util.dumpColumnstcaptionsDump All Table Columnstinputt pluginMenutCatalogc Csg}d}d}d}d}x|jD]}t|t|j}x|jD]}t|t|j}xf|jD][}t|t|j}t|t|j}|j|j|j|j|jfqxWqPWq(Wtd|fd|fd|fd|fgdtd|fd|fd|fd|fgtd|fd|fd|fd|fgdxH|D]@\} } } } t| |f| |f| |f| |fgqvWtd|fd|fd|fd|fgdt|GdGHdS(Nit-tSchematTabletColumntTypescolumns printed( tschematatmaxtlenRttablestcolumnst formattedTypetappendR ( tcatalogtlinest schemalenttablelent columnlenttypelentschemattabletcolumntstttctdt((s..\modules\wb_utils_grt.pytprintAllColumns/s*11.121cCstjdjd}|s0dddg}nxVdddd gD]B}x9|D]1}tjj||}tjj|rP|SqPWqCWdS( NtPATHt:s/usr/bins/usr/local/bins/binsgnome-terminaltkonsoletxtermtrxvt(tostgetenvtsplittpathtjointexiststNone(tpathsttermtdt full_path((s..\modules\wb_utils_grt.pytget_linux_terminal_programOs  swb.tools.cmdlineClientsStart Command Line ClientsHome/Connectionsc Csoddl}ddl}d|jjjkrd}tjjj|}|dkrwt j j ddddddStjjj |}d}nd |jjjkr|j d krd }nd }d}|jd }|dkrd }nd|}n8|jdjddjdd}|jd}d}|jdjddjdd}|dkrud}n|jd} | r| jddjdd} nd} |j dkrd||||| f} |j d| n}|j d kr/d||||| f} tj| dtn<d||||| f} tjdddt| fgdS( Nitsshs 127.0.0.1isStart Command Line Clients"Could not open SSH tunnel to host.tOKttsockettWindowst.t localhosttMySQLs --socket=thostNames\s\\t"s\"tporttuserNamei R#tDarwins%mysql \"-u%s\" \"-h%s\" -P%i %s -p %ss<osascript -e 'tell application "Terminal" to do script "%s"'s*start cmd /C mysql -u%s -h%s -P%i %s -p %stshells /bin/bashs-cs %s -e "%s" &(tplatformR0tdriverRtlowertgrttmodulest DbMySQLQueryt openTunneltmformst Utilitiest show_errort getTunnelPorttsystemR6tparameterValuestreplacet subprocesstPopentTruetcallR;( tconnRJR0thostttunRFR?t socketNametuserR#tcommand((s..\modules\wb_utils_grt.pyt#startCommandLineClientForConnection]sJ         % %   !tlinux2tMWB_MODULE_DIRs/../iodbcadm-gtkcCs5tjjtr-tjtddtdSdSdS(Ns &RIii(R0R3R5t odbcadminRXR[RZ(((s..\modules\wb_utils_grt.pytstartODBCAdminstdarwincCsMtjddt}|dkr9tjddt}n|dkrIdSdS(Nsopen -a 'ODBC Administrator'RIisopen -a 'ODBC Manager'i(RXR[RZ(tret((s..\modules\wb_utils_grt.pyRfs twin32cCstjddtdS(Ns odbcad32.exeRIi(RXR[RZ(((s..\modules\wb_utils_grt.pyRfsspython --versiontstdouttstderrRIs2.6swb.tools.utilitiesShellsStart Shell for MySQL UtilitiestgroupssOthers/Menu/Ungroupedc Csddl}ddl}ddl}|jdkrRd}tj|dtn?|jdkrddl}|jdddt j j j \}}|j |d }|jd t j j jd |jd t j j jd |jd |jdd |jd|jd|jdt j j jd |jd||j|j|d|jd|nt}|rddl}|jdddt j j j \}}|j |d }|jd|jd|jd||jd|j|j|dd|krbtj|dd|gqtjddd||fgn tddS(NiR@sfstart cmd /K "cd utilities && echo The following utilities are available: && echo. && dir *.exe /B /W"RIRHtprefixsdelme.tdirsw+sPATH="$PATH:%s/scripts" R>s$MYSQL_UTILITIES_FOLDER="%s/scripts" sexport PYTHONPATH="%s" t PYTHONPATHsclear s4echo "The following MySQL Utilities are available:" sls "%s/scripts" s rm -f "%s" isosascript -e 'tell application "Terminal" to do script "source \"%s\""' -e 'tell front window of application "Terminal" to set custom title to "MySQL Utilities"'secho $MYSQL_UTILITIES_COMMANDS sbash -i R-s-es /bin/bashs-cs %s -e %s &s#Terminal program could not be found(RJR0ttimeRURXRYRZttempfiletmkstempRQtApptgettget_user_data_foldertfdopentwritetget_resource_pathR1tclosetchmodR;R[t RuntimeError( RJR0RpRaRqtfdt setup_scripttfR8((s..\modules\wb_utils_grt.pytstartUtilitiesShellsF    -##  #   -     #tCheckForUpdateThreadcBs#eZdZdZdZRS(cCs)t|_t|_tt|jdS(N(tFalset is_runningtfinishedtsuperRt__init__(tself((s..\modules\wb_utils_grt.pyRs  cCs|jr dSt|_y=ddl}ddl}|jjj|jd|_Wn+tk r}d|_t ||_ nXdS(Nis*http://wb.mysql.com/installer/products.xml( RRZtxml.dom.minidomturllib2tdomtminidomtparseturlopent ExceptionR6tstrterror(RtxmlRR((s..\modules\wb_utils_grt.pytruns    % cs|jrtS|jsSt|drtjjdt|jdddqnyIt j j j j jt j j j j jt j j j j jf}t j j j jdkrdndfd|jjdD}d |D}d |D}|r t|n|}||krtjjd d d jg|D]}t|^q8dddtjkrtjjdqntjjdddddWn5tk r}tjjdt|dddnXtjjjdt|_t|_tS(NRsCheck for updates failedR=R>tGPLs -commercialc3s5|]+}|jjjdjdkr|VqdS(Ruworkbench-win32N(t parentNodet attributest nodeValue(t.0tpackage(tedition(s..\modules\wb_utils_grt.pys stPackagecss5|]+}|jdjdkr|jdjVqdS(ttypetMSIt thisVersionN(RR(Rtnode((s..\modules\wb_utils_grt.pys scss.|]$}td|jdDVqdS(css|]}t|VqdS(N(tint(Rtnum((s..\modules\wb_utils_grt.pys sRAN(ttupleR2(Rtversion_string((s..\modules\wb_utils_grt.pys ssNew Version AvailablesThe new MySQL Workbench %s has been released. You can download the latest version from http://www.mysql.com/downloads/workbench.RAtCancels Get it Nows(http://www.mysql.com/downloads/workbenchsMySQL Workbench is Up to Dates<You are already using the latest version of MySQL Workbench.sReady.(tisAliveRZRthasattrRQRRRSRRRMtroottwbtinfoRt majorNumbert minorNumbert releaseNumbertlicensetgetElementsByTagNameRt show_messageR4t ResultOthertopen_urlRRsRttset_status_textRRR(Rtcurrent_versiontpackagestversion_stringstversionstnewest_versionRR((Rs..\modules\wb_utils_grt.pytcheckForUpdatesCallbacks.  +<$" 5 &  (t__name__t __module__RRR(((s..\modules\wb_utils_grt.pyRs  swb.tools.checkForUpdatessCheck for UpdatescCs\tjr dStjr"tantjtjjjdtj j dtj dS(NisChecking for updates...g?( tthreadRRRtstartRQRsRtRRRt add_timeoutR(((s..\modules\wb_utils_grt.pytcheckForUpdatess    ((tsysRXR0t threadingRRMRQt DefineModulet ModuleInfoR tplugintwbinputstcurrentCatalogtexporttINTtclassest db_CatalogR*R;tselectedConnectiontdb_mgmt_ConnectionRbRJR1ReRfRtdisable_utilitiesRYtPIPEtSTDOUTRZt communicatet pyversiontjunkRtThreadRRR(((s..\modules\wb_utils_grt.pyts@        '' ''/3  !,6