Esempio n. 1
0
    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)
Esempio n. 2
0
    def __init__(self, frame, bgcolor, settings):
        """Initiate the blogview. 
        
        Arguments
        frame -- the frame on which to layout the displayed information
        bgcolor -- background color of the frame
        
        """

        PlainBlogView.__init__(self, frame, bgcolor, settings)
        self._svLocation = tki.StringVar()
        fntShelf = getFont(settings.footerfontname, settings.footerfontsize,
                           settings.footerfontstyle)

        f = tki.Frame(frame, bg=bgcolor)
        f.grid(row=3,
               column=0,
               padx=strippadding,
               pady=defaultpadding,
               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)
Esempio n. 3
0
    def __init__(self, settings):
        """Initiate the itemview
        
        Arguments
        settings -- object containing font settings
        
        """
        self._currentitem = None
        self._normalfontname = settings.normalfontname
        self._normalfontsize = settings.normalfontsize

        self._fntHeader = getFont(settings.headerfontname, settings.headerfontsize, 
                                  settings.headerfontstyle)
        
        self._fntNormal = getFont(settings.normalfontname, settings.normalfontsize, 
                                  settings.normalfontstyle)
Esempio n. 4
0
    def __init__(self, inidir, inifile):
        """Initiate the application
        
        Arguments
        inidir -- the working directory
        inifile -- the inifile 
        
        """
        settings = Settings2(inidir, inifile)
        dsdblog = InifileDataSourceDescription(sBlog, inidir, inifile)

        #Initiate main GUI
        gui = publicdisplay.PublicDisplay(inifile)
        self.gui = gui
        self.gui.root.protocol("WM_DELETE_WINDOW", self._ehQuit)
        self._views = dict()
        self._datamanagers = dict()

        self._sched = scheduler.Scheduler()

        #Configure blog data manager
        dm = DataManager2Blog(dsdblog, settings)
        self._datamanagers[_blogid] = dm
        self._sched.addUpdatable(dm)
        gui.setupSoftbutton(self._ehBlog, lang[lng.txtList], 1)

        pm = gui.createPanelManager(_blogid, settings.marginx,
                                    settings.marginy)
        blogview = PanelListView(pm, settings)
        self._views[_blogid] = blogview

        #Create blog view
        frame = gui.createMainAreaShape(publicdisplay.shpRoundRect,
                                        _blogviewid)
        blogview = PlainBlogView(frame, gui.bgcolor, settings)
        self._blogview = blogview

        #The second button is always active
        gui.setSoftButtonState(True, 1)
        #Hide the first button and display a text instead
        gui.setSoftButtonState(False, 0, False)
        gui.drawText(
            settings.tlleft, settings.tltop, settings.tllinewidth,
            settings.tltext, settings.tltextcolor,
            getFont(settings.tlfontname, settings.tlfontsize,
                    settings.tlfontstyle))

        self._setupPublicDisplay(_blogid, [_blogviewid], 1)
        self._sched.start()
Esempio n. 5
0
    def __init__(self, inidir, inifile):
        """Initiate the application
        
        Arguments
        inidir -- the working directory
        inifile -- the inifile 
        
        """
        settings = Settings2(inidir, inifile)
        dsdblog = InifileDataSourceDescription(sBlog, inidir, inifile)

        #Initiate main GUI
        gui = publicdisplay.PublicDisplay(inifile)
        self.gui = gui
        self.gui.root.protocol("WM_DELETE_WINDOW", self._ehQuit)
        self._views = dict()
        self._datamanagers = dict()
        
        self._sched = scheduler.Scheduler()
        
        #Configure blog data manager
        dm = DataManager2Blog(dsdblog, settings)
        self._datamanagers[_blogid] = dm
        self._sched.addUpdatable(dm)
        gui.setupSoftbutton(self._ehBlog, lang[lng.txtList], 1)

        pm = gui.createPanelManager(_blogid,settings.marginx, settings.marginy)
        blogview = PanelListView(pm, settings)
        self._views[_blogid] = blogview

        #Create blog view
        frame = gui.createMainAreaShape(publicdisplay.shpRoundRect, _blogviewid)
        blogview = PlainBlogView(frame, gui.bgcolor, settings)
        self._blogview = blogview

        #The second button is always active        
        gui.setSoftButtonState(True, 1)
        #Hide the first button and display a text instead
        gui.setSoftButtonState(False, 0, False)
        gui.drawText(settings.tlleft, settings.tltop, settings.tllinewidth, settings.tltext, settings.tltextcolor, 
                     getFont(settings.tlfontname, settings.tlfontsize, settings.tlfontstyle))
        
        self._setupPublicDisplay(_blogid, [_blogviewid], 1)
        self._sched.start()
