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


Python TextBox.setMaxLength方法代码示例

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


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

示例1: EditPanel

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setMaxLength [as 别名]
class EditPanel(AbsolutePanel):

    def __init__(self, key, title, content):
        AbsolutePanel.__init__(self)
        self.edit_header = Label("Edit a Post", StyleName="header_label")
        self.edit_title_label = Label("Title:")
        self.edit_title = TextBox()
        self.edit_title.setMaxLength(255)
        self.edit_content = TextArea()
        self.edit_content.setVisibleLines(2)
        self.edit_button = Button("Save")
        self.edit_cancel_button = Button("Cancel")
        self.edit_hidden_key = Hidden()
        self.error_message_label = Label("", StyleName="error_message_label")
        edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
        edit_contents.add(self.edit_header)
        edit_contents.add(self.edit_title_label)
        edit_contents.add(self.edit_title)
        edit_contents.add(self.edit_content)
        edit_contents.add(self.edit_button)
        edit_contents.add(self.edit_cancel_button)
        edit_contents.add(self.error_message_label)
        edit_contents.add(self.edit_hidden_key)
        self.edit_dialog = DialogBox(glass=True)
        self.edit_dialog.setHTML('<b>Blog Post Form</b>')
        self.edit_dialog.setWidget(edit_contents)
        left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
        top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
        self.edit_dialog.setPopupPosition(left, top)
        self.edit_dialog.hide()

    def clear_edit_panel(self):
        self.edit_title.setText("")
        self.edit_content.setText("")
        self.error_message_label.setText("")
开发者ID:Afey,项目名称:pyjs,代码行数:37,代码来源:components.py

示例2: Cancel

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setMaxLength [as 别名]
class Cancel(HorizontalPanel):
    def __init__(self):
        HorizontalPanel.__init__(self, Spacing=4)
        self.add(Label('Cancel:', StyleName='section'))
        self.name = TextBox()
        self.name.setMaxLength(18)
        self.name.setVisibleLength(18)
        self.add(self.name)
        self.cancel = Button('Do it', self)
        self.add(self.cancel)
        self.err = Label()
        self.add(self.err)

    def onClick(self, sender):
        self.err.setText('')
        name = self.name.getText().strip()
        if name == '':
            return
        else:
            self.cancel.setEnabled(False)
            remote = server.AdminService()
            id = remote.cancel(name, self)
            if id < 0:
                self.err.setText('oops: could not cancel')

    def onRemoteResponse(self, result, request_info):
        self.cancel.setEnabled(True)
        self.name.setText('')

    def onRemoteError(self, code, message, request_info):
        self.cancel.setEnabled(True)
        self.err.setText('Could not cancel: ' + message['data']['message'])
开发者ID:fluidinfo,项目名称:Tickery,代码行数:34,代码来源:cancel.py

示例3: __init__

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setMaxLength [as 别名]
    def __init__(self):
        SimplePanel.__init__(self)

        field = TextBox()
        field.setVisibleLength(20)
        field.setMaxLength(10)

        self.add(field)
开发者ID:Afey,项目名称:pyjs,代码行数:10,代码来源:textBox.py

示例4: DatePicker

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setMaxLength [as 别名]
class DatePicker(HorizontalPanel):

    time = None
    dateBox = None

    def __init__(self):
        try:
            HorizontalPanel.__init__(self)
            self.time = time.time()

            prevDayBtn = Button(" < ", self.onPrevDay)
            nextDayBtn = Button(" > ", self.onNextDay)
            prevWeekBtn = Button(" << ", self.onPrevWeek)
            nextWeekBtn = Button(" >> ", self.onNextWeek)
            self.dateBox = TextBox()
            self.dateBox.setMaxLength(10)
            self.dateBox.setVisibleLength(10)

            self.add(prevWeekBtn)
            self.add(prevDayBtn)
            self.add(self.dateBox)
            self.add(nextDayBtn)
            self.add(nextWeekBtn)
        except:
            raise

    def onPrevDay(self, sender):
        self.mediator.sendNotification(Notification.PREV_DAY)

    def onNextDay(self, sender):
        self.mediator.sendNotification(Notification.NEXT_DAY)

    def onPrevWeek(self, sender):
        self.mediator.sendNotification(Notification.PREV_WEEK)

    def onNextWeek(self, sender):
        self.mediator.sendNotification(Notification.NEXT_WEEK)

    def displayDay(self):
        self.dateBox.setText(time.strftime("%d/%m/%Y", time.localtime(self.time)))
        date = time.strftime("%Y%m%d", time.localtime(self.time))
        self.mediator.sendNotification(Notification.DATE_SELECTED, date)

    def prevDay(self):
        self.time -= 86400
        self.displayDay()

    def nextDay(self):
        self.time += 86400
        self.displayDay()

    def prevWeek(self):
        self.time -= 7*86400
        self.displayDay()

    def nextWeek(self):
        self.time += 7*86400
        self.displayDay()
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:60,代码来源:DatePicker.py

