Exemple #1
0
    def build(self):
        screen = Screen()

        # Creating a Simple List
        scroll = ScrollView()

        list_view = MDList()
        for i in range(20):

            item = ThreeLineIconListItem(text=str(i) + ' item',
                                         secondary_text='This is ' + str(i) +
                                         'th item',
                                         tertiary_text='hello')

            icons = IconLeftWidget(icon="cake-layered")
            #items = OneLineIconListItem(text=str(i) + ' item')

            item.add_widget(icons)
            list_view.add_widget(item)
        # list_view.add_widget(items)

        scroll.add_widget(list_view)
        # End List

        screen.add_widget(scroll)
        return screen
Exemple #2
0
    def build(self):
        screen = Screen()
        
        list_view = MDList()
        scroll = ScrollView()
        
        # item1 = OneLineListItem(text='item 1')
        # item2 = OneLineListItem(text='item 2')
                
        # list_view.add_widget(item1)
        # list_view.add_widget(item2)

        # scroll.add_widget(list_view)
        # screen.add_widget(scroll)
        
        
        # for loop
        for i in range(1, 21):
            # icon = IconLeftWidget(icon='android')
            image = ImageLeftWidget(source='facebook_icon.png')
            items = ThreeLineAvatarListItem(
                text=f'item {i}',
                secondary_text='Hello world',
                tertiary_text='third text'
            )
            items.add_widget(image)
            list_view.add_widget(items)
            
        scroll.add_widget(list_view)
        screen.add_widget(scroll)
        
        return screen
Exemple #3
0
    def check_press(self, instance_table, current_row):
        self.date = current_row[0]
        self.time = current_row[1]
        self.cs_code = current_row[4]
        report = ScrollView()
        query = "SELECT roll_no,report,remark FROM attendance WHERE cs_code=%s AND date=%s AND time=%s"
        val = (self.cs_code, self.date, self.time)
        tmp_cursor.execute(query, val)
        result = tmp_cursor.fetchall()
        mdlist = MDList()
        for item in result:
            bl = BoxLayout(orientation='horizontal',
                           size_hint=(1, None),
                           height=Window.height * 0.07)
            label1 = MDLabel(text=item[0], halign='center')
            label2 = MDLabel(text=item[1], halign='center')
            label3 = MDLabel(text=item[2], halign='center')
            bl.add_widget(label1)
            bl.add_widget(label2)
            bl.add_widget(label3)
            mdlist.add_widget(bl)
        report.add_widget(mdlist)

        del_btn = MDIconButton(icon='delete')
        del_btn.bind(on_press=self.del_submission)
        self.dialog = MDDialog(size_hint_x=None,
                               width=300,
                               type='custom',
                               content_cls=report,
                               buttons=[del_btn])
        self.dialog.title = current_row[2] + "(" + current_row[
            3] + ")    Dt-" + self.date + " at " + self.time
        self.dialog.open()
Exemple #4
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        app = MDApp.get_running_app()
        scroll = ScrollView()
        Mlist = MDList()
        self.products = app.customconfig.load_products()

        for i in app.customconfig.load_orders():
            item = OrderListItem(i)
            item.text = f"Order: {i.order_number}"
            item.secondary_text = f"Customer: {i.customer}"
            item.tertiary_text = f"Status: {i.status}"
            icon = IconRightWidget(icon="account-details")
            icon.bind(on_release=item.show_popup)
            item.add_widget(icon)
            item.bind(on_release=item.show_popup)
            Mlist.add_widget(item)

        layout = BoxLayout()
        layout.orientation = "vertical"
        toolbar = MDToolbar(title="Orders")
        toolbar.left_action_items = [["menu", lambda x: self.openNav()]]
        layout.add_widget(toolbar)
        scroll.add_widget(Mlist)
        layout.add_widget(scroll)
        self.action = MDFloatingActionButton(icon="plus",
                                             pos_hint={"center_x": 0.5},
                                             on_release=self.openAction)
        layout.add_widget(self.action)

        self.add_widget(layout)
