コード例 #1
0
ファイル: history_popup.py プロジェクト: jsbain/objc_hacks
	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
コード例 #2
0
 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
コード例 #3
0
ファイル: history_popup.py プロジェクト: jsbain/objc_hacks
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
コード例 #4
0
ファイル: history_popup.py プロジェクト: jsbain/objc_hacks
	def __init__(self, title, items, multiple=False, done_button_title='Done'):
		self.items = items
		self.selected_item = None
		self.view = ui.TableView()
		ObjCInstance(self.view).estimatedRowHeight=25
		self.view.row_height=-1
		self.view.background_color=editor.get_theme_dict()['background']
		self.view.tint_color=editor.get_theme_dict()['default_text']
		self.view.separator_color=editor.get_theme_dict()['separator_line']
		self.view.name = title
		self.view.allows_multiple_selection = multiple
		if multiple:
			done_button = ui.ButtonItem(title=done_button_title)
			done_button.action = self.done_action
			self.view.right_button_items = [done_button]
		ds = ThemedListDataSource(items)
		ds.action = self.row_selected
		self.view.data_source = ds
		self.view.delegate = ds
		self.view.frame = (0, 0, 500, 500)
コード例 #5
0
 def __init__(self, title, items, multiple=False, done_button_title='Done'):
     self.items = items
     self.selected_item = None
     self.view = ui.TableView()
     ObjCInstance(self.view).estimatedRowHeight = 25
     self.view.row_height = -1
     self.view.background_color = editor.get_theme_dict()['background']
     self.view.tint_color = editor.get_theme_dict()['default_text']
     self.view.separator_color = editor.get_theme_dict()['separator_line']
     self.view.name = title
     self.view.allows_multiple_selection = multiple
     if multiple:
         done_button = ui.ButtonItem(title=done_button_title)
         done_button.action = self.done_action
         self.view.right_button_items = [done_button]
     ds = ThemedListDataSource(items)
     ds.action = self.row_selected
     self.view.data_source = ds
     self.view.delegate = ds
     self.view.frame = (0, 0, 500, 500)
コード例 #6
0
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
コード例 #7
0
	return logs

if __name__ == '__main__':
	import console
	import ui
	import editor
	import dialogs	
	
	items = []
	
	for log in get_log():
		items.append('{} - {}'.format(log['CFLog Local Time'], log['Message']))
	
	log_text = '\n'.join(items)
	
	def share(sender):
		dialogs.share_text(log_text)
	
	theme = editor.get_theme_dict()
	
	view = ui.TextView()
	view.name = 'Pythonista System Log'
	view.text = log_text
	view.font = ('Menlo-Regular', 15)
	view.editable = False
	
	share_button = ui.ButtonItem(title='Share', action=share)
	view.right_button_items = [share_button]
	
	editor.present_themed(view)
コード例 #8
0
ファイル: theme.py プロジェクト: cclauss/Pythonista-4
def get():
    return editor.get_theme_dict()
コード例 #9
0

if __name__ == '__main__':
    import console
    import ui
    import editor
    import dialogs

    items = []

    for log in get_log():
        items.append('{} - {}'.format(log['CFLog Local Time'], log['Message']))

    log_text = '\n'.join(items)

    def share(sender):
        dialogs.share_text(log_text)

    theme = editor.get_theme_dict()

    view = ui.TextView()
    view.name = 'Pythonista System Log'
    view.text = log_text
    view.font = ('Menlo-Regular', 15)
    view.editable = False

    share_button = ui.ButtonItem(title='Share', action=share)
    view.right_button_items = [share_button]

    editor.present_themed(view)