def main(): # Nacteme notifikace notes = notification.get_scheduled() # Pokud zadne nejsou, zobrazime alert if not notes: console.hud_alert('Žádné připomínky k zobrazení') return # Setridime notifikace podle data notes = sorted(notes, key=lambda x: x['fire_date']) # Prevedeme do vlastniho slovniku, neboli celou notifikaci ulozime # do klice note a pridame vlastni titulek (klic title) skladajici se z data & casu # a textu notifikace. Hodnotu klice title pouziva dialogs.edit_list_dialog. def title(note): dt = datetime.datetime.fromtimestamp(note['fire_date']) return f"{dt:%Y-%m-%d %H:%M} {note['message']}" reminders = [ { 'title': title(note), 'note': note } for note in notes ] final = dialogs.edit_list_dialog('Připomínky', reminders, move=False, delete=True) if final is None: return cancel_removed_reminders_workaround(reminders, final)
def editpayload(payload): editing = True while editing: mainops = [{ 'title': 'Edit' }, { 'title': 'Add Webclip' }, { 'title': 'Add Wifi' }, { 'title': 'Serve' }, { 'title': 'Save' }] + payload.profile choice = dialogs.list_dialog('Profile', mainops) if choice == None: editing == False return payload if choice['title'] == 'Edit': payload.profile = dialogs.edit_list_dialog('Edit Profiles', payload.profile) if choice['title'] == 'Add Webclip': webclip(payload) if choice['title'] == 'Add Wifi': wifi(payload) if choice['title'] == 'Serve': cpload = mprofile.mkplist(payload) serve.run_server(cpload) if choice['title'] == 'Save': name = dialogs.input_alert('File name') name = name + '.mobileconfig' cpload = mprofile.mkplist(pload) cpload = mprofile.stripdict(cpload) plistlib.writePlist(cpload, name) return payload
def make_tags( info_list: str, post_type: str, ) -> str: # info_list tags tags = [] for line in info_list: new_line = re.sub( constants.TAGS_RE, '', line.lower(), re.IGNORECASE, ) if new_line not in tags: tags.append(new_line) # post_type tag tags.append(post_type) # extra tags extra_tag_objs = dialogs.list_dialog( title='Tag Selector', items=constants.TAG_CHOICES, multiple=True, ) or [] extra_tags = [tag['title'] for tag in extra_tag_objs] extra_tags_str = ','.join(extra_tags) extra_tags = helpers.split_list(extra_tags_str) tags.extend(extra_tags) # Make sure only 30 tags num_tags = len(tags) while num_tags > 30: tags = dialogs.edit_list_dialog( title=f'Delete {str(num_tags - 30)} tags', items=tags, delete=True, ) num_tags = len(tags) return ','.join(tags)
def editpayload(payload): editing = True while editing: mainops = [{'title':'Edit'},{'title':'Add Webclip'},{'title':'Add Wifi'},{'title':'Serve'},{'title':'Save'}]+payload.profile choice = dialogs.list_dialog('Profile',mainops) if choice == None: editing == False return payload if choice['title'] == 'Edit': payload.profile = dialogs.edit_list_dialog('Edit Profiles', payload.profile) if choice['title'] == 'Add Webclip': webclip(payload) if choice['title'] == 'Add Wifi': wifi(payload) if choice['title'] == 'Serve': cpload = profile.mkplist(payload) serve.run_server(cpload) if choice['title'] == 'Save': name = dialogs.input_alert('File name') name = name + '.mobileconfig' cpload = profile.mkplist(conf, pload) plistlib.writePlist(cpload, name) return
for code in allpython: c.append(['py', code.getText()]) if cxml: allxml = soup.find_all('code', 'xml') for code in allxml: c.append(['xml', code.getText()]) if cjson: alljson = soup.find_all('code', 'json') for code in alljson: c.append(['json', code.getText()]) if call: alljson = soup.find_all('code') for code in alljson: c.append(['all', code.getText()]) if c: cb = dialogs.edit_list_dialog('Codeblocks', c) if savefile: file = open(filename, 'a') # append/create file for c in cb: file.write(c[1]) file.write('--------------------\n' ) #seperator for different code blocks file.close() print('File ' + filename + ' is created.') else: for c in cb: print(c[1]) print('--------------------\n' ) #seperator for different code blocks else: print('Sorry nothing found.')
def edit_list_dialog_action(sender): print(dialogs.edit_list_dialog('edit list dialog', items=[1, 2, 3, 4]))
allpython = soup.find_all('code','python') for code in allpython: c.append(['py',code.getText()]) if cxml: allxml = soup.find_all('code','xml') for code in allxml: c.append(['xml',code.getText()]) if cjson: alljson = soup.find_all('code','json') for code in alljson: c.append(['json',code.getText()]) if call: alljson = soup.find_all('code') for code in alljson: c.append(['all',code.getText()]) if c: cb = dialogs.edit_list_dialog('Codeblocks', c) if savefile: file = open(filename, 'a') # append/create file for c in cb: file.write(c[1]) file.write('--------------------\n') #seperator for different code blocks file.close() print('File ' + filename + ' is created.') else: for c in cb: print(c[1]) print('--------------------\n') #seperator for different code blocks else: print('Sorry nothing found.')
name = None local = settings_dict['local'] if 'ios_device_name' in local: name = local['ios_device_name'] else: name = dialogs.text_dialog(title='name this device', text='').lower() local['ios_device_name'] = name items = [ { 'title': 'name' }, { 'title': 'address' }, ] source = ui.ListDataSource(items) dialogs.edit_list_dialog(title='remote machines', items=source, move=True, delete=True) print name #os.path.isfile(path) print(settings_dict) _stash('ls') finally: print("all done, writing out settings") with open(settings_file_path, 'w') as out_file: json.dump(settings_dict, out_file)
def tableview_did_select(self, tableview, section, row): if self.docset_section_number == section: if self.manage_docset_row == row: self.show_docset_management_view() elif self.manage_cheatsheet_row == row: console.show_activity('Loading Cheat Sheets...') uiThread = threading.Thread( target=self.show_cheatsheet_management_view) uiThread.start() elif self.manage_usercontributed_row == row: console.show_activity('Loading User Contributed Docsets...') uiThread = threading.Thread( target=self.show_usercontributed_management_view) uiThread.start() elif self.manage_stackoverflow_row == row: console.show_activity('Loading Stack Overflow Docsets...') uiThread = threading.Thread( target=self.show_stackoverflow_management_view) uiThread.start() elif self.manage_transfer_row == row: uiThread = threading.Thread( target=self.show_transfer_management_view) uiThread.start() if self.ack_section_number == section: self.open_url(self.ack_data[row]['url']) if self.pydoc_updates_section_number == section: if row == 0: self.updater.checkForUpdate() elif row == 1: self.updater.reinstallCurrentVersion() elif row == 2: self.updater.showAvailableVersions() elif row == 3: ret = console.alert( 'Warning', 'Pre-release versions can have bugs and be unstable, including corrupting your installation. Only install a pre-release version if you are sure. Would you like to install a pre-release version?', hide_cancel_button=True, button1='No', button2='Yes') if ret == 2: self.updater.showAvailableVersions(True) if self.ui_section_number == section: if row == 0: themes = self.theme_manager.themes data = [x for x in themes.keys()] t = dialogs.list_dialog('Please choose your theme', data) if not t == None: if not t == self.theme_manager.themeFileName: self.theme_manager.saveThemeToUse(t) ret = console.alert( 'Saved', 'Please restart PyDoc for your theme change to take affect.', button1='Ok', hide_cancel_button=True) elif row == 1: styles = ['default', 'panel'] t = dialogs.list_dialog( 'Please choose your presentation style', styles) if not t == None: if not t == self.settings_manager.settings['ui_style']: self.settings_manager.settings['ui_style'] = t self.settings_manager.save_settings() ret = console.alert( 'Saved', 'Please restart PyDoc for your presentation to take affect.', button1='Ok', hide_cancel_button=True) if section == self.websearch_section_number: if row == self.add_websearches_row: dialogs.alert( 'Info', 'Please include {query} in your url this will be replaced with your search query.', hide_cancel_button=True, button1='Ok') ok = True name = '' url = '' while ok: s = [{ 'title': 'Name', 'type': 'text', 'value': name }, { 'title': 'URL', 'type': 'text', 'autocorrection': False, 'autocapitalization': False, 'value': url }] data = dialogs.form_dialog(title='Add Web Search', fields=s) if not data == None: ret, error = self.websearch_manager.AddWebSearch( data['Name'], data['URL']) if not ret: name = data['Name'] url = data['URL'] dialogs.alert('Error', error, hide_cancel_button=True, button1='Ok') else: ok = False dialogs.alert('Save', 'Web Search ' + data['Name'] + ' has been saved.', hide_cancel_button=True, button1='Ok') else: ok = False if row == self.en_di_websearches_row: searches = self.websearch_manager.GetWebSearches() list = [] for search in searches: v = False if search[3] == 1: v = True s = { 'key': str(search[0]), 'type': 'switch', 'value': v, 'title': str(search[1]) } list.append(s) data = dialogs.form_dialog(title='Enable/Disable Web Searches', fields=list) if not data == None: for v in data: if data[v]: self.websearch_manager.EnableWebSearch(v) else: self.websearch_manager.DisableWebSearch(v) if row == self.del_websearches_row: searches = self.websearch_manager.GetWebSearches() d = [] for search in searches: d.append(search[1]) data = dialogs.edit_list_dialog(title='Please swipe to delete', items=d, move=False, delete=True) if not data == None: for search in searches: if not search[1] in data: self.websearch_manager.RemoveWebSearch(search[0]) if row == self.refresh_websearch_icons: console.show_activity('Saving icons...') searches = self.websearch_manager.GetWebSearches() for search in searches: self.websearch_manager.SaveIconForWebSearch( search[0], search[2]) console.hide_activity()
import dialogs #lst = range(10) lst = ['a'+str(i) for i in range(5)] res = dialogs.edit_list_dialog('Please select', lst) print(res)
if imagelink: text = '[image]' else: continue else: if qmlink: text = '[???]' else: continue if '#' in hlurl and not '.' in hlurl: #only shortcuts to other websites continue if hlurl[0] == '/': hlurl = domain + hlurl hl.append([text, hlurl]) l = dialogs.edit_list_dialog('Hyperlinks', hl) style = getSampleStyleSheet() items = [] for i in l: items.append( Paragraph( '<link href="' + i[1] + '" color="blue">' + i[0] + '</link>', style['Heading3'])) if format: pdf = SimpleDocTemplate(filename, pagesize=A4) else: pdf = SimpleDocTemplate(filename, pagesize=letter) pdf.build(items) print 'PDF is created.'
elif hlurl[0] == '/': hlurl = domain + hlurl else: hlurl = domain + hlurl else: continue #no hlurl => no link dhp = hlurl.find(domain[start-2:]) if dhp == -1: #external ext += 1 if not extlink: continue else: #domain dom += 1 if not domainlink: continue print hlurl hl.append([text, hlurl]) l = dialogs.edit_list_dialog('Hyperlinks', hl) heading3 = getSampleStyleSheet()['Heading3'] fmt = '<link href="{1}" color="blue">{0}</link>' items = [Paragraph(fmt.format(*i), heading3) for i in l] pdf = SimpleDocTemplate(filename, pagesize=(A4 if format else letter)) hls = len(items) if items: pdf.build(items) print 'PDF is created with ' + str(hls) + ' hyperlinks.' print str(ext) + ' external, ' + str(dom) + ' and domain links.' else: print 'Nothing to create :(.'
# https://forum.omz-software.com/topic/3864/list-help import dialogs text = '''the tree going''' # dialogs.edit_list_dialog(title='', items= [text], move=True, delete=True) l = dialogs.edit_list_dialog(title='', items=text.split('\n'), move=True, delete=True)