Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Public Attributes
CalendarWizard.TkCalendar Class Reference

List of all members.

Public Member Functions

def __init__
def languageChange
def realLangChange
def setWholeYear
def okButonn_pressed
def quit

Public Attributes

 key
 statusVar
 statusLabel
 langLabel
 langListbox
 langButton
 typeLabel
 typeVar
 typeClRadio
 typeEvRadio
 weekStartsLabel
 weekVar
 weekMondayRadio
 weekSundayRadio
 yearLabel
 yearVar
 yearEntry
 wholeYearLabel
 wholeYear
 wholeYearCheck
 monthLabel
 monthListbox
 imageLabel
 imageVar
 imageCheck
 okButton
 cancelButton

Detailed Description

GUI interface for Scribus calendar wizard.
    It's ugly and very simple. I can say I hate Tkinter :-/

Definition at line 336 of file CalendarWizard.py.


Constructor & Destructor Documentation

def CalendarWizard.TkCalendar.__init__ (   self,
  master = None 
)
Setup the dialog 

Definition at line 340 of file CalendarWizard.py.

00340 
00341     def __init__(self, master=None):
00342         """ Setup the dialog """
00343         # refernce to the localization dictionary
00344         self.key = 'English'
00345         Frame.__init__(self, master)
00346         self.grid()
00347         self.master.resizable(0, 0)
00348         self.master.title('Scribus Calendar Wizard')
00349         #define widgets
00350         self.statusVar = StringVar()
00351         self.statusLabel = Label(self, textvariable=self.statusVar)
00352         self.statusVar.set('Select Options and Values')
00353         # langs
00354        # change the height = to match number of langs.
00355         self.langLabel = Label(self, text='Select language:')
00356         self.langListbox = Listbox(self, selectmode=SINGLE, height=16)
00357         keys = localization.keys()
00358         keys.sort()
00359         for i in keys:
00360             self.langListbox.insert(END, i)
00361         self.langButton = Button(self, text='Change language', command=self.languageChange)
00362         # calendar type
00363         self.typeLabel = Label(self, text='Calendar type')
00364         self.typeVar = IntVar()
00365         self.typeClRadio = Radiobutton(self, text='Classic', variable=self.typeVar, value=0)
00366         self.typeEvRadio = Radiobutton(self, text='Event', variable=self.typeVar, value=1)
00367         # start of week
00368         self.weekStartsLabel = Label(self, text='Week begins with:')
00369         self.weekVar = IntVar()
00370         self.weekMondayRadio = Radiobutton(self, text='Mon', variable=self.weekVar, value=calendar.MONDAY)
00371         self.weekSundayRadio = Radiobutton(self, text='Sun', variable=self.weekVar, value=calendar.SUNDAY)
00372         # year
00373         self.yearLabel = Label(self, text='Year:')
00374         self.yearVar = StringVar()
00375         self.yearEntry = Entry(self, textvariable=self.yearVar, width=4)
00376         self.wholeYearLabel = Label(self, text='Whole year:')
00377         self.wholeYear = IntVar()
00378         self.wholeYearCheck = Checkbutton(self, command=self.setWholeYear, variable=self.wholeYear)
00379         # months
00380         self.monthLabel = Label(self, text='Months:')
00381         self.monthListbox = Listbox(self, selectmode=MULTIPLE, height=12)
00382         # layout stuff
00383         self.imageLabel = Label(self, text='Draw Image Frame:')
00384         self.imageVar = IntVar()
00385         self.imageCheck = Checkbutton(self, variable=self.imageVar)
00386         # closing/running
00387         self.okButton = Button(self, text="OK", width=6, command=self.okButonn_pressed)
00388         self.cancelButton = Button(self, text="Cancel", command=self.quit)
00389         # setup values
00390         self.weekMondayRadio.select()
00391         self.typeClRadio.select()
00392         self.yearVar.set(str(datetime.date(1, 1, 1).today().year))
00393         self.imageCheck.select()
00394         # make layout
00395         self.columnconfigure(0, pad=6)
00396         currRow = 0
00397         self.statusLabel.grid(column=0, row=currRow, columnspan=4)
00398         currRow += 1
00399         self.langLabel.grid(column=0, row=currRow, sticky=W)
00400         self.monthLabel.grid(column=3, row=currRow, sticky=W)
00401         currRow += 1
00402         self.langListbox.grid(column=0, row=currRow, rowspan=6, sticky=N)
00403         self.typeLabel.grid(column=1, row=currRow, sticky=E)
00404         self.typeClRadio.grid(column=2, row=currRow, sticky=W)
00405         self.monthListbox.grid(column=3, row=currRow, rowspan=8)
00406         currRow += 1
00407         self.typeEvRadio.grid(column=2, row=currRow, sticky=W)
00408         currRow += 1
00409         self.weekStartsLabel.grid(column=1, row=currRow, sticky=N+E)
00410         self.weekMondayRadio.grid(column=2, row=currRow, sticky=N+W)
00411         currRow += 1
00412         self.weekSundayRadio.grid(column=2, row=currRow, sticky=N+W)
00413         currRow += 1
00414         self.yearLabel.grid(column=1, row=currRow, sticky=N+E)
00415         self.yearEntry.grid(column=2, row=currRow, sticky=N+W)
00416         currRow += 1
00417         self.wholeYearLabel.grid(column=1, row=currRow, sticky=N+E)
00418         self.wholeYearCheck.grid(column=2, row=currRow, sticky=N+W)
00419         currRow += 1
00420         self.imageLabel.grid(column=1, row=currRow, sticky=N+E)
00421         self.imageCheck.grid(column=2, row=currRow, sticky=N+W)
00422         self.langButton.grid(column=0, row=currRow)
00423         currRow += 3
00424         self.rowconfigure(currRow, pad=6)
00425         self.okButton.grid(column=1, row=currRow, sticky=E)
00426         self.cancelButton.grid(column=2, row=currRow, sticky=W)
00427         # fill the values
00428         self.realLangChange()


