Edit File: ui_config_lib.cpython-37.opt-1.pyc
B 5/9e � @ s� d dl mZ d dlZd dlZddlmZ d dlmZ d dlm Z d dl mZ d dlm Z d dlZd d lmZ d d lmZ G dd� de�Zd Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� ZdS )� )�absolute_importN� )�boolean_to_0_1)�FormattedException)�exec_utility)�UIConfig)�check_quota_enabled)�Feature)�is_panel_feature_supportedc @ s e Zd ZdS )�UIConfigExceptionN)�__name__� __module__�__qualname__� r r �py/clconfig/ui_config_lib.pyr s r z+/usr/share/l.v.e-manager/utils/dynamicui.pyc C s t t� �� �S )a6 Retrives UI settings from config file :return: dict. For example: {'inodeLimits': {'showUserInodesUsage': False}, 'uiSettings': {'hideRubyApp': False, 'hideLVEUserStat': False, 'hidePythonApp': False, 'hidePHPextensions': True} } )�filter_flagsr Z get_configr r r r � get_ui_config s r c C s� yt tdgdd�\} }}W n< tk rV } ztdt|� dtid���W d d }~X Y nX | dkr~td| d | dtid���d S ) Nz--sync-conf=allT)�stderrz Can't execute file %(ctl_cmd)s: Zctl_cmd)�message�contextr z#Error while executing %(ctl_cmd)s: � )r �DYNAMIC_UI_CTL_CMD�OSErrorr �str)Zretcode�out�err�er r r � refresh_panel* s r c C sv yNt | d d �}ddd�}d|| }ttjd�}tj|dd |tjd � W n tjtfk rh Y nX t | � dS )a Sets UI settings to UI config file Using subfunction _set_ui_config :param parameters_dict: Parameters to set dictionary. For example: {'inodeLimits': {'showUserInodesUsage': False}, 'uiSettings': {'hideRubyApp': False, 'hideLVEUserStat': False, 'hidePythonApp': False, 'hidePHPextensions': True} } :return: None � uiSettings� hidePythonAppZdisabledZenabled)�0�1zFcloudlinux-selector set --json --interpreter python --selector-status �wTz /bin/bash)�shell� executable�stdoutr N) r �open�os�devnull� subprocessZ check_callZSTDOUTZCalledProcessError�KeyError�_set_ui_config)�parameters_dictZenablepythonappZ lve_to_selectZ py_commandZFNULLr r r � set_ui_config5 s r- c C s t � �| � t� dS )aW Sets UI settings to config file :param parameters_dict: Parameters to set dictionary. For example: {'inodeLimits': {'showUserInodesUsage': False}, 'uiSettings': {'hideRubyApp': False, 'hideLVEUserStat': False, 'hidePythonApp': False, 'hidePHPextensions': True} } :return: None N)r Z set_configr )r, r r r r+ S s r+ c C sv t | �d�� yt� d k r$| �d� W n tk r: Y nX y ttj�sZ| �di ��d� W n tk rp Y nX | S )Nr ZinodeLimitsZhideLVEUserStat)�panel_filter�getr �popr* r r ZLVE)Zmapped_flagsr r r r b s r c C s� t �� rttj�s| �d� t �� s.ttj�s8| �d� ttj�sL| �d� ttj �s`| �d� ttj �s~| �d� | �d� dS )z� Function that filters UI Settings dictionary depending on panel type :param ui_settings: UI Settings that is filtered ZhideRubyAppr Z hideNodeJsAppZhideXrayAppZ hidePhpAppZhidePHPextensionsN)�detectZ is_cpanelr r Z RUBY_SELECTORr0 Zis_pleskZPYTHON_SELECTORZNODEJS_SELECTORZXRAYZPHP_SELECTOR)Zui_settingsr r r r. q s r. )Z __future__r r'