当前位置: 首页>>代码示例>>Python>>正文


Python ListBox.getText方法代码示例

本文整理汇总了Python中pyjamas.ui.ListBox.ListBox.getText方法的典型用法代码示例。如果您正苦于以下问题:Python ListBox.getText方法的具体用法?Python ListBox.getText怎么用?Python ListBox.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.ui.ListBox.ListBox的用法示例。


在下文中一共展示了ListBox.getText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Milestones_Row

# 需要导入模块: from pyjamas.ui.ListBox import ListBox [as 别名]
# 或者: from pyjamas.ui.ListBox.ListBox import getText [as 别名]
class Milestones_Row(SimplePanel):
    '''
    Create and edit projects
    '''
    def __init__(self, milestone_names, milestone_dates):
        # We need to use old form of inheritance because of pyjamas
        SimplePanel.__init__(self)
        self.milestone_dates = milestone_dates
       
        self.hpanel = HorizontalPanel()
        self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_TOP)
        self.name = ListBox(Height='34px', Width='208px')
        self.name.setStyleName('form-control input-lg')
        self.name.addChangeListener(getattr(self, 'on_milestone_changed'))
       
        for m in milestone_names:
            self.name.addItem(m) 
        if len(self.milestone_dates) > 0:
            self.planned_completion = Label(self.milestone_dates[0])
        else:
            self.planned_completion = Label('Undefined')
            
        self.planned_completion.setStyleName('form-control text-normal')

        self.expected_completion = Report_Date_Field(cal_ID='end')
        self.expected_completion.getTextBox().setStyleName('form-control')
        self.expected_completion.setRegex(DATE_MATCHER)
        self.expected_completion.appendValidListener(self._display_ok)
        self.expected_completion.appendInvalidListener(self._display_error)
        self.expected_completion.validate(None)

        self.hpanel.add(self.name)
        self.hpanel.add(Label(Width='10px'))
        self.hpanel.add(self.planned_completion)
        self.hpanel.add(Label(Width='10px'))
        self.hpanel.add(self.expected_completion)
        
    def get_name_txt(self):
        '''Return project name.
        '''
        return self.name.getText()


    def get_milestone_data(self):
        '''Get milestone data and return in the form suitable for passing to
        the model.
        '''
        name = self.name.getItemText(self.name.getSelectedIndex())
        planned_completion = self.planned_completion.getText()
        expected_completion = self.expected_completion.getTextBox().getText()
        return (name, planned_completion, expected_completion)

    def _display_ok(self, obj):
        obj.setStyleName('form-input')

    def _display_error(self, obj):
        if len(obj.getTextBox().getText()) > 0:
            obj.setStyleName('form-group has-error')
        
    def on_milestone_changed(self, event):
        '''
        Change completion date if milestone changed
        '''
        ind = self.name.getSelectedIndex()
        self.planned_completion.setText(self.milestone_dates[ind])
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:67,代码来源:form.py


注:本文中的pyjamas.ui.ListBox.ListBox.getText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。