+
     i(  c                  s@   R t ^ RIHt ^ RIHt ^ RIHtHtHtH	t	H
t
HtHt ^ RIt^ RIHtHtHtHtHtHtHtHt ^ RIHtHtHt ^ RIHtHt ^ RIHtH t  ^ R	I!H"t"H#t# ^ R
I$H%t% ^ RI&H't' ^ RI(H)t) ^ RI*H+t+ ^ RI,H-t-H.t. ^ RI/H0t0H1t1H2t2 ^ RI3H4t4H5t5 ^ RI6H7t7 ^ RI8H9t9 ^ RI:H;t; ]]<]3,          t=]+! R4      t>]%P~                  R]%P                  R]%P                  R]%P                  R]%P                  R]%P                  R/tE]%P                  ]%P                  ]%P~                  ]%P                  ]%P                  ]%P                  .tF ! R R4      tG ! R R4      tH ! R R]P                  4      tJ ! R  R!4      tK ! R" R#4      tL ! R$ R%4      tM ! R& R'4      tN ! R( R)4      tO ! R* R+4      tP ! R, R-4      tQ ! R. R/]P                  4      tR ! R0 R14      tS ! R2 R34      tT ! R4 R54      tU ! R6 R74      tV ! R8 R94      tW ! R: R;4      tX ! R< R=4      tY ! R> R?4      tZ ! R@ RA4      t[R# )Bz,All components that control a single preset.)annotations)defaultdict)ListOptionalDictUnionCallableLiteralSetN)EV_KEYEV_ABSEV_RELBTN_LEFT
BTN_MIDDLE	BTN_RIGHT	BTN_EXTRABTN_SIDE)Gtk	GtkSourceGdk)InputCombinationInputConfig)keyboard_layoutXKB_KEYCODE_OFFSET)MappingDataMappingType)
DeviceType)OutputTypeNames)
Controller)_)MessageBrokerMessageType)UInputsData
PresetDataCombinationUpdate)HandlerDisabledColors)Transformation)
InputEvent)get_evdev_constant_namezRecord the input firstzinput-gamingzinput-mousezinput-keyboardzinput-tabletzinput-touchpadc                  sZ    ] tR t^Wt$ RtRtR]R&   R R ltR tR R	 lt	R
 R lt
R tRtR# )TargetSelectionzjThe dropdown menu to select the targe_uinput of the active_mapping,

For example "keyboard" or "gamepad".
NzOptional[MappingData]_mappingc               $    V ^8  d   QhRRRRRR/# )   message_brokerr   
controllerr   comboboxGtk.ComboBox Zformat   "H/usr/lib/python3.14/site-packages/inputremapper/gui/components/editor.py__annotate__TargetSelection.__annotate___   s-     C C%C C 	C    c                	sF   Wn         W n        W0n        V P                   P                  \        P
                  V P                  4       V P                   P                  \        P                  V P                  4       V P                  P                  R V P                  4       R# )changedN)_message_broker_controller_gui	subscriber   uinputs_on_uinputs_changedmapping_on_mapping_loadedconnect_on_gtk_target_selected)selfr,   r-   r.      &&&&r3   __init__ZTargetSelection.__init___   ss      .%	&&{':':D<T<TU&&{':':D<S<ST		)T%A%ABr6   c                s   V P                   ec   \        V P                  V P                  4      ;_uu_ 4        V P                  P	                  V P                   P
                  4       RRR4       R# R#   + '       g   i     R# ; i)z'Select the currently configured target.N)r)   r#   r:   rA   set_active_idtarget_uinputrB      &r3   _select_current_targetZ&TargetSelection._select_current_targetm   sW    ==$ D,H,HII		''(C(CD JI %IIIs   0A33B	c                   V ^8  d   QhRR/# )r+   datar    r0   r1   r2   r3   r4   r5   s   s     & & &r6   c                	s   \         P                  ! \        4      pVP                  P	                  4        F  pVP                  V.4       K  	  V P                  P                  V4       \         P                  ! 4       pV P                  P                  VR 4       V P                  P                  VR^ 4       V P                  P                  ^ 4       V P                  4        R# )FtextN)r   	ListStorestrr<   Zkeysappendr:   	set_modelCellRendererText
