Mini Shell

Direktori : /lib64/python3.6/site-packages/pyanaconda/__pycache__/
Upload File :
Current File : //lib64/python3.6/site-packages/pyanaconda/__pycache__/display.cpython-36.opt-1.pyc

3

C��e6�@sTddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddl	mZddlm
Z
mZddl	mZddlmZdd	lmZdd
lmZddlmZddlmZddlZ	ddlZdd
lmZddlmZddl m!Z!ddl"m#Z#m$Z$e#e%�Z&e$�Z'dZ(dd�Z)dd�Z*dd�Z+dd�Z,dd�Z-dd�Z.dd�Z/d$d d!�Z0d"d#�Z1dS)%�N)�conf)�WatchProcesses)�isys)�
startup_utils)�util�	constants)�vnc)�_)�flags)�NETWORK)�AskVNCSpoke)�tui_quit_callback)�DISPLAY_MODE_TEXT)�App)�
ScreenHandler)�get_module_logger�get_stdout_loggera�Do not load the stage2 image over a slow network link.
Wait longer for the X server startup with the inst.xtimeout=<SECONDS> boot option.The default is 60 seconds.
Load the stage2 image into memory with the rd.live.ram boot option to decrease access time.
Enforce text mode when installing from remote media with the inst.text boot option.
Use the customer portal download URL in ilo/drac devices for greater speed.cCs,tjdg�}|rtjd|�n
tjd�dS)z�Start the spice vdagent.

    For certain features to work spice requires that the guest os
    is running the spice vdagent.
    z
spice-vdagentz#spice-vdagent exited with status %dzStarted spice-vdagent.N)r�execWithRedirect�log�info)Zstatus�r�/usr/lib64/python3.6/display.py�start_spice_vd_agentAsrcCsttj�tj�}|jt�t|j|d�}tj|�tj	�|jj
jrp|jsTt
jd�tjj|_dt_|jj
j|_dS)a Ask the user if TUI or GUI-over-VNC should be started.

    :param anaconda: instance of the Anaconda class
    :param vnc_server: instance of the VNC server object
    :param str message: a message to show to the user together
                        with the question
    )�messagez?VNC requested via VNC question, switching Anaconda to GUI mode.TN)rZ
initializeZget_event_loopZset_quit_callbackr
r�ksdatarZschedule_screenZrunr�enabled�gui_moderrr�DisplayModes�GUI�display_moder
�usevnc�password)�anaconda�
vnc_serverrZloopZspokerrr�ask_vnc_questionPs




r$cCs�g}d}tjj�tjkr6|jdtjj�tjf�d}|jrPtjrP|jd�d}|j	j
jtkrl|jd�d}t
j�}|j�r�|jr�|jd�d}tjdtj�s�|jd�d}||fS)	z�Check if we can start VNC in the current environment.

    :returns: if VNC can be started and list of possible reasons
              why VNC can't be started
    :rtype: (boot, list)
    TzANot asking for VNC because current memory (%d) < MIN_GUI_RAM (%d)Fz2Not asking for VNC because of an automated installzJNot asking for VNC because text mode was explicitly asked for in kickstartz2Not asking for VNC because we don't have a networkz
/usr/bin/Xvncz-Not asking for VNC because we don't have Xvnc)�blivetrZtotal_memoryrZMIN_GUI_RAM�append�tui_moder
ZautomatedInstallrZdisplaymodeZdisplayModerrZ	get_proxyZIsConnectingZ	Connected�os�access�X_OK)r"Zerror_messagesZvnc_startup_possibleZ
network_proxyrrr�check_vnc_can_be_startedgs(



r+cCs8tjdddddtjdddd	d
ddd
dgtj|d�dS)z(Start the X server for the Anaconda GUI.ZXorgz-brz-logfilez
/tmp/X.logz:%sZvt6z-sZ1440z-acz	-nolistenZtcpz-dpiZ96z-noreset)Zoutput_redirect�timeoutN)rZstartXrZX_DISPLAY_NUMBER�
subprocessZDEVNULL)�xtimeoutrrr�	start_x11�s
r/cCs^tjjdd�}dtjkr,|dtjd}n|d}tjdddd	gd|id
�}tj|d�dS)a�Start the window manager.

    When metacity actually connects to the X server is unknowable, but
    fortunately it doesn't matter. metacity does not need to be the first
    connection to Xorg, and if anaconda starts up before metacity, metacity
    will just take over and maximize the window and make everything right,
    fingers crossed.
    Add XDG_DATA_DIRS to the environment to pull in our overridden schema
    files.
    ZANACONDA_DATADIRz/usr/share/anacondaZ
XDG_DATA_DIRSz/window-manager:z/window-manager:/usr/shareZmetacityz	--displayz:1z--sm-disable)Zenv_addN)r(�environ�getrZstartProgramrZ
watch_process)ZdatadirZ
xdg_data_dirsZ	childprocrrr�do_startup_x11_actions�s
r2cCsZy$tjd|�tjdddd|g�Wn0tk
rTtjd�tjddddg�YnXdS)	z^Set X server screen resolution.

    :param str runres: a resolution specification string
    z%Setting the screen resolution to: %s.Zxrandrz-dz:1z-szThe X resolution was not setz-qN)rrrr�RuntimeError�error)�runresrrr�set_x_resolution�s