Exemple #5
0
    def build(self):
        screen = Screen()
        self.theme_cls.primary_palette = "Green"

        list_view = MDList()

        scroll = ScrollView()
        scroll.add_widget(list_view)

        for i in range(1, 21):
            if i % 2 == 0:
                icon = IconLeftWidget(icon="android")

                item = ThreeLineIconListItem(
                    text=f"Item {i}",
                    secondary_text="Three lines version",
                    tertiary_text="Third line")
                item.add_widget(icon)

            else:
                image = ImageLeftWidget(source="logoC.png")

                item = ThreeLineAvatarListItem(
                    text=f"Item {i}",
                    secondary_text="Three lines version",
                    tertiary_text="Third line")
                item.add_widget(image)

            list_view.add_widget(item)

        screen.add_widget(scroll)

        return screen
Exemple #6
0
    def __init__(self):
        super().__init__()
        self.row = 2
        self.music_list = get_all_music(MUSIC_DIR[PLATFORM])
        self.orientation = "vertical"
        self.toolbar = MDToolbar(title="Music Player")
        self.toolbar.right_action_items = [[
            "database-settings", lambda x: self.goto_setting()
        ]]
        self.add_widget(self.toolbar)
        scroll_list = ScrollView()
        dml = MDList()
        self.counter = 0
        try:
            for music in self.music_list:
                meta = music['meta']
                path = music['path']
                self.dl = TwoLineListItem(text=(meta['title'] or path),
                                          secondary_text=(meta['artist']
                                                          or 'Unkown'))
                self.dl.id = str(self.counter)
                self.dl.bind(on_press=self.to_playing)
                dml.add_widget(self.dl)
                self.counter += 1
        except Exception as e:
            print(e)
            # raise e

        scroll_list.add_widget(dml)
        self.add_widget(scroll_list)
class ThemeWidget(ScrollView):
    def __init__(self, app, return_back):
        super(ThemeWidget, self).__init__()
        self.list = MDList()
        self.app = app

        themes = [
            'Red', 'Pink', 'Purple', 'DeepPurple', 'Indigo', 'Blue',
            'LightBlue', 'Cyan', 'Teal', 'Green', 'LightGreen', 'DeepOrange',
            'Brown', 'Gray', 'BlueGray', 'Lime', 'Yellow', 'Amber', 'Orange'
        ]
        self.return_button = MDIconButton(icon="arrow-left-circle",
                                          size_hint=(1, None),
                                          pos_hint={
                                              "center_x": 0.5,
                                              "center_y": 0.7
                                          },
                                          on_press=lambda x: return_back())
        self.list.add_widget(self.return_button)

        for theme in themes:
            self.list.add_widget(
                MDRaisedButton(text=theme,
                               on_press=self.change_theme,
                               size_hint=(1, None),
                               pos_hint={
                                   "center_x": 0.5,
                                   "center_y": 0.7
                               }))
        self.add_widget(self.list)

    def change_theme(self, instance):
        self.app.theme_cls.primary_palette = instance.text
Exemple #8
0
    def issues(self):
        if self.others is False:
            frame = MDBoxLayout(orientation='vertical',
                                size_hint_y=None,
                                height=150)
            scroll = ScrollView()
            list_view = MDList()

            scroll.add_widget(list_view)

            remarks = [
                'Awaiting Result', 'Token not found', 'Passport Uploaded',
                'Wrong result uploaded', 'No results uploaded',
                'Card limit exceeded', 'Invalid card', 'Result not uploaded',
                'Incomplete Result', 'Result not visible', 'Invalid pin',
                'Invalid serial', 'Result checker has been used',
                'Pin for Neco not given', 'Wrong result uploaded',
                'Incomplete result', 'Token linked to another candidate',
                'Others'
            ]

            for x in remarks:
                list_view.add_widget(
                    OneLineListItem(text=x, on_press=self.get_selection))

            self.chooser = MDDialog(title='Select Remark',
                                    size_hint=(.5, .4),
                                    type='custom',
                                    content_cls=frame)
            frame.add_widget(scroll)
            # self.chooser.set_normal_height()
            self.chooser.open()
