ó ur™Vc@s‚dZddlmZddlmZdefd„ƒYZdefd„ƒYZdefd „ƒYZd e fd „ƒYZ d S( s3 Common screen functionality for text installer UI iÿÿÿÿ(t_(t InnerWindowt QuitExceptioncBseZdZRS(sDRaised when a function needs to force the program to quit gracefully(t__name__t __module__t__doc__(((sbase_screen.pyR!st SkipExceptioncBseZdZRS(s.Raised to signal this screen should be skipped(RRR(((sbase_screen.pyR&st UIMessagecBs#eZdZd„ZeeƒZRS(s6Exception class for passing an error message to the UIcCs)|jr!|jdr!|jdSdSdS(Nit(targs(tself((sbase_screen.pyt get_message.s (RRRR tpropertytmessage(((sbase_screen.pyR+s t BaseScreencBs×eZdZdZdZdZdZdZde dƒfZ dZ e d„ƒZ d„Zd„Zd„ZeeƒZeeƒZd„Zd „Zd „Zd „Zd „Zd „Zd„Zd„Zd„ZRS(s!Abstract base class for screens, providing some common functionality for all screens. HEADER_TEXT: Default header text for this screen. Screens which have permanent, static headers can define this variable at the class level. Dynamically titled screens should set the default here, and override self.header_text at the instance level as needed. HELP_DATA: This should be a tuple of length two wherein the first item in the tuple is the full path to a text file containing help information, and the second item is the title that should be displayed when that help file is loaded. To support alternate languages, the path name should contain a single '%s', which will get replaced with the current language, and the second item should be "gettext'ed". For example: ("/path/to/file/%s/filename.txt", _("File Title")) HELP_FORMAT: The help title (second item in the HELP_DATA tuple) can be indented by replacing the default with " %s" (or multiple tabs). Generally, the default is sufficient. s DEFAULT TEXTsNo Help Availables%scCs(||_||_||_||_dS(N(tCONFIRM_QUIT_HEADERt QUIT_TEXTt CANCEL_BUTTONtCONFIRM_BUTTON(tclstheadertbodytcanceltconfirm((sbase_screen.pytset_default_quit_textWs   cCs³t|j|j|j|jfƒs=td|jjƒ‚nd|_||_ |j j |_ |j j j ƒ|_|j|_d|_|j|_|j|_tjg|_dS(s0Set main_win and store win_size_y and win_size_xsNBaseScreen.set_default_quit_text() must be run before instantiating %s objectsRiN(ii(tallRRRRt ValueErrort __class__Rtinstancetmain_wint central_areat center_wintwindowtgetmaxyxt _win_sizet HEADER_TEXTt header_textt orig_bordert HELP_DATAt help_datat HELP_FORMATt help_formatRt REPAINT_KEYt redraw_keys(R R((sbase_screen.pyt__init__^s      cCs|jd|jjddS(s>Return the window size, adjusted based on the specified borderii(R"Rt border_size(R ((sbase_screen.pytget_win_size_ysscCs|jd|jjddS(s>Return the window size, adjusted based on the specified borderii(R"RR-(R ((sbase_screen.pytget_win_size_xwscCsdS(s‚Subclasses of BaseScreen should override this function to add/remove Actions from their attached main_win object N((R ((sbase_screen.pyt set_actions~scCsÃ|jj|_zy\|jjƒ|jƒ|jjƒ|jj|jƒ|j ƒ|jj ƒ|j ƒSWn:t k r„‚n't k rª|jjj|dtƒSXWd|j|j_XdS(s]Wrapper method for common entry/exit functionality into _show. This method performs the common tasks of clearing the main_win of the previous screen's objects, resetting and setting the actions, and setting the header_text. This method then call's _show, which should be overridden by the subclass. tskippedN(RR-R%RtclearR0t show_actionstset_header_textR$t_showt do_updatet validate_loopRRt screen_listtget_nexttTrue(R ((sbase_screen.pytshow…s        cCstdƒ‚dS(s”Abstract base method. Subclasses should override this method to set-up any lists, editable fields, or text relevant to this screen s+Subclasses must override the '_show' methodN(tNotImplementedError(R ((sbase_screen.pyR5¡scCst}xì|rô|jj|ƒ}|jjjƒ|kr½||jjjkr½y|jƒt}|jƒWqñt k r¹}|jjj ƒt |ƒ}|rº|jj j |ƒqºqñXq |dkrá|jƒrñt‚qñq t}|jƒq W|jƒ|jjƒ|S(s Validation loop. Runs main_win.process_input to accept user input while the screen is active. When the user tries to move to another screen, validate (if moving onward), save state by calling on_change_screen and either on_prev or on_continue. N(R:Rt process_inputR8t peek_lastthelptvalidatetFalset on_continueRtprevious_screentunicodet error_linet display_errtNonet confirm_quitRton_prevton_change_screenRt make_inactive(R tcontinue_validatet next_screentmsgt error_str((sbase_screen.pyR7©s,        cCs%|jjtjtjtjtjƒS(s©Confirm the user truly wants to quit. Can be overridden by sub-classes needing to do any clean-up, such as signaling other threads to shutdown. (Rtpop_upRRRRR(R ((sbase_screen.pyRHÈscCsdS(sr This function is called whenever the user tries to continue forward. Screens should override this function to do any final checks for data validity. If any problems are found, a UIMessage should be raised, with a string indicating the issue. The string will be displayed to the screen (and must be 78 characters or less) N((R ((sbase_screen.pyR@ÓscCsdS(s Called prior to leaving this screen, but only if quitting or moving to the prior screen. This function should be overridden if data needs to be preserved differently if the user is going 'back' instead of 'forward' N((R ((sbase_screen.pyRIÝscCsdS(së Called prior to leaving this screen, but only if moving to the next screen. This function should be overridden if data needs to be preserved differently if the user is going 'forward' instead of 'back' N((R ((sbase_screen.pyRBæscCsdS(sé Called prior to leaving this screen, regardless of direction. Most data preservation should be done here, unless the data needs to be handled differently depending on the direction the user is going. N((R ((sbase_screen.pyRJîsN(RRRR#RGRRRRRR&R(t classmethodRR,R.R/R t win_size_xt win_size_yR0R;R5R7RHR@RIRBRJ(((sbase_screen.pyR7s.          N( Rtsolaris_install.terminaluiRt'solaris_install.terminalui.inner_windowRt StandardErrorRRRtobjectR(((sbase_screen.pyts