pack_startadd_attributeset_id_columnrI   )rB   rK   Ztarget_storeZuinputrenderer_text   &&   r3   r=   Z#TargetSelection._on_uinputs_changeds   s    }}S)ll'')F) * 			L),,.		]E2		vq9		"##%r6   c               rJ   r+   r>   r   r0   r1   r2   r3   r4   r5      s     & &+ &r6   c                	2    Wn         V P                  4        R # N)r)   rI   rB   r>      &&r3   r?   Z"TargetSelection._on_mapping_loaded   s    ##%r6   c                	sr    V P                   P                  4       pV P                  P                  VR 7       R# ))rF   N)r:   get_active_idr9   update_mapping)rB   r   target   &* r3   rA   Z'TargetSelection._on_gtk_target_selected   s+    ((*''f'=r6   )r9   r:   r)   r8   )__name__
__module____qualname____firstlineno____doc__r)   __annotations__rD   rI   r=   r?   rA   __static_attributes__r0   r6   r3   r(   r(   W   s/    
 '+H#*CE&&>r6   r(   c                  s`    ] tR t^tRtR R lt]R R l4       tR R ltR R	 lt	R
 R lt
RtR# )MappingListBoxz?The listbox showing all available mapping in the active_preset.c               r*   r+   r,   r   r-   r   listboxzGtk.ListBoxr0   r1   r2   r3   r4   MappingListBox.__annotate__   s-     I I%I I 	Ir6   c                	s   Wn         W n        W0n        V P                  P                  V P                  4       V P                   P                  \        P                  V P                  4       V P                   P                  \        P                  V P                  4       V P                  P                  R V P                  4       R# )row-selectedN)r8   r9   r:   Zset_sort_func
_sort_funcr;   r   preset_on_preset_changedr>   _on_mapping_changedr@   _on_gtk_mapping_selectedrB   r,   r-   ri   rC   r3   rD   ZMappingListBox.__init__   s      .%			0&&{'9'94;R;RS&&{':':D<T<TU		.$*G*GHr6   c               s$    V ^8  d   QhRRRRRR/# )r+   row1MappingSelectionLabelrow2returnintr0   r1   r2   r3   r4   rj      s$     1 1. 16K 1PS 1r6   c                s    V P                   \        P                  ! 4       8X  d   ^# VP                   \        P                  ! 4       8X  d   ^ # V P                  VP                  8  d   ^ # ^# )zSort alphanumerical by name.)combinationr   Zempty_combinationname)rr   rt   r[   r3   rl   ZMappingListBox._sort_func   sT     /AACC/AACCII		)q0q0r6   c               rJ   r+   rK   r!   r0   r1   r2   r3   r4   rj      s     $ $z $r6   c                	s   V P                   P                  4       pV F.  pVP                  4        V P                   P                  V4       K0  	  VP                  '       g   R # VP                   FY  p\        V P                  V P                  VP                  4       VP                  4      pV P                   P                  VR4       K[  	  V P                   P                  4        R # N)r:   get_childrencleanupremovemappingsrs   r8   r9   format_nameinput_combinationinsertinvalidate_sort)rB   rK   Zselection_labelsZselection_labelr>   rV   r3   rn   Z!MappingListBox._on_preset_changed   s    99113/O##%II_-  0 }}}}}G3$$  ##%))	O II_b1 % 			!!#r6   c               rJ   rW   r0   r1   r2   r3   r4   rj      s     . .; .r6   c                	sF   \        V P                  V P                  4      ;_uu_ 4        VP                  pV P                  P	                  4        F1  pVP
                  V8X  g   K  V P                  P                  V4       K3  	  R R R 4       R #   + '       g   i     R # ; irY   )r#   r:   rp   r   r|   rw   
select_row)rB   r>   rw   row   &&  r3   ro   Z"MappingListBox._on_mapping_changed   si    TYY(E(EFF!33Kyy--/??k1II((- 0 GFFFs   8B&BB 	c               rJ   )r+   r   zOptional[MappingSelectionLabel]r0   r1   r2   r3   r4   rj      s     7 7/N 7r6   c                	sd    V'       g   R # V P                   P                  VP                  4       R # rY   )r9   Zload_mappingrw   rB   r   r      &&&r3   rp   Z'MappingListBox._on_gtk_mapping_selected   s     %%coo6r6   r9   r:   r8   N)r`   ra   rb   rc   rd   rD   Zstaticmethodrl   rn   ro   rp   rf   r0   r6   r3   rg   rg      s3    II 1 1$&.7 7r6   rg   c                  s   a  ] tR t^tRtR tR V 3R lltR tR tR t	R t
R tR	 R
 ltR R ltR tR R ltR R ltRtV ;t# )rs   z@The ListBoxRow representing a mapping inside the MappingListBox.c               s(    V ^8  d   QhRRRRRRRR/# )	r+   r,   r   r-   r   rx   Optional[str]rw   r   r0   r1   r2   r3   r4   "MappingSelectionLabel.__annotate__   s8     A A%A A 	A
 &Ar6   c                	s
  < \         SV `  4        Wn        W n        V'       g   VP	                  4       pW0n        W@n        V P                  R V P                  4       \        P                  ! 4       V n        V P                  P                  R4       V P                  P                  \        P                  P                  4       V P                  P!                  \        P"                  P$                  4       V P                  P'                  V P
                  4       V P                  P)                  ^4       V P                  P+                  ^4       \        P,                  ! 4       V n        V P.                  P1                  \        P2                  P4                  4       V P.                  P7                  \        P8                  P;                  \        P<                  \        P>                  P@                  4      4       V P.                  PC                  \E        R4      R,           4       V P.                  P)                  ^4       V P.                  P+                  ^4       V P.                  P                  RV PF                  4       \        PH                  ! 4       V n%        V PJ                  PM                  V P
                  4       V PJ                  PO                  \        PP                  PR                  4       V PJ                  P)                  ^4       V PJ                  P+                  ^4       V PJ                  P                  RV PT                  4       V PJ                  P                  R V PV                  4       \        PX                  ! \        PZ                  P\                  R7      V n/        V P^                  Pa                  V P                  4       V P^                  Pc                  V P.                  4       V P^                  Pe                  V P.                  RR^\        Pf                  Ph                  4       V P^                  Pc                  V PJ                  4       V P^                  Pe                  V PJ                  RR^\        Pf                  Pj                  4       V Pc                  V P^                  4       V Pm                  4        V P                  Po                  \p        Pr                  V Pt                  4       V P                  Po                  \p        Pv                  V Px                  4       V P.                  P{                  4        V PJ                  P{                  4        R# )	key-press-eventTzChange Mapping Namez (F2)clickedZactivateorientationFN)>superrD   r8   r9   beautifyrx   rw   r@   _on_key_pressr   LabellabelZset_line_wrapZset_line_wrap_modeZWrapModeZWORDZset_justifyZJustificationZCENTER	set_labelZset_margin_topZset_margin_bottomButtonedit_btn
set_reliefReliefStyleNONEZ	set_imageImagenew_from_icon_nameZ
STOCK_EDITIconSizeZMENUset_tooltip_textr   _set_edit_modeZEntry
name_inputset_text
set_halignAlignZFILL_on_gtk_rename_finished_on_gtk_rename_abortBoxOrientation
HORIZONTAL_boxZset_center_widgetaddZset_child_packingZPackTypeENDZSTARTshow_allr;   r   r>   ro   Zcombination_update_on_combination_updatehide)rB   r,   r-   rx   rw   	__class__s   &&&&&r3   rD   ZMappingSelectionLabel.__init__   s^    	-%'')D	&&(:(:; YY[


  &

%%cll&7&78

s00778

TYY'

!!"%

$$R( 

  !5!56II((9J9JK	
 	&&q)>'?''IJ$$Q'''*i)<)<=))+  +""399>>2&&q)))!,
D,H,HI 143L3LMGG(B(BC			##DJJ/		dmm$		##DMM5%CLLDTDTU		doo&		##DOOT4CLLDVDVW&&{':':D<T<TU&&**D,G,G	
 	r6   c           
     	sf    R V P                    RV P                   R\        \        V 4      4       R2# )z<MappingSelectionLabel for z as z at Z>)rw   rx   ZhexZidrG   rH   r3   __repr__ZMappingSelectionLabel.__repr__  s7    ,T-=-=,>d499+TRUVXY]V^R_Q``abbr6   c                	s    V P                   P                  4        V P                  P                  4        V P                  P	                  4        R # rY   )r   r   r   r   showrG   rH   r3   _set_not_selectedZ'MappingSelectionLabel._set_not_selected  s0    

r6   c                	s    V P                   P                  V P                  4       V P                  P	                  4        V P
                  P                  4        V P                   P	                  4        R # rY   )r   r   rx   r   r   r   r   rG   rH   r3   _set_selectedZ#MappingSelectionLabel._set_selected  sF    

TYY'

r6   c                	s   V P                   P                  V P                  4       V P                  P	                  4        V P                   P                  4        V P                  P                  V P                   4       R # rY   )r   r   rx   r   r   r   r9   	set_focusrB   r      &*r3   r   Z$MappingSelectionLabel._set_edit_mode  sN      +

""4??3r6   c                s"   V P                   P                  4       '       do   VP                  \        P                  8X  d   V P                  4        R# VP                  \        P                  8X  d   V P                  P                  4        R# R# R# )z4"Mapping Selection Row Label key handler for hotkeysN)	r   Z
is_visiblekeyvalr   ZKEY_F2r   Z
KEY_Deleter9   Zdelete_mapping)rB   widgeteventr   r3   r   Z#MappingSelectionLabel._on_key_press"  s]    ::  ""||szz)##%/  //1 0	 #r6   c               rJ   rW   r0   r1   r2   r3   r4   r   +  s     , ,; ,r6   c                	s    VP                   V P                  8w  d   V P                  4        R # VP                  4       V n        V P                  4        V P                  4       P                  4        R # rY   )r   rw   r   r   rx   r   Z
get_parentr   rZ   r[   r3   ro   Z)MappingSelectionLabel._on_mapping_changed+  sT    $$(8(88""$'')	))+r6   c               rJ   )r+   rK   r"   r0   r1   r2   r3   r4   r   3  s     4 4+< 4r6   c                	s    VP                   V P                  8X  d,   V P                  4       '       d   VP                  V n        R # R # R # rY   )Zold_combinationrw   is_selectedZnew_combinationrB   rK   r[   r3   r   Z,MappingSelectionLabel._on_combination_update3  s;    4#3#338H8H8J8J#33D 9K3r6   c                	s4   V P                   P                  4       pVP                  4       P                  4       V P                  P                  4       P                  4       8X  d   R pW n        V P                  4        V P                  P                  VR7       R# ) )rx   N)
r   get_textlowerstriprw   r   rx   r   r9   r]   )rB   r   rx   r_   r3   r   Z-MappingSelectionLabel._on_gtk_rename_finished7  sp    '')::<4#3#3#<#<#>#D#D#FFD	''T'2r6   c               rJ   )r+   	key_eventzGdk.EventKeyr0   r1   r2   r3   r4   r   ?  s     ! ! !r6   c                	sh    VP                   \        P                  8X  d   V P                  4        R # R # rY   )r   r   Z
KEY_Escaper   )rB   r   r   r   r3   r   Z*MappingSelectionLabel._on_gtk_rename_abort?  s%    s~~-  .r6   c               rJ   )r+   ru   Noner0   r1   r2   r3   r4   r   C  s     F F Fr6   c                s    V P                   P                  V P                  4       V P                   P                  V P                  4       R# )z=Clean up message listeners. Execute before removing from gui!N)r8   Zunsubscribero   r   rG   rH   r3   r}   ZMappingSelectionLabel.cleanupC  s6    (()A)AB(()D)DEr6   )r   r9   r8   rw   r   r   rx   r   )r`   ra   rb   rc   rd   __gtype_name__rD   r   r   r   r   r   ro   r   r   r   r}   rf   __classcell__r      @r3   rs   rs      sR    J,NA AFc
42,43!F Fr6   rs   c                  s   a  ] tR tRt$ RtR]R&   R]R&   R tR V 3R lltR	 R
 ltR R lt	R R lt
