def show_view_list_path(self, *args, **kwargs): self.clear_widgets() color = ColorLayout() boxl = BoxLayout(orientation= 'vertical',anchor_y= "top") grid = GridLayout(cols=1, size_hint_y=None) grid.bind(minimum_height=grid.setter('height')) scroll = ScrollView(size_hint=(None, None)) scroll.size = (Window.width, Window.height) scroll.center = Window.center #2 Space added but button go back ocuppies space and first value hidden. l_space = MultiLineLabel(text='',font_size="16dp", background_color=(255,255,255,255), markup=True) grid.add_widget(l_space) l_space = MultiLineLabel(text='',font_size="16dp", background_color=(255,255,255,255), markup=True) grid.add_widget(l_space) for i in args[0]: text = '[color=333333]'+' '+i['text'] + '[/color]'+' ' #~ l = MultiLineLabel(text=text,font_size="16dp",markup=True) l = MultiLineLabel(text=text,font_size="16dp", background_color=(255,255,255,255), markup=True) i['stations'] and l.bind(on_press = partial(self.show_list_stations, i['stations'],args[0])) grid.add_widget(l) button_back = Button(text="Go Back", auto_dismiss=False, size_hint=(None, None), pos_hint= {'center_x':.5, 'center_y':.7}) button_back.height="50dp" button_back.width="100dp" button_back.bind(on_press = lambda widget: self.show_option_view()) scroll.add_widget(grid) boxl.add_widget(scroll) boxl.add_widget(button_back) color.add_widget(boxl) self.add_widget(color)
def __init__(self,**kwargs): super(Medicine,self).__init__(**kwargs) self.active_checkboxes = [] self.checkboxeslist = [] self.scrollsize = fullapp.size[0]*0.86,fullapp.size[1]*0.57 self.scrollpos = fullapp.size[0]*0.07,fullapp.size[1]*0.34 self.canvas.add(Rectangle(size=fullapp.size,pos=fullapp.pos,source="MainBackgroundWhiter.png")) self.add_widget(MenuButton()) rect = Rectangle(size=(fullapp.size[0],fullapp.size[1]*0.236),pos=fullapp.pos,source='FrontForScroll.png') self.canvas.add(rect) self.canvas.add(Color(0.5,0.5,0.5,1)) self.canvas.add(Rectangle(size=self.scrollsize,pos=self.scrollpos)) MedScroll = ScrollView() MedScroll.size_hint = (None,None) MedScroll.size = self.scrollsize MedScroll.pos = self.scrollpos MedBox = Widget() MedBox.size_of_drug = (self.scrollsize[0],fullapp.size[1]*0.1) MedBox.spacing = fullapp.size[1]*0.01 MedBox.size = (self.scrollsize[0],(MedBox.spacing+MedBox.size_of_drug[1])*len(IlnessBase.Medicine)-MedBox.spacing) MedBox.size_hint_y = None for i in range(len(IlnessBase.Medicine)): text = Label(color=(1,1,1,1),markup=True) text.text = IlnessBase.Medicine[i][:IlnessBase.Medicine[i].find(':')] + ' ' + '[i][size=11][color=272727]' + 'ATX num ' + IlnessBase.Medicine[i][IlnessBase.Medicine[i].find(':')+1:] + '[/i][/size][/color]' text.text_size = MedBox.size_of_drug text.text_size[0] -= MedBox.size_of_drug[1] text.halign = 'left' text.valign = 'middle' text.pos = (MedBox.size_of_drug[0]/4.3,i*(MedBox.spacing+MedBox.size_of_drug[1])-MedBox.size_of_drug[1]/2) b = Button(size=MedBox.size_of_drug,pos=(0,i*(MedBox.spacing+MedBox.size_of_drug[1]))) b.bind(on_press=self.on_button) b.add_widget(text) checkbox = CheckBox(size=(MedBox.size_of_drug[1],MedBox.size_of_drug[1]),pos = (MedBox.size_of_drug[0]-MedBox.size_of_drug[1],i*(MedBox.spacing+MedBox.size_of_drug[1]))) checkbox.num = i checkbox.bind(active=self.on_checkbox) b.add_widget(checkbox) self.checkboxeslist.append(checkbox) b.ATXNum = IlnessBase.Medicine[i][IlnessBase.Medicine[i].find(':')+1:] MedBox.add_widget(b) TopLabel = Label(bold=True,size_hint=(None,None),text='check prep:',font_size=fullapp.size[1]*0.036,color = (0,0,0,1),pos = (fullapp.size[0]*0.34,fullapp.size[1]*0.85)) self.SomeWidget = Widget(pos=(0,0),size_hint=(None,None),size = fullapp.size) CancelButton = Button(text = 'exit',font_size=fullapp.size[1]*0.022,size_hint=(None,None),size=(MedBox.size_of_drug[0]/2.01,fullapp.size[1]*0.05), pos = (self.scrollpos[0],self.scrollpos[1]-fullapp.size[1]*0.05-1),background_color = (0.3,0.3,0.9,1),on_press=self.on_cancel) OkButton = Button(text = 'chose',font_size=fullapp.size[1]*0.022,size_hint=(None,None),size=(MedBox.size_of_drug[0]/2.01,fullapp.size[1]*0.05), pos = (self.scrollpos[0]+MedBox.size_of_drug[0]/2+1,self.scrollpos[1]-fullapp.size[1]*0.05-1),background_color = (0.3,0.3,0.9,1),on_press=self.on_choose) self.SomeWidget.add_widget(CancelButton) self.SomeWidget.add_widget(OkButton) self.SomeWidget.opacity=0 MedScroll.add_widget(MedBox) self.add_widget(self.SomeWidget) self.add_widget(MedScroll) self.add_widget(TopLabel)
def build(self): # create a default grid layout with custom width/height layout = GridLayout(cols=1, spacing=10, size_hint=(None, None), width=500) # when we add children to the grid layout, its size doesn't change at # all. we need to ensure that the height will be the minimum required to # contain all the childs. (otherwise, we'll child outside the bounding # box of the childs) layout.bind(minimum_height=layout.setter('height')) # add button into that grid for i in range(30): btn = Button(text=str(i), size=(480, 40), size_hint=(None, None)) layout.add_widget(btn) # create a scroll view, with a size < size of the grid root = ScrollView(size_hint=(None, None)) root.size = (480, 320) root.center = Window.center root.add_widget(layout) return root
def build(self): # create a default grid layout with custom width/height layout = GridLayout(cols=1, spacing=10, size_hint=(None, None), width=500) # when we add children to the grid layout, its size doesn't change at # all. we need to ensure that the height will be the minimum required to # contain all the childs. (otherwise, we'll child outside the bounding # box of the childs) layout.bind(minimum_height=layout.setter('height')) # add button into that grid for i in range(30): btn = Button(text=str(i), size=(480, 40), size_hint=(None, None)) layout.add_widget(btn) # create a scroll view, with a size < size of the grid root = ScrollView(size_hint=(None, None)) root.size = (480, 320) root.center = Window.center root.add_widget(layout) return root
def build(self): layout = GridLayout(cols=1, spacing=10, size_hint=(None, None), width=500) for i in range(30): btn = Button(text=str(i), height=40, width=500) layout.add_widget(btn) root = ScrollView(size_hint=(None, None)) root.size = (480, 320) root.center = Window.center root.add_widget(layout) return root
def make_scroll(self): scroll = ScrollView( ) box = BoxLayout( orientation='vertical') height = 0 for i in range(10): b = self.add_block(i) height += b.height box.add_widget( b ) box.size=300, height scroll.size=Window.size box.size_hint_y = None scroll.add_widget(box) return scroll
def __init__(self, **kwargs): super(Literature, self).__init__(**kwargs) global fullapp,LitScroll self.canvas.add(Rectangle(size=fullapp.size,pos=fullapp.pos,source="MainBackgroundWhiter.png")) self.add_widget(MenuButton()) rect = Rectangle(size=(fullapp.size[0],fullapp.size[1]*0.236),pos=fullapp.pos,source='FrontForScroll.png') self.canvas.add(rect) self.scrollsize = fullapp.size[0]*0.86,fullapp.size[1]*0.6 self.scrollpos = fullapp.size[0]*0.07,fullapp.size[1]*0.27 self.libra = IlnessBase.Literature self.opened_divisions = [0 for i in range(len(self.libra.keys())+6)] LitScroll = ScrollView() LitScroll.size_hint = (None,None) LitScroll.pos = self.scrollpos LitScroll.size = self.scrollsize LitScroll.add_widget(self.create_literature()) self.add_widget(LitScroll) self.add_widget(Label(text = '[color=000033]'+'litra.'+'[/color]',bold= True,font_size = fullapp.size[1]*0.038,pos=(0,fullapp.size[1]*0.44),markup = True))#,pos = (fullapp.size[0]*0.3,fullapp.size[1]*0.8)))
def gpu_overclock(self): layout = GridLayout(cols=1, size_hint=(None, 1.0), width=700) layout.bind(minimum_height=layout.setter('height')) panel = SettingsPanel(title="Gpu Overclocking", settings=self) main = BoxLayout(orientation = 'vertical') root = ScrollView(size_hint=(None, None),bar_margin=-11, bar_color=(47 / 255., 167 / 255., 212 / 255., 1.), do_scroll_x=False) root.size = (600, 400) root.add_widget(layout) main.add_widget(root) done = Button(text ='Done') main.add_widget(done) sio = SettingItem(panel = panel, title = "Sio", disabled=False, desc = "CONFIG_IOSCHED_SIO") sio_radio = CheckBox(active=False) sio.add_widget(sio_radio) layout.add_widget(sio) vr = SettingItem(panel = panel, title = "VR", disabled=False, desc = "CONFIG_IOSCHED_VR") vr_radio = CheckBox(active=False) vr.add_widget(vr_radio) layout.add_widget(vr) popup = Popup(background='atlas://images/eds/pop', title='GPU Overclocking', content=main, auto_dismiss=True, size_hint=(None, None), size=(630, 500)) done.bind(on_release=popup.dismiss) popup.open() def on_sio_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' sio_radio.bind(active=on_sio_active) def on_vr_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' vr_radio.bind(active=on_vr_active)
def notify(self): def exit(instance): self.remove_widget(NotePopup) self.scrollsize = fullapp.size[0]*0.8,fullapp.size[1]*0.6 self.scrollpos = fullapp.size[0]*0.095,fullapp.size[1]*0.185 self.size_of_note = (self.scrollsize[0],fullapp.size[1]*0.25) NotePopup = Popup(size_hint=(None,None),size=(fullapp.size[0]*0.9,fullapp.size[1]*0.8)) NotePopup.pos = (fullapp.size[0]/2 - NotePopup.size[0]/2,fullapp.size[1]/2 - NotePopup.size[1]/2) NotePopup.title = 'view pushers.' NotePopup.title_align = 'center' NotePopup.separator_color = (0.3,0.3,1,1) NotePopup.title_size = fullapp.size[1]*0.03 NoteScroll = ScrollView() NoteScroll.size_hint = (None,None) NoteScroll.size = self.scrollsize NoteScroll.pos =self.scrollpos NoteBox = Widget() NoteBox.size_of_note = self.size_of_note NoteBox.spacing = fullapp.size[1]*0.006 NoteBox.size = (self.scrollsize[0],(NoteBox.spacing+NoteBox.size_of_note[1])*len(fullapp.notes)-NoteBox.spacing) NoteBox.size_hint_y = None for i in range(len(fullapp.notes)): b = Button(size=self.size_of_note,pos=(-2,i*(NoteBox.spacing+NoteBox.size_of_note[1]))) if(fullapp.notes[i]['type'] == 'request'): b.add_widget(Label(markup=True,text='[color=cccccc]'+'ok request number '+ '[b][/color]' + str(fullapp.notes[i]['idnum']) + '[/b]',font_size=fullapp.size[1]*0.03,color=(1,1,1,1),pos=(fullapp.size[0]*0.19,fullapp.size[1]*0.126+i*(NoteBox.spacing+NoteBox.size_of_note[1])))) if(fullapp.notes[i]['undertype']=='med'): preparate = IlnessBase.Medicine[fullapp.notes[i]['idinIlnessBase']] print(preparate) b.add_widget(Label(text_size=(self.size_of_note[0]*0.97,self.size_of_note[1]*0.7),markup=True,text='to adding preparate '+ '[b][i]' + preparate[:preparate.find(':')]\ + '[/b][/i]'+' seems ' + '[b][i]' + preparate[preparate.find(':')+1:] + '[/b][/i]'+' by systemATX.',font_size=fullapp.size[1]*0.03,color=(1,1,1,1),pos=(fullapp.size[0]*0.244,fullapp.size[1]*0.086+i*(NoteBox.spacing+NoteBox.size_of_note[1])))) if(fullapp.notes[i]['state']=='inprogress'): b.add_widget(Label(text='[color=cccccc]Poss: [/color][b][color=adaddf]cheking[/color][b]',font_size=fullapp.size[1]*0.03,markup=True,pos=(fullapp.size[0]*0.184,-fullapp.size[1]*0.046+i*(NoteBox.spacing+NoteBox.size_of_note[1])))) b.add_widget(Label(text='[color=353535]from '+ fullapp.notes[i]['date'],markup=True,font_size=fullapp.size[1]*0.025,pos=(fullapp.size[0]*0.384,-fullapp.size[1]*0.076+i*(NoteBox.spacing+NoteBox.size_of_note[1])))) elif(fullapp.notes[i]['undertype']=='ser'): service = fullapp.notes[i]['name'] print(service) b.add_widget(Label(text_size=(self.size_of_note[0],self.size_of_note[1]*0.7),markup=True,text='To add new usluga '+ '[b][i]' + service\ + '[/b][/i]'+ '[/b][/i]'+'. Check info to usluga.',font_size=fullapp.size[1]*0.03,color=(1,1,1,1),pos=(fullapp.size[0]*0.244,fullapp.size[1]*0.056+i*(NoteBox.spacing+NoteBox.size_of_note[1])))) if(fullapp.notes[i]['state']=='inprogress'): b.add_widget(Label(text='[color=cccccc]Statust: [/color][b][color=adaddf]checking[/color][b]',font_size=fullapp.size[1]*0.03,markup=True,pos=(fullapp.size[0]*0.184,-fullapp.size[1]*0.046+i*(NoteBox.spacing+NoteBox.size_of_note[1])))) b.add_widget(Label(text='[color=353535]from '+ fullapp.notes[i]['date'],markup=True,font_size=fullapp.size[1]*0.025,pos=(fullapp.size[0]*0.384,-fullapp.size[1]*0.076+i*(NoteBox.spacing+NoteBox.size_of_note[1])))) NoteBox.add_widget(b) DefendWidget = Widget(size=fullapp.size,pos=fullapp.pos,size_hint=(None,None)) NoteScroll.add_widget(NoteBox) DefendWidget.add_widget(NoteScroll) DefendWidget.add_widget(Button(size_hint=(None,None),pos=(fullapp.size[0]*0.11,fullapp.size[1]*0.13),size=(25,25),background_normal='47.png',on_press=exit)) if(len(fullapp.notes)==0): DefendWidget.add_widget(Label(text='Non pushers',pos=(self.scrollpos[0]+self.scrollsize[0]/3.6,self.scrollpos[1]+self.scrollsize[1]/2),font_size=fullapp.size[1]*0.04)) else: DefendWidget.add_widget(Label(text_size=(fullapp.size[0]*0.7,100),text='[color=010101]view in [b] http://www.sechenovclinic.ru/[/color][/b]',font_size=fullapp.size[1]*0.02,pos=(self.scrollpos[0]+self.scrollsize[0]/2.7,self.scrollpos[1]-fullapp.size[1]*0.047),markup=True)) NotePopup.add_widget(DefendWidget) self.add_widget(NotePopup)
def gov_select(self): layout = GridLayout(cols=1, size_hint=(None, 1.0), width=700) layout.bind(minimum_height=layout.setter('height')) panel = SettingsPanel(title="Governors", settings=self) main = BoxLayout(orientation = 'vertical') root = ScrollView(size_hint=(None, None),bar_margin=-11, bar_color=(47 / 255., 167 / 255., 212 / 255., 1.), do_scroll_x=False) root.size = (600, 400) root.add_widget(layout) main.add_widget(root) done = Button(text ='Done') main.add_widget(done) lion = SettingItem(panel = panel, title = "Lionhart", disabled=False, desc = "CONFIG_CPU_FREQ_GOV_LIONHEART") lion_radio = CheckBox(active=False) lion.add_widget(lion_radio) layout.add_widget(lion) inte = SettingItem(panel = panel, title = "Intellidemand", disabled=False, desc = "CONFIG_CPU_FREQ_GOV_INTELLIDEMAND") inte_radio = CheckBox(active=False) inte.add_widget(inte_radio) layout.add_widget(inte) zen = SettingItem(panel = panel, title = "Savanged Zen", disabled=False, desc = "CONFIG_CPU_FREQ_GOV_SAVAGEDZEN") zen_radio = CheckBox(active=False) zen.add_widget(zen_radio) layout.add_widget(zen) wax = SettingItem(panel = panel, title = "Brazillian Wax", disabled=False, desc = "CONFIG_CPU_FREQ_GOV_BRAZILLIANWAX") wax_radio = CheckBox(active=False) wax.add_widget(wax_radio) layout.add_widget(wax) popup = Popup(background='atlas://images/eds/pop', title='Governors', content=main, auto_dismiss=True, size_hint=(None, None), size=(630, 500)) done.bind(on_release=popup.dismiss) popup.open() def on_lion_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' lion_radio.bind(active=on_lion_active) def on_inte_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' inte_radio.bind(active=on_inte_active) def on_zen_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' zen_radio.bind(active=on_zen_active) def on_wax_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' wax_radio.bind(active=on_wax_active)
def overclock(self): layout = GridLayout(cols=1, size_hint=(None, 1.0), width=700) layout.bind(minimum_height=layout.setter('height')) panel = SettingsPanel(title="Kernel Base", settings=self) main = BoxLayout(orientation = 'vertical') root = ScrollView(size_hint=(None, None),bar_margin=-11, bar_color=(47 / 255., 167 / 255., 212 / 255., 1.), do_scroll_x=False) root.size = (600, 400) root.add_widget(layout) main.add_widget(root) done = Button(text ='Done') main.add_widget(done) ghz15 = SettingItem(panel = panel, title = "1.5ghz", disabled=False, desc = "CONFIG_MSM_CPU_MAX_CLK_1DOT5GHZ") ghz15_radio = CheckBox(group="overclock", active=False) ghz15.add_widget(ghz15_radio) layout.add_widget(ghz15) ghz17 = SettingItem(panel = panel, title = "1.7ghz", disabled=False, desc = "CONFIG_MSM_CPU_MAX_CLK_1DOT7GHZ") ghz17_radio = CheckBox(group="overclock",active=False) ghz17.add_widget(ghz17_radio) layout.add_widget(ghz17) ghz18 = SettingItem(panel = panel, title = "1.8ghz", disabled=False, desc = "CONFIG_MSM_CPU_MAX_CLK_1DOT8GHZ") ghz18_radio = CheckBox(group="overclock",active=False) ghz18.add_widget(ghz18_radio) layout.add_widget(ghz18) ghz21 = SettingItem(panel = panel, title = "2.1ghz", disabled=False, desc = "CONFIG_MSM_CPU_MAX_CLK_2DOT1GHZ") ghz21_radio = CheckBox(group="overclock",active=False) ghz21.add_widget(ghz21_radio) layout.add_widget(ghz21) popup = Popup(background='atlas://images/eds/pop', title='Overclocking', content=main, auto_dismiss=True, size_hint=(None, None), size=(630, 500)) done.bind(on_release=popup.dismiss) popup.open() def on_ghz15_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' ghz15_radio.bind(active=on_ghz15_active) def on_ghz17_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' ghz17_radio.bind(active=on_ghz17_active) def on_ghz18_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' ghz18_radio.bind(active=on_ghz18_active) def on_ghz21_active(checkbox, value): if value: print 'The checkbox', checkbox, 'is active' else: print 'The checkbox', checkbox, 'is inactive' ghz21_radio.bind(active=on_ghz21_active)
def setMenu(self, menuNum, *largs): self.menu = menuNum print("menu is now: " + str(menuNum)) # Undo the previous menu self.clear_widgets() if self.menu == 0: # Add the start button self.startLayout = AnchorLayout(anchor_x='center', anchor_y='center') self.startLayout.size = Window.size self.startLayout.center = Window.center startButton = Button(text="Start") startButton.size_hint = 0.5, 0.2 startButton.font_size = 35 buttonEvent = partial(self.setMenu, 1) startButton.bind(on_press=buttonEvent) self.startLayout.add_widget(startButton) # Add the settings button self.settingsLayout = AnchorLayout(anchor_x='left', anchor_y='bottom') self.settingsLayout.size = Window.size self.settingsLayout.center = Window.center settingsButton = Button(text="") settingsButton.size_hint = None, None settingsButton.size = 50, 50 settingsButton.font_size = 15 buttonEvent = partial(self.setMenu, 3) settingsButton.bind(on_press=buttonEvent) self.settingsLayout.add_widget(settingsButton) # Add the layouts to the main widget self.add_widget(self.startLayout) self.add_widget(self.settingsLayout) elif self.menu == 1: # Add the back button self.backLayout = AnchorLayout(anchor_x='center', anchor_y='top') self.backLayout.size_hint = None, None self.backLayout.size = Window.size[0], Window.size[1] * 0.95 self.backLayout.center = Window.center btn = Button(text="back", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) btn.bind(on_press=partial(self.setMenu, 0)) self.backLayout.add_widget(btn) # Set up the centered drinks list self.mainLayout = AnchorLayout(anchor_x='center', anchor_y='bottom') self.mainLayout.size_hint = None, None self.mainLayout.size = Window.size[0], Window.size[1] self.mainLayout.center = Window.center layout = GridLayout(cols=1, spacing=30, size_hint_y=None) layout.size_hint_x = 0.8 layout.bind(minimum_height=layout.setter('height')) # Add all the different drinks for i in range(len(drinksList)): if drinksList[i]["canMake"]: btn = Button(text=str(drinksList[i]["name"])) btn.font_size = 25 btn.size_hint_y = None btn.height = 60 btn.bind(on_press=partial(self.setDrink, drinksList[i])) layout.add_widget(btn) # Add some spacing at the end lbl = Label(text="", height=60) layout.add_widget(lbl) # Set up scrolling of the main list scrolling = ScrollView(size_hint=(None, None), size=(Window.width, Window.height)) scrolling.add_widget(layout) scrolling.size_hint = None, None scrolling.size = self.mainLayout.size[ 0] * 0.75, self.mainLayout.size[1] * 0.83 scrolling.center = self.mainLayout.center scrolling.bar_width = 30 scrolling.bar_margin = 0 scrolling.bar_inactive_color = [.7, .7, .7, .9] scrolling.scroll_type = ["bars"] layout.center = scrolling.center self.mainLayout.add_widget(scrolling) # Add the various sections to the root widget self.add_widget(self.mainLayout) self.add_widget(self.backLayout) elif self.menu == 2: # Add the back button self.backLayout = AnchorLayout(anchor_x='center', anchor_y='top') self.backLayout.size_hint = None, None self.backLayout.size = Window.size[0], Window.size[1] * 0.95 self.backLayout.center = Window.center btn = Button(text="back", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) buttonEvent = partial(self.setMenu, 1) btn.bind(on_press=buttonEvent) self.backLayout.add_widget(btn) # Add the make button self.makeLayout = AnchorLayout(anchor_x='center', anchor_y='bottom') self.makeLayout.size_hint = None, None self.makeLayout.size = Window.size[0], Window.size[1] * 0.95 self.makeLayout.center = Window.center btn = Button(id="btnmake", text="make", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) buttonEvent = partial(self.makeDrink) btn.bind(on_press=buttonEvent) self.makeLayout.add_widget(btn) # Make the central layout self.drinkLayout = AnchorLayout(anchor_x='center', anchor_y='bottom') self.drinkLayout.size_hint = None, None self.drinkLayout.size = Window.size[0], Window.size[1] self.drinkLayout.center = Window.center for ing in self.currentDrink["ingredients"]: if ing["name"] not in self.settings["liquidsAvail"]: print("substituting " + ing["name"] + " for " + getLiquid(ing["name"])["subs"]) ing["oldName"] = ing["name"] ing["name"] = getLiquid(ing["name"])["subs"] # Add the drop down boxes to the info self.drinkInfo = GridLayout(cols=4, spacing=15, size_hint=(None, None)) for index, ing in enumerate(self.currentDrink["ingredients"]): if "oldName" in ing.keys(): spinner = Label(text=ing["oldName"] + "\n(" + ing["name"] + ")", size_hint=(None, None), size=(190, 50), font_size=fs) else: spinner = Label(text=ing["name"], size_hint=(None, None), size=(190, 50), font_size=fs) spinner.ind = index self.drinkInfo.add_widget(spinner) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeDrink, index, -25)) self.drinkInfo.add_widget(btn) lbl = Label(id="lbl" + str(index), text=str(ing["ml"]) + " ml", size_hint=(None, None), height=50, width=80, font_size=fs) self.drinkInfo.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeDrink, index, 25)) self.drinkInfo.add_widget(btn) # Set up the scrolling list of ingredients self.scrollingDrinks = ScrollView(size_hint=(None, None), size=(Window.width, Window.height)) self.scrollingDrinks.size_hint = None, None self.scrollingDrinks.size = self.drinkLayout.size[ 0] * 0.85, self.drinkLayout.size[1] * 0.85 self.scrollingDrinks.center = self.drinkLayout.center self.scrollingDrinks.add_widget(self.drinkInfo) self.drinkLayout.add_widget(self.scrollingDrinks) # Add the various sections to the root widget self.add_widget(self.backLayout) self.add_widget(self.drinkLayout) self.add_widget(self.makeLayout) self.checkDrink() elif self.menu == 3: # Add the back button self.backLayout = AnchorLayout(anchor_x='center', anchor_y='top') self.backLayout.size_hint = None, None self.backLayout.size = Window.size[0], Window.size[1] * 0.95 self.backLayout.center = Window.center btn = Button(text="back", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) buttonEvent = partial(self.setMenu, 0) btn.bind(on_press=buttonEvent) self.backLayout.add_widget(btn) # Create the keypad self.keypadWrapper = AnchorLayout(anchor_x='center', anchor_y='center') self.keypadWrapper.size_hint = None, None self.keypadWrapper.size = Window.size[0], Window.size[1] self.keypadWrapper.center = Window.center self.keypadLayout = GridLayout(cols=3) self.keypadLayout.size_hint = None, None self.keypadLayout.size = Window.size[0] * 0.5, Window.size[1] * 0.5 self.keypadLayout.center = Window.center for i in range(9): btn = Button(size_hint=(None, None), size=(80, 80), font_size=fs) buttonEvent = partial(self.enterCode, i + 1) btn.bind(on_press=buttonEvent) self.keypadLayout.add_widget(btn) self.keypadWrapper.add_widget(self.keypadLayout) # Add the various sections to the root widget self.add_widget(self.backLayout) self.add_widget(self.keypadWrapper) elif self.menu == 4: # Add the back button self.backLayout = AnchorLayout(anchor_x='center', anchor_y='top') self.backLayout.size_hint = None, None self.backLayout.size = Window.size[0], Window.size[1] * 0.95 self.backLayout.center = Window.center btn = Button(text="back", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) buttonEvent = partial(self.setMenu, 0) btn.bind(on_press=buttonEvent) self.backLayout.add_widget(btn) self.controlLayout = AnchorLayout(anchor_x='center', anchor_y='bottom') self.controlLayout.size_hint = None, None self.controlLayout.size = Window.size[0] * 0.9, Window.size[ 1] * 0.80 self.controlLayout.center = (Window.center[0], Window.center[1] - 50) # Set up the wrapper grid self.wrapperGrid = GridLayout(cols=1, spacing=15, size_hint=(None, None)) self.wrapperGrid.size = (self.controlLayout.size[0] * 0.99, self.controlLayout.size[1] * 0.99) self.wrapperGrid.center = self.controlLayout.center # Set up the liquid list grid self.liquidGrid = GridLayout(cols=2, spacing=15, size_hint=(None, None)) self.liquidGrid.size = (self.wrapperGrid.size[0] * 0.9, self.wrapperGrid.size[1] * 0.5) self.liquidGrid.center = (self.wrapperGrid.center[0], self.wrapperGrid.center[1]) for index, liq in enumerate(self.settings["liquidsAvail"]): spinner = Spinner(text=liq, id="sd" + str(index), values=liquidNameList, size_hint=(None, None), size=(200, 60), font_size=fs, pos_hint=(None, None)) spinner.bind(text=self.change_avail_drink) self.liquidGrid.add_widget(spinner) # Add the settings layout self.controlGrid = GridLayout(cols=4, spacing=15, size_hint=(None, None)) self.controlGrid.size = (self.wrapperGrid.size[0] * 0.9, self.wrapperGrid.size[1] * 0.30) self.controlGrid.center = self.wrapperGrid.center # Add a value setting lbl = Label(text="maxBooze", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxBooze", -25)) self.controlGrid.add_widget(btn) lbl = Label(id="maxBooze", text=str(self.settings["maxBooze"]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxBooze", 25)) self.controlGrid.add_widget(btn) # Add a value setting lbl = Label(text="maxVol", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxVol", -25)) self.controlGrid.add_widget(btn) lbl = Label(id="maxVol", text=str(self.settings["maxVol"]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxVol", 25)) self.controlGrid.add_widget(btn) # Add a value setting lbl = Label(text="maxChange", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxChange", -25)) self.controlGrid.add_widget(btn) lbl = Label(id="maxChange", text=str(self.settings["maxChange"]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxChange", 25)) self.controlGrid.add_widget(btn) # Add buttons to change active solenoid setting lbl = Label(text="selectedDrink", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind( on_press=partial(self.changeSetting, "selectedSetting", -1)) self.controlGrid.add_widget(btn) lbl = Label(id="selectedSetting", text=str(self.settings["selectedSetting"]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind( on_press=partial(self.changeSetting, "selectedSetting", 1)) self.controlGrid.add_widget(btn) # Add a value setting lbl = Label(text="milliPer25", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "milliPer25", -5, self.settings["selectedSetting"])) self.controlGrid.add_widget(btn) lbl = Label(id="milliPer25", text=str(self.settings["milliPer25"][ self.settings["selectedSetting"] - 1]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "milliPer25", 5)) self.controlGrid.add_widget(btn) # Add the various sections to the root widget self.add_widget(self.backLayout) self.wrapperGrid.add_widget(self.liquidGrid) self.wrapperGrid.add_widget(self.controlGrid) self.controlLayout.add_widget(self.wrapperGrid) self.add_widget(self.controlLayout)
def __init__(self, *args, **kwargs): global s_y, n, yh, yg, sa, btnlist, lbllist btnlist = [] lbllist = [] super().__init__(*args) sel = ScrollView() self.add_widget(sel) dat = os.listdir('.') data = [] for item in range(len(dat)): if dat[item].endswith(".pdf"): data.append(dat[item]) n = len(data) sa = FloatLayout() s_y = 1.02 if n < 11: pass else: s_y = s_y + (n - 10) / 11 sa.size_hint = (1, s_y) with self.canvas: Color(0, 0.5, 1, 1) Rectangle(pos=(0, 0.95 * h), size=(w, h * 0.05)) self.bt2 = Button(size_hint=(0.1, 0.05), pos_hint={ 'x': 0.9, 'y': 0.95 }, background_normal="Icon/add.png") self.add_widget(self.bt2) self.bt2.bind(on_press=self.change) sel.do_scroll_x: False sel.do_scroll_y: True sel.scroll_y = 1 sel.bar_width = 5 sel.size = Window.size sel.add_widget(sa) yh = 0.2 for i in range(n): if i % 2 == 0: z = 0 else: z = 0.5 lb = Label(color=(0, 0, 0, 1), text=data[i], size_hint=(0.5, 0.05 / s_y), pos_hint={ 'x': z, 'y': (s_y - yh) / s_y }) sa.add_widget(lb) if i % 2 != 0: yh = yh + 0.17 lbllist.append(lb) yg = 0.16 for i in range(n): if i % 2 == 0: z = 0.15 else: z = 0.65 btn = Button(background_normal="Icon/pdf.png", size_hint=(0.2, 0.1 / s_y), pos_hint={ 'x': z, 'y': (s_y - yg) / s_y }) sa.add_widget(btn) if i % 2 != 0: yg = yg + 0.17 btnlist.append(btn)