本文整理汇总了Python中dialog.Dialog类的典型用法代码示例。如果您正苦于以下问题:Python Dialog类的具体用法?Python Dialog怎么用?Python Dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,scr,title = "Chat"):
""" takes the curses window to pop up over, title to display, will dynamically size to parent window """
self.current_buddy = None
self.current_server = None
self.chat_connection = None
self.win = None
self.buddys = None
self.messages = None
self.reply = None
self.reply_border = None
self.config_button = None
self.cancel = None
self.config = {}
self.status = {}
self.children = []
self.myname = None
self.event_time = time.clock()
self.title = title
# load the config right away
self.load_config()
self.setparent(scr)
self.resize()
max_y,max_x = self.getparent().getmaxyx()
min_y,min_x = self.getparent().getbegyx()
Dialog.__init__(self,scr,"ChatDialog", max_y, max_x, [ Frame(title),
self.buddys,
self.messages,
self.reply_border,
self.reply,
self.config_button,
self.cancel], min_y, min_x)
self.start_chat_thread()
示例2: __init__
def __init__(self, path=os.getcwd(), extensions=[], title="Select File",
width=540, height=300, window=None, batch=None, group=None,
anchor=ANCHOR_CENTER, offset=(0, 0),
theme=None, movable=True, on_select=None, on_escape=None):
self.path = path
self.extensions = extensions
self.title = title
self.on_select = on_select
self.selected_file = None
self._set_files()
def on_parent_menu_select(choice):
self._select_file(self.parents_dict[choice])
def on_menu_select(choice):
self._select_file(self.files_dict[choice])
self.dropdown = Dropdown(options=self.parents,
selected=self.parents[-1],
align=VALIGN_BOTTOM,
on_select=on_parent_menu_select)
self.menu = Menu(options=self.files, align=HALIGN_LEFT,
on_select=on_menu_select)
self.scrollable = Scrollable(
VerticalLayout([self.dropdown, self.menu], align=HALIGN_LEFT),
width=width, height=height)
content = self._get_content()
Dialog.__init__(self, content, window=window, batch=batch, group=group,
anchor=anchor, offset=offset, theme=theme,
movable=movable, on_escape=on_escape)
示例3: submit
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)
示例4: showSettings
def showSettings(self):
settings = QtCore.QSettings()
dlg = Dialog(
settings.value("connect_points_plugin/point_layer_from", ""),
settings.value("connect_points_plugin/polygin_layer_to", ""),
settings.value("connect_points_plugin/filed_name_id_from", ""),
settings.value("connect_points_plugin/filed_name_link", ""),
settings.value("connect_points_plugin/filed_name_id_to", ""),
settings.value("connect_points_plugin/result_layer_name", ""),
self._iface.mainWindow()
)
res = dlg.exec_()
if res == Dialog.Accepted:
# QgisPlugin().plPrint("Save settings")
plugin_settings = dlg.getSettings()
settings.setValue("connect_points_plugin/point_layer_from", plugin_settings[0])
settings.setValue("connect_points_plugin/polygin_layer_to", plugin_settings[1])
settings.setValue("connect_points_plugin/filed_name_id_from", plugin_settings[2])
settings.setValue("connect_points_plugin/filed_name_link", plugin_settings[3])
settings.setValue("connect_points_plugin/filed_name_id_to", plugin_settings[4])
settings.setValue("connect_points_plugin/result_layer_name", plugin_settings[5])
dlg.deleteLater()
del dlg
示例5: __init__
def __init__(self, startDir, callback, filter = ".*"):
currentDir = startDir.replace('\\','/')
self.callback = callback
self.filter = filter
Dialog.__init__(self, -1, -1, 400,240, "File Dialog")
self.setLayout(pyui2.layouts.TableLayoutManager(6,8))
self.dirLabel = pyui2.widgets.Label("Directory:")
self.fileLabel = pyui2.widgets.Label("Filename:")
self.filterLabel = pyui2.widgets.Label("Filter:")
self.dirBox = pyui2.widgets.Label(currentDir)
self.filesBox = pyui2.widgets.ListBox(self._pyui2Selected, self._pyui2DoubleClicked)
self.nameBox = pyui2.widgets.Label("")
self.filterBox = pyui2.widgets.Edit(self.filter,10,self._pyui2Filter)
self.dirButton = pyui2.widgets.Button("Up", self._pyui2Up)
self.openButton = pyui2.widgets.Button("Open", self._pyui2Open)
self.closeButton = pyui2.widgets.Button("Close", self._pyui2Close)
self.addChild( self.dirLabel, (0,0,2,1) )
self.addChild( self.fileLabel, (0,6,2,1) )
self.addChild( self.filterLabel, (0,7,2,1) )
self.addChild( self.dirBox, (2,0,3,1) )
self.addChild( self.filesBox, (0,1,6,5) )
self.addChild( self.nameBox, (2,6,3,1) )
self.addChild( self.filterBox, (2,7,3,1) )
self.addChild( self.dirButton, (5,0,1,1) )
self.addChild( self.openButton, (5,6,1,1) )
self.addChild( self.closeButton, (5,7,1,1) )
self.pack()
self.setCurrentDir(currentDir)
示例6: execute
def execute(self, source, target):
if not len(target):
return "Area name not specified"
area_id = target[0].lower()
confirm_dialog = Dialog(DIALOG_TYPE_CONFIRM, "Are you sure you want to permanently remove area: " + area_id, "Confirm Delete", self.finish_delete)
confirm_dialog.area_id = area_id
return DialogMessage(confirm_dialog)
示例7: run
def run(self):
from dialog import Dialog
dlg = Dialog(self.iface)
dlg.show()
dlg.exec_()
示例8: main
def main():
while True:
vms = Principal()
ip = vms.get_ip_address(LocalInterface)
result = vms.auth(ip)
token = result.split()[1]
result = vms.procurar(ip, token)
varcontrole = ""
window = Dialog()
if result.split()[0] == "ERR:":
varcontrole = window.yesno("No VMs found. Refresh?")
if varcontrole != 0:
sys.exit(1)
else:
if len(result.split()) > 1:
lista_vms = [(r, '') for r in result.split(' ')]
status, vm = window.menu("VM List", choices=lista_vms)
if status != 0:
sys.exit(1)
else:
vm = result.split()[0]
result = vms.status(vm, token)
if result.split()[0] == "ERR:":
result = vms.ligar(vm, token)
result = vms.conectar(vm, token)
if EnableShutdown:
os.system("shutdown now -h")
sys.exit(1)
示例9: on_action_3_triggered
def on_action_3_triggered(self):
"""
Slot documentation goes here.
"""
# TODO: not implemented yet
#dialog = Dialog()
d = Dialog(self.tableView, self)
d.show()
示例10: ask_user
def ask_user(self):
d = Dialog(callback=self.set_yesno,
text='Just do it?',
action_name='Do It',
title = 'This is a Dialog')
app.dialog = d
d.bind(on_dismiss=app.clear_dialog)
d.open()
示例11: DialogParser
class DialogParser():
"""This class takes care of parsing a chuck of text to make it into a simple list of lines"""
text = ""
def __init__(self, webclient, **kwargs):
"""Constructor"""
self.webclient = webclient
if "filepath" in kwargs:
self.load_text_file(kwargs["filepath"])
def load_text_file(self, filepath):
with open(os.path.abspath(filepath), mode = "r+") as text_file:
self.text = unicode(text_file.read(), "utf-8")
def parse_dialog(self):
"""Parses a dialog using the text class attribute"""
#attempt to match a header containing voice assignments
match_obj = re.compile(r'\[(.*?)\](.*)', re.UNICODE | re.DOTALL).match(self.text)
self.dialog = Dialog()
if match_obj is None:
#match didn't work, there's no voice assignment header
lines = re.compile(r'[\n]+', re.UNICODE).split(self.text)
for line in lines:
if line != "":
splitted = line.split(":", 1)
self.dialog.add_cue(Cue(voice_ref=self.webclient.get_voice_object_from_name(splitted[0]), line=splitted[1]))
else:
#match worked, we have to parse the voice header which looks like this [ character1 : voicename1, ...]
voice_defs = match_obj.groups()[0].split(",")
character_dict = dict()
for voice_def in voice_defs:
character, voice = tuple([string.strip() for string in voice_def.split(":")])
character_dict[character.upper()] = self.webclient.get_voice_object_from_name(voice)
#then parsing the dialog using both the defined characters and the regular voices
#match didn't work, there's no voice assignment header
lines = re.compile(r'[\n]+', re.UNICODE).split(match_obj.groups()[1])
for line in lines:
if line != "":
splitted = line.split(":", 1)
#checking if the voice is a "character" voice or a regular voice
if character_dict.has_key(splitted[0].strip().upper()):
voice_obj = character_dict[splitted[0].strip().upper()]
else:
voice_obj = self.webclient.get_voice_object_from_name(splitted[0])
self.dialog.add_cue(Cue(voice_ref=voice_obj, line=splitted[1]))
def parse_from_string(self, text):
self.text = text
self.parse_dialog()
return self.dialog
示例12: choose_cols
def choose_cols(self):
# XX possibility un/check all
chosens = [(str(i + 1), f, i in self.csv.settings["chosen_cols"]) for i, f in enumerate(self.csv.fields)]
d = Dialog(autowidgetsize=True)
ret, values = d.checklist("What fields should be included in the output file?",
choices=chosens)
if ret == "ok":
self.csv.settings["chosen_cols"] = [int(v) - 1 for v in values]
self.csv.is_processable = True
示例13: activated
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
示例14: start
def start(self, delay_msec=UPDATE_MSEC):
Dialog.start(self)
self.schedule_display_task(delay_msec)
height = int(self.driver.canvas['height'])-100
self.scrollbar.place(x=0, y=0, width=SCROLLBAR_WIDTH, height=height)
self.listbox.place(x=SCROLLBAR_WIDTH, y=0, width=self.driver.canvas['width'], height=str(height))
self.checkbox.place(x=10, y = height+10)
示例15: main
def main(_):
dialog = Dialog()
dialog.load_vocab(FLAGS.voc_path)
dialog.load_examples(FLAGS.data_path)
if FLAGS.train:
train(dialog, batch_size=FLAGS.batch_size, epoch=FLAGS.epoch)
elif FLAGS.test:
test(dialog, batch_size=FLAGS.batch_size)