Esempio n. 6
0
    def __init__(self, frame, bgcolor, settings):
        """Initiate the blogview. 
        
        Arguments
        frame -- the frame on which to layout the displayed information
        bgcolor -- background color of the frame
        
        """
        
        PlainBlogView.__init__(self, frame, bgcolor, settings)
        self._svLocation = tki.StringVar()
        fntShelf = getFont(settings.footerfontname, settings.footerfontsize, 
                                  settings.footerfontstyle)

        f = tki.Frame(frame, bg = bgcolor)
        f.grid(row = 3, column = 0, padx = strippadding, pady = defaultpadding, 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)
Esempio n. 7
0
    def __init__(self, panelmanager, settings):
        """Create PanelListView.

        Arguments
        panelmanager -- the panel manager that has the panels on which the objects 
                        will be visualized
        settings -- settings object containing font settings
        """

        ListView.__init__(self, evPanelItemSelected)

        self._canvas = panelmanager.canvas
        self._eventgenerator = panelmanager.canvas
        self._fntText = getFont(settings.fontname, settings.fontsize,
                                settings.fontstyle)
        self._itemdatatuples = []
        self._uids = []

        panel = panelmanager.panels[0]

        color = panel.center['bg']
        height = panel.center['height']
        #padding = 5
        padding = (height - 4 * settings.fontsize) / 4
        cwrap = panel.center['width'] - 2 * padding
        rwrap = panel.right['width'] - 2 * padding
        ctr = 0

        for i in panelmanager.panels:
            magazine = tki.StringVar()
            blog = tki.StringVar()
            blogexists = tki.StringVar()

            i.left.columnconfigure(0, weight=1)
            i.left.rowconfigure(0, weight=1)
            lblImage = tki.Label(i.left)
            lblImage.grid()

            i.center.columnconfigure(0, weight=1)
            i.center.rowconfigure(0, weight=1)
            i.center.rowconfigure(1, weight=1)

            l = tki.Label(i.center,
                          textvariable=magazine,
                          font=self._fntText,
                          wraplength=cwrap,
                          justify="left",
                          bg=color)
            l.grid(row=0, column=0, sticky=tki.W)
            #l.grid(row = 0, column = 0, padx = padding, pady = padding, sticky = tki.W)
            #l.grid(row = 0, column = 0, padx = padding, pady = padding, sticky = tki.W)
            l = tki.Label(i.center,
                          textvariable=blog,
                          font=self._fntText,
                          wraplength=cwrap,
                          justify="left",
                          bg=color)
            l.grid(row=1, column=0, sticky=tki.W)

            i.right.columnconfigure(0, weight=1)
            i.right.rowconfigure(0, weight=1)

            b = tki.Button(i.right,
                           text=lang[lng.txtShowBlogpost],
                           font=self._fntText,
                           bg=color)
            b.grid(row=0, column=0, padx=padding, pady=padding, sticky=tki.W)
            b.index = ctr
            b.bind("<ButtonRelease-1>", self._ehClick)

            #            l = tki.Label(i.right, textvariable = blogexists, font = self._fntText, wraplength = rwrap, justify="left", bg = color)
            #            l.grid(row = 0, column = 0, padx = padding, pady = padding, sticky = tki.W)
            #            l.index = ctr
            #            l.bind("<Button-1>", self._ehClick)

            ctr += 1
            self._itemdatatuples.append((magazine, blog, blogexists, lblImage))
            self._uids.append(i.uid)

        self._itemcount = ctr