R R ltR tR R ltRtV ;t# )GdkEventRecorderiI  zKRecords events delivered by GDK, similar to the ReaderService/ReaderClient.z	List[int]_combinationzSet[int]_pressedc                    V ^8  d   QhRRRR/# )r+   windowz
Gtk.Windowgui	Gtk.Labelr0   r1   r2   r3   r4   GdkEventRecorder.__annotate__Q  s     4 4z 4	 4r6   c                	s   < \         SV `  4        . V n        \        4       V n        W n        VP                  R V P                  4       R# )r   N)r   rD   r   setr   r:   r@   _on_gtk_event)rB   r   r   r   s   &&&r3   rD   ZGdkEventRecorder.__init__Q  s8    	w 2 23r6   c               rJ   r+   r   z	Gdk.Eventr0   r1   r2   r3   r4   r   X  s     ) )i )r6   c           
     s    \         P                  \        \         P                  \        \         P
                  \        ^	\        ^\        /P                  VP                  4       P                  4      # )z'Get the evdev code for the given event.)r   ZBUTTON_MIDDLEr   ZBUTTON_PRIMARYr   ZBUTTON_SECONDARYr   r   r   getZ
get_buttonZbuttonrB   r   r[   r3   _get_button_codeZ!GdkEventRecorder._get_button_codeX  sT     z  )yx
 #e ''
(	)r6   c               rJ   r   r0   r1   r2   r3   r4   r   b  s     
# 
#I 
#r6   c                s    VP                   pV\        P                  P                  \        P                  P                  39   p\        V P                  4      ^ 8X  d   V'       d
   . V n        R# R# R# )z8If a new combination is being typed, start from scratch.N)typer   	EventType	KEY_PRESSBUTTON_PRESSlenr   r   )rB   r   gdk_event_typeis_pressr   r3   _resetZGdkEventRecorder._resetb  sY    #jj!MM##MM&&&
 

 t}}"x "D (0"r6   c               rJ   r   r0   r1   r2   r3   r4   r   n  s     $ $I $r6   c                s   VP                   pV\        P                  P                  8X  d^   VP                  \
        ,
          pW0P                  9  d   V P                  P                  V4       V P                  P                  V4       V\        P                  P                  8X  dZ   V P                  V4      pW0P                  9  d   V P                  P                  V4       V P                  P                  V4       R# R# )z/Remember pressed keys, write down combinations.N)r   r   r   r   Zhardware_keycoder   r   rO   r   r   r   r   )rB   r   r   coder   r3   _pressZGdkEventRecorder._pressn  s    #jjS]]444)),>>D,,,!!((.MMd#S]]777((/D,,,!!((.MMd# 8r6   c               rJ   r   r0   r1   r2   r3   r4   r     s     " "i "r6   c                s    VP                   \        P                  P                  \        P                  P                  39   d   \        4       V n        R# R# )z.Clear pressed keys if this is a release event.N)r   r   r   ZKEY_RELEASEZBUTTON_RELEASEr   r   r   r[   r3   _releaseZGdkEventRecorder._release  s6    ::#--33S]]5Q5QRREDM Sr6   c                s   VP                   \        P                  P                  \        P                  P                  39   pV'       d   \        V P                  4      ^ 8  d|   V P                   Uu. uF9  pVf   K	  \        P                  ! V4      f   K#  \        P                  ! V4      NK;  	  ppV P                  P                  RP                  V4      4       R# R# R# u upi )z)Show the recorded combination in the gui.Nz + )r   r   r   r   r   r   r   r   Zget_namer:   r   Zjoin)rB   r   r   r   ZnamesrV   r3   _displayZGdkEventRecorder._display  s    ::MM##MM&&"
 

 D--.2 !---D /(7(@(@(F /((.-  
 IIuzz%01 38s   2C#=C#C#c               rJ   r   r0   r1   r2   r3   r4   r     s      i r6   c                s    V P                  V4       V P                  V4       V P                  V4       V P                  V4       R# )z3For all sorts of input events that gtk cares about.N)r   r   r   r   )rB   r   r   r   r3   r   ZGdkEventRecorder._on_gtk_event  s2    EeEer6   )r   r:   r   )r`   ra   rb   rc   rd   re   r   rD   r   r   r   r   r   r   rf   r   r   r   r3   r   r   I  sD    U'N4 4)
#$$"
2 r6   r   c                  s    ] tR tRt$ Rt]! R4      tR]R&   R R ltR t	R	 t
]R
 R l4       t]P                  R R l4       tR tR tR tR R ltR tRtR# )
CodeEditori  z@The editor used to edit the output_symbol of the active_mapping.zEnter your output hererN   placeholderc               r*   )r+   r,   r   r-   r   editorzGtkSource.Viewr0   r1   r2   r3   r4   CodeEditor.__annotate__  s(      )  )% )  ) 	 )r6   c                	s   Wn         W n        W0n        V P                  P                  \        P
                  P                  4       V P                  4        V P                  P                  4       P                  R V P                  4       V P                  P                  RV P                  4       V P                  P                  RV P                  4       V P                  4        R# )r7   zfocus-in-eventzfocus-out-eventN)r8   r9   r   Zset_resize_moder   Z
ResizeModeZ	IMMEDIATE_update_placeholder
get_bufferr@   _on_gtk_changed_connect_message_listener)rB   r,   r-   r   rC   r3   rD   ZCodeEditor.__init__  s      .% 	  !9!9: 	  "%%i1E1EF)4+C+CD*D,D,DE&&(r6   c                	s   V P                   P                  4       pVP                  VP                  4       VP	                  4       R 4      p\        W P                  4      ;_uu_ 4        V P                   P                  4       '       dL   W0P                  8X  d<   VP                  R4       V P                   P                  4       P                  R4       M|VR8X  dF   VP                  V P                  4       V P                   P                  4       P                  R4       M0VR8w  d*   V P                   P                  4       P                  R4       RRR4       R#   + '       g   i     R# ; i)Tr   zopaque-textN)r   r   r   get_start_iterget_end_iterr#   r   Z	has_focusr   r   get_style_contextremove_class	add_class)rB   r   bufferr   s   &*  r3   r   ZCodeEditor._update_placeholder  s    $$&v4468K8K8MtT V%9%9::xx!!##0@0@(@#**,99-H 0 01**,66}E**,99-H ;:::s   'C(EE*	c                	s    V P                   P                  4       pVP                  VP                  4       VP	                  4       R 4      pW P
                  8H  # )T)r   r   r   r   r   r   )rB   r   r   s   &  r3   _shows_placeholderZCodeEditor._shows_placeholder  sG    $$&v4468K8K8MtT''''r6   c               rJ   )r+   ru   rN   r0   r1   r2   r3   r4   r     s     U Uc Ur6   c                s    V P                  4       '       d   R# V P                  P                  4       pVP                  VP	                  4       VP                  4       R4      # )z'Get the user-defined macro code string.r   T)r   r   r   r   r   r   )rB   r      & r3   r   CodeEditor.code  sM     ""$$$$&v4468K8K8MtTTr6   c               r   )r+   r   rN   ru   r   r0   r1   r2   r3   r4   r     s     W W W Wr6   c                sp   V P                   P                  4       p\        W P                  4      ;_uu_ 4        VP	                  V4       V P                  4        V P                   P                  V P                   \        P                  P                  RR4       RRR4       R#   + '       g   i     R# ; i)z+Set the text without triggering any events.FNr{   )
