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


Python TextBox.setVisibleLength方法代码示例

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


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

示例1: Cancel

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [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

示例2: PreferencesDlg

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

    fileLocation = None

    def __init__(self, left = 50, top = 50):
        DialogBox.__init__(self, modal = False)

        self.setPopupPosition(left, top)
        self.setText("Preferences")
        ftable = FlexTable()
        ftableFormatter = ftable.getFlexCellFormatter()
        row = 0

        self.fileLocation = getCookie("fileLocation")

        row += 1
        ftable.setWidget(row, 0, Label("Sheet loaded on startup", wordWrap=False))
        self.fileLocationInput = TextBox()
        self.fileLocationInput.addChangeListener(self.checkValid)
        self.fileLocationInput.addKeyboardListener(self)
        self.fileLocationInput.setVisibleLength(30)
        self.fileLocationInput.setText(self.fileLocation)
        ftable.setWidget(row, 1, self.fileLocationInput)

        row += 1
        hpanel = HorizontalPanel()
        self.saveBtn = Button("Save", self.onSave)
        self.saveBtn.setEnabled(False)
        hpanel.add(self.saveBtn)
        self.cancelBtn = Button("Cancel", self.onCancel)
        hpanel.add(self.cancelBtn)
        ftable.setWidget(row, 0, hpanel)
        ftableFormatter.setColSpan(row, 0, 2)

        self.setWidget(ftable)

    def onCancel(self, sender):
        self.hide()

    def onSave(self, sender):
        setCookie("fileLocation", self.fileLocationInput.getText(), 1000000000)
        self.hide()

    def checkValid(self, evt=None):
        if self.fileLocation != self.fileLocationInput.getText():
            self.saveBtn.setEnabled(True)
        else:
            self.saveBtn.setEnabled(False)

    def onClick(self, sender):
        pass

    def onKeyUp(self, sender, keyCode, modifiers):
        self.checkValid()

    def onKeyDown(self, sender, keyCode, modifiers):
        pass

    def onKeyPress(self, sender, keyCode, modifiers):
        pass
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:62,代码来源:PreferencesDlg.py

示例3: __init__

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [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 setVisibleLength [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: Email

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [as 别名]
class Email(Composite):
    def __init__(self, **kwargs):

        element = None
        if kwargs.has_key('Element'):
            element = kwargs.pop('Element')

        panel = VerticalPanel(Element=element)
        Composite.__init__(self, panel, **kwargs)

        self.TEXT_WAITING = "Please wait..."
        self.TEXT_ERROR = "Server Error"

        self.remote_py = EchoServicePython()

        self.status=Label()
        self.subject = TextBox()
        self.subject.setVisibleLength(60)
        self.sender = TextBox()
        self.sender.setVisibleLength(40)
        self.message = TextArea()
        self.message.setCharacterWidth(60)
        self.message.setVisibleLines(15)
        
        self.button_py = Button("Send", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_py)
        buttons.setSpacing(8)
        
        panel.add(HTML("Subject:"))
        panel.add(self.subject)
        panel.add(HTML("From:"))
        panel.add(self.sender)
        panel.add(HTML("Your Message - please keep it to under 1,000 characters"))
        panel.add(self.message)
        panel.add(buttons)
        panel.add(self.status)
        
    def onClick(self, sender):
        self.status.setText(self.TEXT_WAITING)
        text = self.message.getText()
        msg_sender = self.sender.getText()
        msg_subject = self.subject.getText()

        # demonstrate proxy & callMethod()
        if sender == self.button_py:
            id = self.remote_py.send(msg_sender, msg_subject, text, self)
        if id<0:
            self.status.setText(self.TEXT_ERROR)

    def onRemoteResponse(self, response, request_info):
        self.status.setText(response)

    def onRemoteError(self, code, message, request_info):
        self.status.setText("Server Error or Invalid Response: ERROR " + \
                str(code) + " - " + str(message))
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:59,代码来源:Email.py

示例6: DatePicker

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [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

示例7: addRow

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [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

示例8: ResultsLimit

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [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

示例9: DateField

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

    icon_img = "icon_calendar.gif"
    icon_style = "calendar-img"
    today_text = "Today"
    today_style = "calendar-today-link"

    def __init__(self, format='%d-%m-%Y'):
        self.format = format
        self.tbox = TextBox()
        self.tbox.setVisibleLength(10)
        # assume valid sep is - / . or nothing
        if format.find('-') >= 0:
            self.sep = '-'
        elif format.find('/') >= 0:
            self.sep = '/'
        elif format.find('.') >= 0:
            self.sep = '.'
        else:
            self.sep = ''
        # self.sep = format[2] # is this too presumptious?
        self.calendar = Calendar()
        self.img = Image(self.icon_img)
        self.img.addStyleName(self.icon_style)
        self.calendarLink = HyperlinkImage(self.img)
        self.todayLink = Hyperlink(self.today_text)
        self.todayLink.addStyleName(self.today_style)
        #
        # lay it out
        #
        hp = HorizontalPanel()
        hp.setSpacing(2)
        vp = VerticalPanel()
        hp.add(self.tbox)
        vp.add(self.calendarLink)
        vp.add(self.todayLink)
        #vp.add(self.calendar)
        hp.add(vp)

        Composite.__init__(self)
        self.initWidget(hp)
        #
        # done with layout, so now set up some listeners
        #
        self.tbox.addFocusListener(self) # hook to onLostFocus
        self.calendar.addSelectedDateListener(getattr(self, "onDateSelected"))
        self.todayLink.addClickListener(getattr(self, "onTodayClicked"))
        self.calendarLink.addClickListener(getattr(self, "onShowCalendar"))

    def getTextBox(self):
        return self.tbox

    def getCalendar(self):
        return self.calendar

    def getDate(self):
        """ returns datetime.date object or None if empty/unparsable by current format"""
        _sdate = self.tbox.getText()
        try:
            return datetime.strptime(_sdate, self.format).date()
        except ValueError:
            return None

    def setID(self, id):
        self.tbox.setID(id)

    def onDateSelected(self, yyyy, mm, dd):
        secs = time.mktime((int(yyyy), int(mm), int(dd), 0, 0, 0, 0, 0, -1))
        d = time.strftime(self.format, time.localtime(secs))
        self.tbox.setText(d)

    def onLostFocus(self, sender):
        #
        text = self.tbox.getText().strip()
        # if blank - leave it alone
        if text and len(text) == 8:
            # ok what format do we have? assume ddmmyyyy --> dd-mm-yyyy
            txt = text[0:2] + self.sep + text[2:4] + self.sep + text[4:8]
            self.tbox.setText(txt)

    def onFocus(self, sender):
        pass

    def onTodayClicked(self, event):
        today = time.strftime(self.format)
        self.tbox.setText(today)

    def onShowCalendar(self, sender):
        txt = self.tbox.getText().strip()
        try:
            if txt:
                _d = datetime.strptime(txt,self.format).date()
                self.calendar.setDate(_d)
        except ValueError: pass

        p = CalendarPopup(self.calendar)
        x = self.tbox.getAbsoluteLeft() + 10
        y = self.tbox.getAbsoluteTop() + 10
        p.setPopupPosition(x, y)
        p.show()
开发者ID:jwashin,项目名称:pyjs,代码行数:102,代码来源:Calendar.py

示例10: Impediments

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [as 别名]
class Impediments(SimplePanel):
    '''
    Create and edit projects
    '''
    def __init__(self, start_date, can_delete=True):
        # We need to use old form of inheritance because of pyjamas
        SimplePanel.__init__(self)
        self.vpanel = VerticalPanel()
        desc_panel = VerticalPanel()
        self.desc_box = TextBox()
        self.desc_box.setVisibleLength(44)
        self.desc_box.setStyleName('form-control')
        desc_lbl = Label('impediment description')
        desc_lbl.setStyleName('text-muted')
        desc_panel.add(self.desc_box)
        desc_panel.add(desc_lbl)
        # Set to False if loaded from database
        self.can_delete = can_delete
        
        status_panel = VerticalPanel()
        self.status_lst = ListBox(Height='34px')
        self.status_lst.setStyleName('form-control input-lg')
        self.status_lst.addItem('Open')
        self.status_lst.addItem('Closed')
        # we put date here
        
        self.status_lbl = Label('')
        self.set_start_date(start_date)
        self.status_lbl.setStyleName('text-muted')
        status_panel = VerticalPanel()
        status_panel.add(self.status_lst)
        status_panel.add(self.status_lbl)
        self.comment = Text_Area_Row('', 'why it exists or is being closed')
        hpanel = HorizontalPanel()
        hpanel.add(desc_panel)
        hpanel.add(Label(Width='10px'))
        hpanel.add(status_panel)
        self.vpanel.add(hpanel)
        self.vpanel.add(self.comment.panel())

    def set_start_date(self, start_date):
        date_str = 'added on: ' + start_date
        self.status_lbl.setText(date_str)

    def get_impediment_data(self):
        '''Get impediment data as a list suitable to passing to model.
        '''
        desc = self.desc_box.getText()
        comment = self.comment.widget().getText()
        state = self.status_lst.getItemText(self.status_lst.getSelectedIndex())
        lbl_text = self.status_lbl.getText()
        #
        ind = lbl_text.find(':') + 1
        # We need just date
        start_date = lbl_text[ind:].strip()
        if state == 'Open':
            end_date = None
        else:
            end_date = datetime.date.today().strftime('%d/%m/%Y')
        
        return (desc, comment, start_date, end_date, state)
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:63,代码来源:form.py

示例11: __init__

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [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

示例12: __init__

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setVisibleLength [as 别名]
class SCurveRunPanel :
	
	class onClickListener :
		def __init__(self, panel) :
			self._ClickPanel=panel	
			
		def onRemoteResponse(self, response, request_info):
			#self._ClickPanel.launchButton.setEnabled(False)
			for buttonName in self._ClickPanel.controlValueEntries:
				pass
				#self._ClickPanel.controlValueEntries[buttonName].setText(response[buttonName])
			#self._ClickPanel.controlValueEntries["RangeHi"].setText(response.keys()[1])	
			#self._ClickPanel.launchButton.setEnabled(True)
			
		def onRemoteError(self, code, message, request_info):
			ErrorMessage( "Unable to contact server" )
			
	class controlSCurveValueListener :
		def __init__(self, panel) :
			self._controlPanel=panel
			#self._controlPanel.launchButton.setEnabled(False)
			#self._controlPanel.echoSelection()
			
		def onRemoteResponse(self, response, request_info):
			self._controlPanel.launchButton.setEnabled(False)
			
		def onRemoteError(self, code, message, request_info):
			ErrorMessage( "Unable to contact server" )

	class DoNothingListener :
		"""
		A class to listen for the response to any calls where I don't care about the result.
		Later on I'll put in a popup if there's a message.
		"""
		def onRemoteResponse(self, response, request_info):
			# Don't actually want to do anything
			pass

		def onRemoteError(self, code, message, request_info):
			ErrorMessage( "Unable to contact server: "+str(message) )

	class SaveHistogramsListener :
		def __init__( self, buttonToEnable ) :
			self.buttonToEnable=buttonToEnable
		def onRemoteResponse(self, response, request_info):
			self.buttonToEnable.setEnabled(True)
			ErrorMessage( "Histograms saved", messageTitle="Message" )
		def onRemoteError(self, code, message, request_info):
			self.buttonToEnable.setEnabled(True)
			ErrorMessage( "Unable to contact server: "+str(message) )

	class DataTakingStatusListener :
		def __init__( self, SCurveRunPanelInstance ) :
			self.parentInstance=SCurveRunPanelInstance
		def onRemoteResponse(self, response, request_info):
			self.parentInstance.echo.setText(response["statusString"] )
			if response["fractionComplete"]<1:
				self.parentInstance.launchButton.setEnabled(False)
			else:
				self.parentInstance.launchButton.setEnabled(True)
				self.parentInstance.echo.setText("No data taking")
		def onRemoteError(self, code, message, request_info):
			ErrorMessage( "Unable to contact server: "+str(message) )

	
	def __init__( self ) :
		# This is the service that will be used to communicate with the DAQ software
		self.rpcService = GlibRPCService.instance()
		self.dataRunManager = DataRunManager.instance()

		self.mainPanel = VerticalPanel()
		self.mainPanel.setSpacing(15)
		
		self.controlValueEntries={} #controls the parameters of the s-curve

		#self.graphCanvas=GraphCanvas(self)
		
		#self.rpcService.getSCurveValues( )	
		
		self.mainSettings=VerticalPanel("Control Settings")
		self.startButton=VerticalPanel("Run Button")
		self.canvasPanel=VerticalPanel("Canvas")
		
		self.mainSettings.add(self.createControlPanel(["RangeLo","RangeHi","Steps"]))
		
		self.echo=Label() # A good print screen method
		
		self.launchButton=Button("Launch Now")
		self.launchButton.addClickListener(self)
		self.launchButton.setEnabled(True)
		
		saveHistogramsPanel=HorizontalPanel()
		self.saveHistogramsButton=Button("Save histograms")
		self.saveHistogramsButton.setEnabled(False) # Disable this button until data has been taken
		self.saveHistogramsButton.addClickListener(self)
		self.saveHistogramsFilename=TextBox("Filename")
		self.saveHistogramsFilename.setText("/tmp/scurveHistograms.root")
		self.saveHistogramsFilename.setVisibleLength(50)
		saveHistogramsPanel.add( self.saveHistogramsButton )
		saveHistogramsPanel.add( self.saveHistogramsFilename )
#.........这里部分代码省略.........
开发者ID:BristolHEP-CBC-Testing,项目名称:cbcanalysis,代码行数:103,代码来源:SCurveRunPanel.py


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