def __init__(self, c): PopupPanel.__init__(self, True) p = SimplePanel() p.add(c) c.show(10,10) p.setWidth("100%") self.setWidget(p)
def __init__(self, c): PopupPanel.__init__(self, True) p = SimplePanel() p.add(c) c.show(10, 10) p.setWidth("100%") self.setWidget(p)
def drawFull(self, month, year): # should be called only once when we draw the calendar for the first time # self.vp = VerticalPanel() self.vp.setSpacing(2) self.vp.addStyleName("calendarbox calendar-module calendar") self.setWidget(self.vp) self.setVisible(False) # mth = int(month) yr = int(year) tp = HorizontalPanel() tp.addStyleName("calendar-top-panel") tp.setSpacing(5) h1 = Hyperlink('<<') h1.addClickListener( getattr(self,'onPreviousYear') ) h2 = Hyperlink('<') h2.addClickListener( getattr(self,'onPreviousMonth') ) h4 = Hyperlink('>') h4.addClickListener( getattr(self,'onNextMonth') ) h5 = Hyperlink('>>') h5.addClickListener( getattr(self,'onNextYear') ) tp.add(h1) tp.add(h2) # titlePanel can be changed, whenever we draw, so keep the reference self.titlePanel = SimplePanel() self.titlePanel.setWidget(HTML("<b>" + self.monthsOfYear[mth-1] + " " + str(yr) + "</b>" ) ) self.titlePanel.setStyleName("calendar-center") tp.add( self.titlePanel ) tp.add(h4) tp.add(h5) tvp = VerticalPanel() tvp.setSpacing(10) tvp.add(tp) self.vp.add(tvp) # done with top panel self.middlePanel = SimplePanel() grid = self.drawGrid(mth,yr) self.middlePanel.setWidget(grid) self.vp.add(self.middlePanel) self.defaultGrid = grid # # some links & handlers # bh1 = Hyperlink('Yesterday') bh1.addClickListener( getattr(self,'onYesterday') ) bh2 = Hyperlink('Today') bh2.addClickListener( getattr(self,'onToday') ) bh3 = Hyperlink('Tomorrow') bh3.addClickListener( getattr(self,'onTomorrow') ) bh4 = Hyperlink('Cancel') bh4.addClickListener( getattr(self,'onCancel') ) # # add code to test another way of doing the layout # b = HorizontalPanel() b.add(bh1) b.add(bh2) b.add(bh3) b.addStyleName("calendar-shortcuts") self.vp.add(b) b2 = SimplePanel() b2.add(bh4) b2.addStyleName("calendar-cancel") self.vp.add(b2) self.setVisible(True) return
def drawFull(self, month, year): # should be called only once when we draw the calendar for the first time # self.vp = VerticalPanel() self.vp.setSpacing(2) self.vp.addStyleName("calendarbox calendar-module calendar") self.setWidget(self.vp) self.setVisible(False) # mth = int(month) yr = int(year) tp = HorizontalPanel() tp.addStyleName("calendar-top-panel") tp.setSpacing(5) h1 = Hyperlink('<<') h1.addClickListener(getattr(self, 'onPreviousYear')) h2 = Hyperlink('<') h2.addClickListener(getattr(self, 'onPreviousMonth')) h4 = Hyperlink('>') h4.addClickListener(getattr(self, 'onNextMonth')) h5 = Hyperlink('>>') h5.addClickListener(getattr(self, 'onNextYear')) tp.add(h1) tp.add(h2) # titlePanel can be changed, whenever we draw, so keep the reference self.titlePanel = SimplePanel() self.titlePanel.setWidget( HTML("<b>" + self.getMonthsOfYear()[mth - 1] + " " + str(yr) + "</b>")) self.titlePanel.setStyleName("calendar-center") tp.add(self.titlePanel) tp.add(h4) tp.add(h5) tvp = VerticalPanel() tvp.setSpacing(10) tvp.add(tp) self.vp.add(tvp) # done with top panel self.middlePanel = SimplePanel() grid = self.drawGrid(mth, yr) self.middlePanel.setWidget(grid) self.vp.add(self.middlePanel) self.defaultGrid = grid # # some links & handlers # bh1 = Hyperlink(self.yesterday) bh1.addClickListener(getattr(self, 'onYesterday')) bh2 = Hyperlink(self.today) bh2.addClickListener(getattr(self, 'onToday')) bh3 = Hyperlink(self.tomorrow) bh3.addClickListener(getattr(self, 'onTomorrow')) bh4 = Hyperlink(self.cancel) bh4.addClickListener(getattr(self, 'onCancel')) # # add code to test another way of doing the layout # b = HorizontalPanel() b.add(bh1) b.add(bh2) b.add(bh3) b.addStyleName("calendar-shortcuts") self.vp.add(b) b2 = SimplePanel() b2.add(bh4) b2.addStyleName("calendar-cancel") self.vp.add(b2) self.setVisible(True) return