ó ur™Vc@s´dZddlZddlZddlmZddlmZddlmZm Z m Z ddl m Z ddl mZddlmZdd lmZd efd „ƒYZdS( s Window that represents the entire terminal, and 'top-level' functions, such as capturing keystrokes that will change the screen iÿÿÿÿN(t ColorTheme(t ErrorWindow(t textwidthtcenter_columnst get_encoding(t InnerWindow(tListItem(t ScrollWindow(t WindowAreat MainWindowcBsÑeZdZded„Zd„Zd„Zd„Zd„Z d„Z e d„ƒZ e d„ƒZ e d „ƒZe d „ƒZd „Zd „Zd „Zd„Zejgd„Zd„Zdd„ZRS(s„Represent initscr (the whole screen), and break it into a border, header, and central region. Map F# keystrokes to Actions cCsÍ|dk r||_ntd|ƒ|_||_||_|jƒdddf|_|j|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_||_d|_|jƒdS(skSet the theme, and call reset to initialize the terminal to prepare for the first screen. tforce_bwiiN(tNonetthemeRt screen_listtinitscrtgetmaxyxtdefault_cursor_post cursor_postfootertheadert_cur_header_textt central_areat popup_wint error_linet _active_wintactionst_default_actionstdefault_actionstreset(tselfRR RR R ((smain_window.pyt__init__2s$               cCsZ|jjƒ|jjƒ|jjƒ|jjƒ|j|jkrV|jjƒndS(sCompletely repaint the screenN(Rt redrawwinRRRRR(R((smain_window.pyRTs     cCs!tj|jƒŒtjƒdS(sWrapper to curses.doupdate()N(tcursestsetsyxtget_cursor_loctdoupdate(R((smain_window.pyt do_update]scCs+|jjƒ}|dkr'|j}n|S(sRRetrieve the current cursor position from the active UI element. N(RR"R R(Rtcursor((smain_window.pyR"bs  c Cs |jjƒ}|d}|d}td||ddƒ}t|d|jd|jjƒ|_|jjd|ddƒ}|jj|ddddƒ}|jj|ddd|dƒ}|||g|j_|jj |jjƒtd|dddƒ}t|d|jd|jj ƒ|_ t|d|dddƒ} t| ddd|jƒ|_ |j |_ t| j d| jd d d| j dƒ} t| d |j d|jjd |jjƒ|_td|d|ddƒ} t| d|jƒ|_|jƒd S(ssCreate the InnerWindows representing the header, footer/border, error line, and main central_area iit color_themetcoloriit border_sizei iitwindowthighlight_colorN(ii(RRRRR tborderRtderwint more_windowst set_colorRRRtlinestcolumnsRt error_msgRRRt reset_actions( Rt window_sizet win_size_yt win_size_xt footer_areattoptlefttrightt header_areatcentral_win_areatpopup_win_areat error_area((smain_window.pyRls8  #     cCs<g|jD]}tj|ƒ^q }||_|jƒdS(sqReset the actions to the defaults, clearing any custom actions registered by individual screens N(RtcopyRtset_default_actions(RtactionR((smain_window.pyR2Žs% cCs|jtjS(N(RR tKEY_F2(R((smain_window.pytcontinue_action™scCs|jtjS(N(RR tKEY_F3(R((smain_window.pyt back_actionscCs|jtjS(N(RR tKEY_F6(R((smain_window.pyt help_action¡scCs|jtjS(N(RR tKEY_F9(R((smain_window.pyt quit_action¥scCsB|jjƒ|jjƒ|jjƒ|jjƒ|jƒdS(s*Clear all InnerWindows and reset_actions()N(RtclearRRRt clear_errR2(R((smain_window.pyRI©s     cCs9t||jjjdƒ}|jj|ƒ||_dS(sSet the header_textiN(RRtareaR0tadd_textR(Rt header_textttext((smain_window.pytset_header_text±scCs1i|_x!|jD]}||j|jR t&solaris_install.terminalui.color_themeRt'solaris_install.terminalui.error_windowRtsolaris_install.terminalui.i18nRRRt'solaris_install.terminalui.inner_windowRt$solaris_install.terminalui.list_itemRt(solaris_install.terminalui.scroll_windowRt&solaris_install.terminalui.window_areaRtobjectR (((smain_window.pyts