本文整理匯總了Python中dialogs.form_dialog方法的典型用法代碼示例。如果您正苦於以下問題:Python dialogs.form_dialog方法的具體用法?Python dialogs.form_dialog怎麽用?Python dialogs.form_dialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dialogs
的用法示例。
在下文中一共展示了dialogs.form_dialog方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: tableview_accessory_button_tapped
# 需要導入模塊: import dialogs [as 別名]
# 或者: from dialogs import form_dialog [as 別名]
def tableview_accessory_button_tapped(self, tableview, section, row):
wiki = self.wikis[tableview.data_source.items[row]['title']]
wikiname = tableview.data_source.items[row]['title']
s1fields = [{'type': 'text', 'key': 'title', 'title': 'Title',
'value': wikiname},
{'type': 'url', 'key': 'url', 'title': 'URL',
'value': wiki['url']}]
urlinfo = 'Make sure that your URL starts with "http://" or "https://'\
'" and it is NOT the full wiki URL like "https://en.wikiped'\
'ia.org/wiki." Use "https://en.wikipedia.org" instead.'
s2fields = [{'type': 'url', 'key': 'extension',
'title': 'Wiki extension', 'value': wiki['ext']}]
extInfo = 'What is meant by "Wiki extension" is the end of the wiki\''\
's url (for Wikipedia it\'s "/wiki.")'
result = dialogs.form_dialog('Edit Data',
sections=(('', s1fields, urlinfo),
('', s2fields, extInfo)))
if result:
origTitle = tableview.data_source.items[row]['title']
tableview.data_source.items[row]['title'] = result['title']
tableview.reload_data()
self.wikis[tableview.data_source.items[row]['title']] =
{'url': result['url'], 'ext': result['extension']}
del self.wikis[origTitle]
示例2: add
# 需要導入模塊: import dialogs [as 別名]
# 或者: from dialogs import form_dialog [as 別名]
def add(self, sender):
'''Add wiki to list of wikis'''
s1fields = [{'type': 'text', 'key': 'title', 'title': 'Title'},
{'type': 'url', 'key': 'url', 'title': 'URL',
'value': 'http'}]
urlinfo = 'Make sure that your URL starts with "http://" or "https://'\
'"and it is NOT the full wiki URL like "https://en.wikipedi'\
'a.org/wiki." Use "https://en.wikipedia.org" instead.'
s2fields = [{'type': 'url', 'key': 'extension',
'title': 'Wiki extension'}]
extInfo = 'What is meant by "Wiki extension" is the end of the wiki\''\
's url (for Wikipedia it\'s "/wiki.")'
result = dialogs.form_dialog('Add Wiki',
sections=(('', s1fields, urlinfo),
('', s2fields, extInfo)))
if result:
self.tv.data_source.items.append(({'title': result['title'],
'accessory_type':
'detail_disclosure_button'}))
self.tv.delegate.wikis[result['title']] = {'url': result['url'],
'ext':
result['extension']}
self.tv.reload()
示例3: edit_item
# 需要導入模塊: import dialogs [as 別名]
# 或者: from dialogs import form_dialog [as 別名]
def edit_item(key, value):
values = dialogs.form_dialog(title='Edit Item', fields=[{'type':'text', 'title':'Key', 'value':key},{'type':'text', 'title':'Value', 'value':value}])
if not values == None:
dbo.dictionary[values['Key']] = values['Value']
table_view.reload()
示例4: run
# 需要導入模塊: import dialogs [as 別名]
# 或者: from dialogs import form_dialog [as 別名]
def run(self, input=''):
formDict = [{'type':'text','title':'Title','key':'title'},
{'type':'text', 'title':'Street', 'autocorrection':False},
{'type':'text', 'title':'City', 'autocorrection':False},
{'type':'text', 'title':'Country', 'autocorrection':False},
{'type':'text', 'title':'Zip Postcode','key':'ZIP', 'autocorrection':False}]
address = dialogs.form_dialog(title='Address Input', fields=formDict)
ev = ElementValue(type = self.get_output_type(), value = address)
self.status = 'complete'
return ev
示例5: add_item
# 需要導入模塊: import dialogs [as 別名]
# 或者: from dialogs import form_dialog [as 別名]
def add_item(sender):
values = dialogs.form_dialog(title='Add Item', fields=[{'type':'text', 'title':'Key'},{'type':'text', 'title':'Value'}])
if not values == None:
dbo.dictionary[values['Key']] = values['Value']
table_view.reload()
示例6: form_dialog_from_fields_dict
# 需要導入模塊: import dialogs [as 別名]
# 或者: from dialogs import form_dialog [as 別名]
def form_dialog_from_fields_dict(title, fields_dict):
return dialogs.form_dialog(title, [{'title': k, 'type': v} for k, v in fields_dict.items()])
示例7: turns_popup
# 需要導入模塊: import dialogs [as 別名]
# 或者: from dialogs import form_dialog [as 別名]
def turns_popup():
import collections, dialogs, ui
def form_dialog_from_fields_dict(title, fields_dict, autotext=False, colors=True):
ret = [{'title': k, 'type': v} for k, v in fields_dict.items()]
if not autotext:
for d in ret:
d.update({
"autocorrection": False,
"autocapitalization": ui.AUTOCAPITALIZE_NONE,
})
if colors:
for i, d in enumerate(ret, start=1):
d.update({
"tint_color": "#{0}".format(
'ff0000' if i == 1 else
'ffae55' if i == 2 else
'f4ff00' if i == 3 else
'00ff16'
)
})
return dialogs.form_dialog(title, ret)
my_fields_dict1 = collections.OrderedDict((
('1', 'text'), ('2', 'text'), ('3', 'text'),
('4', 'text'), ('5', 'text'), ('6', 'text'),
('7', 'text'), ('8', 'text'), ('9', 'text'),
('10', 'text'),
))
try:
d = form_dialog_from_fields_dict("Enter letters (group by turns)", my_fields_dict1, False, True)
except:
return ";"*9
argz = d['1'], d['2'], d['3'], d['4'], d['5'], d['6'], d['7'], d['8'], d['9'], d['10']
return "{0};{1};{2};{3};{4};{5};{6};{7};{8};{9}".format(*argz)