Beispiel #1
0
 def load_group_page(self):
     ContentNavigationDrawer.populateNavDrawerValues(self)
     self.ids['allorgscroll'].clear_widgets()  #To clear list of orgs
     query = f'''SELECT ORG_ID,NAME,REGISTRATION FROM ORG WHERE 
     ORG_ID IN (
     SELECT ORG_ID FROM ORG
     MINUS 
     SELECT ORG_ID FROM CONTACT_ORG WHERE CONTACT_ID = {globalvariables.var_userid}
     AND STATUS='Y')'''
     # run direct SQL
     stmt = ibm_db.exec_immediate(connection.conn, query)
     orglist = ibm_db.fetch_both(stmt)
     item = TwoLineAvatarListItem()
     while (orglist):
         file_found = download_org_image(str(orglist[0]))
         if file_found == True:
             image = ImageLeftWidget(source="resources/org/" +
                                     str(orglist[0]) + ".png")
         else:
             image = ImageLeftWidget(source="resources/org/default.jpg")
         item = TwoLineAvatarListItem(text=str(orglist[1]),
                                      secondary_text=str(orglist[2]))
         item.add_widget(image)
         item.bind(on_release=self.row_press)
         self.ids['allorgscroll'].add_widget(item)
         orglist = ibm_db.fetch_both(
             stmt)  #for incrementing rows inside while loop
Beispiel #2
0
 def load_org_list(self):
     self.ids['scroll'].clear_widgets()  #To clear list of orgs
     query = f'''SELECT ORG_ID,NAME,REGISTRATION FROM ORG WHERE 
     ORG_ID IN (SELECT ORG_ID FROM CONTACT_ORG WHERE CONTACT_ID={globalvariables.var_userid} 
     AND MEMBER_FLAG='Y' AND STATUS='Y')'''
     # run direct SQL
     stmt = ibm_db.exec_immediate(connection.conn, query)
     orglist = ibm_db.fetch_both(stmt)
     item = TwoLineAvatarListItem()
     if orglist is False:
         self.ids['nogroupwarning'].pos_hint = {"x": 0.2, "y": 0.3}
         self.ids['nogroupwarning'].font_size = '20sp'
         self.ids[
             'nogroupwarning'].text = """You have not joined any groups. 
         Your joined groups will show up here"""
     else:
         while (orglist):
             file_found = download_org_image(str(orglist[0]))
             if file_found == True:
                 image = ImageLeftWidget(source="resources/org/" +
                                         str(orglist[0]) + ".png")
             else:
                 image = ImageLeftWidget(source="resources/org/default.jpg")
             item = TwoLineAvatarListItem(text=str(orglist[1]),
                                          secondary_text=str(orglist[2]))
             item.add_widget(image)
             item.bind(on_release=self.row_press)
             self.ids['scroll'].add_widget(item)
             orglist = ibm_db.fetch_both(
                 stmt)  #for incrementing rows inside while loop
Beispiel #3
0
 def __init__(self, name, state, gender, *args, **kwargs):
     super(MyItem, self).__init__(*args)
     self.text = name
     self.secondary_text = state
     self._no_ripple_effect = True
     self.image = ImageLeftWidget(source=f"images/{gender}.png")
     self.add_widget(ImageLeftWidget(source=f"images/{state}.jpg"))
     self.add_widget(self.image)
Beispiel #4
0
        def visualize_json(self):

            self.ids.friendscreen.ids.container.clear_widgets()

            for i in self.data.keys():

                if self.data[i]['kurir'] == 'jne':

                    image = ImageLeftWidget(source=self.kurirs[0])

                if self.data[i]['kurir'] == 'tiki':
                    image = ImageLeftWidget(source=self.kurirs[1])
                if self.data[i]['kurir'] == 'pos':
                    image = ImageLeftWidget(source=self.kurirs[2])
                if self.data[i]['kurir'] == 'jnt':
                    image = ImageLeftWidget(source=self.kurirs[8])
                if self.data[i]['kurir'] == 'ninja':
                    image = ImageLeftWidget(source=self.kurirs[7])
                if self.data[i]['kurir'] == 'lion':
                    image = ImageLeftWidget(source=self.kurirs[6])
                if self.data[i]['kurir'] == 'anteraja':
                    image = ImageLeftWidget(source=self.kurirs[3])
                if self.data[i]['kurir'] == 'wahana':
                    image = ImageLeftWidget(source=self.kurirs[5])
                if self.data[i]['kurir'] == 'sicepat':
                    image = ImageLeftWidget(source=self.kurirs[4])

                isi = TwoLineAvatarListItem(
                    text=self.data[i]['kurir'].upper(),
                    on_press=lambda x, item=i: self.show_dialog5(text=item),
                    secondary_text=i)
                isi.add_widget(image)

                self.ids.friendscreen.ids.container.add_widget(isi)