r6cCs4|r|rtjrt|�tjddddg�t�dS)z�Perform X11 actions not related to startup.

    :param str runres: a resolution specification string
    :param gui_mode: an Anaconda display mode
    Zxrdbz-nocppz-mergez/etc/X11/XresourcesN)r
r r6rrr)r5rrrr�do_extra_x11_actions�sr7cCs`|dkrtjj}tjjd|f�s6tjd|fdd�td|fd�}|jd|�|j	�dS)zWrite the X driver.Nz
%s/etc/X11i�)�modez%s/etc/X11/xorg.conf�wzBSection "Device"
	Identifier "Videocard0"
	Driver "%s"
EndSection
)
r�targetZsystem_rootr(�path�isdir�makedirs�open�write�close)Zdriver�root�frrr�
write_xdriver�srCcCs*yt|j�}Wn(tk
r6tjd|j�tj}YnXtj�}||_	||_
|j|_|j|_
|jr�dt_|js�tjd�tjj|_|j|_|jr�|jjd�}|d|_t|�dkr�t|d�dkr�t|d�dkr�|d|_|jr�t|jdd�tjr�d	S|jjj�rrdt_|j�s*tjd
�tjj|_|jdk�rB|jjj|_|jdk�rZ|jjj |_|jdk�rr|jjj!|_|j�r�dd
�t"j#t$j%j&d�D�}d|k�r�t'jd�tjj(|_dt_dt_)t*|�\}}|�s�dt_)x|D]}t'j|��q�W|j�otj+�ptj}	|	�rFt,j-dt,j.��rFt'jt/d��t0j1d�tjj(|_d}	|j2�r|tj)�r|t/d�}
t3|||
�|jjj�s|dt_)|j4�t5j6||�|	�o�|j}	|	�r�yt7|�t8�Wn�t9k
�rN}z|tjd|�t:d�t;j<ddt,j=�j>dd�}x"t?jd�D]}
t:|j@|
���qWtAjBd�tjj(|_d|_Ct0j1d�WYd	d	}~Xn`tDtEfk
�r�}z>tjd|�t:d�tAjBd�tjj(|_d|_Ct0j1d�WYd	d	}~XnX|jC�s�tF|jG|jd�|j2�r|jC�rtj)�r|jjj�rt/d �}
t3|||
�|j�rtj�r|jH�t8�|jI�d	S)!z�Setup the display for the installation environment.

    :param anaconda: instance of the Anaconda class
    :param options: command line/boot options
    z&invalid inst.xtimeout option value: %sTzBVNC requested via boot/CLI option, switching Anaconda to GUI mode.�:r��/)rANz<VNC requested via kickstart, switching Anaconda to GUI mode.�css|]}|dVqdS)rENr)�.0�tuprrr�	<genexpr>sz setup_display.<locals>.<genexpr>zpyanaconda.ui.zpyanaconda.ui.guizAGraphical user interface not available, falling back to text modeFz
/usr/bin/Xorgz<Graphical installation is not available. Starting text mode.�z�Text mode provides a limited set of installation options. It does not offer custom partitioning for full control over the disk layout. Would you like to use VNC mode instead?zX startup failed: %szn
X did not start in the expected time, falling back to text mode. There are multiple ways to avoid this issue:z * z   �)Zinitial_indentZsubsequent_indent�width�
z&X or window manager startup failed: %sz?
X or window manager startup failed, falling back to text mode.)rz�X was unable to start on your machine. Would you like to start VNC to connect to this computer from another computer and perform a graphical installation or continue with a text mode installation?)J�intr.�
ValueErrorrZwarningrZ	X_TIMEOUTrZ	VncServerr"r,rZnoninteractiveZinteractive_moder
r rrrrZvncpasswordr!Z
vncconnect�splitZvncconnecthost�lenZvncconnectportZxdriverrCZrescue_moderr�hostZport�pkgutilZiter_modules�
pyanacondaZui�__path__�
stdout_logZTUIZvncquestionr+Zpreexisting_x11r(r)r*r	�timeZsleepr'r$Zlog_display_moderZcheck_memoryr/r2�TimeoutError�print�textwrapZTextWrapper�get_terminal_size�columns�X_TIMEOUT_ADVICEZfillrZ
vtActivateZgui_startup_failed�OSErrorr3r7r5ZstartServerZ
initInterface)r"Zoptionsr.r#ZcargsZmodsZvnc_can_be_startedZvnc_error_messagesZ
error_messageZwant_xr�e�wrapper�linerrr�
setup_display�s�

















&rc)N)2r(r-rXr[rTZ&pyanaconda.core.configuration.anacondarZ pyanaconda.core.process_watchersrrUrrZpyanaconda.corerrrZpyanaconda.core.i18nr	Zpyanaconda.flagsr
Z,pyanaconda.modules.common.constants.servicesrZpyanaconda.ui.tui.spokes.askvncrZpyanaconda.ui.tuir
Z
pyanaconda.uir%Zpykickstart.constantsrZ
simplelinerZ simpleline.render.screen_handlerrZpyanaconda.anaconda_loggersrr�__name__rrWr^rr$r+r/r2r6r7rCrcrrrr�<module>sB+