def build(self): tb_panel= TabbedPanel() tb_panel.background_image ="fundal2.jpg" tb_panel.default_tab_text = "tab-ul default" tb_panel.default_tab_content = Image(source='infoacademy3.gif',pos=(200, 100), size=(200, 200)) th_text_head = TabbedPanelHeader(text='Text tab') th_text_head.content= Label(text='Infoacademy', font_size = 40) th_img_head= TabbedPanelHeader(text='Image tab') th_img_head.content= Image(source='infoacademy4.gif',pos=(400, 100), size=(400, 400)) th_btn_head = TabbedPanelHeader(text='Button tab') layout= GridLayout(cols=1) eticheta=Label(text='tab-ul cu buton', font_size = 40) buton=Button(text='Acesta este un buton',font_size=20) layout.add_widget(eticheta) layout.add_widget(buton) th_btn_head.content= layout th_btn_head.content.padding = 200 tb_panel.add_widget(th_text_head) tb_panel.add_widget(th_img_head) tb_panel.add_widget(th_btn_head) return tb_panel
def __init__(self, **kwargs): super(DataScreen, self).__init__(**kwargs) tab = TabbedPanel() self.th_chart_head = TabbedPanelHeader(text='Chart') tab.default_tab_text = 'Table' self.list_adapter = ListAdapter(data=[], args_converter=self.argsc, cls=TableItemView, selection_mode='single', allow_empty_selection=True) self.list_adapter.bind(on_selection_change=self.selection_changed) list_view = ListView(adapter=self.list_adapter) self.th_chart_head.content = GraphView() tab.default_tab_content = TableView(list_view) tab.add_widget(self.th_chart_head) button = Button(text='Add',size_hint_y=None,height=dp(50)) button.bind(on_release=self.addItem) layout = BoxLayout(orientation='vertical') layout.add_widget(tab) layout.add_widget(button) self.add_widget(layout)
def build(self): tb_panel= TabbedPanel(tab_width=Window.size[0]/4) screen_layout = BoxLayout(padding=10, orientation="horizontal", size_hint=(.7, 1)) tb_panel.default_tab_text = 'Login' #Create text tab th_text_head = TabbedPanelHeader(id='one',text='Screen1') th_text_head.content = test1().test() #tb_panel.Screen1_tab_content = self.test() #Create image tab th_img_head= TabbedPanelHeader(text='Screen2') th_img_head.content= Image(source='sample.jpg',pos=(400, 100), size=(400, 400)) #Create button tab th_btn_head = TabbedPanelHeader(text='Screen3') th_btn_head.content= Button(text='This is my button',font_size=20, size_hint_x=0.5, size_hint_y=0.5) th_text2_head = TabbedPanelHeader(text='Screen4') th_text2_head.content= Label(text='This is my text content') tb_panel.add_widget(th_text_head) tb_panel.add_widget(th_img_head) tb_panel.add_widget(th_btn_head) tb_panel.add_widget(th_text2_head) return tb_panel
def build(self): tb_panel = TabbedPanel(tab_width=Window.size[0] / 4) screen_layout = BoxLayout(padding=10, orientation="horizontal", size_hint=(.7, 1)) tb_panel.default_tab_text = 'Login' #Create text tab th_text_head = TabbedPanelHeader(id='one', text='Screen1') th_text_head.content = test1().test() #tb_panel.Screen1_tab_content = self.test() #Create image tab th_img_head = TabbedPanelHeader(text='Screen2') th_img_head.content = Image(source='sample.jpg', pos=(400, 100), size=(400, 400)) #Create button tab th_btn_head = TabbedPanelHeader(text='Screen3') th_btn_head.content = Button(text='This is my button', font_size=20, size_hint_x=0.5, size_hint_y=0.5) th_text2_head = TabbedPanelHeader(text='Screen4') th_text2_head.content = Label(text='This is my text content') tb_panel.add_widget(th_text_head) tb_panel.add_widget(th_img_head) tb_panel.add_widget(th_btn_head) tb_panel.add_widget(th_text2_head) return tb_panel
def build(self): self.icon = 'diceSmall.png' mainPanel = TabbedPanel() mainPanel.default_tab_text = 'Dice Roll' mainPanel.add_widget(self.tabProbabilityTesting()) mainPanel.default_tab_content = self.tabDiceRoll() return mainPanel
def build(self): tp = TabbedPanel() tp.default_tab_text = 'beta v0.45' return Test()
def build(self): #*******ROOTWIDGET******* layout = GridLayout(rows=2) #*******SUB-WIDGETS******* layoutTop = GridLayout(cols=3,rows=1)#SUB-WIDGET-1 layoutTop.size_hint = (1, 0.1) layoutMid = GridLayout(cols=1, size_hint_x=1)#SUB-WIDGET-2 #*******CONTENT-OF-SUB-WIDGET-1******* backbtn = Button() title = Label(text = 'Pro-Forma App', font_size = '20sp', pos = (0,300), size_hint_y = None,size_hint_x=None, width=200, halign ='right', valign='middle') title.size_hint = (None, 0.1) dropbtn = Button() #*******CONTENT-OF-SUB-WIDGET-2******* tp_panel = TabbedPanel() tp_panel.default_tab_text = "Login Tab" #*******TAB1******* th_tab1 = TabbedPanelHeader(text = 'Pro-Forma') #*******MAIN-LAYOUT-FOR-TAB1******* mainlayout = GridLayout(cols=1, spacing=10) #*******LAYOUT-FOR-PROPERTY-INFORMATION******* layouttab1 = GridLayout(cols=2,rows=6, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40) #*******LAYOUT-FOR-UNIT-MIX******* layoutmix = GridLayout(cols=4, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40) #*******LAYOUT-FOR-EXPENSES******* layoutexpense = GridLayout(cols=2) #*******LAYOUT-FOR-ACCOUNTS******* #*******CONTENT1******* mainlayout.add_widget(Label(text='Property Information',size_hint_y=None, height=50)) #*******CONTENT2******* layouttab1.add_widget(Label(text= 'Property Name', size_hint_x=None, width=200,size_hint_y=None, height=50, font_size='20sp')) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle')) layouttab1.add_widget(Label(text= 'Property Address', size_hint_x=None, width=200,size_hint_y=None, height=50, font_size='20sp')) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle')) layouttab1.add_widget(Label(text= 'Town/City', size_hint_x=None, width=200,size_hint_y=None, height=50, font_size='20sp')) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle')) layouttab1.add_widget(Label(text= 'Asking Price', size_hint_x=None, width=200,size_hint_y=None, height=50, font_size='20sp')) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle')) layouttab1.add_widget(Label(text= 'Total Units', size_hint_x=None, width=200,size_hint_y=None, height=50, font_size='20sp')) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle')) layouttab1.add_widget(Label(text= 'Square Footage', size_hint_x=None, width=200,size_hint_y=None, height=50, font_size='20sp')) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle')) mainlayout.add_widget(layouttab1) #*******CONTENT3******* mainlayout.add_widget(Label(text='Unit Mix',size_hint_x=None, width=200, size_hint_y=None, height=50)) #*******CONTENT4******* layoutmix.add_widget(Label(text='# of Units')) layoutmix.add_widget(Label(text='Unit Type')) layoutmix.add_widget(Label(text='SquareFeet')) layoutmix.add_widget(Label(text='Monthly Rent')) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) mainlayout.add_widget(layoutmix) #*******CONTENT5******* mainlayout.add_widget(Label(text='Expenses',size_hint_x=None, width=200, size_hint_y=None, height=50)) #*******CONTENT6******* layoutexpense.add_widget(Label(text='Accounting')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Advertising')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Bank Charges')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Electricity')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Gas')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Security')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='All insurance')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Permits and fees')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Maintenance')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Trash Pick-up')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='All other')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) mainlayout.add_widget(layoutexpense) #*******CONTENT7******* mainlayout.add_widget(Label(text='Accounts')) #*******CONTENT7******* #*******SCOLLABILITY******* #*******CALLING-MAINLAYOUT-IN-TAB1******* th_tab1.content = mainlayout #___*******TAB2*******___# th_tab2 = TabbedPanelHeader(text = 'Info. Tab') #___*******TAB3*******___# th_tab3 = TabbedPanelHeader(text = 'Due Deligence') #___*******TAB4*******___# th_tab4 = TabbedPanelHeader(text = 'Saved Reports') #*******CALLING-TABS-TO-tp_panel******* tp_panel.add_widget(th_tab1) tp_panel.add_widget(th_tab2) tp_panel.add_widget(th_tab3) tp_panel.add_widget(th_tab4) #*******ADDING-CONTENTS-OF-SUB-WIDGETS******* layoutTop.add_widget(backbtn) layoutTop.add_widget(title) layoutTop.add_widget(dropbtn) layoutMid.add_widget(tp_panel) #*******ADDING-CONTENTS-OF-ROOT-WIDGET******* layout.add_widget(layoutTop) layout.add_widget(layoutMid) #*******CALLING-THE-ROOT-WIDGET******* return layout
def build(self): tp = TabbedPanel() wid = Widget(size_hint=(0.9, 1)) slider = Slider(min=0, max=32, value=0, value_track=True, orientation='vertical', step=1.0, value_track_color=[1, 0, 0, 1], size_hint=(0.1, 1)) self.label_pattern = "Axis {} : {}" self.edit_label_pattern = "Edit Color {}. Keep Axis {} : Layer Index {}. Slide : {}" self.color_preview_data = None self.fileroot = Root() self.axis = 0 self.edit_axis = 1 self.slider_value = 0 self.layer_index = 0 self.load_file = 0 self.plot3d = Draw3DSurface() upper_layout = BoxLayout() upper_layout.add_widget(wid) upper_layout.add_widget(slider) self.label = Label( text=self.label_pattern.format(AxisList[self.axis], 0)) btn_load_lut1 = Button(text='Load LUT 1', on_press=partial(self.load_lut, wid, 1)) btn_load_lut2 = Button(text='Load LUT 2', on_press=partial(self.load_lut, wid, 2)) btn_showlayer = Button(text='Show LUT Layer', on_press=partial(self.show_lut_layer, wid)) btn_showplot = Button(text='Show 3D Plot', on_press=partial(self.show_3D_plot, wid)) btn_double = Button(text='Change Axis', on_press=partial(self.change_axis, wid)) btn_save_lut = Button(text='Save LUT', on_press=partial(self.save_lut, wid)) layout = BoxLayout(size_hint=(1, None), height=50) layout.add_widget(btn_load_lut1) layout.add_widget(btn_load_lut2) layout.add_widget(btn_showlayer) layout.add_widget(btn_showplot) layout.add_widget(btn_double) layout.add_widget(btn_save_lut) layout.add_widget(self.label) root = BoxLayout(orientation='vertical') root.add_widget(upper_layout) root.add_widget(layout) slider.bind(value=partial(self.onlutlayerchange, wid)) tp.default_tab_text = "Analysis" tp.background_color = (0, 0, 0, 1) tp.default_tab_content = root #Edit tab define th_text_head = TabbedPanelHeader(text='Edit') slider_layout = BoxLayout(size_hint=(1, 0.9)) color_wid = Widget(size_hint=(1, 0.1)) self.slider_list = [] for i in range(33): self.slider_list.append( Slider(min=0, max=1, value=0, value_track=False, orientation='vertical', cursor_size=(18, 18), step=0.000001, background_width=0)) for slider_item in self.slider_list: slider_layout.add_widget(slider_item) slider_item.bind(value=partial(self.oneditcolorvalue, color_wid)) edit_preview = BoxLayout(orientation='vertical', size_hint=(0.9, 1)) edit_preview.add_widget(slider_layout) edit_preview.add_widget(color_wid) edit_layout_upper = BoxLayout() c_slider = Slider(min=0, max=32, value=0, value_track=True, orientation='vertical', step=1.0, value_track_color=[1, 0, 0, 1], size_hint=(0.1, 1)) c_slider.bind(value=partial(self.onslidervaluechange, color_wid)) edit_layout_upper.add_widget(edit_preview) edit_layout_upper.add_widget(c_slider) edit_layout_lower = BoxLayout(size_hint=(1, None), height=50) btn_swap_axis = Button(text='Swap Axis', size_hint=(0.15, 1), on_press=partial(self.swap_axis, color_wid)) btn_apply_change = Button(text='Apply Change', size_hint=(0.15, 1), on_press=partial(self.apply_change)) self.edit_label = Label(text=self.edit_label_pattern.format( AxisList[self.edit_axis], AxisList[self.axis], 0, 0), size_hint=(0.5, 1)) edit_layout_lower.add_widget(btn_swap_axis) edit_layout_lower.add_widget(btn_apply_change) edit_layout_lower.add_widget(self.edit_label) edit_layout = BoxLayout(orientation='vertical') edit_layout.add_widget(edit_layout_upper) edit_layout.add_widget(edit_layout_lower) th_text_head.content = edit_layout tp.add_widget(th_text_head) th_text_head.bind( on_press=partial(self.edit_press_callback, color_wid)) return tp
def build(self): tb_panel = TabbedPanel() #tb_panel.do_default_tab = False #building_content= FloatLayout() #th_interval_head = TabbedPanelHeader(text="Interval") #th_interval = FloatLayout() #th_interval.add_widget(date1) #date2=datepicker.DatePicker(size_hint = (0.1,0.1)) #th_interval.add_widget(date2) #th_interval_head.content = th_interval #th_building_head = TabbedPanelHeader(text="Building") #th_building_head.content = building_content graph_content = FloatLayout() StartDate = Label(text='Start Date:', font_size=('19dp'), size_hint=(0.1, 0.1), pos_hint={ "x": 0.21, "top": 1 }) graph_content.add_widget(StartDate) startmonth = TextInput(text='', font_size=('15dp'), multiline=False, pos_hint={ "x": 1, "top": 0.5 }, hint_text="MM", input_filter='int') start_month_area = FloatLayout(size_hint=(0.03, 0.04), pos_hint={ "x": 0.27, "top": 0.99 }) start_month_area.add_widget(startmonth) graph_content.add_widget(start_month_area) slashDate1 = Label(text='/', font_size=('19dp'), size_hint=(0.1, 0.1), pos_hint={ "x": 0.29, "top": 1 }) graph_content.add_widget(slashDate1) startday = TextInput(multiline=False, font_size=('15dp'), hint_text="DD", pos_hint={ "x": 1, "top": 0.5 }, input_filter='float') start_day_area = FloatLayout(size_hint=(0.03, 0.04), pos_hint={ "x": 0.32, "top": .99 }) start_day_area.add_widget(startday) graph_content.add_widget(start_day_area) slashDate2 = Label(text='/', font_size=('19dp'), size_hint=(0.1, 0.1), pos_hint={ "x": 0.34, "top": 1 }) graph_content.add_widget(slashDate2) startyear = TextInput(multiline=False, font_size=('15dp'), hint_text="YYYY", pos_hint={ "x": 1, "top": 0.45 }, input_filter='float') start_year_area = FloatLayout(size_hint=(0.04, 0.04), pos_hint={ "x": 0.36, "top": .992 }) start_year_area.add_widget(startyear) graph_content.add_widget(start_year_area) starthour = TextInput(multiline=False, font_size=('15dp'), hint_text="Hr", pos_hint={ "x": 1, "top": 0.5 }, input_filter='float') start_hour_area = FloatLayout(size_hint=(0.03, 0.04), pos_hint={ "x": 0.44, "top": .99 }) start_hour_area.add_widget(starthour) graph_content.add_widget(start_hour_area) colonDate1 = Label(text=':', font_size=('19dp'), size_hint=(0.1, 0.1), pos_hint={ "x": 0.46, "top": 1 }) graph_content.add_widget(colonDate1) startminute = TextInput(multiline=False, font_size=('15dp'), hint_text="Min", pos_hint={ "x": 1, "top": 0.5 }, input_filter='float') start_minute_area = FloatLayout(size_hint=(0.03, 0.04), pos_hint={ "x": 0.49, "top": .99 }) start_minute_area.add_widget(startminute) graph_content.add_widget(start_minute_area) bt3 = ToggleButton(text='AM', group='time1', size_hint=(0.05, 0.025), pos_hint={ "x": 0.57, "top": 0.974 }) graph_content.add_widget(bt3) bt4 = ToggleButton(text='PM', group='time1', size_hint=(0.05, 0.025), pos_hint={ "x": 0.57, "top": 0.95 }) graph_content.add_widget(bt4) EndDate = Label(text='End Date:', font_size=('19dp'), size_hint=(0.1, 0.1), pos_hint={ "x": 0.21, "top": 0.9 }) graph_content.add_widget(EndDate) endmonth = TextInput(text='', font_size=('15dp'), multiline=False, pos_hint={ "x": 1, "top": 0.5 }, hint_text="MM", input_filter='int') end_month_area = FloatLayout(size_hint=(0.03, 0.04), pos_hint={ "x": 0.27, "top": 0.89 }) end_month_area.add_widget(endmonth) graph_content.add_widget(end_month_area) slashDate3 = Label(text='/', font_size=('19dp'), size_hint=(0.1, 0.1), pos_hint={ "x": 0.29, "top": .9 }) graph_content.add_widget(slashDate3) endday = TextInput(multiline=False, font_size=('15dp'), hint_text="DD", pos_hint={ "x": 1, "top": 0.5 }, input_filter='float') end_day_area = FloatLayout(size_hint=(0.03, 0.04), pos_hint={ "x": 0.32, "top": 0.89 }) end_day_area.add_widget(endday) graph_content.add_widget(end_day_area) slashDate4 = Label(text='/', font_size=('19dp'), size_hint=(0.1, 0.1), pos_hint={ "x": 0.34, "top": .9 }) graph_content.add_widget(slashDate4) endyear = TextInput(multiline=False, font_size=('15dp'), hint_text="YYYY", pos_hint={ "x": 1, "top": 0.5 }, input_filter='float') end_year_area = FloatLayout(size_hint=(0.04, 0.04), pos_hint={ "x": 0.36, "top": 0.89 }) end_year_area.add_widget(endyear) graph_content.add_widget(end_year_area) endhour = TextInput(multiline=False, font_size=('15dp'), hint_text="Hr", pos_hint={ "x": 1, "top": 0.5 }, input_filter='float') end_hour_area = FloatLayout(size_hint=(0.03, 0.04), pos_hint={ "x": 0.44, "top": 0.89 }) end_hour_area.add_widget(endhour) graph_content.add_widget(end_hour_area) colonDate2 = Label(text=':', font_size=('19dp'), size_hint=(0.1, 0.1), pos_hint={ "x": 0.46, "top": 0.9 }) graph_content.add_widget(colonDate2) endminute = TextInput(multiline=False, font_size=('15dp'), hint_text="Min", pos_hint={ "x": 1, "top": 0.5 }, input_filter='float') end_minute_area = FloatLayout(size_hint=(0.03, 0.04), pos_hint={ "x": 0.49, "top": 0.89 }) end_minute_area.add_widget(endminute) graph_content.add_widget(end_minute_area) bt5 = ToggleButton(text='AM', group='time2', size_hint=(0.05, 0.025), pos_hint={ "x": 0.57, "top": 0.874 }) graph_content.add_widget(bt5) bt6 = ToggleButton(text='PM', group='time2', size_hint=(0.05, 0.025), pos_hint={ "x": 0.57, "top": 0.85 }) graph_content.add_widget(bt6) #graph settings midnightButton = ToggleButton(text='Midnight Markers', size_hint=(0.25, 0.05), pos_hint={ "right": 1, "top": 1 }) midnightButton.bind( on_press=lambda x: (graphSettings.ToggleMidnight())) graph_content.add_widget(midnightButton) noonButton = ToggleButton(text='Noon Markers', size_hint=(0.25, 0.05), pos_hint={ "right": 1, "top": .951 }) noonButton.bind(on_press=lambda x: (graphSettings.ToggleNoon())) graph_content.add_widget(noonButton) global ampm1 ampm1 = "AM" #default global ampm2 ampm2 = "AM" #default def ampmSET1(self): ampm1 = "AM" def ampmSET2(self): ampm1 = "PM" def ampmSET3(self): ampm2 = "AM" def ampmSET4(self): ampm2 = "PM" bt3.bind(on_press=ampmSET1) bt4.bind(on_press=ampmSET2) bt5.bind(on_press=ampmSET3) bt6.bind(on_press=ampmSET4) def buttonClicked(self): graph_area = FloatLayout(size_hint=(0.75, 0.8), pos_hint={ "left": 0, "top": 0.9 }) plt.gcf().clear() try: sMonth = int(startmonth.text) sDay = int(startday.text) sYear = int(startyear.text) sHour = int(starthour.text) sMin = int(startminute.text) eMonth = int(endmonth.text) eDay = int(endday.text) eYear = int(endyear.text) eHour = int(endhour.text) eMin = int(endminute.text) if sMonth > 12: sMonth = 12 if sMonth < 0: sMonth = 0 if sMonth in [4, 6, 9, 11]: if sDay > 30: sDay = 30 elif sMonth in [1, 3, 5, 7, 8, 10, 12]: if sDay > 31: sDay = 31 elif sMonth == 2: sDay = 28 if sDay < 0: sDay = 0 if sYear > 2020: sYear = 2020 if sYear < 2000: sYear = 2000 if sHour > 12: sHour = 12 if sHour < 0: sHour = 0 if sMin > 59: sMin = 59 if sMin < 0: sMin = 0 if eMonth > 12: eMonth = 12 if eMonth < 0: eMonth = 0 if eMonth in [4, 6, 9, 11]: if eDay > 30: eDay = 30 elif eMonth in [1, 3, 5, 7, 8, 10, 12]: if eDay > 31: eDay = 31 elif eDay == 2: eDay = 28 if eDay < 0: eDay = 0 if eYear > 2020: eYear = 2020 if eYear < 2000: eYear = 2000 if eHour > 12: eHour = 12 if eHour < 0: eHour = 0 if eMin > 59: eMin = 59 if eMin < 0: eMin = 0 if sHour < 10: sHour = "0" + str(sHour) if sMin < 10: sMin = "0" + str(sMin) if eHour < 10: eHour = "0" + str(eHour) if eMin < 10: eMin = "0" + str(eMin) startinterval = (" " + str(sMonth) + "/" + str(sDay) + "/" + str(sYear) + " " + str(sHour) + ":" + str(sMin) + ":" + "00 " + ampm1) endinterval = (" " + str(eMonth) + "/" + str(eDay) + "/" + str(eYear) + " " + str(eHour) + ":" + str(eMin) + ":" + "00 " + ampm2) database.SetInterval(startinterval, endinterval) except: plt.gcf().clear() graph_area.add_widget( Label(text="No data for given parameters", font_size="30dp", pos_hint={ "x": 0, "y": 0.1 }, color=(1, 0, 0, 1))) graph_content.add_widget(graph_area) return 0 if database.ReadData() == False or len( database.selectedBuildings) == 0: plt.gcf().clear() graph_area.add_widget( Label(text="No data for given parameters", font_size="30dp", pos_hint={ "x": 0, "y": 0.1 }, color=(1, 0, 0, 1))) graph_content.add_widget(graph_area) return 0 #if database has no data return a graph error # Initialize graph after prospects # Loop for grabbing buildings and data points ticks = [] labels = [] timestamps = [] kilowatts = [] for buildingNum in range(0, len(database.buildingsData)): timestamps = [] kilowatts = [] for dataPoint in range( 0, len(database.buildingsData[buildingNum].dataPoints)): timestamps.append( database.SetDateToUnix( database.buildingsData[buildingNum]. dataPoints[dataPoint].timestamp)) kilowatts.append( float(database.buildingsData[buildingNum]. dataPoints[dataPoint].kilowatts)) plt.plot(timestamps, kilowatts, label=str(database.buildingsData[buildingNum].name)) plt.xlabel('Timestamp') plt.ylabel('Kilowatts') plt.legend() #midnight and noon lines if graphSettings.midnight == True: for midnight in timestamps: if (midnight % 86400) == 0: plt.axvline(x=(midnight), linestyle=('--'), color=(0, 0, 0, 1)) #for noon in if graphSettings.noon == True: for noon in timestamps: if (noon % 86400) == 43200: plt.axvline(x=(noon), linestyle=('--'), color=(1, 0, 0, 1)) tickNum = 7 for x in range(0, tickNum): ticks.append( (x * ((database.unixInterval[1] - database.unixInterval[0]) / tickNum) + database.unixInterval[0])) # print(self.ticks[x])#verifies the graph ticks label = database.SetUnixToLabel( (x * ((database.unixInterval[1] - database.unixInterval[0]) / tickNum) + database.unixInterval[0])) labels.append(label) # print(self.labels[x])#verifies the graph tick labels ticks.append(database.unixInterval[1]) labels.append(database.SetUnixToLabel(database.unixInterval[1])) plt.xticks(ticks=ticks, labels=labels, rotation=15) plt.title("Dynamic Kilowatt/hr Graph") plt.grid() graphwidget = FigureCanvasKivyAgg((plt.gcf())) graph_area.add_widget(graphwidget) graph_content.add_widget(graph_area) ok = Button(text="Graph", size_hint=(.2, .2), pos_hint={ "x": 0, "top": 1 }) ok.bind(on_press=buttonClicked) graph_content.add_widget(ok) buildingButtons = [] def createButton(name, index): button = ToggleButton(text=name, size_hint=(0.25, 0.05), pos_hint={ "right": 1, "y": 0.05 * index }) button.bind( on_press=lambda x: (database.ChangeBuilding(index + 1))) graph_content.add_widget(button) for i, val in enumerate(database.buildings): createButton(val, i) #_lgraph_head = TabbedPanelHeader(text='Graphs') #th_lgraph_head.content = graph_content tb_panel.default_tab_content = graph_content tb_panel.default_tab_text = "Graphs" #tb_panel.add_widget(th_interval_head) #tb_panel.add_widget(th_building_head) #tb_panel.add_widget(th_lgraph_head) return tb_panel
def coin_page(self): mainview = ModalView(size_hint=(0.75, 0.75)) grid = GridLayout( rows=2, cols=1, padding=[10, 15, 10, 30] # left, top, right, bottom ) # Area to contain price graphs located at the top half of the screen. graph_box = BoxLayout(orientation="vertical", size_hint_y=0.5, size_hint_x=.6) # Will contain the alerts below graph - once user sets them alarm_box = GridLayout(cols=2, size_hint_x=1, size_hint_y=.5) # First row of alerts box contains current price. self.current_price = coin_gecko.get_crypto_fiat_price( cryptoCurrency=self.current_coin) live_price_text = 'The current price is $' \ + str(self.current_price) live_price_label = Label(text="", size_hint_x=.5) dummy_label = Label(text=live_price_text, size_hint_x=.5) alarm_box.add_widget(live_price_label) alarm_box.add_widget(dummy_label) # Second row of alerts box contains alerts input box set_alarm_label = Label(text='Set Target Price: ', size_hint_x=0.5) self.alarm_textinput = TextInput(multiline=False, size_hint_x=0.5) # method actioned to check text input self.alarm_textinput.bind(text=self.on_text) alarm_box.add_widget(set_alarm_label) alarm_box.add_widget(self.alarm_textinput) # Third row of alerts box to contain buttons to set alerts alarm_button_less_than = Button(text="<", size_hint_x=1) alarm_button_more_than = Button(text=">", size_hint_x=1) alarm_box.add_widget(alarm_button_less_than) alarm_box.add_widget(alarm_button_more_than) # methods called on press of third row buttons, and then alerts added to log alarm_button_less_than.bind(on_release=self.alert_callback_less_than) alarm_button_more_than.bind(on_release=self.alert_callback_more_than) # Fourth row of alerts box will contain the alerts log. # self.scroll_label = ScrollableLabel(size_hint_x=1) #shown as self.history in sentdex tutorial # how to use self for input/label while not using self for old alerts # existing alerts scrollable_label = ScrollableLabel(size_hint_x=1) # existing alerts alarm_box.add_widget(scrollable_label) # new alerts self.new_alerts_scrollable_label = ScrollableLabel(size_hint_x=1) alarm_box.add_widget(self.new_alerts_scrollable_label) self.price_chart() # Fourth row of alerts box continued graph_tabs = TabbedPanel(pos_hint={'center_x': .5, 'center_y': 1}) graph_tabs.default_tab_text = '24hr' graph_tabs.default_tab.bind = self.one_day_chart() graph_tabs.default_tab_content = self.graph # graph title seven_days_tab = TabbedPanelHeader(text='7 days') seven_days_tab.bind = self.seven_day_chart() seven_days_tab.content = self.graph graph_tabs.add_widget(seven_days_tab) # make the actual plots graph_box.add_widget(graph_tabs) grid.add_widget(graph_box) grid.add_widget(alarm_box) # grid.add_widget(scrollable_label) mainview.add_widget(grid) mainview.open() parsedatabase.check_alerts(scrollable_label)
def build(self): #*******ROOTWIDGET******* layout = GridLayout(rows=2) #*******SUB-WIDGETS******* layoutTop = GridLayout(cols=3,rows=1)#SUB-WIDGET-1 layoutTop.size_hint = (1, 0.1) layoutMid = FloatLayout()#SUB-WIDGET-2 layoutMid.size_hint = (1, 1) #*******CONTENT-OF-SUB-WIDGET-1******* menubtn = Button(text='Menu') menubtn.size_hint = (0.1, 0.1) head = Label(text='PRO-FORMA',size_hint_y = None,size_hint_x=None, width=200) head.size_hint = (0.8, 0.1) backbtn = Button(text='Drop') backbtn.size_hint = (0.1, 0.1) #dropbtn = Button() #*******CONTENT-OF-SUB-WIDGET-2******* tp_panel = TabbedPanel() tp_panel.default_tab_text = "Global News" layoutnews = GridLayout(rows=2) upperlayout = GridLayout(cols=3, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40, size_hint_y=None, height = 50, size_hint_x=1) lowerlayout = GridLayout(row=1) upperlayout.add_widget(Button(text='S', size_hint=(0.1, None))) upperlayout.add_widget(TextInput(text='search', size_hint=(0.8, None), focus=True, multiline=False)) upperlayout.add_widget(Button(text='settings', size_hint=(0.1, None))) lowerlayout.add_widget(Label()) layoutnews.add_widget(upperlayout) layoutnews.add_widget(lowerlayout) tp_panel.default_tab_content = layoutnews #*******TAB1******* th_tab1 = TabbedPanelHeader(text = 'Pro-Forma') #*******SCROLLABILITY-WIDGET******* scroll = ScrollView(size_hint=(1, None), size=(800, 1000)) mainlayout = GridLayout(cols = 1, spacing = 10, size_hint_y=None, size_hint_x=1) mainlayout.bind(minimum_height=mainlayout.setter('height')) #*******LAYOUT-FOR-PROPERTY-INFORMATION******* layouttab1 = GridLayout(cols=2,rows=6, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40, size_hint_y=None, height = 250, size_hint_x=1) #*******LAYOUT-FOR-UNIT-MIX******* layoutmix = GridLayout(cols=4, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40,size_hint_y=None, height = 80) #*******LAYOUT-FOR-EXPENSES******* layoutexpense = GridLayout(cols=2, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40, size_hint_y=None, height = 960) #*******LAYOUT-FOR-ACCOUNTS******* layoutacc = GridLayout(cols=2, pos_hint ={'center_x': .5, 'center_y': .5},row_force_default=True, row_default_height=40,size_hint_y=None, height = 240) #*******CONTENT1***** mainlayout.add_widget(Label(text='Property Information',size_hint=(None, 1))) #*******CONTENT2******* layouttab1.add_widget(Label(text= 'Property Name', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Property Address', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Town/City', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Asking Price', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Total Units', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) layouttab1.add_widget(Label(text= 'Square Footage', font_size=15, size_hint=(0.4, None))) layouttab1.add_widget(TextInput(text='input', font_size=15, halign ='left', valign='middle',size_hint=(0.6, None),multiline=False, focus=True)) mainlayout.add_widget(layouttab1) #*******CONTENT3******* mainlayout.add_widget(Label(text='Unit Mix',size_hint_x=None, width=200, size_hint_y=None, height=50)) #*******CONTENT4******* layoutmix.add_widget(Label(text='# of Units')) layoutmix.add_widget(Label(text='Unit Type')) layoutmix.add_widget(Label(text='SquareFeet')) layoutmix.add_widget(Label(text='Monthly Rent')) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) layoutmix.add_widget(TextInput(text='Input', font_size=15)) mainlayout.add_widget(layoutmix) #*******CONTENT7******* mainlayout.add_widget(Label(text='Accounts',size_hint_x=None, width=200, size_hint_y=None, height=50)) #*******CONTENT7******* layoutacc.add_widget(Label(text='Purchase Price')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Deposit')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Loan Amount')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Annual Interest')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Period')) layoutacc.add_widget(TextInput(text='Input')) layoutacc.add_widget(Label(text='Total Cash Outlay')) layoutacc.add_widget(TextInput(text='Input')) mainlayout.add_widget(layoutacc) #*******CONTENT5******* mainlayout.add_widget(Label(text='Expenses',size_hint_x=None, width=200, size_hint_y=None, height=50)) #*******CONTENT6******* layoutexpense.add_widget(Label(text='Accounting')) layoutexpense.add_widget(TextInput(text='Input', font_size=15,)) layoutexpense.add_widget(Label(text='Advertising')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Bank Charges')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Electricity')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Gas')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Security')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='All insurance')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Permits and fees')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Maintenance')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='Trash Pick-up')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) layoutexpense.add_widget(Label(text='All other')) layoutexpense.add_widget(TextInput(text='Input', font_size=15)) mainlayout.add_widget(layoutexpense) #*******CALLING-MAINLAYOUT-IN-TAB1******* scroll.add_widget(mainlayout) th_tab1.content = scroll tp_panel.add_widget(th_tab1) #___*******TAB3*******___# th_tab3 = TabbedPanelHeader(text = 'Saved Reports') tp_panel.add_widget(th_tab3) #*******ADDING-CONTENTS-OF-SUB-WIDGETS******* layoutTop.add_widget(menubtn) layoutTop.add_widget(head) layoutTop.add_widget(backbtn) layoutMid.add_widget(tp_panel) #*******ADDING-CONTENTS-OF-ROOT-WIDGET******* layout.add_widget(layoutTop) layout.add_widget(layoutMid) #*******CALLING-THE-ROOT-WIDGET******* return layout