Esempio n. 1
0
 def displayData(self, school_id=0, semester=1):
     title = '%s %d Semester %d' % ('Primary', gVar.schYr, semester)
     self.label_title.SetLabelText(title)
     
     # create class variables
     self.origional_list_of_days = [0,0,0,0,0] # set all days = 'no scheduled activities'
     self.semester_no = semester
     self.school_id   = school_id
     
     orig_days_list = []
     res = fetch.exculSchedule_forSchSemYr(school_id, semester, gVar.schYr)
     for row in res:
         orig_days_list.append(row['day'])
     
     dayNo = 1
     for chbx in self.ckbx_list:
         day_name = gVar.dayNames[dayNo]
         label_text = "%s (-)" % day_name
         if dayNo in orig_days_list:
             print 'dayno', dayNo, ' in list', orig_days_list
             self.origional_list_of_days[dayNo-1] = True
             chbx.SetValue(True)
             schedule_id = fetch.excul_schedule_id(dayNo, semester, school_id, gVar.schYr)
             res = fetch.exculGroupsDATA_forScheduleID(schedule_id)
             club_count = len(res)
             label_text = "%s (%d) clubs" % (day_name, club_count )
             if club_count:
                 chbx.Disable()
         chbx.SetLabelText(label_text)
         print 'dayno', dayNo
         dayNo += 1
Esempio n. 2
0
    def AddNewSizerAndCtrls(self, schedule_id):
        club_dict = fetch.exculGroupsDATA_forScheduleID(schedule_id)
        number_of_ctrls = len(club_dict)

        rows = math.ceil(number_of_ctrls/3 + .5)
        if rows > 0:
            self.sizer_clubs = wx.GridSizer(rows, 3, 5, 5)
            self.panel_clubListCtrls.SetSizer(self.sizer_clubs)

            self.club_listCtrls = []
            self.vClubListCtrls = {}
            for key in club_dict:
                print 'add club  group id =', club_dict[key][0]
                self.AddClubList(key, club_dict)
            self.Layout()
Esempio n. 3
0
 def init_club_lists(self, schedule_id):
     club_dict = fetch.exculGroupsDATA_forScheduleID(schedule_id)
     club_count = len(club_dict)
     rows = math.ceil(club_count/3 + .5)
     #
     if club_count > 0:
         try:
             self.sizer_clubs.DeleteWindows()
             self.sizer_clubs.Destroy()
             self.panel_clubListCtrls.DestroyChildren()
             self.AddNewSizerAndCtrls(schedule_id)
         except:
             self.AddNewSizerAndCtrls(schedule_id)
     else:
         if self.sizer_clubs:
             self.sizer_clubs.DeleteWindows()
     return