def __init__(self, frame, bgcolor, settings): """Initiate the bookview Arguments frame -- the frame on which to layout the displayed information bgcolor -- background color of the frame settings -- object containing font settings """ ItemView.__init__(self, settings) self._svTitle = tki.StringVar() self._svAuthor = tki.StringVar() self._svLocation = tki.StringVar() fntAuthor = getFont(settings.authorfontname, settings.authorfontsize, settings.authorfontstyle) fntShelf = getFont(settings.footerfontname, settings.footerfontsize, settings.footerfontstyle) width = frame['width'] frame.rowconfigure(3, weight = 1) frame.columnconfigure(0, weight = 1) if(settings.scrollenabled): bsb = ButtonScrollbar(frame, settings) bsb['bg'] = 'white' width -= bsb.getWidth() bsb.grid(row = 3, column = 1, sticky = tki.NS) l = tki.Label(frame) self._lblImage = l l.grid(row = 0, column = 0, pady = defaultpadding) l = tki.Label(frame, textvariable = self._svTitle, font = self._fntHeader, wraplength = width - (2 * textpadding), justify="left", bg="white") l.grid(row = 1, column = 0, pady = defaultpadding) l = tki.Label(frame, textvariable = self._svAuthor, font = fntAuthor, wraplength = width - (2 * textpadding), justify="left", bg="white") l.grid(row = 2, column = 0, pady = defaultpadding) t = tki.Text(frame, width = width - (2 * textpadding), height = 96, wrap = tki.WORD, bg="white", font = self._fntNormal, relief = tki.FLAT) t.grid(row = 3, column = 0, padx = textpadding, pady = defaultpadding, sticky = tki.W + tki.N) self._tDesc = t if(settings.scrollenabled): bsb.addScrollable(t) f = tki.Frame(frame, bg = bgcolor) f.grid(row = 4, column = 0, padx = strippadding, sticky = tki.W + tki.E) f.columnconfigure(0, weight = 1) l = tki.Label(f, textvariable = self._svLocation, bg = bgcolor, font = fntShelf, fg="white") l.grid(padx = defaultpadding, sticky = tki.E + tki.S)
def _displayItem(self, item): """Display a book item. Arguments item -- the book item to display """ ItemView._displayItem(self, item) self._svAuthor.set(item.author) self._svLocation.set(lng.lang[lng.txtLocatedAt] + ' ' + item.shelf)
def __init__(self, frame, bgcolor, settings): """Initiate the plainblogview. Arguments frame -- the frame on which to layout the displayed information bgcolor -- background color of the frame settings -- object containing font settings """ ItemView.__init__(self, settings) self._svTitle = tki.StringVar() width = frame['width'] frame.rowconfigure(2, weight=1) frame.columnconfigure(0, weight=1) if (settings.scrollenabled): bsb = ButtonScrollbar(frame, settings) bsb['bg'] = 'white' width -= bsb.getWidth() bsb.grid(row=2, column=1, sticky=tki.NS) l = tki.Label(frame) self._lblImage = l l.grid(row=0, column=0, pady=defaultpadding) l = tki.Label(frame, textvariable=self._svTitle, font=self._fntHeader, wraplength=width - (2 * textpadding), justify="left", bg="white") l.grid(row=1, column=0, pady=defaultpadding) t = tki.Text(frame, width=width - (2 * textpadding), height=96, wrap=tki.WORD, bg="white", font=self._fntNormal, relief=tki.FLAT) t.grid(row=2, column=0, padx=textpadding, pady=defaultpadding, sticky=tki.W + tki.N) self._tDesc = t if (settings.scrollenabled): bsb.addScrollable(t)