Member Function Documentation

def CalendarWizard.TkCalendar.languageChange (   self,
  lang = 'English' 
)
Called by Change button. Get language list value and
    call real re-filling. 

Definition at line 429 of file CalendarWizard.py.

00429 
00430     def languageChange(self, lang='English'):
00431         """ Called by Change button. Get language list value and
00432             call real re-filling. """
00433         ix = self.langListbox.curselection()
00434         if len(ix)==0:
00435             self.statusVar.set('Select a language, please')
00436             return
00437         self.realLangChange(lang=self.langListbox.get(ix[0]))

Here is the call graph for this function:

User variables testing and preparing 

Definition at line 455 of file CalendarWizard.py.

00455 
00456     def okButonn_pressed(self):
00457         """ User variables testing and preparing """
00458         # year
00459         try:
00460             year = self.yearVar.get().strip()
00461             if len(year) != 4:
00462                 raise ValueError
00463             year = int(year, 10)
00464         except ValueError:
00465             self.statusVar.set('Year must be in the "YYYY" format e.g. 2005.')
00466             return
00467         # months
00468         selMonths = self.monthListbox.curselection()
00469         if len(selMonths) == 0:
00470             self.statusVar.set('At least one month must be selected.')
00471             return
00472         months = {}
00473         for i in selMonths:
00474             months[int(i)] = self.monthListbox.get(i)
00475         # day order
00476         dayList = localization[self.key][1]
00477         if self.weekVar.get() == calendar.SUNDAY:
00478             dl = dayList[:6]
00479             dl.insert(0, dayList[6])
00480             dayList = dl
00481         # draw images etc.
00482         if self.imageVar.get() == 0:
00483             draw = False
00484         else:
00485             draw = True
00486         # create calendar (finally)
00487         if self.typeVar.get() == 0:
00488             cal = ScClassicCalendar(year, months, dayList, self.weekVar.get(), draw)
00489         else:
00490             cal = ScEventCalendar(year, months, dayList, self.weekVar.get(), draw)
00491         self.master.withdraw()
00492         err = cal.createCalendar()
00493         if err != None:
00494             self.master.deiconify()
00495             self.statusVar.set(err)
00496         else:
00497             self.quit()

Here is the call graph for this function:

Definition at line 498 of file CalendarWizard.py.

00498 
00499     def quit(self):
00500         self.master.destroy()
00501 

Here is the caller graph for this function:

def CalendarWizard.TkCalendar.realLangChange (   self,
  lang = 'English' 
)
Real widget setup. Ot takes values from localization dictionary.
[0] = months, [1] Days 

Definition at line 438 of file CalendarWizard.py.

00438 
00439     def realLangChange(self, lang='English'):
00440         """ Real widget setup. Ot takes values from localization dictionary.
00441         [0] = months, [1] Days """
00442         self.key = lang
00443         self.monthListbox.delete(0, END)
00444         self.wholeYear.set(0)
00445         for i in localization[lang][0]:
00446             self.monthListbox.insert(END, i)

Here is the caller graph for this function:

All/none months selection. It's called after "Whole year" check button
click. 

Definition at line 447 of file CalendarWizard.py.

00447 
00448     def setWholeYear(self):
00449         """ All/none months selection. It's called after "Whole year" check button
00450         click. """
00451         if self.wholeYear.get() == 1:
00452             self.monthListbox.selection_set(0, END)
00453         else:
00454             self.monthListbox.selection_clear(0, END)


Member Data Documentation

Definition at line 387 of file CalendarWizard.py.

Definition at line 384 of file CalendarWizard.py.

Definition at line 382 of file CalendarWizard.py.

Definition at line 383 of file CalendarWizard.py.

Definition at line 343 of file CalendarWizard.py.

Definition at line 360 of file CalendarWizard.py.

Definition at line 354 of file CalendarWizard.py.

Definition at line 355 of file CalendarWizard.py.

Definition at line 379 of file CalendarWizard.py.

Definition at line 380 of file CalendarWizard.py.

Definition at line 386 of file CalendarWizard.py.

Definition at line 350 of file CalendarWizard.py.

Definition at line 349 of file CalendarWizard.py.

Definition at line 364 of file CalendarWizard.py.

Definition at line 365 of file CalendarWizard.py.

Definition at line 362 of file CalendarWizard.py.

Definition at line 363 of file CalendarWizard.py.

Definition at line 369 of file CalendarWizard.py.

Definition at line 367 of file CalendarWizard.py.

Definition at line 370 of file CalendarWizard.py.

Definition at line 368 of file CalendarWizard.py.

Definition at line 376 of file CalendarWizard.py.

Definition at line 377 of file CalendarWizard.py.

Definition at line 375 of file CalendarWizard.py.

Definition at line 374 of file CalendarWizard.py.

Definition at line 372 of file CalendarWizard.py.

Definition at line 373 of file CalendarWizard.py.


The documentation for this class was generated from the following file: