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


Python Window.alert方法代码示例

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


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

示例1: onClick

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
    def onClick(self):

        if not self.survey.is_cookie_set() and self.mturk_input.accepted == True:
             if not self.survey.survey_filledout():
                 Window.alert("Please fill out the survey")
             else:

                 self.survey.set_cookie()

                 encoded_answers = []
                 for i,answer in enumerate(self.survey.get_answers()):
                     encoded_answers.append(("survey_answer%d" % i,answer))

                     

                 self.mturk_output.add_data(encoded_answers)
                 self.mturk_output.add_data(self.sentence_set.get_sentences())
                 self.mturk_output.add_data(self.sentence_set.get_masks())
                 self.mturk_output.add_data(self.sentence_set.get_annotations())
                 self.mturk_output.mturk_form.submit()
        else:
             self.mturk_output.add_data(self.sentence_set.get_sentences())
             self.mturk_output.add_data(self.sentence_set.get_masks())
             self.mturk_output.add_data(self.sentence_set.get_annotations())
             self.mturk_output.mturk_form.submit()
开发者ID:lukeorland,项目名称:Choban,代码行数:27,代码来源:Sentiment.py

示例2: swap

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
    def swap(self, x1, y1):
        if self.base.control_panel.start_button.state == "up":
            return None
        blank_pos = self.getBlankPos()
        x2 = blank_pos[0]
        y2 = blank_pos[1]

        flag = False
        if x1 == x2:
            if (y1 - y2) in [1, -1]:
                flag = True
        elif y1 == y2:
            if (x1 - x2) in [1, -1]:
                flag = True
        if flag == True:
            w = self.getWidget(x1, y1)
            c = Cell(w.no, "images/button_%s.jpg" % w.no, "images/button_%s_down.jpg" % w.no)
            c.addMouseListener(CellListener())
            c.x = x2
            c.y = y2
            c.screen = self
            self.setWidget(x2, y2, c)
            self.clearCell(x1, y1)
            self.incrCount()

        if self.complete():
            Window.alert("Bingo!!!.. You won the game.. Congrats..")
开发者ID:vijayendra,项目名称:Puzzle-Game,代码行数:29,代码来源:Puzzle.py

示例3: onRemoteResponse

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
    def onRemoteResponse(self, response, request_info):        
#        Window.alert(dir(request_info))
#        Window.alert(request_info.method)
#        Window.alert(request_info.handler)
#        time.sleep( 3 )
        Window.alert("inside MLAlgorithmService: compression is done")
        self.callback.loadImage(response)
开发者ID:aprovodi,项目名称:mlServerCalculations,代码行数:9,代码来源:MLAlgorithmService.py

示例4: reduceterm

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
def reduceterm(sender, maxlines):
    """When the Reduce button is pressed: call cc.runfile with our input.

    There is a maximum number of lines that we will output, to prevent a
    stalling browser and an overfull document. The user can raise this limit
    with a link.
    """

    input = inputArea.getText()
    output = ""
    nlines = 0

    def catchoutput(s, end="\n"):
        output += s + end
        nlines += 1
        if nlines > maxlines:
            raise OverlongOutput()

    cc._defs = dict()
    try:
        cc.runfile(inputfile=io.StringIO(input), verbose=False, printout=catchoutput, printerr=catchoutput)
    except OverlongOutput:
        extra = FlowPanel(StyleName="terminated")
        extra.add(InlineLabel("Reduction terminated after %s lines. " % (maxlines,)))
        extra.add(Button("Try longer", functools.partial(queuereduce, maxlines=nextmaxlines(maxlines))))
        showOutput(output, extra=extra)
    except Exception, e:
        Window.alert(e)
开发者ID:ThreeLetterNames,项目名称:continuation-calculus-paper,代码行数:30,代码来源:cc_eval.py

示例5: themesPanel

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
	def themesPanel(self, themes=None):
		Window.alert('line:111')
		themes = None
		if not themes: themes=['0','1', 'cms', 'pypress']

		vPanel = VerticalPanel()
		for i in range(len(themes)):
			"""
			a_n = location.getPathName().split('/')[1]
			lambda1 = lambda x: w_l.pathname.replace('/'+a_n+'/', '/'+x+'/')+'?theme='+x
        	lambda2 = lambda x: w_l.pathname.replace('/'+a_n+'/', '/a/')+'?theme='+x
			href = {
				'cms' : lambda1, 
				'pypress' : lambda1,
				'o' : lambda2, 
				'1' : lambda2 
			}.get(themes[i], lambda2)(themes[i])
			"""

			a=Button('theme '+themes[i], 
					lambda x: location.setSearchDict({'theme': x.getID()}), 
					StyleName='link')
			a.setID(themes[i])
			vPanel.add(a)
	
		return vPanel
开发者ID:molhokwai,项目名称:libraries,代码行数:28,代码来源:Index0.py

