/snap/core22/2437/usr/share/subiquity/subiquitycore/ui/__pycache__
NameSizeModeActions
actionmenu.cpython-310.pyc46350644editdlrm
anchors.cpython-310.pyc15870644editdlrm
buttons.cpython-310.pyc16350644editdlrm
container.cpython-310.pyc126220644editdlrm
form.cpython-310.pyc161050644editdlrm
frame.cpython-310.pyc17130644editdlrm
interactive.cpython-310.pyc36110644editdlrm
selector.cpython-310.pyc79160644editdlrm
spinner.cpython-310.pyc16740644editdlrm
stretchy.cpython-310.pyc56220644editdlrm
table.cpython-310.pyc139490644editdlrm
utils.cpython-310.pyc105380644editdlrm
width.cpython-310.pyc11300644editdlrm
__init__.cpython-310.pyc1790644editdlrm
Edit: /snap/core22/2437/usr/share/subiquity/subiquitycore/ui/__pycache__/utils.cpython-310.pyc (10538B)
o K^)@s~dZddlmZddlZddlmZmZmZmZm Z m Z m Z m Z mZmZddlmZmZddlmZmZmZddlmZddlmZdd lmZdd lmZed Z d d Z!e!GdddZ e"gdZ#ddZ$e$GdddZ%dde#e"dgBDZ&ddZ'ddZ(ddZ)  d0dd Z*Gd!d"d"eZ+Gd#d$d$e Z, & 'd1d(d)Z-d*d+Z.Gd,d-d-eZ/Gd.d/d/eZ0dS)2z UI utilities ) partialmethodN) ACTIVATEAttrMapCompositeCanvasconnect_signalLineBoxPaddingSelectableIconTextWidgetDecoration WidgetDisable) cancel_btn other_btn)ListBoxPile WidgetWrap)Spinner)Stretchy)TableRow) widget_widthzsubiquitycore.ui.utilsc Csd}td|D][}t|d|tt|dt|d|tt|dt|d|ttd||d t|d |ttdd |fd t|d |ttdd |fd t|d|ttdd |fd q|S)aT Decorator for generating useful padding methods Loops through and generates methods like: Padding.push_1(Widget) Sets the left padding attribute by 1 Padding.pull_24(Widget) Sets right padding attribute by 24. Padding.center_50(Widget) Provides center padding with a relative width of 50 dzpush_{})leftzpull_{})rightzfixed_{}center)alignwidth min_widthz center_{}relative)rrzleft_{}rzright_{}r)rangesetattrformatr_Padding)cls padding_countir&./usr/share/subiquity/subiquitycore/ui/utils.py apply_padders3s2    r(c@seZdZdZeeZdS)rau Padding methods .. py:meth:: push_X(:class:`urwid.Widget`) This method supports padding the left side of the widget from 1-99, for example: .. code:: Padding.push_20(Text("This will be indented 20 columns") .. py:meth:: pull_X(:class:`urwid.Widget`) This method supports padding the right side of the widget from 1-99, for example: .. code:: Padding.pull_20(Text("This will be right indented 20 columns") .. py:meth:: fixed_X(:class:`urwid.Widget`) This method supports padding the widget to a fixed size and centering it. from 1-99, for example: .. code:: Padding.fixed_20(Text("This will be centered and fixed sized of 20 columns")) .. py:meth:: center_X(:class:`urwid.Widget`) This method centers a widget with X being the relative width of the widget. .. code:: Padding.center_10(Text("This will be centered with a " "width of 10 columns")) .. py:meth:: left_X(:class:`urwid.Widget`) This method aligns a widget left with X being the relative width of the widget. .. code:: Padding.left_10(Text("This will be left aligned with a " "width of 10 columns")) .. py:meth:: right_X(:class:`urwid.Widget`) This method right aligns a widget with X being the relative width of the widget. .. code:: Padding.right_10(Text("This will be right aligned with a " "width of 10 columns")) N)__name__ __module__ __qualname____doc__rr line_breakr&r&r&r'rXs >r)bodyzdanger_button focus danger_buttonzdone_button focus done_buttonzframe_button focus frame_button frame_headerframe_header_fringe info_error info_minor info_primarymenu_button focus menu_buttonzother_button focus other_buttonprogress_completeprogress_incompletezscrollbar focus scrollbarzstring_input focus string_inputc CsJtD] }|d}|tvrt||tt||dqt||tt|dq|S)z Applies AttrMap attributes to Color class Eg: Color.frame_header(Text("I'm text in the Orange frame header")) Color.body(Text("Im text in wrapped with the body color")) z focus)attr_map focus_map)r>) STYLE_NAMESr rr)r#kkfr&r&r'apply_style_maps rCc@seZdZdZdS)ColoraZ Partial methods for :class:`~subiquity.palette.STYLES` .. py:meth:: frame_header(:class:`urwid.Widget`) This method colors widget based on the style map used. .. code:: Color.frame_header(Text("This will use foreground and background " "defined from the STYLES attribute")) N)r)r*r+r,r&r&r&r'rDs rDcCsi|]}|dqS)r5r&).0rAr&r&r' srFcCstt|tSN)r r_disable_everything_mapwr&r&r'disabledrKcCs$t|tr|j}t|tr|j}|SrG) isinstancer original_widgetrrIr&r&r' undisableds  rOcCs0d}|D] }tt||}qtt|||ddS)Nr)rrr)maxrr"r)buttonsrbuttonr&r&r' button_piles  rTTFcCst|tr t|}|rt|}|durd}n t|tr t|}g}|dur2dt|fdtdfg}|dtdfg}|durK|d|fdtdfgt||}|rZt |d|_ tj |ddS)a_Helper to create a common screen layout. The commonest screen layout in subiquity is: [ 1 line padding (optional) ] excerpt (optional) [ 1 line padding ] Box widget (usually a ListBox) [ 1 line padding ] a button_pile [ 1 line padding ] This helper makes creating this a 1-liner. NFpackL)r) rMlistrr center_63rTr extendrlenfocus_position center_79)rowsrR focus_buttonsexcerpt narrow_rows excerpt_rowsr.piler&r&r'screens2        recsHeZdZdZdZdfdd ZddZdd Zd d Zdd dZ Z S)CursorOverridezKDecoration to override where the cursor goes when a widget is focused. Trcst|||_dSrG)super__init__cursor_x)selfrJri __class__r&r'rh$s  zCursorOverride.__init__cCs |jdfS)Nrri)rjsizer&r&r'get_cursor_coords(s z CursorOverride.get_cursor_coordscC|j||SrG)_original_widgetr_rjrnfocusr&r&r'r_+rLzCursorOverride.rowscCrprG)rqkeypressrrr&r&r'rt.rLzCursorOverride.keypressFcCs*|j||}|rt|}|||_|SrG)rqrenderrrocursor)rjrnrscr&r&r'ru1s  zCursorOverride.render)r)F) r)r*r+r,has_original_widthrhror_rtru __classcell__r&r&rkr'rfsrfc@seZdZdZdgZddZdS) ClickableIconzLike Button, but simpler. clickcCs |j|tkr |S|ddS)Nr{) _command_mapr_emit)rjrnkeyr&r&r'rt>szClickableIcon.keypressN)r)r*r+r,signalsrtr&r&r&r'rz:s rzr8r7rWcspt|}tts dittsditt||dt|dfddt|dfddS)Nrmopenc SrG set_attr_mapmenu)amr?r&r'O z&make_action_menu_row..closecrrGrr)rr>r&r'rPr)rrMdictrrfr)cellsrr>r?rirowr&)rr>r?r'make_action_menu_rowDs  rcCs"|d}ddd|DS)Nz cSsg|]}|ddqS)  )replace)rEpr&r&r' Vszrewrap..)splitjoinstrip)textparasr&r&r'rewrapTs rcs$eZdZfddZddZZS)SomethingFailedcsX||_ttd|jd}t|tdt|dtdt|gg}td|dddS)NCloselabelon_pressrVrrW) parentr_rr rrTrgrh)rjrmsgstderrokwidgetsrkr&r'rhZs zSomethingFailed.__init__cCs|jdSrG)rremove_overlayrjsenderr&r&r'rirLzSomethingFailed.closer)r*r+rhrryr&r&rkr'rYs rcs&eZdZfddZdddZZS) LoadingDialogcs||_t|dd|_|jd|_t|d|_dtd|fd|jfg}|dur@||_t t d|j d}| dt |gfttt|dS) Ndots)styleFrrUrCancelr)rrspinnerstartclosedr\rr task_to_cancelr rrappendrTrgrhrr)rjraio_looprrrcancelrkr&r'rhos zLoadingDialog.__init__NcCs:|jrdS|dur|jd|_|j|jdS)NT)rrrrstoprrrr&r&r'rs  zLoadingDialog.closerGrr&r&rkr'rms r)NTNF)r8r7rW)1r, functoolsrloggingurwidrrrrrrr"r r r r subiquitycore.ui.buttonsr rsubiquitycore.ui.containerrrrsubiquitycore.ui.spinnerrsubiquitycore.ui.stretchyrsubiquitycore.ui.tablersubiquitycore.ui.widthr getLoggerlogr(setr@rCrDrHrKrOrTrerfrzrrrrr&r&r&r'sB 0      % E -