Exemple #9
0
def diff_dialog(instance, *args):
    image = instance.selected_image.original_source
    stdout_cache = read_stdout_cache(image)
    layout = MDList()
    if len(stdout_cache.keys()) == 0:
        alert("No stdout text available.")
        return
    item = OneLineListItem(text="Select first text",
                           on_release=partial(select_text,
                                              stdout_cache.keys()))
    layout.add_widget(item)
    item = OneLineListItem(
        text="Select second text",
        on_release=partial(select_text, stdout_cache.keys()),
    )
    layout.add_widget(item)
    dialog = MDDialog(
        title="Compare stdouts",
        type='custom',
        auto_dismiss=False,
        content_cls=layout,
        buttons=[
            MDFlatButton(text="COMPARE",
                         on_release=partial(diff, stdout_cache, image)),
            MDFlatButton(text="DISCARD", on_release=close_dialog),
        ],
    )
    dialog.open()
    def goto_folder_dialog(self, *args):
        def close_dialog(instance, *args):
            instance.parent.parent.parent.parent.dismiss()

        if self.file_chooser.multiselect == True:
            self.update_filechooser_multiselect()
        sellist = MDList()
        for sel in self.file_chooser.selection:
            sellist.add_widget(OneLineListItem(text=sel))
        dialog = MDDialog(title="Please insert the desired folderpath",
                          type='custom',
                          auto_dismiss=False,
                          content_cls=MDTextField(text=''),
                          buttons=[
                              MDFlatButton(
                                  text="GO TO FOLDER", on_release=self.goto_folder
                              ),
                              MDFlatButton(
                                  text="DISCARD", on_release=close_dialog
                              ),
                          ],
                          )
        if get_app()._platform not in ['win32', 'win64']:
            # TODO: Focus function seems buggy in win
            dialog.content_cls.focused = True
        dialog.open()