示例6: jumpsFromGregorian

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
	def jumpsFromGregorian(self, gregorianDate):
		"""
    	-   Obtention of Number of seconds ahead or before reference point
    	-   Calculation*:
        	-   Calculation of _Number of Cycle Jumps_ from reference point in number of seconds
		"""
		Window.alert(gregorianDate)
		gregorianDate = datetime.datetime(gregorianDate)
		Window.alert(isinstance(gregorianDate, datetime.datetime))
		Window.alert(gregorianDate)
		jumps = 0
		diff = datetime.datetime(gregorianDate) - datetime.datetime(self.referencePoint.START_DATE)
		Window.alert(diff.days)
		f = diff>0

		diff = math.abs(diff)
		while diff>0:
			jumps = jumps+1
			Window.alert(float(self.referencePoint.CREATION_SPEED))
			if f:
				"""original formula: (1*13/(self.referencePoint.SPEED*13^jumps))"""
				diff = diff - (1/(self.referencePoint.CREATION_SPEED*13^(jumps-1)))
			else:
				"""original formula: (1*13/(self.referencePoint.SPEED/13^jumps))"""
				diff = diff - (1/(self.referencePoint.CREATION_SPEED/13^(jumps+1)))

		return jumps
开发者ID:molhokwai,项目名称:libraries,代码行数:29,代码来源:Cycle.py

示例7: onError

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
 def onError(self, text):
     obj = JSONParser().decode(text)
     # Hack for 201 being seen as error
     if not obj['ok']:
         Window.alert(text)
     else:
         self.editor.reloadDocument()
开发者ID:CodeSturgeon,项目名称:slipcover,代码行数:9,代码来源:editor.py

示例8: onSubmit

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
 def onSubmit(self, event):
     # This event is fired just before the form is submitted. We can take
     # this opportunity to perform validation.
     print "onSubmit", event
     if (len(self.tb.getText()) == 0):
         Window.alert("The text box must not be empty")
         event.setCancelled()
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:9,代码来源:FormPanelExample.py

示例9: check_win

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
 def check_win(self):
     for i in range(self.parent.getRowCount()):
         for j in range(self.parent.getColumnCount()):
             if self.parent.getWidget(i,j).light:
                 return 
     Window.alert('You win!!! But can you beat the next level?')
     global game
     game.next_level()
开发者ID:jaredly,项目名称:pyjamas,代码行数:10,代码来源:lightout.py

示例10: onSelection

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
 def onSelection(self, event):
     clickedLink = event.getSelectedItem()
     if clickedLink.getChildCount() == 0:
         if not self.apiClient.isSessionValid():
             Window.alert(u"Your session has expired")
             self.showcaseWrapper.clear()
         else:
             History.newItem(clickedLink.getText())
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:10,代码来源:ShowcaseClient.py

示例11: save

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
 def save(self, _):
     global gw
     pwd=""
     if self.password.getText() != "" or self.passwordRepeat.getText() != "":
         if self.password.getText() != self.passwordRepeat.getText():
             Window.alert("Passwords differ");
             return
         pwd = pwhash(self.password.getText())
     gw.updateUser(self.app.cookie, self.uid, self.handle.getText(), self.name.getText(), pwd, self.admin.isChecked(), self.email.getText(), RPCCall(self.onUpdate))
开发者ID:antialize,项目名称:djudge,代码行数:11,代码来源:main.py

示例12: createPanels

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
    def createPanels(self):
        """ Create the various panels to be used by this application.

            This should be overridden by the subclass to create the various
            panels the application will use.  Upon completion, the subclass
            should return a dictionary mapping the ID to use for each panel to
            the panel to be displayed.
        """
        Window.alert("Must be overridden.")
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:11,代码来源:uiHelpers.py

示例13: onRemoteResponse

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
 def onRemoteResponse(self, response, request_info):
     '''
     Called when a response is received from a RPC.
     '''
     if request_info.method == 'getaccounts':
         #TODO
         self.updateGrid(response)
     else:
         Window.alert('Unrecognized JSONRPC method.')
开发者ID:fedenko,项目名称:clientbank,代码行数:11,代码来源:AccountListSink.py

示例14: onRemoteResponse

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
    def onRemoteResponse(self, response, request_info):

        method = request_info.method
        if method == 'getExampleObjects':
            self.exampleTable.clear()
            for obj in response:
                self.exampleTable.add(ExampleObject(obj, response[obj]))
        else:
            Window.alert('DefaultView: Unrecognized JSONRPC method. method= %s' % method)
开发者ID:ikebrown,项目名称:html5App,代码行数:11,代码来源:DefaultView.py

示例15: mouseOverMarker

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import alert [as 别名]
 def mouseOverMarker( self,ind ):
     Window.alert('test1')
     marker = self.markers[ind]
     iwo = InfoWindowOptions()
     iwo.position = marker['latlng']
     iwo.content = marker['title']
     Window.alert('test2')
     self.iw = InfoWindow( iwo )
     self.iw.open( self.mapPanel.map )
开发者ID:jackdreilly,项目名称:iShakeBackend,代码行数:11,代码来源:EventSimple.py


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