Example #1
0
    def on_select_subject(self):
        global StaffID
        global subject_obj
        subject_obj = self.ids.subject_label

        class SubjectList(OneLineIconListItem):
            def on_release(self):
                global SUBJECT
                global subject_obj
                SUBJECT = self.text
                subject_obj.text = SUBJECT

        query = "SELECT DISTINCT subject from staff_class WHERE sid = %s"
        val = (StaffID, )
        tmp_cursor.execute(query, val)
        result = tmp_cursor.fetchall()
        subject_list = []
        for item in result:
            list_item = SubjectList(text=item[0])
            subject_list.append(list_item)
        dialog = MDDialog(size_hint_x=None,
                          width=300,
                          type='confirmation',
                          items=subject_list)
        dialog.title = 'Select subject'
        dialog.open()
Example #2
0
    def on_select_class(self):
        global StaffID
        global class_obj
        class_obj = self.ids.class_label

        class ClassList(OneLineIconListItem):
            def on_release(self):
                global CLASS
                global class_obj
                CLASS = self.text
                class_obj.text = CLASS

        query = "SELECT DISTINCT class from staff_class WHERE sid = %s"
        val = (StaffID, )
        tmp_cursor.execute(query, val)
        result = tmp_cursor.fetchall()
        class_list = []
        for item in result:
            list_item = ClassList(text=item[0])
            class_list.append(list_item)
        dialog = MDDialog(size_hint_x=None,
                          width=300,
                          type='confirmation',
                          items=class_list)
        dialog.title = 'Select class'
        dialog.open()