def __init__(self, path, finished_handler, frame=(0, 0, 500, 500), background_color=(1.0, 1.0, 1.0)): self.background_color = background_color self.frame = frame self.scroll = ui.ScrollView(frame=(0, 0, self.width, self.height)) self.scroll.delegate = SVDelegate() self.scroll.add_subview(DropDown(path, 0)) self.add_subview(self.scroll) self.selectedIndex = None self.finished_handler = finished_handler self.selectIcon = ui.Image.named('iob:ios7_checkmark_empty_256') self.checkscroll = ui.ScrollView(frame=(0, 0, self.width, self.height)) self.checkscroll.touch_enabled = 0 self.add_subview(self.checkscroll) self.check = ui.ImageView(frame=(self.width - 32, 0, 32, 32)) self.check.image = self.selectIcon self.check.hidden = 1 self.checkscroll.add_subview(self.check)
def __init__(self, elements): # This will also be called without arguments when the view is loaded from a UI file. # You don't have to call super. Note that this is called *before* the attributes # defined in the UI file are set. Implement `did_load` to customize a view after # it's been fully loaded from a UI file. # assumes list_todisplay is a list of dictionary of values to be displayed # as minicards self.width = 375 # OPTIMIZE: set widh and height variables as global at top self.height = 667 self.frame = (0, 0, self.width, self.height) self.elements = elements cardsize = 80 spacing = cardsize + 20 self.background_color = 'white' self.scroll = ui.ScrollView() self.scroll.flex = 'WH' self.scroll.frame = (5, 0, self.width - 10, self.height) #self.scroll.content_inset = (0,5,0,5) self.scroll.content_size = (self.scroll.width, spacing * len(elements)) for n, data in enumerate(self.elements): card = self.make_card(data) if n == 0: card.frame = (0, 0, self.width, cardsize) card.background_color = 0.8 else: card.frame = (0, n * spacing, self.width, cardsize) self.scroll.add_subview(card) self.add_subview(self.scroll)
def __init__(self): self.data_x=[] self.data_y=[] self.org_y=[] self.epoch=-1 self.index=-1 self.offset_x=50 self.offsey_y=50 self.scrollView=ui.ScrollView() self.scrollView.delegate=self self.background_color='white' self.scrollViewitems=[] # 存储柱状图柱子label self.x_axe=ui.Label() self.x_axe.background_color="#494949" self.scrollView.add_subview(self.x_axe) # y轴相关参数 self.y_axe_x=self.offset_x-5 self.y_axe_y=40 self.y_axe_w=5 self.y_axe_h=self.height-self.offsey_y-35 self.info_label=ui.Label() self.info_label.frame=(0,0,220,20) self.info_label.background_color="#103142" self.info_label.text_color="#b7e6fc" self.info_label.alignment=ui.ALIGN_CENTER self.info_label.hidden=True self.add_subview(self.scrollView) self.add_subview(self.info_label)
def initHospResults(): global HospView global _hospView window = ui.get_screen_size() container = ui.ScrollView() container.background_color = 'white' container.alpha = 1 container.content_size = (window.x, window.y * .9) container.name = 'Results-Container' _hospView.tint_color = 'gray' lyft = _hospView['lyft'] uber = _hospView['uber'] maps = _hospView['maps'] lyft.name = 'lyft' uber.name = 'uber' maps.name = 'maps' uber.image = ui.Image.named('assets/uber-1.png').with_rendering_mode( ui.RENDERING_MODE_ORIGINAL) maps.image = ui.Image.named('assets/maps-1.png').with_rendering_mode( ui.RENDERING_MODE_ORIGINAL) lyft.image = ui.Image.named('assets/lyft-1.png').with_rendering_mode( ui.RENDERING_MODE_ORIGINAL) container.add_subview(_hospView) HospView = container
def prepareResultsView(): global resultsV global page global backC global hospitalTable window = ui.get_screen_size() _v = ui.ScrollView() #_v = SceneView() _v.background_color = '#f0ede6' _v.content_size = (window.x, window.y * 3) _v.frame = (0, 0, window.x, window.y) _v.alpha = 1 _v.name = 'Results' backB = ui.Button(title='Go back!') backB.center = (_v.width * .5, _v.height * .8) backB.flex = 'LRTB' getResults() #_v.add_subview(backB) #ui.delay(partial(showResults, _v, [backB, tv]), .5) resultsV = _v homeV.navigation_view.push_view(resultsV) page = 1
def make_view(self): sv = ui.ScrollView(frame=self.bounds.inset(20, 20)) sv.flex = 'wh' sv.bg_color = 'white' sv.corner_radius = 3 self.sv = sv self.add_subview(sv)
def add_page(self, page, values): p = ui.ScrollView() p.frame = self.options.frame p.y = 0 p.background_color = "#DDDDDD" y = 20 for k, v in sorted(values.iteritems()): if isinstance(v, str): t = v v = ui.Label() v.text = t t = k k = ui.Button() k.action = self.present_help k.title = t v.name = k.title k.width = 200 v.width = 300 k.x = 20 v.x = 230 k.y = y v.y = y k.height = 25 v.height = 25 if isinstance(v, ui.TextField) else 200 y += v.height + 15 p.add_subview(k) p.add_subview(v) p.content_size = (540, y + 30) self.options.add_subview(p) self.pages[page] = p
def __init__(self, song): self.name = song self.update_interval = 0.005 w, h = ui.get_screen_size() self.sv = ui.ScrollView() self.sv.width = w self.sv.height = h heading_thickness = 20 self.sv.frame = (0, -heading_thickness, w, h) length = calculate_length(song) self.sv.content_size = (length, h - heading_thickness) self.sv.add_subview(MusicView(song, length, screen_height)) self.sv.shows_horizontal_scroll_indicator = False self.sv.shows_vertical_scroll_indicator = False self.sig = ui.View() self.sig.width = w * screen_padding * 0.8 self.sig.height = h self.sig.add_subview(Signature(self.sig.width, self.sig.height)) button_width = 50 #self.controls = ui.View() #self.controls.width = button_width * 2 #self.controls.height = button_width #print(h) #self.controls.frame = ((w / 2) - button_width, 718, (w/2) + button_width, 768) #self.add_subview(Controls(button_width * 2, button_width, button_width)) self.add_subview(self.sv) self.add_subview(self.sig)
def __init__(self, **kwargs): self.scrollView = ui.ScrollView( delegate=self, paging_enabled=True, shows_horizontal_scroll_indicator=False, bounces=False, frame=self.bounds, flex='WH', ) self.pageControl = UIPageControl.alloc().init().autorelease() self._target = ChangePageClass.new().autorelease() self._target.page_control = self self.pageControl.addTarget_action_forControlEvents_( self._target, 'changePage', 1 << 12) #1<<12 = 4096 self.pageControl.numberOfPages = len(self.scrollView.subviews) self.pageControl.currentPage = 0 self.pageControl.hidesForSinglePage = True self._prev_page = 0 super().add_subview(self.scrollView) ObjCInstance(self).addSubview_(self.pageControl) super().__init__(**kwargs)
def __init__(self): self.data_x=[] self.data_y=[] self.org_y=[] self.epoch=-1 self.index=-1 self.offset_x=100 self.offsey_y=50 self.scrollView=ui.ScrollView() self.scrollView.delegate=self self.scrollViewitems=[] self.x_axe=ui.Label() self.x_axe.background_color="#494949" self.y_axe=ui.Label() self.y_axe.background_color="#494949" self.scrollView.add_subview(self.x_axe) self.scrollView.add_subview(self.y_axe) self.info_label=ui.Label() self.info_label.frame=(0,0,220,20) self.info_label.background_color="#103142" self.info_label.text_color="#b7e6fc" self.info_label.alignment=ui.ALIGN_CENTER self.info_label.hidden=True self.add_subview(self.scrollView) self.add_subview(self.info_label)
def __init__( self, db_name, table_name=None, conf=None, **kwargs, ): self.background_color = kwargs.pop('background_color', 'black') self.tint_color = kwargs.pop('tint_color', 'black') self.text_color = kwargs.pop('text_color', 'black') super().__init__(**kwargs) self.db_name = db_name self.table_name = table_name self.load_table() self.columns = self.analyze_columns() self.sv = ui.ScrollView( frame=self.bounds, flex='WH', ) self.add_subview(self.sv) self.tv = ui.TableView( frame=self.bounds, flex='H', ) self.tv.width = len( self.rows[0]) * self.cell_width + (len(self.rows[0]) - 1) * 8 self.sv.content_size = self.tv.width, 10 self.sv.add_subview(self.tv) self.tv.data_source = self self.cursor = None
def __init__(self, detailwidth=320 - 22, style='slide', delegate=None, mainview=None, detailview=None, initial_state=0, **kwargs): ui.View.__init__(self, **kwargs) self._sv = ui.ScrollView() self._sv.flex = 'wh' self._sv.frame = self.bounds self._sv.content_size = (self.bounds[2] + 1, self.bounds[3]) self._mainviewcontainer = ui.View() self._mainviewcontainer.frame = self.bounds self._detailviewcontainer = ui.View() self._detailviewcontainer.frame = self.bounds self.detailwidth = detailwidth self._detailviewcontainer.width = detailwidth self._detailviewcontainer.x = -detailwidth self._mainviewcontainer.flex = 'WH' self._detailviewcontainer.flex = 'H' self._mainview = None self._detailview = None self.delegate = delegate self._sv.delegate = self self._sv.add_subview(self._mainviewcontainer) self._sv.add_subview(self._detailviewcontainer) self.add_subview(self._sv) self.style = 'slide' # 'slide','resize' self.state = 0 #1 when detail shown self._modify_gesture()
def plot_to_scrollable_image_view(plt): img_view = ui.ImageView() b = io.BytesIO() plt.savefig(b) img_view.image = ui.Image.from_data(b.getvalue()) view = ui.ScrollView() view.add_subview(img_view) return view
def __init__(self, stash, name='vks', flex='wh'): self.stash = stash self.flex = flex self.name = name self.sv = ui.ScrollView(name, flex='wh') super(ShVk, self).add_subview(self.sv) self.sv.delegate = self self.dx = 0 self.SCROLL_PER_CHAR = 20.0 # Number of pixels to scroll to move 1 character
def __init__(self, frame, width, height, items_per_line, num_items): self.frame = frame # make the scroll view scroll = ui.ScrollView() scroll.frame = frame scroll.content_size = (self.width, height * num_items) print(scroll.content_size) self.add_subview(scroll)
def __init__(self, columns, rows, **kwargs): self.columns = columns if not self.columns: raise ValueError("Must have at least one column", self.columns) self.rows = rows self.background_color = kwargs.pop('background_color', 'black') self.tint_color = kwargs.pop('tint_color', 'white') self.text_color = kwargs.pop('text_color', 'white') super().__init__(**kwargs) number_ds = SheetView.RowNumbers(self) row_ds = SheetView.Rows(self) self.h_scroll = ui.ScrollView(content_size=(row_ds.desired_width, 10), ) self.content = ui.View( width=row_ds.desired_width, height=self.h_scroll.bounds.height, flex='H', ) self.h_scroll.add_subview(self.content) dock(self.h_scroll).right(self) self.column_headings = ui.View(width=row_ds.desired_width) for i, column_title in enumerate(columns): column_label = self.make_column_label(column_title) if i == 0: dock(column_label).top_left(self.column_headings) else: dock(column_label).right_of(previous) previous = column_label self.column_headings.height = previous.height + 2 * At.gap dock(self.column_headings).top_left(self.content) self.tv = ui.TableView( data_source=row_ds, width=row_ds.desired_width, background_color=self.background_color, ) dock(self.tv).below(self.column_headings) at(self.tv).bottom = at(self.content).bottom self.row_numbers = ui.TableView( data_source=number_ds, width=number_ds.desired_width, background_color=self.background_color, ) dock(self.row_numbers).bottom_left(self) at(self.row_numbers).top = at(self.tv).top + via_screen_y at(self.h_scroll).left = at(self.row_numbers).right at(self.tv).content_y = at(self.row_numbers).content_y at(self.row_numbers).content_y = at(self.tv).content_y
def __init__(self, hour, minute, type, star, gun_type): self.v = ui.load_view() ds = DollsSearchService(DollsYamlRepository()) self.dolls = ds.search(hour, minute, star, gun_type) scroll = ui.ScrollView() for index, doll in enumerate(self.dolls): scroll.add_subview(self.create_doll_view(doll, index)) self.type = type scroll.frame = (0, 50, self.v.width, self.v.height) scroll.content_size = (500, 120 + len(self.dolls) * 220) self.v.add_subview(scroll)
def infopop(self): """ Modal style pop-up. """ w, h = ui.get_window_size() width = round((w * 0.8), 0) height = round((h * 0.8 / 1.5), 0) if not self.infopopup: # Outer p = ui.ScrollView() p.border_color = '#ccc' p.border_width = 1 p.width = width p.height = height p.corner_radius = 10 t = ui.TextView() t.width = width t.height = height t.font = ('<System>', 12) t.content_inset = (5, 5, 5, 5) b = ui.Button() b.action = self.closepop b.image = ui.Image.named('iob:ios7_close_outline_24') b.width = 24 b.height = 24 b.x = (width - 29) b.y = 5 t.editable = False t.add_subview(b) self.popuptext = t p.y = (((h - height) / 2) - 40) p.x = ((w - width) / 2) p.add_subview(self.popuptext) self.infopopup = p p.height = 0 def animate_popup(): """ Method to animate the the popup, because its prettier. """ self.infopopup.height = height self.infopopup.height = 0 self.tv.add_subview(self.infopopup) ui.animate(animate_popup, 1)
def plot_to_scrollable_image_view(plt): img_view = ui.ImageView() b = io.BytesIO() plt.savefig(b, format='png', dpi=160) img_view.image = ui.Image.from_data(b.getvalue()) view = ui.ScrollView() view.add_subview(img_view) view.dx = 0 view.ready = True view.bounces = False return view
def __init__(self, active=True, **kwargs): super().__init__(**kwargs) self.scroll_view = ui.ScrollView( frame=self.bounds, flex='WH', ) self.add_subview(self.scroll_view) self.container = FitView(active=active) self.scroll_view.add_subview(self.container) attr(self.scroll_view).content_size = at(self.container).size
def main(): # Create a ScrollView with some colored "pages" as a demo... page_w = 200 scroll_view = ui.ScrollView(frame=(0, 0, page_w, 500)) scroll_view.content_size = (50 * page_w, 0) for i in range(50): swatch_frame = (i*page_w, 0, page_w, 500) swatch = ui.View(bg_color=(random(), random(), random()), frame=swatch_frame) scroll_view.add_subview(swatch) # Wrap it in the custom container view, and present that: container = PagingScrollContainer(scroll_view, frame=(0, 0, 500, 500)) container.present('sheet')
def __init__(self, *args, **kwargs): super().__init__(self, *args, **kwargs) self.background_color = '#333' self.dict = dict({}) self.scroll_view = ui.ScrollView(frame=self.bounds, flex='WH') self.scroll_view.shows_horizontal_scroll_indicator = False self.add_subview(self.scroll_view) self.buttons = [] self.bw = 125 for line in FILE: line = line.replace('\n', '') self.new_button(line, 'Options')
def __init__(self, *args, **kwargs): ui.View.__init__(self, *args, **kwargs) self.bg_color = 'slategray' self.flex = 'WH' self.scroll_view = ui.ScrollView() #self.scroll_view.bounces = 0 #self.scroll_view.scroll_enabled = 0 self.scroll_view.bg_color = 'steelblue' self.scroll_view.flex = 'WH' self.add_subview(self.scroll_view)
def __init__(self, *args, **kwargs): ui.View.__init__(self, *args, **kwargs) self.visible_range = [] self.visible_views = {} self.items = [] self.reusable_cells = [] self.item_size = (120, 120) self.scrollview = ui.ScrollView(frame=self.bounds, flex='WH') self.scrollview.content_size = (0, 2000) self.scrollview.delegate = self self.data_source = None self.add_subview(self.scrollview)
def __init__(self): self.view = ui.View(background_color="lightyellow") self.view.name = "MiniPhotoView" scrollview1 = ui.ScrollView() scrollview1.name = "scrollview1" scrollview1.flex = "WH" scrollview1.content_size = (2000, 2000) self.view.add_subview(scrollview1) self.view.present("full_screen") self.sv1 = self.view["scrollview1"] width, height = self.sv1.content_size self.sv1.add_subview(MyPictureView(width, height))
def __init__(self): self.view = ui.View(background_color='lightyellow') self.view.name = 'MiniPhotoView' scrollview1 = ui.ScrollView() scrollview1.name = 'scrollview1' scrollview1.flex = 'WH' scrollview1.content_size = (2000, 2000) self.view.add_subview(scrollview1) self.view.present('full_screen') self.sv1 = self.view['scrollview1'] width, height = self.sv1.content_size self.sv1.add_subview(MyPictureView(width, height))
def scrollview(message): sv = ui.ScrollView() sv.frame = (10, 10, 380, 380) sv.content_size = 380, 800 view.add_subview(sv) tv = ui.TextView() tv.frame = (10, 10, 380, 380) tv.font = ('Palatino', 18) tv.editable = False tv.text = message sv.add_subview(tv)
def __init__(self, stash, name="vks", flex="wh"): if not IN_PYTHONISTA: ui.View.__init__(self) self.stash = stash self.flex = flex self.name = name self.sv = ui.ScrollView(name, flex="wh") super(ShVk, self).add_subview(self.sv) self.sv.delegate = self self.dx = 0 self.SCROLL_PER_CHAR = 20.0 # Number of pixels to scroll to move 1 character
def __init__(self): self.root = ui.View() self.root.name = "filenav" self.root.flex = "WH" self.scroll = ui.ScrollView() self.scroll.shows_vertical_scroll_indicator = False self.scroll.flex = "WH" self.root.add_subview(self.scroll) self.scroll.bounds = tuple(self.root.bounds) self.scroll.content_size = 0, self.scroll.height self.view_stack = [] self.nav_stack = []
def __init__(self): w,h = ui.get_screen_size() self.ty = ui.Label() self.ty.text = 'Hello' self.ty.text_color = 'black' self.ty.font = ('<system>', 60) self.ty.frame = (0, 0, w, h*0.25) self.ty.bg_color = 'yellow' self.sv = ui.ScrollView() self.sv.width = w self.sv.height = h*0.25 self.sv.content_size = (2*w, h*0.25) self.sv.add_subview(self.ty) self.add_subview(self.sv)