Beispiel #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
Beispiel #6
0
 def __init__(self, name, invention, state, *args, **kwargs):
     super(MyItem, self).__init__(*args)
     self.text = invention
     self.secondary_text = name
     self._no_ripple_effect = True
     self.image = ImageLeftWidget(source=f'images/state/{state}.png')
     self.add_widget(self.image)
Beispiel #7
0
 def __init__(self, *args, **kwargs):
     super(Lista, self).__init__(**kwargs)
     I = str(args[0]).replace(".json", "")
     self.text = I
     self.secondary_text = 'Productos'
     imagen = ImageLeftWidget(source=f'Imagenes/Proveedores/{I}.jpg')
     self.add_widget(imagen)
Beispiel #8
0
 def new_message(self, message, image_name, name='Server'):
     """
     Compose a message to showcase in the app
     """
     new_message = TwoLineAvatarIconListItemAligned(text=message, secondary_text=name, halign='left')
     new_message.add_widget(ImageLeftWidget(source=image_name))
     self.ids.msg_list.add_widget(new_message)
Beispiel #9
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.register_event_type("on_open")
        self.register_event_type("on_close")

        if self.panel_cls and isinstance(
                self.panel_cls,
            (
                MDExpansionPanelOneLine,
                MDExpansionPanelTwoLine,
                MDExpansionPanelThreeLine,
            ),
        ):
            self.panel_cls.pos_hint = {"top": 1}
            self.panel_cls._no_ripple_effect = True
            self.panel_cls.bind(
                on_release=lambda x: self.check_open_panel(self.panel_cls))
            self.chevron = MDExpansionChevronRight()
            self.panel_cls.add_widget(self.chevron)
            self.panel_cls.add_widget(ImageLeftWidget(source=self.icon))
            self.add_widget(self.panel_cls)
        else:
            raise ValueError(
                "KivyMD: `panel_cls` object must be must be one of the "
                "objects from the list\n"
                "[MDExpansionPanelOneLine, MDExpansionPanelTwoLine, "
                "MDExpansionPanelThreeLine]")
Beispiel #10
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
Beispiel #11
0
 def __init__(self, *args, **kwargs):
     super(MyItem, self).__init__(*args)
     self.text = kwargs["book"]
     self.secondary_text = kwargs["author"]
     self._no_ripple_effect = True
     self.image = ImageLeftWidget(source=f"images/{kwargs['genre']}.png")
     self.add_widget(self.image)
Beispiel #12
0
    async def load_basic_info_section(self):
        """Load basic info for the currently selected taxon"""
        # Name, rank
        logger.info('Taxon: Loading basic info section')
        item = ThreeLineAvatarIconListItem(
            text=self.selected_taxon.name,
            secondary_text=self.selected_taxon.rank.title(),
            tertiary_text=self.selected_taxon.preferred_common_name,
        )

        # Icon (if available)
        icon_path = get_icon_path(self.selected_taxon.iconic_taxon_id)
        if icon_path:
            item.add_widget(ImageLeftWidget(source=icon_path))
        self.basic_info.add_widget(item)

        # Star Button
        star_icon = StarButton(
            self.selected_taxon.id,
            is_selected=get_app().is_starred(self.selected_taxon.id),
        )
        star_icon.bind(on_release=self.on_star)
        item.add_widget(star_icon)

        # Other attrs
        for k in [
                'id', 'is_active', 'observations_count',
                'complete_species_count'
        ]:
            label = k.title().replace('_', ' ')
            value = getattr(self.selected_taxon, k)
            item = OneLineListItem(text=f'{label}: {value}')
            self.basic_info.add_widget(item)