Esempio n. 8
0
    def _settheme(self, screenwidth, screenheight):
        """Set the theme that was specified in the inifile. 
        
        Arguments
        screenwidth -- the width of the screen
        screenheight -- the height of the screen
        
        """
        bgcolor = self._settings.bgcolor
        self.bgcolor = bgcolor
        
        self._passivefont = getFont(self._settings.softbuttonfontname, self._settings.softbuttonfontsize, 
                                    self._settings.softbuttonfontstyle)
        
        self._activefont = getFont(self._settings.softbuttonactivefontname, self._settings.softbuttonactivefontsize, 
                                    self._settings.softbuttonactivefontstyle)

        #Load images
        dirname = os.path.dirname(sys.argv[0])

        imagename = os.path.join(dirname, self._settings.softbtnimagename)
        softimage = Image.open(imagename)
        topheight = softimage.size[1]
        softimage = ImageTk.PhotoImage(softimage)
        self._softimage = softimage

        imagename = os.path.join(dirname, self._settings.softbtnactiveimagename)
        softimage = Image.open(imagename)
        topheight = softimage.size[1]
        softimage = ImageTk.PhotoImage(softimage)
        self._softimageactive = softimage

        imagename = os.path.join(dirname, self._settings.prevbuttonimagename)
        previmage = Image.open(imagename)
        prevwidth = previmage.size[0]
        bottomheight = previmage.size[1]
        previmage = ImageTk.PhotoImage(previmage)
        self._donotthrow.append(previmage)

        imagename = os.path.join(dirname, self._settings.nextbuttonimagename)
        nextimage = Image.open(imagename)
        nextwidth = nextimage.size[0]
        bottomheight = max(bottomheight, nextimage.size[1])
        nextimage = ImageTk.PhotoImage(nextimage)
        self._donotthrow.append(nextimage)

        canvasheight = (screenheight - (bottomheight + 2 * _bottompadding))
        mainareaheight = (screenheight - (topheight + 2 * self._settings.softbuttonoffsety + bottomheight + 2 * _bottompadding))
        imagename = os.path.join(dirname, self._settings.bgimagename)
        bgimage = Image.open(imagename)
        bgimage = bgimage.resize((screenwidth, canvasheight), Image.ANTIALIAS)
        bgimage = ImageTk.PhotoImage(bgimage)
        self._donotthrow.append(bgimage)
        
        #Calculate dimensions        
        canvascenterx = screenwidth / 2
        canvascentery = canvasheight / 2
        
        #Store values for later use
        self._mainwidth = screenwidth
        self._mainheight = mainareaheight
        self._maincenterx = canvascenterx
        self._maincentery = topheight + 2 * self._settings.softbuttonoffsety + mainareaheight / 2

        #Create top frame
#        topframe = tki.Frame(self.root, bg = bgcolor)
#        topframe.grid(row = 0, sticky = tki.W + tki.N + tki.E)
#        topframe.columnconfigure(0, weight = 1)
#        topframe.columnconfigure(1, weight = 1)

