Package libxyz :: Package ui :: Module prompt
[hide private]
[frames] | no frames]

Source Code for Module libxyz.ui.prompt

 1  #-*- coding: utf8 -* 
 2  # 
 3  # Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008 
 4  # 
 5  # This file is part of XYZCommander. 
 6  # XYZCommander is free software: you can redistribute it and/or modify 
 7  # it under the terms of the GNU Lesser Public License as published by 
 8  # the Free Software Foundation, either version 3 of the License, or 
 9  # (at your option) any later version. 
10  # XYZCommander is distributed in the hope that it will be useful, 
11  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
13  # GNU Lesser Public License for more details. 
14  # You should have received a copy of the GNU Lesser Public License 
15  # along with XYZCommander. If not, see <http://www.gnu.org/licenses/>. 
16   
17  from libxyz.ui import lowui 
18  from libxyz.core.utils import ustring 
19   
20 -class Prompt(lowui.Text):
21 """ 22 Command line prompt 23 """ 24
25 - def __init__(self, text, attr=None):
26 """ 27 @param text: Prompt text 28 """ 29 30 if attr is not None: 31 _arg = (attr, text) 32 else: 33 _arg = text 34 35 super(Prompt, self).__init__(_arg)
36 37 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38
39 - def __len__(self):
40 """ 41 Return prompt text length 42 """ 43 44 return len(ustring(self.get_text()[0]))
45