Beispiel #13
0
 def __init__(self, nazev, popisek, img,  *args, **kwargs):
     super(MyItem, self).__init__(*args)
     self.text = nazev
     self.secondary_text = popisek
     self._no_ripple_effect = True
     self.image = ImageLeftWidget(source=img)
     self.add_widget(self.image)
Beispiel #14
0
 def on_start(self):  # on_start and build methods are automatically called
     for i in range(20):
         item = TwoLineAvatarListItem(text='item ' + str(i),
                                      secondary_text='Hello World')
         img = ImageLeftWidget(source='itaFlag.png')
         item.add_widget(img)
         self.root.ids.container.add_widget(item)
    def on_start(self):
        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)


            self.root.ids.container.add_widget(item)
Beispiel #16
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
Beispiel #17
0
 def display_teachers(self):
     first_line_text = "Nom : {}"
     second_line_text = "Prénoms : {}"
     third_line_text = "Matiere : {}"
     table_entries = dbmanager.get_all(dbmanager.DbTeacher)
     for entry in table_entries:
         item = ThreeLineAvatarListItem()
         item.text = first_line_text.format(entry.name)
         item.secondary_text = second_line_text.format(entry.surname)
         item.tertiary_text = third_line_text.format(entry.topic_name)
         item.secondary_theme_text_color = 'Primary'
         item.tertiary_theme_text_color = "Primary"
         # item.width = self.parent.width/2
         icon = ImageLeftWidget()
         icon.source = f"teacher_px.png"
         item.add_widget(icon)
         self.avatars_list.add_widget(widget=item)
Beispiel #18
0
 def __init__(self, name, pohlavi, povolani, obrazek, vek, ockovani, *args,
              **kwargs):
     super(MyItem, self).__init__(*args)
     self.text = f"{name},  {pohlavi}, {vek}, {povolani}"
     self.secondary_text = ockovani
     self._no_ripple_effect = True
     self.obrazek = ImageLeftWidget(source=obrazek)
     self.add_widget(self.obrazek)
Beispiel #19
0
 def build_publication_button(
         self, img_path: str,
         publication: Publication) -> TwoLineAvatarListItem:
     button = TwoLineAvatarListItem(text=publication.title,
                                    secondary_text=publication.author,
                                    on_release=self.change_screens)
     button.add_widget(ImageLeftWidget(source=img_path))
     return button
Beispiel #20
0
 def __init__(self, book, *args, **kwargs):
     super().__init__(*args,
                      text=book.title,
                      secondary_text=book.subtitle,
                      tertiary_text=book.price,
                      **kwargs)
     image = ImageLeftWidget(source=book.image_path)
     self.add_widget(image)
Beispiel #21
0
 def __init__(self, name, state, *args, **kwargs):
     super(MyItem, self).__init__(*args)
     self.text = "Jméno osoby"
     self.secondary_text = "Stát osoby"
     self.text = name
     self.secondary_text = state
     self._no_ripple_effect = True
     self.image = ImageLeftWidget(source="images/red.png")
     self.add_widget(self.image)
Beispiel #22
0
 def __init__(self, i, *args, **kwargs):
     js = JsonStore('names.json')
     super(MyItem, self).__init__(*args)
     state = js.get(i)['state']
     self.text = js.get(i)['name']
     self.secondary_text = js.get(i)['state']
     self._no_ripple_effect = True
     self.image = ImageLeftWidget(source=f"images/{state}.jpg")
     self.add_widget(self.image)
    def set_area_list(self):
        for area in sorted(AREAS):
            source = os.path.join(AVATAR_DIR, f'{area[0]}.png')

            avatar = ImageLeftWidget(source=source)
            area_container_item = CustomOneLineAvatarListItem(
                text=f"{area}", on_release=lambda area: print(dir(area)))
            area_container_item.add_widget(avatar)
            app().kv.ids.area_container.add_widget(area_container_item)
Beispiel #24
0
 def __init__(self, *args, **kwargs):
     super(Listadatos, self).__init__(**kwargs)
     I = str(args[0]).replace("Pedido-", "")
     I = str(I).replace(".csv", "")
     self.text = I
     self.secondary_text = 'Pedido'
     imagen = ImageLeftWidget(source=f'Imagenes/Proveedores/{I}.jpg')
     self.add_widget(imagen)
     global Empresa
     Empresa = args[0]