r   r   r#   r   r   r   Zdo_move_cursorr   ZMovementStepZBUFFER_ENDS)rB   r   r      && r3   r   r     sw     $$&V%9%9::OOD!$$&HH##DHHc.>.>.J.JBPUV ;:::s   A"B$$B5	c                	s    V P                   P                  \        P                  V P                  4       V P                   P                  \        P
                  V P                  4       R # rY   )r8   r;   r   r>   r?   recording_finished_on_recording_finishedrG   rH   r3   r   Z$CodeEditor._connect_message_listener  sP    &&##	
 	&&**''	
r6   c                s   RV P                   9   d}   V P                  P                  R4       V P                  P                  R4       V P                  P	                  R4       V P                  P                  4       P                  R4       R# V P                  P                  R4       V P                  P                  R4       V P                  P	                  R4       V P                  P                  4       P                  R4       R# )z6Show line numbers if multiline, otherwise remove them.Z
TZ	multilineFN)r   r   Zset_show_line_numbersZset_show_line_marksZset_monospacer   r   r   rG   rH   r3   _toggle_line_numbersZCodeEditor._toggle_line_numbers  s    499HH**40HH((.HH""4(HH&&(22;?HH**51HH((/HH""5)HH&&(55kBr6   c                	s    V P                  4       '       d   R # V P                  P                  V P                  R7       R # )N)output_symbol)r   r9   r]   r   r   r   r3   r   ZCodeEditor._on_gtk_changed  s/    ""$$''dii'@r6   c               rJ   rW   r0   r1   r2   r3   r4   r   
  s     $ $+ $r6   c                	s<   \         pV P                  P                  4       '       g   VP                  ;'       g    R pV P                  P                  4       P                  4       VP                  4       P                  4       8w  d   W n        V P                  4        R# )r   N)SET_KEY_FIRSTr9   is_empty_mappingr   r   r   r   r   )rB   r>   r   r   r3   r?   ZCodeEditor._on_mapping_loaded
  sk    0022((..BD99??""$

(:(:(<<I!!#r6   c                	sP    V P                   P                  V P                  4       R # rY   )r9   r   r   r   r[   r3   r   Z!CodeEditor._on_recording_finished  s    ""488,r6   )r9   r8   r   r   N)r`   ra   rb   rc   rd   r   r   re   rD   r   r   Zpropertyr   Zsetterr   r   r   r?   r   rf   r0   r6   r3   r   r     sq    J12K2 )DI$(
 U U 
[[W W
CA$-r6   r   c                  sP    ] tR tRtRtR R ltR R ltR R ltR	 tR
 t	R t
RtR# )RequireActiveMappingi  z-Disable the widget if no mapping is selected.c               r*   )r+   r,   r   r   Gtk.ToggleButtonrequire_recorded_inputZboolr0   r1   r2   r3   r4   !RequireActiveMapping.__annotate__  s-     H H%H !H !%	Hr6   c                	s    W n         V P                   P                  4       V n        W0n        R V n        R V n        VP                  \        P                  V P                  4       VP                  \        P                  V P                  4       R # rY   )_widgetZget_tooltip_text_default_tooltip_require_recorded_input_active_preset_active_mappingr;   r   rm   
_on_presetr>   _on_mapping)rB   r,   r   r   rC   r3   rD   ZRequireActiveMapping.__init__  sj      $ = = ?'=$486:  !3!3T__E  !4!4d6F6FGr6   c               rJ   )r+   preset_datar!   r0   r1   r2   r3   r4   r   +  s      j r6   c                	rX   rY   )r   _check)rB   r  r[   r3   r  ZRequireActiveMapping._on_preset+  s    )r6   c               rJ   )r+   mapping_datar   r0   r1   r2   r3   r4   r   /  s       r6   c                	rX   rY   )r   r  )rB   r  r[   r3   r  Z RequireActiveMapping._on_mapping/  s    +r6   c                	s<   V P                   '       d%   \        V P                   P                  4      ^ 8X  d7   V P                  4        V P                  P                  \        R4      4       R# V P                  '       di   V P                  '       dW   V P                  P                  4       '       g7   V P                  4        V P                  P                  \        R4      4       R# V P                  4        V P                  P                  V P                  4       R# )i    zAdd a mapping firstNzRecord input first)r   r   r   _disabler   r   r   r   r   Zhas_input_defined_enabler   rB   Z__r   r3   r  ZRequireActiveMapping._check3  s    """c$*=*=*F*F&G1&LMMOLL))!,A*BC ((($$$((::<<MMOLL))!,@*AB%%d&;&;<r6   c                	sr    V P                   P                  R 4       V P                   P                  ^4       R# TNr   set_sensitiveset_opacityrG   rH   r3   r  ZRequireActiveMapping._enableE  s&    ""4(  #r6   c                	sr    V P                   P                  R 4       V P                   P                  R4       R# )F      ?Nr
  rG   rH   r3   r  ZRequireActiveMapping._disableI  s&    ""5)  %r6   )r   r   r   r   r   N)r`   ra   rb   rc   rd   rD   r  r  r  r  r  rf   r0   r6   r3   r   r     s$    7H =$$&r6   r   c                  2    ] tR tRtRtR R ltR tR tRtR# )	RecordingToggleiN  z>The toggle that starts input recording for the active_mapping.c               r*   )r+   r,   r   r-   r   toggler   r0   r1   r2   r3   r4   ZRecordingToggle.__annotate__Q  s(     
 
%
 
 !	
r6   c                	s   Wn         W n        W0n        VP                  R V P                  4       VP                  RR 4       V P                   P                  \        P                  V P                  4       \        VVRR7       R# )toggledr   c                 s"    \         P                  # rY   )r   Z
EVENT_STOP)Zargss   *r3   <lambda>Z*RecordingToggle.__init__.<locals>.<lambda>_  s    r6   F)r   N)
r8   r9   r:   r@   _on_gtk_toggler;   r   r   r   r   )rB   r,   r-   r  rC   r3   rD   ZRecordingToggle.__init__Q  st      .%	y$"5"56 	(*FG&&**''	

 	#(	
r6   c                	s    V P                   P                  4       '       d   V P                  P                  4        R # V P                  P	                  4        R # rY   )r:   
get_activer9   Zstart_key_recordingZstop_key_recordingr  r   r3   r  ZRecordingToggle._on_gtk_togglek  s9    99!!002//1r6   c                	s    \        V P                  V P                  4      ;_uu_ 4        V P                  P                  R 4       RRR4       R#   + '       g   i     R# ; iFN)r#   r:   r  
set_activer  r[   r3   r   Z&RecordingToggle._on_recording_finishedq  s:    TYY(;(;<<II  ' =<<<s   AA 	r   N)	r`   ra   rb   rc   rd   rD   r  r   rf   r0   r6   r3   r  r  N  s    H
42(r6   r  c                  r  )	RecordingStatusiv  z2Displays if keys are being recorded for a mapping.c               r   )r+   r,   r   r   r   r0   r1   r2   r3   r4   ZRecordingStatus.__annotate__y  s     
 
%
 
r6   c                	s    W n         VP                  \        P                  V P                  4       VP                  \        P
                  V P                  4       R # rY   )r:   r;   r   Zrecording_started_on_recording_startedr   r   )rB   r,   r   r   r3   rD   ZRecordingStatus.__init__y  sK    
 	  ))&&	

 	  **''	
r6   c                	<    V P                   P                  R 4       R# r	  r:   Zset_visibler   r[   r3   r  Z%RecordingStatus._on_recording_started  s    		d#r6   c                	r  r  r  r   r[   r3   r   Z&RecordingStatus._on_recording_finished  s    		e$r6   )r:   N)	r`   ra   rb   rc   rd   rD   r  r   rf   r0   r6   r3   r  r  v  s    <
"$%r6   r  c                  8    ] tR tRtRtR R ltR R ltR tRtR	# )
AutoloadSwitchi  zBThe switch used to toggle the autoload state of the active_preset.c               r*   r+   r,   r   r-   r   switch
Gtk.Switchr0   r1   r2   r3   r4   AutoloadSwitch.__annotate__  s)     T T+T9CTMWTr6   c                	    Wn         W n        W0n        V P                  P                  R V P                  4       V P                   P                  \        P                  V P                  4       R# 	state-setN)	r8   r9   r:   r@   r  r;   r   rm   rn   rB   r,   r-   r  rC   r3   rD   ZAutoloadSwitch.__init__  sQ      .%			+t':':;&&{'9'94;R;RSr6   c               rJ   ry   r0   r1   r2   r3   r4   r     s     0 0z 0r6   c                	    \        V P                  V P                  4      ;_uu_ 4        V P                  P                  VP                  4       R R R 4       R #   + '       g   i     R # ; irY   )r#   r:   r  r  Zautoloadr   r[   r3   rn   Z!AutoloadSwitch._on_preset_changed  s>    TYY(;(;<<II  / =<<<   &AA*	c                	l    V P                   P                  V P                  P                  4       4       R # rY   )r9   Zset_autoloadr:   r  r   r   r3   r  ZAutoloadSwitch._on_gtk_toggle  s#    %%dii&:&:&<=r6   r   N)	r`   ra   rb   rc   rd   rD   rn   r  rf   r0   r6   r3   r  r    s    LT0>r6   r  c                  r  )
ReleaseCombinationSwitchi  zMThe switch used to set the active_mapping.release_combination_keys parameter.c               r*   r  r0   r1   r2   r3   r4   %ReleaseCombinationSwitch.__annotate__  s)     V V+V9CVMWVr6   c                	r!  r"  )	r8   r9   r:   r@   r  r;   r   r>   ro   r$  rC   r3   rD   Z!ReleaseCombinationSwitch.__init__  sQ      .%			+t':':;&&{':':D<T<TUr6   c               rJ   )r+   rK   r   r0   r1   r2   r3   r4   r)    s     @ @ @r6   c                	r%  rY   )r#   r:   r  r  release_combination_keysr   r[   r3   ro   Z,ReleaseCombinationSwitch._on_mapping_changed  s@    TYY(;(;<<II  !>!>? =<<<r&  c                	n    V P                   P                  V P                  P                  4       R 7       R# ))r*  N)r9   r]   r:   r  r   r   r3   r  Z'ReleaseCombinationSwitch._on_gtk_toggle  s&    ''AUAUAW'Xr6   r   N)	r`   ra   rb   rc   rd   rD   ro   r  rf   r0   r6   r3   r(  r(    s    WV@Yr6   r(  c                  s6   a  ] tR tRtRtR tR V 3R lltRtV ;t# )InputConfigEntryi  zPThe ListBoxRow representing a single input config inside the CombinationListBox.c               r   )r+   r   r   r-   r   r0   r1   r2   r3   r4   ZInputConfigEntry.__annotate__  s     1" 1"k 1"z 1"r6   c                	s  <a  \         S
S `  4        VS n        VS n        \        P
                  ! \        P                  P                  ^R7      pVP                  ^4       \        P                  ! 4       pVP                  VP                  4       4       VP                  VRR^ 4       \        P                  ! 4       pVP                  \        P                  P                   4       VP#                  \        P$                  P&                  4       VP)                  4       P+                  R4       \        P,                  P/                  R\        P0                  P2                  4      pVP5                  V4       \        P                  ! 4       pVP                  \        P                  P                   4       VP#                  \        P$                  P&                  4       VP)                  4       P+                  R4       \        P,                  P/                  R\        P0                  P2                  4      pVP5                  V4       \        P
                  ! \        P                  P6                  R7      p	V	P                  VRR^ 4       V	P9                  VRR^ 4       VP9                  V	RR^ 4       VP;                  RV 3R	 l4       VP;                  RV 3R
 l4       S P5                  V4       S P=                  4        VS n        VS n         R# )i   )r   ZspacingFzno-v-paddingzgo-upzgo-downr   Tr   c                 P   < SP                   P                  SP                  R 4      # )Zupr9   Z move_input_config_in_combinationinput_eventr   rB      *r3   r  +InputConfigEntry.__init__.<locals>.<lambda>  s!    t''HH  $r6   c                 r-  )Zdownr.  r0  r1  r3   r  r2    s!    t''HH  &r6   N)!r   rD   r/  r9   r   r   r   r   Zset_margin_startr   r   ZdescriptionrR   r   r   r   r   r   r   r   r   r   r   r   r   ZBUTTONr   ZVERTICALZpack_endr@   r   _up_btn	_down_btn)rB   r   r-   Zhboxr   Zup_btnZup_imgZdown_btnZdown_imgZvboxr   s   f&&       r3   rD   ZInputConfigEntry.__init__  s    %ww3??#=#=qIb!		))+,ueQ/#))--(#//../  ",,^<--gs||7J7JK

6::<CIIMM*COO001""$..~>99//	3<<;N;NOXww3??#;#;<tQ/htQ/dE5!,	
 		
 	 !r6   )r9   r4  r3  r/  )	r`   ra   rb   rc   rd   r   rD   rf   r   r   r   r3   r,  r,    s    Z'N1" 1"r6   r,  c                  P    ] tR tRtRtR R ltR R ltR R ltR	 R
 ltR t	Rt
R# )CombinationListboxi  zHThe ListBox with all the events inside active_mapping.input_combination.c               r*   rh   r0   r1   r2   r3   r4   CombinationListbox.__annotate__  s-     E E%E E 	Er6   c                	sT   Wn         W n        W0n        R V n        V P                   P	                  \
        P                  V P                  4       V P                   P	                  \
        P                  V P                  4       V P                  P                  RV P                  4       R # )Nrk   )r8   r9   r:   r   r;   r   r>   ro   selected_event_on_event_changedr@   _on_gtk_row_selectedrq   rC   r3   rD   ZCombinationListbox.__init__  s      .%	8<&&$$	
 	&&&&""	

 			.$*C*CDr6   c               rJ   r+   r   r&   r0   r1   r2   r3   r4   r7    s     * * *r6   c                	s    V P                   P                  4        F1  pVP                  V8X  g   K  V P                   P                  V4       K3  	  R # rY   )r:   r|   r/  r   )rB   r   r   r   r3   _select_rowZCombinationListbox._select_row  s7    99))+C%'		$$S) ,r6   c               rJ   rW   r0   r1   r2   r3   r4   r7    s     P P; Pr6   c                	s   V P                   VP                  8X  d   R # V P                  P                  4       pV F  pV P                  P	                  V4       K   	  V P
                  P                  4       '       d
   R V n         R # VP                  V n         V P                    F2  pV P                  P                  \        W@P
                  4      R4       K4  	  R # rz   )	r   r   r:   r|   r~   r9   r   r   r,  )rB   r>   Zevent_entriesZevent_entryr   rV   r3   ro   Z&CombinationListbox._on_mapping_changed  s     9 99		..0(KII[) ) ,,.. $D ' 9 9D**		  !1%9I9I!JBO +r6   c               rJ   r;  r0   r1   r2   r3   r4   r7  !  s     $ $z $r6   c                	s    \        V P                  V P                  4      ;_uu_ 4        V P                  V4       R R R 4       R #   + '       g   i     R # ; irY   )r#   r:   r:  r<  r   r[   r3   r9  Z$CombinationListbox._on_event_changed!  s7    TYY(A(ABBU# CBBBs   AA	c                	s    V P                   P                  4        FA  pVP                  4       '       g   K  V P                  P	                  VP
                  4        R # 	  R # rY   )r:   r|   r   r9   Zload_input_configr/  r   r_   r3   r:  Z'CombinationListbox._on_gtk_row_selected%  sA    99))+C    223??C ,r6   )r   r9   r:   r8   N)r`   ra   rb   rc   rd   rD   r<  ro   r9  r:  rf   r0   r6   r3   r6  r6    s     RE,*
P$r6   r6  c                  r  )
AnalogInputSwitchi,  z>The switch that marks the active_input_config as analog input.c               r*   )r+   r,   r   r-   r   r   r  r0   r1   r2   r3   r4   AnalogInputSwitch.__annotate__/  s-     S S%S S 	Sr6   c                	s    Wn         W n        W0n        R V n        V P                  P	                  RV P
                  4       V P                   P                  \        P                  V P                  4       R # )Nr#  )
r8   r9   r:   _input_configr@   r  r;   r   r8  	_on_eventrB   r,   r-   r   rC   r3   rD   ZAnalogInputSwitch.__init__/  sW      .%	48		+t':':;&&{'A'A4>>Rr6   c               rJ   )r+   	input_cfgr   r0   r1   r2   r3   r4   r>  =  s     
% 
%; 
%r6   c                	s   \        V P                  V P                  4      ;_uu_ 4        V P                  P                  VP                  4       Wn        R R R 4       VP                  \        8X  d9   V P                  P                  R4       V P                  P                  R4       R # V P                  P                  R4       V P                  P                  ^4       R #   + '       g   i     L; i)NFr  T)
r#   r:   r  r  Zdefines_analog_inputr?  r   r	   r  r  )rB   rB  r[   r3   r@  ZAnalogInputSwitch._on_event=  s    TYY(;(;<<II  !?!?@!* = >>V#II##E*II!!#&II##D)II!!!$ =<s   ,C""C2	c                	r'  rY   )r9   Zset_event_as_analogr:   r  r   r   r3   r  Z AnalogInputSwitch._on_gtk_toggleI  s#    ,,TYY-A-A-CDr6   r9   r:   r?  r8   N)	r`   ra   rb   rc   rd   rD   r@  r  rf   r0   r6   r3   r=  r=  ,  s    HS
%Er6   r=  c                  r  )
TriggerThresholdInputiM  zThe number selection used to set the speed or position threshold of the
active_input_config when it is an ABS or REL event used as a key.c               r*   r+   r,   r   r-   r   r   zGtk.SpinButtonr0   r1   r2   r3   r4   "TriggerThresholdInput.__annotate__Q  s-     S S%S S 	Sr6   c                	s$   Wn         W n        W0n        R V n        V P                  P	                  ^^4       V P                  P                  RV P                  4       V P                   P                  \        P                  V P                  4       R # )Nvalue-changed)r8   r9   r:   r?  set_incrementsr@   r   r;   r   r8  r@  rA  rC   r3   rD   ZTriggerThresholdInput.__init__Q  sk      .%	48		  A&		/4+?+?@&&{'A'A4>>Rr6   c               rJ   )r+   input_configr   r0   r1   r2   r3   r4   rF  `  s     . .k .r6   c                	s   VP                   \        8X  d8   V P                  P                  R 4       V P                  P	                  R4       MVP                   \
        8X  dT   V P                  P                  R4       V P                  P	                  ^4       V P                  P                  R^c4       MRV P                  P                  R4       V P                  P	                  ^4       V P                  P                  RR4       \        V P                  V P                  4      ;_uu_ 4        V P                  P                  VP                  ;'       g    ^ 4       Wn        RRR4       R#   + '       g   i     R# ; i)Fr  Ti  Nii)r   r	   r:   r  r  r
   	set_ranger#   r   	set_valueanalog_thresholdr?  )rB   rI  r[   r3   r@  ZTriggerThresholdInput._on_event`  s    &II##E*II!!#&&(II##D)II!!!$IIR(II##D)II!!!$IIc*TYY(<(<==II = = B BC!- >===s   /6E//F 	c                	s    V P                   P                  V P                  P                  \	        V P
                  P                  4       4      R 7      4       R# ))rL  N)r9   Zupdate_input_configr?  Zmodifyrv   r:   	get_valuer   r   r3   r   Z%TriggerThresholdInput._on_gtk_changedq  s?    ,,%%s499;N;N;P7Q%R	