示例5: DatePicker

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setMaxLength [as 别名]
class DatePicker(HorizontalPanel):

    time = None
    dateBox = None

    def __init__(self):
        try:
            HorizontalPanel.__init__(self)
            self.time = time.time()
            self.date = None

            self.prevDayBtn = Button(" < ", self.onPrevDay)
            self.nextDayBtn = Button(" > ", self.onNextDay)
            self.prevWeekBtn = Button(" << ", self.onPrevWeek)
            self.nextWeekBtn = Button(" >> ", self.onNextWeek)
            self.dateBox = TextBox()
            self.dateBox.setMaxLength(10)
            self.dateBox.setVisibleLength(10)

            self.add(self.prevWeekBtn)
            self.add(self.prevDayBtn)
            self.add(self.dateBox)
            self.add(self.nextDayBtn)
            self.add(self.nextWeekBtn)
        except:
            raise

    def onPrevDay(self, sender):
        self.time -= 86400

    def onNextDay(self, sender):
        self.time += 86400

    def onPrevWeek(self, sender):
        self.time -= 7*86400

    def onNextWeek(self, sender):
        self.time += 7*86400

    def displayDay(self):
        self.dateBox.setText(time.strftime("%d/%m/%Y", time.localtime(self.time)))
        self.date = time.strftime("%Y%m%d", time.localtime(self.time))
开发者ID:Ludovic-Condette,项目名称:pyjs,代码行数:44,代码来源:DatePicker.py

示例6: addRow

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setMaxLength [as 别名]
 def addRow(self, timeVO = None):
     self.rows += 1
     col = -1
     for name, maxLength, visibleLength in self.columns:
         col += 1
         textBox = TextBox()
         textBox.setText("")
         textBox.col = col
         textBox.row = self.rows
         textBox.addChangeListener(self.checkValid)
         textBox.addKeyboardListener(self)
         textBox.addFocusListener(self)
         textBox.setName(name)
         if not maxLength is None:
             textBox.setMaxLength(maxLength)
         if not visibleLength is None:
             textBox.setVisibleLength(visibleLength)
         self.setWidget(self.rows, col, textBox)
     if not timeVO is None:
         self.setRow(self.rows, timeVO)
开发者ID:Afey,项目名称:pyjs,代码行数:22,代码来源:TimeGrid.py

示例7: ResultsLimit

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setMaxLength [as 别名]
class ResultsLimit(HorizontalPanel):
    def __init__(self):
        HorizontalPanel.__init__(self, Spacing=4)
        self.add(Label('Results limit:', StyleName='section'))
        self.value = Label()
        self.add(self.value)
        self.newValue = TextBox()
        self.newValue.setMaxLength(5)
        self.newValue.setVisibleLength(5)
        self.add(self.newValue)
        self.update = Button('Update', ResultsUpdate(self))
        self.add(self.update)
        displayer = ResultsDisplay(self)
        self.refresh = Button('Refresh', displayer, StyleName='refresh')
        self.add(self.refresh)
        self.err = Label()
        self.add(self.err)
        remote = server.AdminService()
        id = remote.getResultsLimit(displayer)
        if id < 0:
            self.err.setText('oops: could not call getResultsLimit')
开发者ID:jdunck,项目名称:Tickery,代码行数:23,代码来源:results.py

