本文整理汇总了Python中dialog.Dialog方法的典型用法代码示例。如果您正苦于以下问题:Python dialog.Dialog方法的具体用法?Python dialog.Dialog怎么用?Python dialog.Dialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dialog
的用法示例。
在下文中一共展示了dialog.Dialog方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: btslist
# 需要导入模块: import dialog [as 别名]
# 或者: from dialog import Dialog [as 别名]
def btslist():
global height,width,bts
d = dialog.Dialog()
d.setBackgroundTitle('Pick a BTS')
f=open(gsmsession + '/scan.current')
bts=[]
mylist=[]
for line in f:
m=re.search('.*;(.*);(.*);(.*);(.*)', line)
if(m):
mylist.append([m.group(2),"%s-%s %s"%(m.group(1),m.group(3),m.group(4)),"helptext"])
bts.append([m.group(2),m.group(3),m.group(1),"",m.group(4)])
f.close()
choice = d.menu("Pick a BTS", item_help=1, width=width-6, menu_height=height-10, choices=mylist)
if choice[1]=="":
return -1
for sublist in bts:
if sublist[0]==choice[1]:
return sublist
return -1 #wtf?
示例2: imp_dialog
# 需要导入模块: import dialog [as 别名]
# 或者: from dialog import Dialog [as 别名]
def imp_dialog(self):
try:
from dialog import Dialog
except ImportError:
raise SystemExit()
self.d = Dialog(dialog="dialog", autowidgetsize=True)
示例3: run_interactively
# 需要导入模块: import dialog [as 别名]
# 或者: from dialog import Dialog [as 别名]
def run_interactively():
"""Select and run data pipelines"""
from dialog import Dialog
d = Dialog(dialog="dialog", autowidgetsize=True) # see http://pythondialog.sourceforge.net/doc/widgets.html
def run_pipeline_and_notify(pipeline: pipelines.Pipeline, nodes: {pipelines.Node} = None):
if not run_pipeline(pipeline, nodes, interactively_started=True):
sys.exit(-1)
def menu(node: pipelines.Node):
if isinstance(node, pipelines.Pipeline):
code, choice = d.menu(
text='Pipeline ' + '.'.join(node.path()) if node.parent else 'Root pipeline',
choices=[('▶ ', 'Run'), ('>> ', 'Run selected')]
+ [(child.id, '→' if isinstance(child, pipelines.Pipeline) else 'Run')
for child in node.nodes.values()])
if code == d.CANCEL:
return
if choice == '▶ ':
run_pipeline_and_notify(node)
elif choice == '>> ':
code, node_ids = d.checklist('Select sub-nodes to run. If you want to run all, then select none.',
choices=[(node_id, '', False) for node_id in node.nodes.keys()])
if code == d.OK:
run_pipeline_and_notify(node, {node.nodes[id] for id in node_ids})
else:
menu(node.nodes[choice])
return
else:
run_pipeline_and_notify(pipeline=node.parent, nodes=[node])
menu(config.root_pipeline())
示例4: __init__
# 需要导入模块: import dialog [as 别名]
# 或者: from dialog import Dialog [as 别名]
def __init__(self, voc_path, train_dir):
self.dialog = Dialog()
self.dialog.load_vocab(voc_path)
self.model = Seq2Seq(self.dialog.vocab_size)
self.sess = tf.Session()
ckpt = tf.train.get_checkpoint_state(train_dir)
self.model.saver.restore(self.sess, ckpt.model_checkpoint_path)
示例5: main
# 需要导入模块: import dialog [as 别名]
# 或者: from dialog import Dialog [as 别名]
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)