本文整理汇总了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()
示例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..")
示例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)
示例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)
示例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
示例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
示例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()
示例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()
示例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()
示例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())
示例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))
示例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.")
示例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.')
示例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)
示例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 )