本文整理汇总了Python中dialog.Dialog.show方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.show方法的具体用法?Python Dialog.show怎么用?Python Dialog.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dialog.Dialog
的用法示例。
在下文中一共展示了Dialog.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def run(self):
from dialog import Dialog
dlg = Dialog(self.iface)
dlg.show()
dlg.exec_()
示例2: submit
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def submit(self):
m = str(self.textArea.toPlainText()).strip()
if m.find('@timenow') is not -1:
url = 'http://localhost:8000/polls/GetCurSet2/'
r = requests.get(url)
timenow = json.loads(str(r.text))['curTime']
m = m.replace('@timenow', '<a href="time://' + str(timenow) + '">@' + str(timenow) + '</a>')
payload={'name':self.username, 'message':m}
if m is not '':
if self.isQues.isChecked():
payload['isQues'] = True
payload['isAns' ] = False
elif self.isAns.isChecked():
payload['isQues'] = False
payload['isAns' ] = True
payload[ 'tag' ] = str(self.tagArea.text()).strip()
else:
payload['isQues'] = False
payload['isAns' ] = False
url = 'http://localhost:8000/polls/PostInsertQuery/'
data = {'data':json.dumps(payload)}
r = requests.get(url,params = data)
# Checks if the request is processed correctly by the server
if int(r.status_code) == 500:
d = Dialog ('Invalid! Please Try Again..',self)
d.show()
self.tagArea.clear()
else:
self.textArea.setText('')
self.tagArea.clear()
self.isChat.setChecked(True)
示例3: on_action_3_triggered
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def on_action_3_triggered(self):
"""
Slot documentation goes here.
"""
# TODO: not implemented yet
#dialog = Dialog()
d = Dialog(self.tableView, self)
d.show()
示例4: scence1
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def scence1(screen):
#background = gameObject.createBgd(tileSheet)
screen.fill((0,0,0))
zeldaDialog = Dialog(screen, zeldaPhoto)
linkDialog = Dialog(screen, linkPhoto)
unNoDialog = Dialog(screen)
unNoDialog.message = (
"???: Excuse me! Sir. ",
"Princess Zelda would like to have a word with you. ",
"She is waiting for you in front of the castle. ",
"Do not make princess waiting for you to long. ",)
unNoDialog.show = True
unNoDialog.sndNext()
unNoDialog.message = (
"Ok, let me explain the basic control. ",
"Basicly, there are three keyboard you have to know: ",
"Escape key: exit from current state (useless in dialog) ",
"Spacebar : to advance dialog, to talk, to start the game ",
"Enter key : mostly work the same as spacebar ",
"use arrow key to move. ")
unNoDialog.show = True
unNoDialog.sndNext()
linkDialog.message = (
"Ok! I will be there right away. ",
"Thank you. ")
linkDialog.show = True
linkDialog.sndNext()
if test.run(screen):
keepGoing = True
else:
keepGoing = False
return True #donePlayer = True
cover = pygame.Surface(screen.get_size())
cover.fill((0,0,0,0))
cover = cover.convert()
alpha = 0
time = pygame.time.Clock()
pygame.mixer.music.fadeout(500)
while keepGoing:
time.tick(30)
if alpha >= 255:
keepGoing = False
cover.set_alpha(alpha)
alpha += 5
screen.blit(cover, (0,0))
pygame.display.flip()
return False #donePlaying = false
示例5: activated
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def activated(self, index):
'''
After activated item from list, appropriate dialog will appear.
'''
if not ( index.parent().data().toString().isEmpty() ) or not ( isinstance(index.model(), QStandardItemModel) ):
module = self.moduleList.model().data(index,Qt.UserRole+1).toPyObject()
dialog = Dialog(self._iface, module)
dialog.show()
else:
pass
示例6: search
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def search(self):
if not self.is_number(self.searchArea.text()):
d = Dialog ('Invalid! Please Try Again..',self)
d.show()
self.searchArea.clear()
else :
url = 'http://localhost:8000/polls/Search/'
payload = {'id' : int(self.searchArea.text())}
r = requests.get(url, params=payload)
m = json.loads(r.text)
if int(r.status_code) == 500:
d = Dialog ('Invalid! Please Try Again..',self)
d.show()
self.searchArea.clear()
else:
data = json.loads(r.text)
if data['ques'] == {}:
d = Dialog ('Not a question! Please Try Again..',self)
d.show()
self.searchArea.clear()
else:
message = 'Q '+ str(data['ques']['message'])
message += '\n'
if data['ques']['hasAns']:
ans = data['answer']
j = 1
for i in ans:
message +='A'+str(j)+' '+ i['message']+'\n'
j += 1
d = Dialog (message,self)
d.show()
self.searchArea.clear()
示例7: Register
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
class Register(QtGui.QDialog,form2_class):
"""A simple Media Player using VLC and Qt
"""
def __init__(self, master=None):
QtGui.QMainWindow.__init__(self, master)
self.setupUi(self)
self.setWindowTitle("Register Window")
self.okButton.clicked.connect(self.register)
self.cancelButton.clicked.connect(self.close)
def register(self):
for i in ('username','password','email','fname','lname'):
exec ("%sValue = str(self.%s.text()).strip()" % (i,i))
isTA = self.checkBox.isChecked()
if all(a != '' for a in (usernameValue, passwordValue, emailValue, fnameValue, lnameValue)):
payload = {
'username' : str (usernameValue),
'pass' : str (passwordValue),
'email' : str (emailValue),
'lname' : str (lnameValue),
'fname' : str (fnameValue),
'ista' : str (isTA)
}
url = URL + 'Register/'
r=requests.get(url,params=payload)
if int(r.status_code) == 500:
self.dlg = Dialog('Username already aquired...')
self.dlg.show()
else:
self.dlg = Dialog(r.text+' successfully registered', self)
self.dlg.show()
self.hide()
else: Dialog('Field Missing!', self).show()
def closeEvent(self, event):
reply = QtGui.QMessageBox.question(self, 'Message',
"Are you sure to quit?", QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
event.accept()
else:
event.ignore()
示例8: scenceLevel3
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def scenceLevel3(screen):
background = gameObject.createBgd(tileSheet)
screen.blit(background, (0,0))
zeldaDialog = Dialog(screen, zeldaPhoto)
linkDialog = Dialog(screen, linkPhoto)
zeldaDialog.message = (
"Pretty good job Link! ",
"Nevertheless, I would like more candies.",
"Let's head to Candy Castle 1. ")
zeldaDialog.show = True
zeldaDialog.sndNext()
zeldaDialog.message = (
"As I know from the people around there, ",
"there are out number of zombies. If you think you ",
"can't avoide them, you can throw the candy as your ",
"bullet and they'll out of your way. ",
"(hit spacebar to throw, you can't throw candy if you ",
"have 0 candy.) ")
zeldaDialog.show = True
zeldaDialog.sndNext()
示例9: scenceLevel2
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def scenceLevel2(screen):
background = gameObject.createBgd(tileSheet)
screen.blit(background, (0,0))
zeldaDialog = Dialog(screen, zeldaPhoto)
linkDialog = Dialog(screen, linkPhoto)
zeldaDialog.message = (
"Pretty good job Link! ",
"Nevertheless, I would like more candies.",
"Let's head to Candy Forest 2. ")
zeldaDialog.show = True
zeldaDialog.sndNext()
示例10: conversion
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def conversion(self, screen = None):
if not screen:
screen = pygame.display.set_mode((640, 480))
dialog = Dialog(screen,zeldaPhoto)
if self.conNum == 0:
linkDialog = Dialog(screen, linkPhoto)
dialog.message = (
"Link!!!! ",
"I miss you very much. ",
"How have you been? ")
dialog.show = True
dialog.sndNext()
linkDialog.message = (
"... ",
"so far so good. ")
linkDialog.show = True
linkDialog.sndNext()
dialog.message = (
"What's bite you! ",
"Anyway, I have some mission for you to do. ",
"I'm sure it is piece of cake for you. ")
dialog.show = True
dialog.sndNext()
linkDialog.message = (
"??? ",
"yea? ")
linkDialog.show = True
linkDialog.sndNext()
dialog.message = (
"Here is the deal. "
"I want you to bring some candies. ",
"Oh, anyway, I want a lot of candies. ",
"Therefore, You have to collect as many candies as possible. ",
"I love candy very much because it tast extremely woderfull. ",
"You know what, ... uh...oh, I know that eating candy would ",
"help my teeth drop easily. Once they're all gone, I have no ",
"worry about toothache any more. ",
"Ok, now let's head to Candy Forest and collect them for me. ")
dialog.show = True
dialog.sndNext()
self.conNum += 1
elif self.conNum == 1:
dialog.message = (
"Hello, Link ",
"How are you doing? ",
)
dialog.show = True
dialog.sndNext()
示例11: mapNumber2
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
#.........这里部分代码省略.........
(unWalkSurf, (335, 150)),(unWalkSurf1,(535, 150)),(unWalkSurf, (535, 200)),
(unWalkSurf, (585, 200)),(unWalkSurf2,(432,150)),(unWalkSurf2,(495,150))]
unWalkLayer = gameObject.Layer()
unWalkLayer.fillPart(surfList, True, invinsible = True)
transferLayer = gameObject.Layer()
transferLayer.transPoint((525, 140))
transferLayer1 = gameObject.Layer()
transferLayer1.transPoint((475, 140),(50,20))
transferLayer2 = gameObject.Layer()
transferLayer2.transPoint((410, 140),(50,20))
transRectList = [transferLayer.rect, transferLayer1.rect, transferLayer2.rect]
transferLayer3 = gameObject.Layer()
transferLayer3.transPoint((0, 350),(5,300))
transferLayer4 = gameObject.Layer()
transferLayer4.transPoint((640, 350),(5,300))
for element in unWalkLayer.unWalkableList:
link.unWalkableList.append(element)
link.unWalkableList.append(princess.rect)
dialog = Dialog(screen)
allSprite = pygame.sprite.Group(unWalkLayer, transferLayer, transferLayer1,
transferLayer2, transferLayer3, transferLayer4, princess,link)
keepGoing = True
time = pygame.time.Clock()
canLeave = False
screen.blit(background, (0,0))
while keepGoing:
time.tick(30)
for event in pygame.event.get():
if event.type == pygame.QUIT:
keepGoing = False
return -1, None
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
keepGoing = False
return -1, None
elif event.key == pygame.K_SPACE:
if link.bigRect.colliderect(princess.rect):
if link.dir == "up":
princess.face("down")
elif link.dir == "down":
princess.face("up")
if link.dir == "left":
princess.face("right")
elif link.dir == "right":
princess.face("left")
allSprite.clear(screen, background)
allSprite.update()
allSprite.draw(screen)
pygame.display.flip()
princess.conversion(screen)
princess.face("down")
canLeave = True
mousePos = gameObject.mouse_pos()
pygame.display.set_caption("Mouse Pos: %s" % str(mousePos))
if link.rect.collidelist(transRectList) != -1:
keepGoing = False
return 1, (560, 390)
elif link.rect.colliderect(transferLayer3.rect):
if canLeave:
keepGoing = False
return 0, None
link.move("right")
link.move("right")
link.moveStep([("right", 10),])
dialog.message = ("I have to talk with princess ",
"before I set out. ")
dialog.show = True
dialog.sndNext()
#link.face("right")
if link.rect.colliderect(transferLayer4.rect):
if canLeave:
keepGoing = False
return 0, None
link.move("left")
link.move("left")
link.moveStep([("left", 10),])
dialog.message = ("I have to talk with princess ",
"before I set out. ")
dialog.show = True
dialog.sndNext()
#link.face("left")
allSprite.clear(screen, background)
allSprite.update()
allSprite.draw(screen)
pygame.display.flip()
return 0, None
示例12: PostQues
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
class PostQues(QtGui.QWidget):
'''
A simple class for posting popup question to check presence
'''
def __init__(self,master=None):
QtGui.QWidget.__init__(self, master)
self.setWindowTitle('Post Question')
self.i=0
self.option = []
self.question = []
self.optionEdit = []
self.questionEdit = []
self.currectOption = []
self.question.append(QtGui.QLabel('Question'))
self.option.append(QtGui.QLabel('Option'+ str(self.i + 1)))
self.questionEdit.append(QtGui.QLineEdit())
self.optionEdit.append(QtGui.QLineEdit())
self.addOptButton = QtGui.QPushButton('',self)
self.addOptButton.setIcon(QtGui.QIcon('add.png'))
self.addOptButton.clicked.connect(self.addOption)
self.submitButton = QtGui.QPushButton('Submit',self)
self.submitButton.clicked.connect(self.submit)
self.currectOption.append(QtGui.QCheckBox('',self))
self.grid = QtGui.QGridLayout()
self.grid.setSpacing(10)
self.grid.addWidget(self.question[self.i], 1, 0)
self.grid.addWidget(self.questionEdit[self.i], 1, 1,1,6)
self.grid.addWidget(self.option[self.i], 2, 0)
self.grid.addWidget(self.optionEdit[self.i], 2, 1,1,4)
self.grid.addWidget(self.currectOption[self.i], 2, 5)
self.grid.addWidget(self.addOptButton, 2,6)
self.grid.addWidget(self.submitButton, 3,2,1,2)
self.i+=1
self.setLayout(self.grid)
# self.setGeometry(300, 300, 350, 300)
self.setWindowTitle('Review')
def addOption(self):
self.option.append(QtGui.QLabel('Option'+ str(self.i + 1)))
self.optionEdit.append(QtGui.QLineEdit())
self.currectOption.append(QtGui.QCheckBox('',self))
self.grid.addWidget(self.option[self.i], 2+self.i, 0)
self.grid.addWidget(self.optionEdit[self.i],2+self.i,1,1,4)
self.grid.addWidget(self.currectOption[self.i], 2+self.i, 5)
self.grid.addWidget(self.addOptButton, 2 + self.i, 6)
self.grid.addWidget(self.submitButton, 3 + self.i, 2, 1, 2)
self.i+=1
def submit(self):
options=[]
currectAns = []
question = str(self.questionEdit[0].text()).strip()
for j in xrange(self.i):
options.append(str(self.optionEdit[j].text()).strip())
if self.currectOption[j].isChecked():
currectAns.append(True)
else:
currectAns.append(False)
if not question or options[0] == '':
self.dlg = Dialog("Field missing")
self.dlg.show()
else:
url = 'http://localhost:8000/polls/PostQues/'
payload = {'options':options, 'ques':question, 'currectAnswer':currectAns}
r=requests.get(url,params=payload)
self.hide()
def closeEvent(self, event):
reply = QtGui.QMessageBox.question(self, 'Message',
"Are you sure to quit?", QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
event.accept()
else:
event.ignore()
示例13: main
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
def main():
a = QApplication(sys.argv)
w = Dialog()
w.show()
w.destroyed.connect(a.quit)
return a.exec_()
示例14: Player
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
class Player(QtGui.QMainWindow,form_class):
"""A simple Media Player using VLC and Qt for client side
"""
def __init__(self,sid=None, master=None):
QtGui.QMainWindow.__init__(self, master)
self.setupUi(self)
self.setWindowTitle("Media Player")
# creating a basic vlc instance
self.instance = vlc.Instance()
# creating an empty vlc media player
self.mediaplayer = self.instance.media_player_new()
self.timer = QtCore.QTimer(self)
self.timer.setInterval(200)
# Connection setups
self.timer.timeout.connect(self.updateUI)
self.timeslider.sliderMoved.connect(self.setPosition)
self.playbutton.clicked.connect(self.asynPlay)
self.stopbutton.clicked.connect(self.stop)
self.playbutton.setIcon(QtGui.QIcon('playButton.png'))
self.playbutton.setIconSize(QtCore.QSize(24,24))
self.stopbutton.setIcon(QtGui.QIcon('stopButton.png'))
self.stopbutton.setIconSize(QtCore.QSize(24,24))
self.volumeslider.setValue(self.mediaplayer.audio_get_volume())
self.volumeslider.valueChanged.connect(self.setVolume)
self.menuOpen.triggered.connect(self.openFile)
self.menuExit.triggered.connect(sys.exit)
self.menuChatbox.triggered.connect (self.openChat)
#variables
self.data = {}
self.isPlaying = False
self.isPaused = True
self.isStopped = False
self.haveQues = False
self.sync = False
self.Play = False
self.curPosition = 0
self.previousStatus = ''
self.lastState = ''
self.QuesSet = []
self.sessionid = sid
self.chat = None
if self.mediaplayer.play() == -1:
self.playbutton.setText("Open")
self.openChat()
self.setGeometry(255,0,640,600)
def openChat (self):
if self.chat:
self.chat.hide()
self.chat = Chat (self, False, self.sessionid)
self.chat.show()
def setPosition (self, position):
self.mediaplayer.set_position(position/1000.0)
def openFile(self, filename=None):
"""Open a media file in a MediaPlayer
"""
print 'in openfile'
# First checking id we have the md5 of the file in session.
# we can have the md5 only if the server is already open.
# getting the digest value from the snc_server
cookies = {'sessionid':self.sessionid}
url = URL + 'InitDigest/'
dig = str(requests.get(url,cookies=cookies).text)
# changing the filename according to the fact weather md5 is provided or not.
# ========================================================================================================================
if dig is not '':
# retrive the filename if available.
# if not available then, take further actions by informing the user.
os.chdir('../SNC_folder')
filelist = []
for i in [k for asd,asdf,k in os.walk('.')][0]: filelist.append(os.getcwd() + '/' + i)
# calculated md5 is stored in form of dict in this variable
digest = {}
#for i in filelist: digest[str(hashlib.md5(open(i).read(128)).hexdigest())] = i
for i in filelist:
f = open(i)
s = str (hashlib.md5(f.read(128)).hexdigest())
f.close()
digest[s] = i
# if digest.has_key(dig):
# filename = digest[dig]
# print filename
# break
if digest.has_key(dig):
filename = digest[dig]
print filename
#.........这里部分代码省略.........
示例15: Login
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show [as 别名]
class Login(QtGui.QMainWindow,form_class):
"""A simple Media Player using VLC and Qt
"""
def __init__(self, master=None):
QtGui.QMainWindow.__init__(self, master)
self.setupUi(self)
self.setWindowTitle("Login Window")
self.registerButton.clicked.connect(self.openRegisteration)
self.loginButton.clicked.connect(self.login)
self.cancelButton.clicked.connect(self.closeWindow)
self.sessionid = ''
self.dlgw=[]
def login(self):
usernameValue =str(self.username.text()).strip()
passwordValue =str(self.password.text()).strip()
if usernameValue == '' or passwordValue == '':
self.dlg=Dialog('Field Missing!')
self.dlg.show()
else:
payload = {
'username' : str (usernameValue),
'pass' : str (passwordValue)
}
url = URL + 'Login/'
r = requests.get(url,params=payload)
if r.text == '':
self.dlg = Dialog("username or password incorrect")
self.dlg.show()
else:
# Login Successfull
self.sessionid = r.cookies['sessionid']
# Initialising the request with the session variables
cookies = {'sessionid':self.sessionid}
requests.get(URL + 'Initialise/', cookies=cookies)
data = json.loads(r.text)
isTA = data['isTA']
if isTA:
self.dpl = TaView()
self.dpl.postSessionid (self.sessionid)
self.dpl.show()
# self.snc = snc_server.Player(self, self.sessionid)
# self.snc.show()
else:
self.snc = snc_client.Player(self.sessionid)
self.snc.show()
# self is passed in the chat to gain the access to
# self.sessionid variable..
# self.chat = Chat(self,isTA)
# self.chat.show()
self.hide()
def openRegisteration(self):
self.reg = Register()
self.reg.show()
def closeWindow(self):
QtCore.QCoreApplication.instance().quit()
def closeEvent(self, event):
reply = QtGui.QMessageBox.question(self, 'Message',
"Are you sure to quit?", QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
event.accept()
else:
event.ignore()