示例8: __init__

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setMaxLength [as 别名]
class Application:
	def __init__(self):
		#set some vars
		self.title = "last.fm"

		#this is where we build the ui
		self.statusPanel = VerticalPanel()
		self.statusPanel.setID('status_panel')

		#make a few Labels to hold station, artist, track, album info
		self.stationLabel = Label()
		self.artistLabel = Label()
		self.trackLabel = Label()
		self.albumLabel = Label()
		self.timeLabel = Label()
		self.infoTable = FlexTable()
		i=0
		self.stationLabel = Label()
		self.infoTable.setWidget(i,0,Label("Station:") )
		self.infoTable.setWidget(i,1,self.stationLabel)
		i+=1
		self.infoTable.setWidget(i,0,Label("Artist:") )
		self.infoTable.setWidget(i,1,self.artistLabel)
		i+=1
		self.infoTable.setWidget(i,0,Label("Track:") )
		self.infoTable.setWidget(i,1,self.trackLabel)
		i+=1
		self.infoTable.setWidget(i,0,Label("Album:") )
		self.infoTable.setWidget(i,1,self.albumLabel)
		
		self.statusPanel.add(self.infoTable)
		self.statusPanel.add(self.timeLabel)
		#make the time bar
		timebarWrapperPanel = SimplePanel()
		timebarWrapperPanel.setID("timebar_wrapper")
		#timebarWrapperPanel.setStyleName('timebar_wrapper')
		self.timebarPanel = SimplePanel()
		self.timebarPanel.setID("timebar")
		#self.timebarPanel.setStyleName('timebar')
		timebarWrapperPanel.add(self.timebarPanel)
		self.statusPanel.add(timebarWrapperPanel)
		#make some shit for buttons
		self.buttonHPanel = HorizontalPanel()
		self.skipButton = Button("Skip", self.clicked_skip )
		self.buttonHPanel.add(self.skipButton)
		loveButton = Button("Love", self.clicked_love )
		self.buttonHPanel.add(loveButton)
		pauseButton = Button("Pause", self.clicked_pause )
		self.buttonHPanel.add(pauseButton)
		banButton = Button("Ban", self.clicked_ban )
		self.buttonHPanel.add(banButton)

		#control the volume
		self.volumePanel = HorizontalPanel()
		self.volumeLabel = Label("Volume:")
		self.volumePanel.add(self.volumeLabel)
		volupButton = Button("+", self.clicked_volume_up, 5)
		self.volumePanel.add(volupButton)
		voldownButton = Button("-", self.clicked_volume_down, 5)
		self.volumePanel.add(voldownButton)
		
		#make buttons and shit to create a new station
		self.setStationHPanel = HorizontalPanel()
		self.setStationTypeListBox = ListBox()
		self.setStationTypeListBox.setVisibleItemCount(0)

		self.setStationTypeListBox.addItem("Similar Artists", "artist/%s/similarartists")
		self.setStationTypeListBox.addItem("Top Fans", "artist/%s/fans")
		self.setStationTypeListBox.addItem("Library", "user/%s/library")
		self.setStationTypeListBox.addItem("Mix", "user/%s/mix")
		self.setStationTypeListBox.addItem("Recommended", "user/%s/recommended")
		self.setStationTypeListBox.addItem("Neighbours", "user/%s/neighbours")
		self.setStationTypeListBox.addItem("Global Tag", "globaltags/%s")

		self.setStationHPanel.add(self.setStationTypeListBox)
		self.setStationTextBox = TextBox()
		self.setStationTextBox.setVisibleLength(10)
		self.setStationTextBox.setMaxLength(50)
		self.setStationHPanel.add(self.setStationTextBox)
		self.setStationButton = Button("Play", self.clicked_set_station)
		self.setStationHPanel.add(self.setStationButton)

		#make an error place to display data
		self.infoHTML = HTML()
		RootPanel().add(self.statusPanel)
		RootPanel().add(self.buttonHPanel)
		RootPanel().add(self.volumePanel)
		RootPanel().add(self.setStationHPanel)
		RootPanel().add(self.infoHTML)
		
	def run(self):
		self.get_track_info()

	def get_track_info(self):
		HTTPRequest().asyncGet("/track_info", TrackInfoHandler(self))
		Timer(5000,self.get_track_info)

	def clicked_skip(self):
		self.skipButton.setEnabled(False)
		HTTPRequest().asyncGet("/skip",ButtonInfoHandler(self,self.skipButton) )
#.........这里部分代码省略.........
开发者ID:christophgysin,项目名称:PyWebShellFM,代码行数:103,代码来源:interface.py


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