r6   rC  N)	r`   ra   rb   rc   rd   rD   r@  r   rf   r0   r6   r3   rD  rD  M  s    IS."
r6   rD  c                  r  )
ReleaseTimeoutInputiw  zMThe number selector used to set the active_mapping.release_timeout parameter.c               r*   rE  r0   r1   r2   r3   r4    ReleaseTimeoutInput.__annotate__z  -     V V%V V 	Vr6   c                	sN   Wn         W n        W0n        V P                  P                  R R 4       V P                  P	                  ^ ^4       V P                  P                  RV P                  4       V P                   P                  \        P                  V P                  4       R# )g{Gz?rG  Nr8   r9   r:   rH  rJ  r@   r   r;   r   r>   _on_mapping_messagerA  rC   r3   rD   ZReleaseTimeoutInput.__init__z  sy      .%			  t,		Aq!		/4+?+?@&&{':':D<T<TUr6   c               rJ   rW   r0   r1   r2   r3   r4   rO    s     	9 	9; 	9r6   c                	s   \         VP                   Uu. uF  q"P                  NK  	  up9   d8   V P                  P	                  R 4       V P                  P                  ^4       M6V P                  P	                  R4       V P                  P                  R4       \        V P                  V P                  4      ;_uu_ 4        V P                  P                  VP                  4       RRR4       R# u upi   + '       g   i     R# ; iTFr  N)
r   r   r   r:   r  r  r#   r   rK  release_timeoutrB   r>   r   r   r3   rR  Z'ReleaseTimeoutInput._on_mapping_message  s    g.G.GH.GUjj.GHHII##D)II!!!$II##E*II!!#&TYY(<(<==II 7 78 >= I >==s   C4&C99D
	c                	r+  ))rT  Nr9   r]   r:   rM  r   r   r3   r   Z#ReleaseTimeoutInput._on_gtk_changed  s&    ''		8K8K8M'Nr6   r   N	r`   ra   rb   rc   rd   rD   rR  r   rf   r0   r6   r3   rN  rN  w  s    WV	9Or6   rN  c                  r  )