Beispiel #25
0
    def __init__(self, book, **kwargs):
        super().__init__(text=book.title,
                         secondary_text=book.subtitle,
                         tertiary_text=f"Price: {book.price}",
                         **kwargs)
        self.book = book

        image = ImageLeftWidget(source=self.book.image_path)

        self.add_widget(image)
Beispiel #26
0
 def __init__(self, item, *args, **kwargs):
     super(MyItem, self).__init__()
     self.id = item['id']
     self.text = item['name']
     self.secondary_text = f"{item['state_short']},  \n {item['city']}"
     self._no_ripple_effect = True
     self.image = ImageLeftWidget()
     self.image.source = f"images/{item['state_short']}.png"
     self.add_widget(self.image)
     self.icon = IconRightWidget(icon="delete", on_release=self.on_delete)
     self.add_widget(self.icon)
Beispiel #27
0
 def __init__(self, item, *args, **kwargs):
     super(MyItem, self).__init__()
     self.id = item['id']
     self.text = item['name']
     self.secondary_text = item['author']
     #self.tertiary_text = item['genre']
     self._no_ripple_effect = True
     self.image = ImageLeftWidget()
     self.image.source = "images/book.png"
     self.add_widget(self.image)
     self.icon = IconRightWidget(icon="delete", on_release=self.on_delete)
     self.add_widget(self.icon)
Beispiel #28
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.register_event_type("on_open")
        self.register_event_type("on_close")

        if self.panel_cls and isinstance(
            self.panel_cls,
            (
                MDExpansionPanelOneLine,
                MDExpansionPanelTwoLine,
                MDExpansionPanelThreeLine,
                MDExpansionPanelLabel,
            ),
        ):
            self.panel_cls.pos_hint = {"top": 1}
            self.panel_cls._no_ripple_effect = True
            self.panel_cls.bind(
                on_release=lambda x: self.check_open_panel(self.panel_cls)
            )
            if not isinstance(self.panel_cls, MDExpansionPanelLabel):
                self.chevron = MDExpansionChevronRight()
                self.panel_cls.add_widget(self.chevron)
                if self.icon:
                    if self.icon in md_icons.keys():
                        self.panel_cls.add_widget(
                            IconLeftWidget(
                                icon=self.icon,
                                pos_hint={"center_y": 0.5},
                            )
                        )
                    else:
                        self.panel_cls.add_widget(
                            ImageLeftWidget(
                                source=self.icon, pos_hint={"center_y": 0.5}
                            )
                        )
                else:
                    self.panel_cls.remove_widget(
                        self.panel_cls.ids._left_container
                    )
                    self.panel_cls._txt_left_pad = 0
            else:
                # if no icon
                self.panel_cls._txt_left_pad = m_res.HORIZ_MARGINS
            self.add_widget(self.panel_cls)
        else:
            raise ValueError(
                "KivyMD: `panel_cls` object must be must be one of the "
                "objects from the list\n"
                "[MDExpansionPanelOneLine, MDExpansionPanelTwoLine, "
                "MDExpansionPanelThreeLine]"
            )
Beispiel #29
0
 def format_comment_preview(self, img_path: str, publication: Publication,
                            comment: Comment) -> BoxLayout:
     """
     set up a comment for preview (for profile page)
     """
     comment_preview = ThreeLineAvatarListItem(
         text=publication.title,
         secondary_text=publication.author,
         tertiary_text=f'"{comment.content[:20]}..."',
         ripple_scale=0,
         font_style='H6',
         secondary_font_style='Body2',
         secondary_theme_text_color='Primary')
     comment_preview.add_widget(ImageLeftWidget(source=img_path))
     return comment_preview
Beispiel #30
0
 def __init__(self, item, *args, **kwargs):
     """
     Konstruktoru se předává parametr item - datový objekt jedné osoby
     """
     super(MyItem, self).__init__()
     # Předání informací o osobě do parametrů widgetu
     self.id = item['id']
     self.text = item['name']
     self.secondary_text = item['state']
     self._no_ripple_effect = True
     # Zobrazení vlajky podle státu osoby
     self.image = ImageLeftWidget(source=f"images/{item['state']}.png")
     self.add_widget(self.image)
     # Vložení ikony pro vymazání osoby ze seznamu
     self.icon = IconRightWidget(icon="delete", on_release=self.on_delete)
     self.add_widget(self.icon)