Example #1
0
    def make_simple_items_notebook(self):
        simple_items = self.cfg.get("simple_items")
        self.simple_items_notebook=simpleItemNotebook(id=-1,name="si_notebook", parent=self)
        for x in range(len(simple_items)):	
            try:
                simple_items[x]
                page_name="stuff"

                try:
                    page_name=simple_items[x][3]["page"]                                
                except:
                    pass

                if (not(self.simple_items_notebook.hasPage(page_name))):
                    self.simple_items_notebook.addPage(page_name)
                    
                my_page=self.simple_items_notebook.pages[page_name]
                newButton = wxButton(id=-1,
                                 label=item(x).getLabel(),
                                 name='item_%i' % (x+1),
                                 parent=my_page,
                                 pos=wxPoint(100* (my_page.counter % 5), 32 * (my_page.counter / 5)),
				                 size=wxSize(100, 32), style=0)
                setattr(self,"item_%i" % (x+1), newButton)
                my_page.counter=my_page.counter+1
                EVT_BUTTON(getattr(self,"item_%i" % (x+1)),
                           getattr(getattr(self,"item_%i" % (x+1)),"GetId")(),
                           self.Generate_OnItem_Button(x))
                try:
                    getattr(self,"item_%i" % (x+1)).SetForegroundColour(simple_items[x][3]["color"])
                except:
                    a="no color"
            except:
                a="outofrange"
        return self.simple_items_notebook
Example #2
0
    def make_simple_items_notebook(self):
        simple_items = self.cfg.get("simple_items")
        self.simple_items_notebook = simpleItemNotebook(id=-1,
                                                        name="si_notebook",
                                                        parent=self)
        for x in range(len(simple_items)):
            try:
                simple_items[x]
                page_name = "stuff"

                try:
                    page_name = simple_items[x][3]["page"]
                except:
                    pass

                if (not (self.simple_items_notebook.hasPage(page_name))):
                    self.simple_items_notebook.addPage(page_name)

                my_page = self.simple_items_notebook.pages[page_name]
                newButton = wxButton(id=-1,
                                     label=item(x).getLabel(),
                                     name='item_%i' % (x + 1),
                                     parent=my_page,
                                     pos=wxPoint(100 * (my_page.counter % 5),
                                                 32 * (my_page.counter / 5)),
                                     size=wxSize(100, 32),
                                     style=0)
                setattr(self, "item_%i" % (x + 1), newButton)
                my_page.counter = my_page.counter + 1
                EVT_BUTTON(
                    getattr(self, "item_%i" % (x + 1)),
                    getattr(getattr(self, "item_%i" % (x + 1)), "GetId")(),
                    self.Generate_OnItem_Button(x))
                try:
                    getattr(self, "item_%i" % (x + 1)).SetForegroundColour(
                        simple_items[x][3]["color"])
                except:
                    a = "no color"
            except:
                a = "outofrange"
        return self.simple_items_notebook
Example #3
0
 def Generate_OnItem_Button(self,item_number):
     return lambda event : self.orderbox.append(item(item_number))
Example #4
0
 def Generate_OnItem_Button(self, item_number):
     return lambda event: self.orderbox.append(item(item_number))