#        b = tki.Button(topframe, font = self._passivefont, image = self._softimage, compound = tki.CENTER, bd = 0, highlightthickness = 0,  
#                       bg = bgcolor, activebackground = bgcolor, foreground = _topbuttontextcolor, activeforeground = _topbuttontextcolor, relief = tki.FLAT)
#        self._softbtn.append(b)
#        
#        b.grid(column = 0, row = 0, sticky = tki.W)
#        b = tki.Button(topframe, font = self._passivefont, image = self._softimage, compound = tki.CENTER, bd = 0, highlightthickness = 0,  
#                       bg = bgcolor, activebackground = bgcolor, foreground = _topbuttontextcolor, activeforeground = _topbuttontextcolor)
#        self._softbtn.append(b)
#        b.grid(column = 1, row = 0, sticky = tki.E)

        #Create main canvas
        canvas = tki.Canvas(self.root, bg = bgcolor, bd = 0, highlightthickness = 0)
        self.maincanvas = canvas
        canvas.grid(row = 0, column = 0, sticky = tki.W + tki.N + tki.E + tki.S)
        canvas.create_image(canvascenterx, canvascentery, image = bgimage)
        
        #Create top buttons
        color = self._settings.softbuttonbgcolor
        frame = tki.Frame(self.root)
        canvas.create_window(self._settings.softbuttonoffsetx, self._settings.softbuttonoffsety, window = frame, anchor = tki.NW)
        b = tki.Button(frame, font = self._passivefont, image = self._softimage, compound = tki.CENTER, bd = 0, highlightthickness = 0,  
                       bg = color, activebackground = color, foreground = _topbuttontextcolor, activeforeground = _topbuttontextcolor, relief = tki.FLAT, 
                       command = lambda : self._ehButton(0))
        self._softbtn.append(b)
        b.grid()

        frame = tki.Frame(self.root)
        canvas.create_window(screenwidth - self._settings.softbuttonoffsetx, self._settings.softbuttonoffsety, window = frame, anchor = tki.NE)
        b = tki.Button(frame, font = self._passivefont, image = self._softimage, compound = tki.CENTER, bd = 0, highlightthickness = 0,  
                       bg = color, activebackground = color, foreground = _topbuttontextcolor, activeforeground = _topbuttontextcolor, 
                       command = lambda : self._ehButton(1))
        self._softbtn.append(b)
        b.grid()
        
        #Create bottom frame
        bottomframe = tki.Frame(self.root, height = 100, bg = bgcolor)
        bottomframe.grid(row = 1, sticky = tki.W + tki.E + tki.S)
        #bottomframe.columnconfigure(0, weight = 1)
        bottomframe.columnconfigure(1, weight = 1)
        bottomframe.rowconfigure(0, weight = 1)
        #bottomframe.columnconfigure(2, weight = 1)
        self._bottomframe = bottomframe
        
        self._bottomrectwidth = screenwidth - prevwidth - nextwidth - 6 * _bottompadding
        self._bottomrectheight = bottomheight

        b = tki.Button(bottomframe, image = previmage, bd = 0, highlightthickness = 0,  bg = bgcolor, 
                       activebackground = bgcolor, command = self._ehprev)
        self._btnprev  = b
        b.grid(column = 0, row = 0, padx = _bottompadding, pady = _bottompadding, sticky = tki.W)

        b = tki.Button(bottomframe, image = nextimage, bd = 0, highlightthickness = 0,  bg = bgcolor, 
                       activebackground = bgcolor, command = self._ehnext)
        self._btnnext  = b
        b.grid(column = 2, row = 0, padx = _bottompadding, pady = _bottompadding, sticky = tki.E)
Esempio n. 9
0
    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)
