Esempio n. 1
0
	def load(self):
		try:
			tmp_controls = []
			progress = xbmcgui.DialogProgressBG()
			progress.create(utils.addonname, 'Loading ...')

			progress.update(20, 'Add Calendars controls')
			ctrls = utils.buildCalendarList(self.shift_left, self.h - 150 - self.shift_top, self.logo_size, 150, self.calCon, self)
			tmp_controls.extend(ctrls)

			progress.update(30, 'Add View Selection controls')
			ctrls = utils.buildViewSelection(self.shift_left, self.h - 350 - self.shift_top, self.logo_size, 60, self.calCon, self)
			tmp_controls.extend(ctrls)

			progress.update(40, 'Add Navigation controls')
			tmp_controls.extend(utils.buildNavigation(self.shift_left, self.shift_top+self.logo_size, self.logo_size, 73, self.date_center))

			progress.update(60, 'Add Calendar controls')
			year_ago = self.date_center + relativedelta.relativedelta(months=-1)
			next_year = self.date_center + relativedelta.relativedelta(months=1)
			tmp_controls.extend(utils.buildMonth(self.shift_left + self.logo_size, self.shift_top, self.calendar_width, self.calendar_hight, year_ago.year, year_ago.month, self.date_center, None))
			tmp_controls.extend(utils.buildMonth(self.shift_left + self.logo_size, self.shift_top+self.calendar_hight, self.calendar_width, self.calendar_hight, self.date_center.year, self.date_center.month, self.date_center, None))
			tmp_controls.extend(utils.buildMonth(self.shift_left + self.logo_size, self.shift_top+2*self.calendar_hight, self.calendar_width, self.calendar_hight, next_year.year, next_year.month, self.date_center, None))
			self.unique_month = self.date_center.year*12+self.date_center.month

			progress.update(60, 'Load View (Day/Month)')
			tmp_controls.extend(self.loadView())

			progress.update(80, 'Add all controls to window')
			utils.addControls(self, tmp_controls, self.control_to_data)

			self.focus_on_selected()

			progress.update(100, 'finish ....')
			progress.close()
			
			self.keyOrder()
		
		except:
			progress.close()
			print "Unexpected error:", sys.exc_info()[0]
			raise
Esempio n. 2
0
	def loadView(self):
		
		if self.view == utils.VIEW_TYPE_MONTH:			
			self.view_controls = utils.buildMonth(self.shift_left + self.logo_size + self.calendar_width, self.shift_top, self.day_view_width, self.h-2*self.shift_top, self.date_center.year , self.date_center.month, self.date_center, self.calCon)

		elif self.view == utils.VIEW_TYPE_DAY:			
			self.view_controls = utils.buildDayView(self.shift_left + self.logo_size + self.calendar_width, self.shift_top, self.day_view_width, self.date_center, self.calCon)

		elif self.view == utils.VIEW_TYPE_WEEK:
			self.view_controls = utils.buildWeek(self.shift_left + self.logo_size + self.calendar_width, self.shift_top, self.day_view_width, self.h-2*self.shift_top, self.date_center.year , self.date_center.month, self.date_center, self.before, self.after, self.calCon)
		print 'wwwwwwwwwwwwwwwwwwwwwwwwwwwwww11'+self.view+str(len(self.view_controls))
		return self.view_controls
    def update(self):
        # Clean UI controls to be replaced
        utils.removeControls(self, self.month_view_controls, self.control_to_data)

        # Build the month view controls and save it for removal/update
        self.month_view_controls = utils.buildMonth(
            self.left,
            self.top,
            self.width,
            self.hight,
            self.selection_date.year,
            self.selection_date.month,
            self.getSelectedDate(),
            None,
        )

        # Build the time selection controls
        if type(self.selection_date) is date:
            _h = 0
            _m = 0
        else:
            _h = self.selection_date.hour
            _m = self.selection_date.minute

            self.month_view_controls.extend(
                utils.buildTime(
                    self.left + self.width - self.width / 2 - self.space,
                    self.top + self.hight + self.space,
                    self.width / 2,
                    30,
                    _h,
                    _m,
                )
            )

            # Add all controls to screen
        utils.addControls(self, self.month_view_controls, self.control_to_data)

        # Set the focus on the selected control
        self.focus_on_selected()