def list_dialog(title='', items=None, multiple=False, done_button_title='Done'): ''' copy of list_dialog from dialogs module, with themed mode, and with extra buttonitems to load and save history''' if not items: items = [] c = _ListDialogController(title, items, multiple, done_button_title=done_button_title) c.idxNew=0 #editor.apply_ui_theme(c.view,editor.get_theme_dict()['name']) save=ui.ButtonItem(title='Save') save.action=save_history load=ui.ButtonItem(title='Load') load.action=load_history copy=ui.ButtonItem(title='Copy') copy.action=copy_history searchField=ui.TextField() searchField.placeholder='Search' searchField.frame=(0,0,180,32) searchField.clear_button_mode='always' editor.apply_ui_theme(searchField) searchBarButton=ui.ButtonItem() ObjCInstance(searchBarButton).customView=searchField searchField.delegate=c.view.data_source c.view.right_button_items=[save,load,copy] c.view.left_button_items=[searchBarButton] editor.present_themed(c.view,editor.get_theme_dict()['name'],style='popover') c.view.wait_modal() return c.selected_item
def __init__(self): self.frame = (0, 0, 500, 470) self.table_view = ui.TableView(frame=(10, 10, 480, 400)) self.text_view = ui.TextField(frame=(10, 420, 480, 40)) self.add_subview(self.table_view) self.add_subview(self.text_view) editor.apply_ui_theme(self)
def choose_theme(sender): light_themes = [None, "Default", "Dawn", "Tomorrow", "Solarized Light"] dark_themes = ["Solarized Dark", "Cool Glow", "Gold", "Tomorrow Night", "Oceanic", "Editorial"] thm_nm = dialogs.list_dialog("Themes", light_themes + dark_themes) if thm_nm in light_themes: for x in background_changes: x.background_color = "#fff" elif thm_nm in dark_themes: for x in background_changes: x.background_color = "#373737" editor.apply_ui_theme(bible, theme_name=thm_nm)
def choose_theme(sender): light_themes = [None, 'Default', 'Dawn', 'Tomorrow', 'Solarized Light'] dark_themes = [ 'Solarized Dark', 'Cool Glow', 'Gold', 'Tomorrow Night', 'Oceanic', 'Editorial' ] thm_nm = dialogs.list_dialog('Themes', light_themes + dark_themes) if thm_nm in light_themes: for x in background_changes: x.background_color = '#fff' elif thm_nm in dark_themes: for x in background_changes: x.background_color = '#373737' editor.apply_ui_theme(bible, theme_name=thm_nm)
def tableview_cell_for_row(self, tv, section, row): item = self.items[row] cell = ui.TableViewCell() cell.text_label.number_of_lines = 0 cell.text_label.text = str(item) cell.text_label.text_color =editor.get_theme_dict()['default_text'] if self.highlight_color: bg_view = ui.View(background_color=self.highlight_color) cell.selected_background_view = bg_view if self.font: cell.text_label.font = self.font cell.background_color=editor.get_theme_dict()['background'] editor.apply_ui_theme(cell,editor.get_theme_dict()['name']) return cell
def tableview_cell_for_row(self, tv, section, row): item = self.items[row] cell = ui.TableViewCell() cell.text_label.number_of_lines = 0 cell.text_label.text = str(item) cell.text_label.text_color = editor.get_theme_dict()['default_text'] if self.highlight_color: bg_view = ui.View(background_color=self.highlight_color) cell.selected_background_view = bg_view if self.font: cell.text_label.font = self.font cell.background_color = editor.get_theme_dict()['background'] editor.apply_ui_theme(cell, editor.get_theme_dict()['name']) return cell
def show_menu(self,menubar): ed=self.editorView() tv=ed.textView() editormenu = ed.viewWithTag_(MENUTAG) if not editormenu: editormenu=ui.View(frame=(0,0,tv.frame().size.width,32),bg_color=(.24,.2,.24)) editormenu.flex='wh' editormenu.bg_color=None editor.apply_ui_theme(menubar) #editor.apply_ui_theme(editormenu) ed.addSubview_(ObjCInstance(editormenu)) #tv.frameOrigin=CGPoint(0,32) ObjCInstance(editormenu).tag=MENUTAG editormenu=ObjCInstance(editormenu) for sv in editormenu.subviews(): sv.removeFromSuperview() editormenu.addSubview_(ObjCInstance(menubar)) menubar.frame=rect_to_tuple(editormenu.bounds()) ts=ed.textView().textStorage()
def show_menu(self, menubar): ed = self.editorView() tv = ed.textView() editormenu = ed.viewWithTag_(MENUTAG) if not editormenu: editormenu = ui.View(frame=(0, 0, tv.frame().size.width, 32), bg_color=(.24, .2, .24)) editormenu.flex = 'wh' editormenu.bg_color = None editor.apply_ui_theme(menubar) #editor.apply_ui_theme(editormenu) ed.addSubview_(ObjCInstance(editormenu)) #tv.frameOrigin=CGPoint(0,32) ObjCInstance(editormenu).tag = MENUTAG editormenu = ObjCInstance(editormenu) for sv in editormenu.subviews(): sv.removeFromSuperview() editormenu.addSubview_(ObjCInstance(menubar)) menubar.frame = rect_to_tuple(editormenu.bounds()) ts = ed.textView().textStorage()
def list_dialog(title='', items=None, multiple=False, done_button_title='Done'): ''' copy of list_dialog from dialogs module, with themed mode, and with extra buttonitems to load and save history''' if not items: items = [] c = _ListDialogController(title, items, multiple, done_button_title=done_button_title) c.idxNew = 0 #editor.apply_ui_theme(c.view,editor.get_theme_dict()['name']) save = ui.ButtonItem(title='Save') save.action = save_history load = ui.ButtonItem(title='Load') load.action = load_history copy = ui.ButtonItem(title='Copy') copy.action = copy_history searchField = ui.TextField() searchField.placeholder = 'Search' searchField.frame = (0, 0, 180, 32) searchField.clear_button_mode = 'always' editor.apply_ui_theme(searchField) searchBarButton = ui.ButtonItem() ObjCInstance(searchBarButton).customView = searchField searchField.delegate = c.view.data_source c.view.right_button_items = [save, load, copy] c.view.left_button_items = [searchBarButton] editor.present_themed(c.view, editor.get_theme_dict()['name'], style='popover') c.view.wait_modal() return c.selected_item
def choose_theme(sender): background_changes = [ search_selection, search, books, bible, thoughts_view, heading, theme_button, book_marks ] light_themes = [None, 'Default', 'Dawn', 'Tomorrow', 'Solarized Light'] dark_themes = [ 'Solarized Dark', 'Cool Glow', 'Gold', 'Tomorrow Night', 'Oceanic', 'Editorial' ] thm_nm = dialogs.list_dialog('Themes', light_themes + dark_themes) if thm_nm in light_themes: for x in background_changes: try: x.background_color = '#fff' except: None elif thm_nm in dark_themes: for x in background_changes: try: x.background_color = '#373737' except: None editor.apply_ui_theme(bible, theme_name=thm_nm)
def create_menu(debugger): '''create a menu, and bind to debugger. ''' button_items = [] for name, imagename in btn_dict.items(): b = ui.Button(name=name, image=ui.Image.named(imagename)) action = getattr(debugger, name+'_action', None) if callable(action): b.action = action else: b.enabled = False button_items.append(b) ed = editor._get_editor_tab().editorView() w,h = ed.frame().size.width, ed.frame().size.height debugmenu = ui.View(frame = (w-44, 0, 44, h),flex='LH') y = 10 for b in button_items: b.y = y debugmenu.add_subview(b) y += b.height + 20 ObjCInstance(debugmenu).tag = DEBUGMENUTAG editor.apply_ui_theme(debugmenu) return debugmenu
def set_tint_color_cheat(self, theme): # maybe this is a screw up.... #return btn = ui.Button() editor.apply_ui_theme(btn, theme_name=theme) self.tc = btn.tint_color
def reset_theme(self, sender): #print('in, reset_theme') self.theme = sender.title self.set_tint_color_cheat(self.theme) editor.apply_ui_theme(self, theme_name=sender.title) self.update_view()
zip_button = top_pane['btn_zip'] zip_button.action = zip_notes #chapters.data_source = ui.ListDataSource(range(1,100)) share_button = bible.right_button_items[0] share_button.action = share deep_search_field = top_pane['deep_search_field'] deep_search_field.placeholder = 'Find' deep_search_field.delegate = MyTextFieldDelegate() bible.right_button_items[4].action = capture_screen video_button = bible.right_button_items[2] video_button.action = view_video #--- SEARCH ENGINE search = bible['search'] editor.apply_ui_theme(search) search.alpha = 0 search.hidden = True #search.border_color = 'red' search.border_width = 2 search_field = search['search_field'] search_field.delegate = MyTextFieldDelegate() search_clear_button = search['btn_clear_search'] search_clear_button.action = clear_search forward_button = search['btn_forward'] forward_button.action = forward_to_thoughts text = search['textview1'] search_selection = search['textview2'] search_selection.text = """Romans 13: 8 #Owe no man any thing, but to love one another: for he that loveth another hath fulfilled the law.""" table = search['tableview1']