Esempio n. 10
0
    def _settheme(self, screenwidth, screenheight):
        """Set the theme that was specified in the inifile. 
        
        Arguments
        screenwidth -- the width of the screen
        screenheight -- the height of the screen
        
        """
        bgcolor = self._settings.bgcolor
        self.bgcolor = bgcolor

        self._passivefont = getFont(self._settings.softbuttonfontname,
                                    self._settings.softbuttonfontsize,
                                    self._settings.softbuttonfontstyle)

        self._activefont = getFont(self._settings.softbuttonactivefontname,
                                   self._settings.softbuttonactivefontsize,
                                   self._settings.softbuttonactivefontstyle)

        #Load images
        dirname = os.path.dirname(sys.argv[0])

        imagename = os.path.join(dirname, self._settings.softbtnimagename)
        softimage = Image.open(imagename)
        topheight = softimage.size[1]
        softimage = ImageTk.PhotoImage(softimage)
        self._softimage = softimage

        imagename = os.path.join(dirname,
                                 self._settings.softbtnactiveimagename)
        softimage = Image.open(imagename)
        topheight = softimage.size[1]
        softimage = ImageTk.PhotoImage(softimage)
        self._softimageactive = softimage

        imagename = os.path.join(dirname, self._settings.prevbuttonimagename)
        previmage = Image.open(imagename)
        prevwidth = previmage.size[0]
        bottomheight = previmage.size[1]
        previmage = ImageTk.PhotoImage(previmage)
        self._donotthrow.append(previmage)

        imagename = os.path.join(dirname, self._settings.nextbuttonimagename)
        nextimage = Image.open(imagename)
        nextwidth = nextimage.size[0]
        bottomheight = max(bottomheight, nextimage.size[1])
        nextimage = ImageTk.PhotoImage(nextimage)
        self._donotthrow.append(nextimage)

        canvasheight = (screenheight - (bottomheight + 2 * _bottompadding))
        mainareaheight = (screenheight -
                          (topheight + 2 * self._settings.softbuttonoffsety +
                           bottomheight + 2 * _bottompadding))
        imagename = os.path.join(dirname, self._settings.bgimagename)
        bgimage = Image.open(imagename)
        bgimage = bgimage.resize((screenwidth, canvasheight), Image.ANTIALIAS)
        bgimage = ImageTk.PhotoImage(bgimage)
        self._donotthrow.append(bgimage)

        #Calculate dimensions
        canvascenterx = screenwidth / 2
        canvascentery = canvasheight / 2

        #Store values for later use
        self._mainwidth = screenwidth
        self._mainheight = mainareaheight
        self._maincenterx = canvascenterx
        self._maincentery = topheight + 2 * self._settings.softbuttonoffsety + mainareaheight / 2

        #Create top frame
        #        topframe = tki.Frame(self.root, bg = bgcolor)
        #        topframe.grid(row = 0, sticky = tki.W + tki.N + tki.E)
        #        topframe.columnconfigure(0, weight = 1)
        #        topframe.columnconfigure(1, weight = 1)

        #        b = tki.Button(topframe, font = self._passivefont, image = self._softimage, compound = tki.CENTER, bd = 0, highlightthickness = 0,
        #                       bg = bgcolor, activebackground = bgcolor, foreground = _topbuttontextcolor, activeforeground = _topbuttontextcolor, relief = tki.FLAT)
        #        self._softbtn.append(b)
        #
        #        b.grid(column = 0, row = 0, sticky = tki.W)
        #        b = tki.Button(topframe, font = self._passivefont, image = self._softimage, compound = tki.CENTER, bd = 0, highlightthickness = 0,
        #                       bg = bgcolor, activebackground = bgcolor, foreground = _topbuttontextcolor, activeforeground = _topbuttontextcolor)
        #        self._softbtn.append(b)
        #        b.grid(column = 1, row = 0, sticky = tki.E)

        #Create main canvas
        canvas = tki.Canvas(self.root, bg=bgcolor, bd=0, highlightthickness=0)
        self.maincanvas = canvas
        canvas.grid(row=0, column=0, sticky=tki.W + tki.N + tki.E + tki.S)
        canvas.create_image(canvascenterx, canvascentery, image=bgimage)

        #Create top buttons
        color = self._settings.softbuttonbgcolor
        frame = tki.Frame(self.root)
        canvas.create_window(self._settings.softbuttonoffsetx,
                             self._settings.softbuttonoffsety,
                             window=frame,
                             anchor=tki.NW)
        b = tki.Button(frame,
                       font=self._passivefont,
                       image=self._softimage,
                       compound=tki.CENTER,
                       bd=0,
                       highlightthickness=0,
                       bg=color,
                       activebackground=color,
                       foreground=_topbuttontextcolor,
                       activeforeground=_topbuttontextcolor,
                       relief=tki.FLAT,
                       command=lambda: self._ehButton(0))
        self._softbtn.append(b)
        b.grid()

        frame = tki.Frame(self.root)
        canvas.create_window(screenwidth - self._settings.softbuttonoffsetx,
                             self._settings.softbuttonoffsety,
                             window=frame,
                             anchor=tki.NE)
        b = tki.Button(frame,
                       font=self._passivefont,
                       image=self._softimage,
                       compound=tki.CENTER,
                       bd=0,
                       highlightthickness=0,
                       bg=color,
                       activebackground=color,
                       foreground=_topbuttontextcolor,
                       activeforeground=_topbuttontextcolor,
                       command=lambda: self._ehButton(1))
        self._softbtn.append(b)
        b.grid()

        #Create bottom frame
        bottomframe = tki.Frame(self.root, height=100, bg=bgcolor)
        bottomframe.grid(row=1, sticky=tki.W + tki.E + tki.S)
        #bottomframe.columnconfigure(0, weight = 1)
        bottomframe.columnconfigure(1, weight=1)
        bottomframe.rowconfigure(0, weight=1)
        #bottomframe.columnconfigure(2, weight = 1)
        self._bottomframe = bottomframe

        self._bottomrectwidth = screenwidth - prevwidth - nextwidth - 6 * _bottompadding
        self._bottomrectheight = bottomheight

        b = tki.Button(bottomframe,
                       image=previmage,
                       bd=0,
                       highlightthickness=0,
                       bg=bgcolor,
                       activebackground=bgcolor,
                       command=self._ehprev)
        self._btnprev = b
        b.grid(column=0,
               row=0,
               padx=_bottompadding,
               pady=_bottompadding,
               sticky=tki.W)

        b = tki.Button(bottomframe,
                       image=nextimage,
                       bd=0,
                       highlightthickness=0,
                       bg=bgcolor,
                       activebackground=bgcolor,
                       command=self._ehnext)
        self._btnnext = b
        b.grid(column=2,
               row=0,
               padx=_bottompadding,
               pady=_bottompadding,
               sticky=tki.E)