RelativeInputCutoffInputi  zBThe number selector to set active_mapping.rel_to_abs_input_cutoff.c               r*   rE  r0   r1   r2   r3   r4   %RelativeInputCutoffInput.__annotate__  rP  r6   c                	sN   Wn         W n        W0n        V P                  P                  ^^4       V P                  P	                  ^R4       V P                  P                  RV P                  4       V P                   P                  \        P                  V P                  4       R# )   i  rG  NrQ  rA  rC   r3   rD   Z!RelativeInputCutoffInput.__init__  sy      .%			  A&		At$		/4+?+?@&&{':':D<T<TUr6   c               rJ   rW   r0   r1   r2   r3   r4   rY    s     A A; Ar6   c                	sD   \         VP                   Uu. uF  q"P                  NK  	  up9   dM   VP                  \        8X  d8   V P
                  P                  R 4       V P
                  P                  ^4       M6V P
                  P                  R4       V P
                  P                  R4       \        V P
                  V P                  4      ;_uu_ 4        V P
                  P                  VP                  4       RRR4       R# u upi   + '       g   i     R# ; irS  )r   r   r   output_typer
   r:   r  r  r#   r   rK  Zrel_to_abs_input_cutoffrU  r   r3   rR  Z,RelativeInputCutoffInput._on_mapping_message  s    w/H/HI/Hezz/HII##v-II##D)II!!!$II##E*II!!#&TYY(<(<==II ? ?@ >= J >==s   D	&DD	c                	r+  ))Zrel_xy_cutoffNrV  r   r   r3   r   Z(RelativeInputCutoffInput._on_gtk_changed  s&    ''dii6I6I6K'Lr6   r   NrW  r0   r6   r3   rX  rX    s    LVAMr6   rX  c                  r5  )OutputAxisSelectori  zThe dropdown menu used to select the output axis if the active_mapping is a
mapping targeting an analog axis

