Python ui.ButtonItem() Examples
The following are 12
code examples of ui.ButtonItem().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ui
, or try the search function
.
Example #1
Source File: easy_config.py From stash with MIT License | 6 votes |
def __init__(self): ui.View.__init__(self) self.background_color = "#ffffff" self.table = ui.TableView() self.table.delegate = self.table.data_source = self self.table.flex = "WH" self.add_subview(self.table) self.ai = ui.ActivityIndicator() self.ai.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE self.ai.hides_when_stopped = True self.ai.x = self.width / 2.0 - (self.ai.width / 2.0) self.ai.y = self.height / 2.0 - (self.ai.height / 2.0) self.ai.flex = "LRTB" self.ai.background_color = "#000000" self.ai.alpha = 0.7 self.ai.corner_radius = 5 self.add_subview(self.ai) self.subview_open = False self.cur_tf = None self.hide_kb_button = ui.ButtonItem( "Hide Keyboard", action=self.hide_keyboard, enabled=False, ) self.right_button_items = (self.hide_kb_button, )
Example #2
Source File: FlowCreationView.py From pythonista-scripts with MIT License | 6 votes |
def __init__(self, elements, saveCallBack, addElementAction, saveFlowAction, runFlowAction, showElementRuntimeView, thememanager, flowType, flowTypeSelection): self.flowType = flowType self.elements = elements self.saveCallBack = saveCallBack self.flowTypeSelection = flowTypeSelection self.showElementRuntimeView = showElementRuntimeView self.extraRows = 2 self.adminRow = 0 self.typeRow = 1 self.title = '' self.currentElementNumber = -1 self.addElementButton = ui.ButtonItem(title = 'Add Element', action = addElementAction) self.saveFlowButton = ui.ButtonItem(title='Save', action=saveFlowAction) self.runFlowButton = ui.ButtonItem(title='Run', action=runFlowAction) self.titleButton = ui.Button(title='Change Title') self.editButtonsRight = [self.addElementButton] self.editButtonsLeft = [self.saveFlowButton] self.runButtonsRight = [self.runFlowButton] self.runButtonsLeft = [] self.thememanager = thememanager
Example #3
Source File: abfahrt.py From pythonista-scripts with MIT License | 5 votes |
def __init__(self): self.tv = ui.TableView() self.tv.flex = 'WH' self.tv.data_source = self self.tv.delegate = self self.add_subview(self.tv) self.name = 'Nearby' self.right_button_items = [ui.ButtonItem(image=ui.Image.named('refresh'), title="refresh", action=lambda x: self.load_stations())] self.load_stations()
Example #4
Source File: refactoring.py From blackmamba with MIT License | 5 votes |
def __init__(self, change_set, *args, **kwargs): super().__init__(*args, **kwargs) self.name = 'Preview' self.apply_changes = False def apply(sender): self.apply_changes = True self.close() button = ui.ButtonItem('Apply', action=apply) self.right_button_items = [button] textview = ui.TextView(frame=self.bounds, flex='WH') textview.editable = False diff = _change_set_diff(change_set) attributed_string = _diff_to_attributed_string(diff) _set_attributed_text(textview, attributed_string) self.add_subview(textview) def cancel(): self.close() self.handlers = [ register_key_event_handler(UIEventKeyCode.ESCAPE, cancel), register_key_event_handler(UIEventKeyCode.DOT, cancel, modifier=UIKeyModifier.COMMAND), register_key_event_handler(UIEventKeyCode.ENTER, lambda: apply(None)) ]
Example #5
Source File: File Picker.py From pythonista-scripts with MIT License | 5 votes |
def __init__(self, root_node, allow_multi=False, async_mode=False): self.async_mode = async_mode self.allow_multi = allow_multi self.selected_entries = None self.table_view = ui.TableView() self.table_view.frame = (0, 0, 500, 500) self.table_view.data_source = self self.table_view.delegate = self self.table_view.flex = 'WH' self.table_view.allows_multiple_selection = True self.table_view.tint_color = 'gray' self.view = ui.View(frame=self.table_view.frame) self.view.add_subview(self.table_view) self.view.name = root_node.title self.busy_view = ui.View(frame=self.view.bounds, flex='WH', background_color=(0, 0, 0, 0.35)) hud = ui.View(frame=(self.view.center.x - 50, self.view.center.y - 50, 100, 100)) hud.background_color = (0, 0, 0, 0.7) hud.corner_radius = 8.0 hud.flex = 'TLRB' spinner = ui.ActivityIndicator() spinner.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE spinner.center = (50, 50) spinner.start_animating() hud.add_subview(spinner) self.busy_view.add_subview(hud) self.busy_view.alpha = 0.0 self.view.add_subview(self.busy_view) self.done_btn = ui.ButtonItem(title='Done', action=self.done_action) if self.allow_multi: self.view.right_button_items = [self.done_btn] self.done_btn.enabled = False self.root_node = root_node self.entries = [] self.flat_entries = [] if self.async_mode: self.set_busy(True) t = threading.Thread(target=self.expand_root) t.start() else: self.expand_root()
Example #6
Source File: istaflow.py From pythonista-scripts with MIT License | 5 votes |
def setup_navigationview(self, initview): initview.right_button_items = [ui.ButtonItem(title='Add Flow', action=self.show_flowcreationview)] initview.left_button_items = [ui.ButtonItem(title='Elements', action=self.show_elementmanagementview)] self.navigation_view = ui.NavigationView(initview) self.navigation_view.bar_tint_color=self.theme_manager.main_bar_colour self.navigation_view.tint_color = self.theme_manager.main_tint_colour self.navigation_view.background_color = self.theme_manager.main_background_colour self.navigation_view.title_color = self.theme_manager.main_title_text_colour
Example #7
Source File: istaflow.py From pythonista-scripts with MIT License | 5 votes |
def show_elementmanagementview(self, sender): self.validate_navigationview() if self.element_management_view == None: raise ValueError("element_management_view hasnt been initialised") else: self.element_management_view.right_button_items = [ui.ButtonItem(title='Create Element', action=self.show_elementcreationview)] self.navigation_view.push_view(self.element_management_view)
Example #8
Source File: AssetPickerView.py From pythonista-scripts with MIT License | 5 votes |
def load_button_items(self): if self.is_main(): self.left_button_items = [ui.ButtonItem('Cancel', action=lambda s: self.navigation_view.close())] else: self.right_button_items = [ui.ButtonItem('Done', action=lambda s: self.navigation_view.close())]
Example #9
Source File: ElementCreationView.py From pythonista-scripts with MIT License | 5 votes |
def get_view(savecb, apcb, capcb, thememanager): dbo = ElementCreationView(saveCallBack = savecb, showAssetPickerCallBack = apcb, closeAssetPickerCallBack = capcb, thememanager = thememanager) table_view.name = 'Element' table_view.data_source = dbo table_view.delegate = dbo table_view.right_button_items = [ui.ButtonItem(title='Save Element', action=dbo.create_element)] table_view.background_color = thememanager.main_background_colour return table_view
Example #10
Source File: Webbrowser.py From pythonista-scripts with MIT License | 5 votes |
def make_button_item(action, image_name): return ui.ButtonItem(action=action, image=ui.Image.named(image_name))
Example #11
Source File: NavigationViewExample.py From pythonista-scripts with MIT License | 5 votes |
def make_button_item(action, image_name): return ui.ButtonItem(action=action, image=ui.Image.named(image_name))
Example #12
Source File: uidir.py From pythonista-scripts with MIT License | 5 votes |
def getFile(setter=None,base_dir='.'): fv = FileViewer(setter,base_dir) fv.height=700 nv = ui.NavigationView(fv) def openDocuments(sender,path): def setme(fv,value): # set and bubble up setters fv.src.sel[0]=value if fv.src.setter is not None: fv.src.setter(value) newfv = FileViewer(setter=lambda value:setme(fv,value),base_dir=path) nv.push_view(newfv) nv.right_button_items=[ ui.ButtonItem(title='Documents', action=lambda sender:openDocuments(sender,os.path.expanduser('~/Documents'))), ui.ButtonItem(title='Library', action=lambda sender:openDocuments(sender,os.path.split(os.__file__)[0]))] nv.height=800 nv.width=500 nv.name = 'File Selector' nv.present('popover') ui.in_background(nv.wait_modal) nv.wait_modal() return fv.src.sel[0]