Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/landscape/ui/view/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyc


Tc@sddlZddlZddlmZddlmZmZddlmZm	Z	m
Z
ejdZdZ
dZdZd	ejfd
YZdS(iN(tgettext(tGObjecttGtk(tCANONICAL_MANAGEDt
LOCAL_MANAGEDtNOT_MANAGEDsT^(([a-zA-Z][a-zA-Z0-9\-]*)?[a-zA-Z0-9][\.]?)*(([A-Za-z][A-Za-z0-9\-]*)?[A-Za-z0-9])$cCs
|jS(s/
    Do some minimal host name sanitation.
    (tstrip(t	host_name((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytsanitise_host_namescCstj|dk	S(sh
    Check that the provided host name complies with L{HOST_NAME_REGEXP} and is
    therefor valid.
    N(tHOST_NAME_REGEXPtmatchtNone(R((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytis_valid_host_namescCs.y|jdtSWntk
r)tSXdS(sT
    Test that the provided string contains only characters from the ASCII set.
    tasciiN(tdecodetTruetUnicodeDecodeErrortFalse(ttext((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytis_asciis


tClientSettingsDialogcBsaeZdZdZdZdZdZdZdZdZ	dZ
ed	Zed
Z
edZedZed
ZedZedZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%RS(#s
    L{ClientSettingsDialog} is a subclass of Gtk.Dialog that loads the UI
    components from the associated Glade XML file and wires everything up to
    the controller.
    slandscape-client-settings.gladeiicCstt|jdtddtjj|jd|jt	t	|_
t|_g|_
||_|j|j|jjdS(NttitlesLandscape Servicetflagsspreferences-management-service(tsuperRt__init__t_RtDialogFlagstMODALtset_default_icon_namet
set_resizableRt_initialisedtsett_validation_errorst_errored_entriest
controllertsetup_uit	load_datatrevert(tselfR"((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyR5s


			

cCs-|jtjjtj|jj|dS(sb
        Show a warning icon on a L{Gtk.Entry} to indicate some associated
        error.
        N(tset_icon_from_stockRtEntryIconPositiontPRIMARYtSTOCK_DIALOG_WARNINGR!tappend(R&tentry((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytindicate_error_on_entryDscCst|jj}t|}t|}|rM|rM|jj|tS|j|j|sy|jj	|j
n|s|jj	|jntSdS(N(
Rtlocal_landscape_host_entrytget_textRRtset_textRR-R taddtINVALID_HOST_NAMEtUNICODE_IN_ENTRYR(R&Rtascii_okthost_name_ok((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyt%check_local_landscape_host_name_entryMscCs>t|jrtS|j||jj|jtSdS(sN
        Check that the text content of a L{Gtk.Entry} is acceptable.
        N(RR/RR-R R1R3R(R&R,((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytcheck_entry]s

cCst|_|jjr+|jdn|jj|jj	}|jj
|d\}|tkrntS|t
kr|j|j}|j|j}|o|S|j}|j|j}|o|SdS(Ni(RR t_info_bar_containertget_visibletdismiss_infobarRt	liststoretget_itertuse_type_comboboxt
get_activetgetRRRR7thosted_account_name_entrythosted_password_entryR6tlocal_password_entry(R&tactive_itertmanagement_typetaccount_name_oktpassword_okR5((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytvalidity_checkhs	
cCs
tdS(NR(R(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytNO_SERVICE_TEXTzscCs
tdS(NsLandscape - hosted by Canonical(R(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytHOSTED_SERVICE_TEXT~scCs
tdS(NsLandscape - dedicated server(R(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytLOCAL_SERVICE_TEXTscCs
tdS(NtRegister(R(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytREGISTER_BUTTON_TEXTscCs
tdS(NtDisable(R(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytDISABLE_BUTTON_TEXTscCs
tdS(NsInvalid host name.(R(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytINVALID_HOST_NAME_MESSAGEscCs
tdS(Ns"Only ASCII characters are allowed.(R(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytUNICODE_IN_ENTRY_MESSAGEscCs|jj}x;|jj|dd|jjkrL|jj|}qW|jj|}|j\}|jj	|dS(s_
        Load the persisted L{management_type} from the controller and set the
        combobox appropriately.

        Note that Gtk makes us jump through some hoops by having it's own model
        level to deal with here.  The conversion between paths and iters makes
        more sense if you understand that treeviews use the same model.
        iN(
R;tget_iter_firstR?R"RDt	iter_nexttget_pathtget_indicesR=t
set_active(R&t	list_itertpathtindex((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyt&_set_use_type_combobox_from_controllers	cCs0|jj|jj|jj|jjdS(N(R@R0R"thosted_account_nameRAthosted_password(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyt"_set_hosted_values_from_controllers	
cCs0|jj|jj|jj|jjdS(N(R.R0R"tlocal_landscape_hostRBtlocal_password(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyt!_set_local_values_from_controllers	
cCsAt|_|jj|j|j|jt|_dS(N(RRR"tloadR\R_RYR(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyR$s	



cCstjtjtjtj}d|_|jt|j	|j
jdg|jt|j
|j
jdg|jt|j|j
jdg|S(s
        Construct the correct L{Gtk.ListStore} to drive the L{Gtk.ComboBox} for
        use-type.  This a table of:

           * Management type (key)
           * Text to display in the combobox
           * L{Gtk.Frame} to load when this item is selected.
        sno-service-frameshosted-service-frameslocal-service-frameN(Rt	ListStoreRt
TYPE_PYOBJECTtTYPE_STRINGRt
active_widgetR+RRHt_buildert
get_objectRRIRRJ(R&R;((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytmake_liststores		cCs`|jjd|_|jjd|jd|jjd|_|jjd|jddS(Nshosted-account-name-entrytchangedRZshosted-password-entryR[(ReRfR@tconnectton_changed_eventRA(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytlink_hosted_service_widgetss				cCs`|jjd|_|jjd|jd|jjd|_|jjd|jddS(Nslocal-landscape-host-entryRhR]slocal-password-entryR^(ReRfR.RiRjRB(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytlink_local_service_widgetss				cCst|jjd|_|jjd|j|jj|tj}|jj|t	|jj
|dddS(Nsuse-type-comboboxRhRi(ReRfR=Riton_combo_changedt	set_modelRtCellRendererTextt
pack_startRt
add_attribute(R&R;tcell((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytlink_use_type_comboboxscCs|jtjjdS(N(tresponseRtResponseTypetCANCEL(R&twidget((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytcancel_responsescCs|jr"|jtjjnvg}|j|jkrM|j|jn|j	|jkrr|j|j
n|jjdj
||jjdS(Ns
(RGRtRRutOKR3R R+RPR2ROtinfo_messageR0tjoinR8tshow(R&Rwt
error_text((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytregister_responsescCsf|jj\}|j\}|j\}}|tkrR|j|jn|j|jdS(N(tregister_buttontget_childrenRR0RNRL(R&RDt	alignmentthboxtimagetlabel((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytset_button_textscCs	tjdtj|_|jj|jttd|jjd|j|jj	tjdtj
|_|jj|jttd|jj	|jjd|jtjdtj
|_|jj|jttd|jj	|jjd|jdS(Ntstockitclicked(RtButtontSTOCK_REVERT_TO_SAVEDt
revert_buttontaction_areaRpRRiR%R|tSTOCK_CANCELt
cancel_buttonRxtSTOCK_OKRR~(R&((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyt
setup_buttonss


cCsD|jjx'|jD]}|jtjjdqWg|_dS(N(R8thideR!R'RR(R)R(R&RwR,((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyR:s
cCs|jjd}|jjd}|jt|jttj|_|jjdtj}|j	||j
tj}|j	||j
|jj|dtdtdd|jj|dtdtdd|j
}tj}tj|_|jjdd|jj
|j|jdtdtdd	tjd
}|jd|j|j
|j|dtdtdd|j
|j|dtdtdddS(Nslabels-sizegroupsentries-sizegroupitexpandtfilltpaddingig?itDismissR(ReRftset_ignore_hiddenRRtHBoxR8tset_spacingtInfoBart
add_widgetR|tLabelRptget_content_areaRzt
set_alignmentRRRiR:(R&tlabels_size_grouptentries_size_grouptinfo_bartempty_labeltcontent_areaRt	ok_button((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytsetup_info_bars8







"

cCs*tj|_|jjd|jjtjjtjjt	d|j
|j}|jd|j
d|j|jjd|_|jj|j|jdtdtdd|jj|jdtdtdd|j|_|j|j|j|j|jdS(	Nslandscape-clienttuiis
toplevel-vboxRRRi(RtBuilderRetset_translation_domaint
add_from_filetosRWR{tdirnamet__file__t
GLADE_FILERRtset_border_widthRRft_vboxtunparentRpRR8RRgR;RsRkRlR(R&R((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyR#6s(		






cCs|jj|j}|jdk	r=|jj|jn|jj|d\}|j||j	r||j
_|j
jn|jj|d\|_|jj
|jj|jdS(Nii(R;R<R>RdRRtremoveR?RRR"RDtmodifyRR1(R&tcomboboxRVRD((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyRmLs
	
cCs*t|j||j|jjdS(N(tsetattrR"R/R(R&Rwt	attribute((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyRjYscGs|jdS(N(tdestroy(R&targs((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pytquit]scCs(|jj|j|jjdS(N(R"R%R$(R&tbutton((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyR%`s

(&t__name__t
__module__t__doc__RR2R3RR-R6R7RGtpropertyRHRIRJRLRNRORPRYR\R_R$RgRkRlRsRxR~RRR:RR#RmRjRR%(((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyR*sF																							
		(treRRRt
gi.repositoryRRtlandscape.ui.constantsRRRtcompileR	RRRtDialogR(((sC/usr/lib/python2.7/dist-packages/landscape/ui/view/configuration.pyt<module>s