modifies the active_mapping.output_code and active_mapping.output_type parameters
c               r*   )r+   r,   r   r-   r   r   r/   r0   r1   r2   r3   r4   OutputAxisSelector.__annotate__  s-     V V%V V 	Vr6   c                	s   Wn         W n        W0n        / V n        \        P
                  ! \        \        4      V n        R V n        V P                  P                  V P                  4       \        P                  ! 4       pV P                  P                  VR4       V P                  P                  VR^4       V P                  P                  ^ 4       V P                  P                  RV P                  4       V P                   P!                  \"        P$                  V P&                  4       V P                   P!                  \"        P(                  V P*                  4       R # )NFrL   r7   )r8   r9   r:   _uinputsr   rM   rN   model_current_targetrP   rQ   rR   rS   rT   r@   _on_gtk_select_axisr;   r   r>   rR  r<   _on_uinputs_message)rB   r,   r-   r   rU   s   &&&& r3   rD   ZOutputAxisSelector.__init__  s      .%	13]]3,
.2		DJJ',,.		]E2		vq9		"		)T%=%=>&&{':':D<T<TU&&{':':D<T<TUr6   c               rJ   )r+   r^   r   r0   r1   r2   r3   r4   r]    s     & & &r6   c                	s   WP                   8X  d   R # V P                  P                  4        V P                  P                  R\	        R4      .4       Ve   V P
                  P                  V4      ;'       g    \        \        4      pVP                  \        4      ;'       g    R UUu. uF  w  r4\        V3NK  	  pppTP                  R VP                  \        4      ;'       g    R 4       4       V FQ  w  rc\        Wc4      p\        V\        4      '       d
   V^ ,          pV P                  P                  V RV 2V.4       KS  	  Wn         R # u uppi )N
None, NonezNo Axisc              3  s2   "   T F  p\         V3x  K  	  R # 5irY   )r   ).0r   r   r3   	<genexpr>Z0OutputAxisSelector._set_model.<locals>.<genexpr>  s      +I4+Is   , r0   )r`  r_  ZclearrO   r   r^  r   r   Zlistr
   Zextendr   r'   Z
isinstance)rB   r^   Zcapabilitiesr   ZabsinfoZtypes_codesZtype_Zkey_names   &&      r3   
_set_modelZOutputAxisSelector._set_model  s-   )))



<967==,,V4IID8IL4@4D4DV4L4R4RPR4R4R=44R    +7+;+;F+C+I+Ir+I   +25?h--'{H

!!eWBtf#5x"@A	  +  &s   +Ec               rJ   rW   r0   r1   r2   r3   r4   r]    s     U U; Ur6   c                	s.   \        V P                  V P                  4      ;_uu_ 4        V P                  VP                  4       V P                  P                  VP                   R VP                   24       RRR4       R#   + '       g   i     R# ; i)rf  N)r#   r:   ra  rg  rF   rE   r[  output_coderZ   r[   r3   rR  Z&OutputAxisSelector._on_mapping_message  sf    TYY(@(@AAOOG112II##w':':&;2g>Q>Q=R$ST BAAAs   ABB	c               rJ   )r+   r<   r    r0   r1   r2   r3   r4   r]    s     ( (; (r6   c                	s(    VP                   V n        R # rY   )r<   r^  )rB   r<   r[   r3   rb  Z&OutputAxisSelector._on_uinputs_message  s    r6   c                	s   V P                   P                  4       R 8X  d   RpMz\        ;QJ d;    . R V P                   P                  4       P                  R4       4       F  NK  	  5M4! R V P                   P                  4       P                  R4       4       4      pV P                  P                  V^ ,          V^,          R7       R# )rc  Nc              3  s8   "   T F  p\        V4      x  K  	  R # 5irY   )rv   )rd  Zir   r3   re  Z9OutputAxisSelector._on_gtk_select_axis.<locals>.<genexpr>  s     S.Rc!ff.Rs   Z,)r[  rh  )NN)r:   r\   ZtupleZsplitr9   r]   )rB   r   Z	type_coder_   r3   ra  Z&OutputAxisSelector._on_gtk_select_axis  s    99""$4$ISdii.E.E.G.M.Mc.RSSdii.E.E.G.M.Mc.RSSI''!!)A, 	( 	
r6   )r9   r`  r:   r8   r^  r_  N)r`   ra   rb   rc   rd   rD   rg  rR  rb  ra  rf   r0   r6   r3   r\  r\    s"    V0&.U
(
r6   r\  c                  sJ    ] tR tRtRtR R ltR R ltR R ltR	 R
 ltRt	R# )KeyAxisStackSwitcheri  z^The controls used to switch between the gui to modify a key-mapping or
an analog-axis mapping.c          
     s,    V ^8  d   QhRRRRRRRRR	R/# )