Esempio n. 11
0
    def __init__(self, panelmanager, settings):
        """Create PanelListView.

        Arguments
        panelmanager -- the panel manager that has the panels on which the objects 
                        will be visualized
        settings -- settings object containing font settings
        """

        ListView.__init__(self, evPanelItemSelected)
        
        self._canvas = panelmanager.canvas
        self._eventgenerator = panelmanager.canvas
        self._fntText = getFont(settings.fontname, settings.fontsize, settings.fontstyle)
        self._itemdatatuples = []
        self._uids = []
        
        panel = panelmanager.panels[0]
        
        color = panel.center['bg']
        height = panel.center['height']
        #padding = 5
        padding = (height - 4 * settings.fontsize) / 4
        cwrap = panel.center['width'] - 2 * padding
        rwrap = panel.right['width'] - 2 * padding
        ctr = 0

        for i in panelmanager.panels:
            magazine = tki.StringVar()
            blog = tki.StringVar()
            blogexists = tki.StringVar()

            i.left.columnconfigure(0, weight = 1)
            i.left.rowconfigure(0, weight = 1)
            lblImage = tki.Label(i.left)
            lblImage.grid()

            i.center.columnconfigure(0, weight = 1)
            i.center.rowconfigure(0, weight = 1)
            i.center.rowconfigure(1, weight = 1)
            
            l = tki.Label(i.center, textvariable = magazine, font = self._fntText, wraplength = cwrap, justify="left", bg = color)
            l.grid(row = 0, column = 0, sticky = tki.W)
            #l.grid(row = 0, column = 0, padx = padding, pady = padding, sticky = tki.W)
            #l.grid(row = 0, column = 0, padx = padding, pady = padding, sticky = tki.W)
            l = tki.Label(i.center, textvariable = blog, font = self._fntText, wraplength = cwrap, justify="left", bg = color)
            l.grid(row = 1, column = 0, sticky = tki.W)
            
            i.right.columnconfigure(0, weight = 1)
            i.right.rowconfigure(0, weight = 1)
            
            
            b = tki.Button(i.right, text = lang[lng.txtShowBlogpost], font = self._fntText, bg = color)
            b.grid(row = 0, column = 0, padx = padding, pady = padding, sticky = tki.W)
            b.index = ctr
            b.bind("<ButtonRelease-1>", self._ehClick)

#            l = tki.Label(i.right, textvariable = blogexists, font = self._fntText, wraplength = rwrap, justify="left", bg = color)
#            l.grid(row = 0, column = 0, padx = padding, pady = padding, sticky = tki.W)
#            l.index = ctr
#            l.bind("<Button-1>", self._ehClick)

            ctr += 1
            self._itemdatatuples.append((magazine, blog, blogexists, lblImage))
            self._uids.append(i.uid)            
            
        self._itemcount = ctr