Exemple #1
0
    def ResultUpdate(self,result):
        self.added=None
        if type(result)==str:
            to_add=Label(text=result,font_size='30sp',valign ='center',halign="center")
            self.added=to_add
            self.add_widget(to_add)
        else:
            layout = GridLayout(cols=1, spacing=10, size_hint_y=None,row_force_default=True, row_default_height=80)
            layout.bind(minimum_height=layout.setter('height'))

            for i in result:
                box=BoxLayout(orientation='vertical')
                title=Label(text=i[3],markup=True)
                url=Label(text="[ref="+i[2]+"]"+i[2]+"[/ref]",font_size="12sp",markup=True)
                url.on_ref_press=(lambda x: webbrowser.get("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s").open(x))
                content=Label(text="Score: "+str(i[1])+"\n"+"File: "+i[0],font_size="12sp")
                box.add_widget(title)
                box.add_widget(url)
                box.add_widget(content)
                layout.add_widget(box)
            sv = ScrollView(size_hint=(1, None), size=(Window.width, Window.height-50))
            sv.add_widget(layout)
            root=AnchorLayout(anchor_x="left",anchor_y="top")
            root.add_widget(sv)
            self.add_widget(root)
            self.added=root