r+   r,   r   r-   r   stackz	Gtk.Stackkey_macro_toggler   analog_toggler0   r1   r2   r3   r4   !KeyAxisStackSwitcher.__annotate__  sC     V V%V V 	V
 +V (Vr6   c                	sB   Wn         W n        W0n        W@n        WPn        V P                  P                  R V P                  4       V P                  P                  R V P                  4       V P                   P                  \        P                  V P                  4       R# )r  N)r8   r9   _stack_key_macro_toggle_analog_toggler@   r  r;   r   r>   rR  )rB   r,   r-   rj  rk  rl     &&&&&&r3   rD   ZKeyAxisStackSwitcher.__init__  s{      .%!1+&&y$2E2EF##It/B/BC&&{':':D<T<TUr6   c               rJ   )r+   mapping_typezLiteral['key_macro', 'analog']r0   r1   r2   r3   r4   rm    s     ' '(F 'r6   c                	st   V\         P                  P                  8X  dC   V P                  P	                  \
        P                  4       V P                  pV P                  pMAV P                  P	                  \
        P                  4       V P                  pV P                  p\        W P                  4      ;_uu_ 4        VP                  R 4       RRR4       \        W0P                  4      ;_uu_ 4        VP                  R4       RRR4       R#   + '       g   i     LI; i  + '       g   i     R# ; i)TNF)r   ANALOGvaluern  Zset_visible_child_namer   Zanalog_axisrp  ro  Zkey_or_macror#   r  r  )rB   rr  ZactiveZinactiver   r3   _set_activeZ KeyAxisStackSwitcher._set_active  s    ;--333KK../J/JK((F--HKK../K/KL++F**HV%8%899d# :X':':;;& <; :9;;;s    D7D&D#	&D7	c               rJ   rW   r0   r1   r2   r3   r4   rm  )  s     : :; :r6   c                	sR   VP                   \        P                  P                  8X  d*   V P	                  \        P                  P                  4       VP                   \        P
                  P                  8X  d,   V P	                  \        P
                  P                  4       R # R # rY   )rr  r   rs  rt  ru  	KEY_MACROrZ   r[   r3   rR  Z(KeyAxisStackSwitcher._on_mapping_message)  so    ;#5#5#;#;;[//556;#8#8#>#>>[22889 ?r6   c               rJ   )r+   btnr   r0   r1   r2   r3   r4   rm  1  s     S S"2 Sr6   c                	s   VP                  4       '       * pV'       d:   \        WP                  4      ;_uu_ 4        VP                  R 4       RRR4       R# WP                  J d7   V P
                  P                  \        P                  P                  R7       R# V P
                  P                  \        P                  P                  R7       R#   + '       g   i     R# ; i)TN)rr  )r  r#   r  r  ro  r9   r]   r   rv  rt  rs  )rB   rw  Z
was_activer   r3   r  Z#KeyAxisStackSwitcher._on_gtk_toggle1  s    ))
 &9&9::t$ ;(((++9N9N9T9T+U++9K9K9Q9Q+R ;:s   CC#	)rp  r9   ro  r8   rn  N)
r`   ra   rb   rc   rd   rD   ru  rR  r  rf   r0   r6   r3   ri  ri    s#    V$':S Sr6   ri  c                  s>    ] tR tRtRtR R ltR R ltR R ltR	tR
# )TransformationDrawAreaiA  zBThe graph which shows the relation between input- and output-axis.c               r*   )r+   r,   r   r-   r   r   zGtk.DrawingArear0   r1   r2   r3   r4   #TransformationDrawArea.__annotate__D  s-     V V%V V 	Vr6   c                	s    Wn         W n        W0n        R  V n        V P                  P	                  RV P
                  4       V P                   P                  \        P                  V P                  4       R# )c                s    V # rY   r0   )xrH   r3   r  Z1TransformationDrawArea.__init__.<locals>.<lambda>N  s    qr6   ZdrawN)
r8   r9   r:   _transformationr@   _on_gtk_drawr;   r   r>   rR  rA  rC   r3   rD   ZTransformationDrawArea.__init__D  sY      .%	EP		&$"3"34&&{':':D<T<TUr6   c               rJ   rW   r0   r1   r2   r3   r4   ry  S  s      ; r6   c                	s    \        ^dRVP                  VP                  VP                  4      V n        V P
                  P                  4        R# )id   Ni)r%   deadzonegainexpor{  r:   Z
queue_drawrZ   r[   r3   rR  Z*TransformationDrawArea._on_mapping_messageS  s:    -w''w|| 
 			r6   c               rJ   )r+   contextzcairo.Contextr0   r1   r2   r3   r4   ry  Y  s     3 3} 3r6   c                	sf   \        R	^a4       Uu. uF2  pV^,          R,           R
V P                  V4      ,          R,           3NK4  	  ppV P                  P                  4       pV P                  P	                  4       p\        WV34      pV UUu. uF  w  r8W7,          W,          3NK  	  p	ppVP                  ^ V,          RV,          4       VP                  ^V,          RV,          4       VP                  RV,          RV,          4       VP                  ^V,          RV,          4       VP                  RV,          RV,          4       VP                  RV,          ^V,          4       VP                  RV,          ^ 4       VP                  RV,          RV,          4       VP                  RV,          ^ 4       VP                  RV,          RV,          4       VP                  ^4       \        P                  ! RRRR4      p
VP                  V
P                  V
P                  V
P                  V
P                  4       VP!                  4        VP                  ! V	^ ,          !   V	R,           F  pVP                  ! V!   K  	  \"        P$                  ! 4       pVP                  ^4       VP'                  \(        P*                  P,                  4       VP                  VP                  VP                  VP                  VP                  4       VP!                  4        R# u upi u uppi )ia   r  gQ?gp=
ף?gQ?g{Gz?g?:rZ  NNNig      )Zranger{  r:   Zget_allocated_widthZget_allocated_heightZminZmove_toZline_toZset_line_widthr   ZRGBAZset_source_rgbaZredZgreenZblueZalphaZstroker$   Zget_accent_colorZset_line_capcairoZLineCapZROUND)rB   r   r  rz  ZpointsZwidthZheightZbZyZscaled_pointsZarrow_colorZscaled_pointZ
line_colors   &&&          r3   r|  Z#TransformationDrawArea._on_gtk_drawY  s    3^
 $ Ws]D4#7#7#::S@A# 	 

 		--///1 4:;FDA!%F; 	AsQw'AsQw'q$(+AsQw'q$(+ 	aQ'a#q$(+a#q$(+q!hhsCc2OO		
 	 	q)*)"--LOO\* . ,,.
q!U]]001NNOO		
 	e
 <s   8L(L-)r9   r:   r8   r{  N)	r`   ra   rb   rc   rd   rD   rR  r|  rf   r0   r6   r3   rx  rx  A  s    LV3 3r6   rx  c                  sD    ] tR tRtRtR R ltR R ltR tR tR	 t	R
t
R# )Slidersi  z]The different sliders to modify the gain, deadzone and expo parameters of the
active_mapping.c          
     s,    V ^8  d   QhRRRRRRRRRR/# )	r+   r,   r   r-   r   r~  z	Gtk.Ranger}  r  r0   r1   r2   r3   r4   Sliders.__annotate__  sC     V V%V V 	V
 V Vr6   c                	s6   Wn         W n        W0n        W@n        WPn        V P                  P                  R^4       V P                  P                  ^ R4       V P                  P                  R^4       V P                  P                  RV P                  4       V P                  P                  RV P                  4       V P                  P                  RV P                  4       V P                   P                  \        P                  V P                  4       R# )r+   g?rG  Nir{   )r8   r9   _gain	_deadzone_exporJ  r@   _on_gtk_gain_changed_on_gtk_expo_changed_on_gtk_deadzone_changedr;   r   r>   rR  )rB   r,   r-   r~  r}  r  rq  r3   rD   ZSliders.__init__  s      .%
!


R#  C(

R#

?D,E,EF

?D,E,EF0M0MN&&{':':D<T<TUr6   c               rJ   rW   r0   r1   r2   r3   r4   r    s     7 7; 7r6   c                	s~   \        V P                  V P                  4      ;_uu_ 4        V P                  P                  VP                  4       R R R 4       \        V P
                  V P                  4      ;_uu_ 4        V P
                  P                  VP                  4       R R R 4       \        V P                  V P                  4      ;_uu_ 4        V P                  P                  VP                  4       R R R 4       R #   + '       g   i     L; i  + '       g   i     L{; i  + '       g   i     R # ; irY   )r#   r  r  rK  r~  r  r  r  r  r  r}  rZ   r[   r3   rR  ZSliders._on_mapping_message  s    TZZ)B)BCCJJ  . D TZZ)B)BCCJJ  . D T^^T-J-JKKNN$$W%5%56 LK DC DC LKKs#   &D?&D&D+D	D(	+D<	c                	r+  ))r~  N)r9   r]   r  rM  r   r   r3   r  ZSliders._on_gtk_gain_changed  &    ''TZZ-A-A-C'Dr6   c                	r+  ))r}  N)r9   r]   r  rM  r   r   r3   r  Z Sliders._on_gtk_deadzone_changed  s&    ''1I1I1K'Lr6   c                	r+  ))r  N)r9   r]   r  rM  r   r   r3   r  ZSliders._on_gtk_expo_changed  r  r6   )r9   r  r  r  r8   N)r`   ra   rb   rc   rd   rD   rR  r  r  r  rf   r0   r6   r3   r  r    s$    V.7EMEr6   r  )\rd   Z
__future__r    Zcollectionsr   Ztypingr   r   r   r   r   r   r   r  Zevdev.ecodesr	   r
   r   r   r   r   r   r   Zgi.repositoryr   r   r   Z"inputremapper.configs.input_configr   r   Z%inputremapper.configs.keyboard_layoutr   r   Zinputremapper.configs.mappingr   r   Zinputremapper.groupsr   Z.inputremapper.gui.components.output_type_namesr   Zinputremapper.gui.controllerr   Zinputremapper.gui.gettextr   Z)inputremapper.gui.messages.message_brokerr   r   Z'inputremapper.gui.messages.message_datar    r!   r"   Zinputremapper.gui.utilsr#   r$   Z7inputremapper.injection.mapping_handlers.axis_transformr%   Zinputremapper.input_eventr&   Zinputremapper.utilsr'   rv   ZCapabilitiesr   ZGAMEPADZMOUSEZKEYBOARDZGRAPHICS_TABLETZTOUCHPADZUNKNOWNZ
ICON_NAMESZICON_PRIORITIESr(   rg   Z
ListBoxRowrs   r   r   r   r  r  r  r(  r,  r6  r=  rD  rN  rX  r\  ri  rx  r  r0   r6   r3   <module>r     s  * 3 # # F F F 	 	 	 . - L U B + J 3 ' 
 < R 0 7CI*+ m))
 /> />d:7 :7z@FCNN @FFP Pfy- y-x3& 3&l%( %(P% %6> >*Y Y*6"s~~ 6"r5 5pE EB'
 '
TO OB!M !MHE
 E
P:S :SzK K\,E ,Er6   