Exemple #11
0
    def pass_id(self, onelinelistitem):
        x = onelinelistitem.text.split()[2]
        print(x)
        self.company_id = int(x)
        url_home = "https://jobhunt-disha-tushar.herokuapp.com/api/home/"
        print(self.header)
        response = requests.get(url_home, headers=self.header)
        print(response)
        for i in response.json():
            print(i["id"], int(x))
            if i["id"] == int(x):

                self.root.current = "JobDetails"

                scroll = ScrollView(size_hint=(1, 0.91), )
                list_view = MDList()
                scroll.add_widget(list_view)
                for j in i.keys():
                    if j == "id":
                        continue
                    if j == "description":
                        one = OneLineListItem(on_press=self.describe, text=str(j))
                        list_view.add_widget(one)
                    else:
                        one = OneLineListItem(text=str(j) + ": " + str(i[j]))
                        list_view.add_widget(one)
                self.root.get_screen('JobDetails').add_widget(scroll)

                # self.root.get_screen('JobDetails').ids['jobdescribe'].on_press=self.describe()'''
                # self.root.get_screen('JobDetails').add_widget(Button(text="Description",on_press=self.describe))

                '''
 def delete_file_chooser_selection_dialog(self, *args):
     def close_dialog(instance, *args):
         instance.parent.parent.parent.parent.dismiss()
     if self.file_chooser.multiselect == True:
         self.update_filechooser_multiselect()
     sellist = MDList()
     for sel in self.file_chooser.selection:
         sellist.add_widget(OneLineListItem(text=sel))
     dialog = MDDialog(title="The following selection will be deleted:",
                       type='custom',
                       auto_dismiss=False,
                       content_cls=sellist,
                       buttons=[
                           MDFlatButton(
                               text="DELETE", on_release=self.delete_file_chooser_selection
                           ),
                           MDFlatButton(
                               text="DISCARD", on_release=close_dialog
                           ),
                       ],
                       )
     if get_app()._platform not in ['win32', 'win64']:
         # TODO: Focus function seems buggy in win
         dialog.content_cls.focused = True
     dialog.open()
Exemple #13
0
    def build(self):
        # screens
        screen1 = Screen(name="login")

        # l = GridLayout(cols=1)
        # label = MDLabel(text="fromage", halign='center', theme_text_color="Custom",
        #                 text_color=(0, 1, 0, 0.5), font_style='Caption',
        #                 pos_hint={'center_x': 0.5, 'center_y': 0.5})
        # icon_label = MDIcon(icon='language-python', halign='center',
        #                     pos_hint={'center_x': 0.5, 'center_y': 0.5})
        # l.add_widget(label)
        # l.add_widget(icon_label)
        # l.add_widget(MDFlatButton(text="fromage",
        # pos_hint={'center_x': 0.5, 'center_y': 0.5}))
        # l.add_widget(MDRectangleFlatButton(text='fromage',
        #                                   pos_hint={'center_x': 0.5, 'center_y': 0.5}))
        # username = MDTextField(text="enter id:", size_hint_x=None,
        #                        width=300, pos_hint={'center_x': 0.5, 'center_y': 0.5})

        button = MDRectangleFlatButton(text="show",
                                       pos_hint={
                                           'center_x': 0.5,
                                           'center_y': 0.4
                                       },
                                       on_release=self.show_data)
        self.username = Builder.load_string("""username_helper""")
        self.password = Builder.load_string("""password_helper""")

        screen1.add_widget(self.username)
        # screen1.add_widget(self.password)
        screen1.add_widget(button)

        self.sm.add_widget(screen1)

        # screen 2
        screen2 = Screen(name="list")
        scroll = ScrollView()
        list_view = MDList()

        items = [
            ThreeLineAvatarListItem(text="Item {}".format(i),
                                    secondary_text="Hello world",
                                    tertiary_text="text")
            for i in range(1, 21)
        ]
        for item in items:
            item.add_widget(ImageLeftWidget(source="fb.png"))
            list_view.add_widget(item)
        list_view.add_widget(
            MDRectangleFlatButton(text="show",
                                  pos_hint={
                                      'center_x': 0.5,
                                      'center_y': 0.4
                                  },
                                  on_release=self.change_dark))
        scroll.add_widget(list_view)
        screen2.add_widget(scroll)
        self.sm.add_widget(screen2)
        return self.sm
Exemple #14
0
 def __init__(self, *args, **kwargs):
     super(Persons, self).__init__(orientation="horizontal")
     scrollview = ScrollView()
     list = MDList()
     for i in person_list:
         list.add_widget(MyItem(name=i['name'], state=i['state']))
     scrollview.add_widget(list)
     self.add_widget(scrollview)
Exemple #15
0
 def __init__(self, *args, **kwargs):
     super(Persons, self).__init__(orientation="horizontal")
     scrollview = ScrollView()
     list = MDList()
     for i in range(3):
         list.add_widget(MyItem(str(i)))
     scrollview.add_widget(list)
     self.add_widget(scrollview)
Exemple #16
0
class OptionsBox(ScrollView):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.list = MDList()
        self.add_widget(self.list)

    @property
    def selected_option(self):
        for option in self.list.children:
            if option.selected:
                return option
        else:
            return None

    @property
    def selected_option_index(self):
        for i, option in enumerate(self.list.children):
            if option.selected:
                return i
        else:
            return None

    def select_next(self):
        try:
            self.select_option(self.selected_option_index - 1)
        except Exception:
            self.select_option(0)

    def select_previous(self):
        try:
            self.select_option(self.selected_option_index + 1)
        except Exception:
            self.select_option(0)

    def select_option(self, index):
        if len(self.list.children) + 1 < index:
            return
        [option.deselect() for option in self.list.children if option.selected]
        self.list.children[index].select()

    def refresh_options(self, items):
        self.remove_items()
        self.add_items(items)
        if len(items):
            self.select_option(len(items) - 1)

    def add_items(self, items):
        for idx, item in enumerate(items):
            i = SingleOption(text=item['title'],
                             secondary_text=item.get('subtitle', ''),
                             command=item.get('command', None))
            self.list.add_widget(i)

    def remove_items(self):
        self.list.clear_widgets()
    def __init__(self, *args, **kwargs):
        super(Persons, self).__init__(orientation="horizontal")
        scroll_view = ScrollView()
        list_osob = MDList()

        for person in data['osoby']:
            list_osob.add_widget(MyItem(name=person['name'], state=person['state'], img=person['img']))

        scroll_view.add_widget(list_osob)
        self.add_widget(scroll_view)
Exemple #18
0
 def __init__(self, *args, **kwargs):
     super(Books, self).__init__(orientation="horizontal")
     scrollview = ScrollView()
     list = MDList()
     with open("modules/books.json", encoding="UTF-8") as file:
         for i in json.load(file):
             list.add_widget(
                 MyItem(author=i['author'],
                        book=i['book'],
                        genre=i['genre']))
     scrollview.add_widget(list)
     self.add_widget(scrollview)
Exemple #19
0
 def goApplications(self):
     response = requests.get("https://jobhunt-disha-tushar.herokuapp.com/api/applications/", headers=self.header)
     print(response)
     if response.ok:
         self.root.current = "Applications"
         scroll = ScrollView(size_hint=(1, 0.91))
         list_view = MDList()
         scroll.add_widget(list_view)
         for i in response.json():
             print("Companies", i)
             one = OneLineListItem(text="Company id: " + str(i["id"]) + '    Company name: ' + i["name"])
             list_view.add_widget(one)
         self.root.get_screen('Applications').add_widget(scroll)
Exemple #20
0
 def update_content_tasks(self, search_text):
     app = App.get_running_app()
     with orm.db_session:
         tasks = app.db.Tasks.select(lambda t: search_text in t.title)
         self.results_box.clear_widgets()
         if len(tasks) == 0:
             self.nothing_found()
             return
         tasks_list = MDList()
         for t in tasks:
             new_task = Task(title=t.title, deadline=t.deadline, db_id=t.id)
             tasks_list.add_widget(new_task)
         self.results_box.add_widget(tasks_list)
Exemple #21
0
 def goProfile(self):
     self.root.current = "Profile"
     scroll = ScrollView(size_hint=(1, 0.91))
     list_view = MDList()
     scroll.add_widget(list_view)
     response = requests.get("https://jobhunt-disha-tushar.herokuapp.com/api/giveProfile/",headers=self.header)
     print(response,type(response.json()[0]))
     for i,j in response.json()[0].items():
         if i == "id":
             continue
         print("Companies", i)
         one = OneLineListItem(text=str(i) + "    " + str(j))
         list_view.add_widget(one)
     self.root.get_screen('Profile').add_widget(scroll)
class ProductPopup(Popup):
    def __init__(self, product, MDlist, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.title = f"{product.name}"
        self.MDlist = MDlist
        self.product = product
        self.size_hint = (0.7, 0.9)

        layout = BoxLayout()
        layout.orientation = "vertical"

        layout.add_widget(
            Label(text=f"Product: {product.name}", size_hint=(1, 0.3)))
        layout.add_widget(
            Label(text=f"Cost: £{round(product.cost, 2)}", size_hint=(1, 0.3)))

        scroll = ScrollView()
        self.Mlist = MDList()
        self.build_list()

        scroll.add_widget(self.Mlist)
        layout.add_widget(scroll)

        btn_layout = BoxLayout(size_hint=(1, 0.3))
        btn_layout.add_widget(
            MDRectangleFlatButton(text="Return", on_release=self.dismiss))
        btn_layout.add_widget(
            MDRectangleFlatButton(text="Discard",
                                  on_release=self.discard_product))
        layout.add_widget(btn_layout)
        self.content = layout

    def discard_product(self, td):
        app = MDApp.get_running_app()
        app.customconfig.remove_product(self.product.name)
        self.MDlist()
        self.dismiss()

    def build_list(self):
        self.Mlist.clear_widgets()
        app = MDApp.get_running_app()
        for i in self.product.materials:
            item = MaterialListItem(i, self.build_list)
            item.text = f"{i.name}"
            item.secondary_text = f"Cost: £{round(i.unit_price, 2)}"
            icon = IconRightWidget(icon="layers-outline")
            icon.bind(on_release=item.show_popup)
            item.add_widget(icon)
            item.bind(on_release=item.show_popup)
            self.Mlist.add_widget(item)
class MyList(ScrollView):
    items = ListProperty()

    def __init__(self, *a, **kw):
        super().__init__(*a, **kw)

        self.size = (1, dp(400))

        self.list = MDList()

        for i in self.items:
            self.list.add_widget(i)

        self.add_widget(self.list)
Exemple #24
0
class ListScrollApp(MDApp):

    def __init__(self, **kwargs):
        super(ListScrollApp, self).__init__(**kwargs)
        self.Main_Win    = MDFloatLayout()
        self.Rel_Win     = RelativeLayout()
        self.List_Scr    = ScrollView()
        self.The_List    = MDList()
        return

    def build(self):
        #######################################
        self.Main_Win.size = Window.size
        Xc = int(self.Main_Win.width * 0.5)
        Yc = int(self.Main_Win.height * 0.5)
        #######################################
        self.Rel_Win.size_hint = (None, None)
        self.Rel_Win.width     = int(self.Main_Win.width * 0.3)
        self.Rel_Win.height    = int(self.Main_Win.height * 0.5)
        self.Rel_Win.x         = Xc - int(self.Rel_Win.width * 0.5)
        self.Rel_Win.y         = Yc - int(self.Rel_Win.height * 0.5)
        #######################################
        self.List_Scr.bar_inactive_color = (0.4, 0, 0, 1)
        self.List_Scr.bar_color   = (1, 0.15, 0.15, 1)
        self.List_Scr.bar_margin  = 5
        self.List_Scr.bar_width   = int(self.Rel_Win.width * 0.10)
        self.List_Scr.bar_pos_y   = 'right'
        # self.List_Scr.scroll_type = ['content']
        # self.List_Scr.scroll_type = ['bars']
        self.List_Scr.scroll_type = ['content', 'bars']
        #######################################
        Height1 = int(self.Rel_Win.height / 10)
        self.The_List.clear_widgets()
        for i in range(100):
            self.The_List.add_widget(Button(text=f"Button Number {i}", \
                                            size_hint = (None, None), \
                                            width = self.Rel_Win.width, \
                                            height = Height1))
        #######################################
        if(self.The_List.parent == None):
            self.List_Scr.add_widget(self.The_List)
        if(self.List_Scr.parent == None):
            self.Rel_Win.add_widget(self.List_Scr)
        if(self.Rel_Win.parent == None):
            self.Main_Win.add_widget(self.Rel_Win)
        #######################################
        self.List_Scr.scroll_x    = 1
        self.List_Scr.scroll_y    = 1
        #######################################
        return self.Main_Win
Exemple #25
0
 def __init__(self, *args, **kwargs):
     super(Persons, self).__init__(orientation="horizontal")
     scrollview = ScrollView()
     list = MDList()
     # for person in person_list:
     #     list.add_widget(MyItem(name=person['name'], state=person['state']))
     with open("modules/person.json", encoding="utf-8") as f:
         data = json.load(f)
         for person in data["person"]:
             list.add_widget(
                 MyItem(name=person['name'],
                        state=person['state'],
                        gender=person['gender']))
     scrollview.add_widget(list)
     self.add_widget(scrollview)
Exemple #26
0
def select_text(stdout_keys, instance, *args):
    layout = MDList()
    for key in stdout_keys:
        item = OneLineListItem(
            text=key,
            on_release=partial(set_text, key, instance),
        )
        layout.add_widget(item)
    dialog = MDDialog(
        title="Select text",
        type='custom',
        auto_dismiss=False,
        content_cls=layout,
    )
    dialog.open()
Exemple #27
0
class Lights(ScrollView):
    def __init__(self, config, **kwargs):
        super(Lights, self).__init__(**kwargs)
        '''
        configure list
        '''
        self.list = MDList()

        for entity in config['entities']:
            item = LightsItem(config=entity)
            self.list.add_widget(item)
        '''
        add widgets
        '''
        self.add_widget(self.list)
Exemple #28
0
    def build(self):
        screen = Screen()

        scroll = ScrollView()
        list_view = MDList()
        scroll.add_widget(list_view)

        for i in range(20):
            items = ThreeLineListItem(text='Item ' + str(i + 1),
                                      secondary_text='Hello world',
                                      tertiary_text='third text')
            list_view.add_widget(items)

        screen.add_widget(scroll)
        return screen
Exemple #29
0
class Soliders(BoxLayout):
    def __init__(self, *args, **kwargs):
        super(Soliders, self).__init__(orientation="vertical")
        global app
        app = App.get_running_app()
        scrollview = ScrollView()
        self.list = MDList()
        self.database = Db(dbtype='sqlite', dbname='soliders.db')
        self.rewrite_list()
        scrollview.add_widget(self.list)
        self.add_widget(scrollview)
        button_box = BoxLayout(orientation='horizontal')

        new_solider_btn = MDRectangleFlatButton()
        new_solider_btn.text = "Zapsat vojáka"
        new_solider_btn.icon_color = [0.9, 0.9, 0.9, 1]
        new_solider_btn.md_bg_color = [0, 0.5, 0.8, 1]
        new_solider_btn.pos_hint = {"center_x": .5}
        new_solider_btn.on_release = self.on_create_solider
        button_box.add_widget(new_solider_btn)
        self.add_widget(button_box)

    def rewrite_list(self):
        self.list.clear_widgets()
        soliders = self.database.read_all()
        for x in soliders:
            print(vars(x))
            self.list.add_widget(MyItem(item=vars(x)))

    def on_create_solider(self, *args):
        self.dialog = SoliderDialog(id=None)
        self.dialog.open()

    def create(self, solider):
        create_solider = Solider()
        create_solider.name = solider['name']
        self.database.create(create_solider)
        self.rewrite_list()

    def update(self, solider):
        update_solider = self.database.read_by_id(solider['id'])
        update_solider.name = solider['name']
        self.database.update()
        self.rewrite_list()

    def delete(self, id):
        self.database.delete(id)
        self.rewrite_list()
Exemple #30
0
    def goApplicants(self,text):

        url_base = "https://jobhunt-disha-tushar.herokuapp.com/api/applicants/" + text
        response = requests.get(url_base, headers=self.header)
        print(text,response)
        print(response)
        if response.ok:
            self.root.current = "Applicants"
            scroll = ScrollView(size_hint=(1, 0.91))
            list_view = MDList()
            scroll.add_widget(list_view)
            for i in response.json():
                print("Jobs", i)
                one = OneLineListItem(text='Applicant name: ' + str(i['name']))
                list_view.add_widget(one)
            self.root.get_screen('Applicants').add_widget(scroll)