Example #1
0
    def __init__(self, previewx, previewy, frame):
        """Creates an indexed frame and adds it to the scrollbox 

        Arguments
        previewx -- width of preview images
        previewy -- height of preview images
        frame -- the frame on which to layout the widgets

        """
        ListView.__init__(self, evItemSelected)

        width = frame['width']
        height = frame['height']

        self._eventgenerator = frame

        columncount = (width - _minspace) / (_minspace + previewx)
        rowcount = (height - _minspace) / (_minspace + previewy)
        self._itemcount = rowcount * columncount

        for i in range(rowcount):
            frame.rowconfigure(i, weight=1)

        for i in range(columncount):
            frame.columnconfigure(i, weight=1)

        self._labels = []

        for i in range(rowcount):
            for j in range(columncount):
                l = tki.Label(
                    frame
                )  #, image = image1)#, text = 'bild ' + str(j) + ', ' + str(i))
                #print('bild ' + str(j) + ', ' + str(i))
                self._labels.append(l)
                l.grid(row=i, column=j, padx=_minspace, pady=_minspace)
                l.index = (i * columncount) + j
                l.bind("<Button-1>", self._ehClick)
Example #2
0
    def __init__(self, previewx, previewy, frame):
        """Creates an indexed frame and adds it to the scrollbox 

        Arguments
        previewx -- width of preview images
        previewy -- height of preview images
        frame -- the frame on which to layout the widgets

        """
        ListView.__init__(self, evItemSelected)
        
        width = frame['width']
        height = frame['height']
        
        self._eventgenerator = frame
        
        columncount = (width - _minspace) / (_minspace + previewx)
        rowcount = (height - _minspace) / (_minspace + previewy)
        self._itemcount = rowcount * columncount
        
        for i in range(rowcount):
            frame.rowconfigure(i, weight = 1)
            
        for i in range(columncount):
            frame.columnconfigure(i, weight = 1)
            
        self._labels = []
        
        for i in range(rowcount):
            for j in range(columncount):
                l = tki.Label(frame)#, image = image1)#, text = 'bild ' + str(j) + ', ' + str(i))
                #print('bild ' + str(j) + ', ' + str(i))
                self._labels.append(l)
                l.grid(row = i, column = j, padx = _minspace, pady = _minspace)
                l.index = (i * columncount) + j
                l.bind("<Button-1>", self._ehClick)
Example #3
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
Example #4
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