Ejemplo n.º 1
0
    def __init__(self,parent):
        self.known_title=False
	self.parent=parent
        self.trailing_two=False
	self.selected_kind = cfg.get("default_kind")
        if isinstance(bookStatus, tuple):
            self.statuses=bookStatus
	else:
	    self.statuses = False
        self.keybuffer=""
        wxDialog.__init__(self, parent,-1,"Merchandise Details")
#        self.SetBackgroundColour("FIREBRICK")
        self.SetSize((400, 570))

        self.master_sizer=wxBoxSizer(wxVERTICAL)

        self.toprow=wxBoxSizer(wxHORIZONTAL)
        self.toprow_col1=wxBoxSizer(wxVERTICAL)
        self.toprow_col2=wxBoxSizer(wxVERTICAL)
        self.static0=wxStaticText(self, -1, "Item ID (UPC or ISBN):")
        self.number=wxTextCtrl(id=-1,name="merchandise_id", parent=self, style=wxTE_PROCESS_ENTER)
        EVT_TEXT(self,self.number.GetId(), self.OnText)
        EVT_TEXT_ENTER(self,self.number.GetId(), self.OnTextEnter)
        if ON_LINUX:
            EVT_CHAR(self.number, self.OnKeyDown)

        self.toprow_col1.Add(self.static0,0,wxEXPAND|wxALL,5)
        self.toprow_col1.Add(self.number,0,wxEXPAND|wxALL,5)
        
        self.static0a=wxStaticText(self, -1, "Quantity:")
        self.quantity=wxTextCtrl(id=-1,name="quantity", parent=self, style=0)
        self.quantity.SetValue("1")

        self.toprow_col2.Add(self.static0a,0,wxEXPAND|wxALL,5)
        self.toprow_col2.Add(self.quantity,0,wxEXPAND|wxALL,5)
        
        self.toprow.Add(self.toprow_col1,0,wxEXPAND|wxALL,5)
        self.toprow.Add(self.toprow_col2,0,wxEXPAND|wxALL,5)

        self.master_sizer.Add(self.toprow,0,wxEXPAND|wxALL,5)
        self.row2=wxBoxSizer(wxHORIZONTAL)
        self.static1=wxStaticText(self, -1, "Title:")
        self.description=wxTextCtrl(id=-1,name="merchandise_description", parent=self, style=0)

        self.row2.Add(self.static1,0,wxGROW,5)
        self.row2.Add(self.description,1,wxGROW,5)
	self.master_sizer.Add(self.row2,0, wxGROW,5)

        self.prices=multiplePrices(self)
        self.prices.addPage(page_name="list price",master=True)
        for m in cfg.get("multiple_prices"):
            self.prices.addPage(page_name=m[0],proportion_of_master=m[1])

        self.prices.render()
        self.master_sizer.Add(self.prices.mp_sizer,1,wxEXPAND|wxALL, 5)
        
        self.row4=wxBoxSizer(wxHORIZONTAL)
        self.static3=wxStaticText(self, -1, "Publisher:")
        self.publisher=wxTextCtrl(id=-1,name="merchandise_publisher", parent=self, style=0)
        self.row4.Add(self.static3,0,wxEXPAND|wxALL,5)
        self.row4.Add(self.publisher,1,wxGROW)
	self.master_sizer.Add(self.row4, 0, wxGROW,5)

        self.row5 = wxBoxSizer(wxHORIZONTAL)
	self.static4=wxStaticText(self, -1, "Author:")
        self.moreAuthor = wxButton(self, -1, "More authors", (110, 500))
        EVT_BUTTON(self, self.moreAuthor.GetId(), self.OnMoreAuthor)
        self.author=wxTextCtrl(id=-1,name="merchandise_author", parent=self, style=0)
	self.row5.Add(self.static4,0,wxEXPAND|wxALL,5)
        self.row5.Add(self.author,1,wxGROW,5,1)
	self.row5.Add(self.moreAuthor,0,wxEXPAND|wxALL,5)
	self.master_sizer.Add(self.row5, 0, wxGROW,5)

	self.row6 = wxBoxSizer(wxHORIZONTAL)
        self.static5=wxStaticText(self, -1, "Category:")
        self.category=wxTextCtrl(id=-1,name="merchandise_category", parent=self, style=0)
        self.row6.Add(self.static5,0,wxEXPAND|wxALL,5)
        self.row6.Add(self.category,1,wxGROW,5,1)
	self.master_sizer.Add(self.row6,0,wxGROW,5)

        self.row7 = wxBoxSizer(wxHORIZONTAL)
	self.static6=wxStaticText(self, -1, "Distributor:")
        self.distributor=wxTextCtrl(id=-1,name="merchandise_distributor", parent=self, style=0)
        self.row7.Add(self.static6,0,wxEXPAND|wxALL,5)
        self.row7.Add(self.distributor,1,wxGROW,5,1)
	self.master_sizer.Add(self.row7, 0, wxEXPAND|wxALL,5)

        self.static7=wxStaticText(self, -1, "Owner:")
        self.owner=wxTextCtrl(id=-1,name="merchandise_owner", parent=self, style=0)
        self.owner.SetValue(cfg.get("default_owner"))
        
        self.master_sizer.Add(self.static7,0,wxEXPAND|wxALL,5)
        self.master_sizer.Add(self.owner,0,wxEXPAND|wxALL,5)

        if self.statuses:
            self.static8=wxStaticText(self, -1, "Status:")
            self.status=wxRadioBox(id=-1,name="Radio box 1", parent=self, choices = self.statuses )

            self.master_sizer.Add(self.static8,0,wxEXPAND|wxALL,5)
            self.master_sizer.Add(self.status,0,wxEXPAND|wxALL,5)


        kinds=["%s" % k.kindName for k in list(Kind.select())]
                
        self.static8=wxStaticText(self, -1, "Kind:")
        self.kind=wxChoice(id=-1,name="merchandise_kind", parent=self,choices=kinds,style=0)

        position = self.kind.FindString(self.selected_kind)
	self.kind.SetSelection(position)

        self.master_sizer.Add(self.static8,0,wxEXPAND|wxALL,5)
        self.master_sizer.Add(self.kind,0,wxEXPAND|wxALL,5)

        self.static9=wxStaticText(self, -1, "Notes:")
        self.notes=wxTextCtrl(id=-1,name="merchandise_notes", parent=self, style=0)
        
        self.master_sizer.Add(self.static9,0,wxEXPAND|wxALL,5)
        self.master_sizer.Add(self.notes,0,wxEXPAND|wxALL,5)

        self.b = wxButton(self, -1, "Add and continue", (15, 500))
        EVT_BUTTON(self, self.b.GetId(), self.OnAddAndContinue)

        self.b2 = wxButton(self, -1, "Add and quit", (110, 500))
        EVT_BUTTON(self, self.b2.GetId(), self.OnAddAndQuit)
        self.b3 = wxButton(self, -1, "Cancel", (110, 500))
        EVT_BUTTON(self, self.b3.GetId(), self.OnCancel)

        self.bottomrow=wxBoxSizer(wxHORIZONTAL)
        self.bottomrow.Add(self.b,1,wxGROW, 5)
        self.bottomrow.Add(self.b2,1,wxGROW, 5)
        self.bottomrow.Add(self.b3,1,wxGROW, 5)
        
        self.master_sizer.Add(self.bottomrow,0,wxEXPAND|wxALL,5)
        self.statusBar = wxStatusBar(self, -1, name="statusBar")
        self.master_sizer.Add(self.statusBar,0,wxEXPAND|wxALL,5)
        
        self.number.SetFocus()  
        self.Fit()
	self.SetSizer(self.master_sizer)
        self.SetAutoLayout(1)
        self.master_sizer.Fit(self)
Ejemplo n.º 2
0
    def __init__(self, parent):
        self.known_title = False
        self.parent = parent
        self.trailing_two = False
        self.selected_kind = cfg.get("default_kind")
        if isinstance(bookStatus, tuple):
            self.statuses = bookStatus
        else:
            self.statuses = False
        self.keybuffer = ""
        wxDialog.__init__(self, parent, -1, "Merchandise Details")
        #        self.SetBackgroundColour("FIREBRICK")
        self.SetSize((400, 570))

        self.master_sizer = wxBoxSizer(wxVERTICAL)

        self.toprow = wxBoxSizer(wxHORIZONTAL)
        self.toprow_col1 = wxBoxSizer(wxVERTICAL)
        self.toprow_col2 = wxBoxSizer(wxVERTICAL)
        self.static0 = wxStaticText(self, -1, "Item ID (UPC or ISBN):")
        self.number = wxTextCtrl(id=-1,
                                 name="merchandise_id",
                                 parent=self,
                                 style=wxTE_PROCESS_ENTER)
        EVT_TEXT(self, self.number.GetId(), self.OnText)
        EVT_TEXT_ENTER(self, self.number.GetId(), self.OnTextEnter)
        if ON_LINUX:
            EVT_CHAR(self.number, self.OnKeyDown)

        self.toprow_col1.Add(self.static0, 0, wxEXPAND | wxALL, 5)
        self.toprow_col1.Add(self.number, 0, wxEXPAND | wxALL, 5)

        self.static0a = wxStaticText(self, -1, "Quantity:")
        self.quantity = wxTextCtrl(id=-1,
                                   name="quantity",
                                   parent=self,
                                   style=0)
        self.quantity.SetValue("1")

        self.toprow_col2.Add(self.static0a, 0, wxEXPAND | wxALL, 5)
        self.toprow_col2.Add(self.quantity, 0, wxEXPAND | wxALL, 5)

        self.toprow.Add(self.toprow_col1, 0, wxEXPAND | wxALL, 5)
        self.toprow.Add(self.toprow_col2, 0, wxEXPAND | wxALL, 5)

        self.master_sizer.Add(self.toprow, 0, wxEXPAND | wxALL, 5)
        self.row2 = wxBoxSizer(wxHORIZONTAL)
        self.static1 = wxStaticText(self, -1, "Title:")
        self.description = wxTextCtrl(id=-1,
                                      name="merchandise_description",
                                      parent=self,
                                      style=0)

        self.row2.Add(self.static1, 0, wxGROW, 5)
        self.row2.Add(self.description, 1, wxGROW, 5)
        self.master_sizer.Add(self.row2, 0, wxGROW, 5)

        self.prices = multiplePrices(self)
        self.prices.addPage(page_name="list price", master=True)
        for m in cfg.get("multiple_prices"):
            self.prices.addPage(page_name=m[0], proportion_of_master=m[1])

        self.prices.render()
        self.master_sizer.Add(self.prices.mp_sizer, 1, wxEXPAND | wxALL, 5)

        self.row4 = wxBoxSizer(wxHORIZONTAL)
        self.static3 = wxStaticText(self, -1, "Publisher:")
        self.publisher = wxTextCtrl(id=-1,
                                    name="merchandise_publisher",
                                    parent=self,
                                    style=0)
        self.row4.Add(self.static3, 0, wxEXPAND | wxALL, 5)
        self.row4.Add(self.publisher, 1, wxGROW)
        self.master_sizer.Add(self.row4, 0, wxGROW, 5)

        self.row5 = wxBoxSizer(wxHORIZONTAL)
        self.static4 = wxStaticText(self, -1, "Author:")
        self.moreAuthor = wxButton(self, -1, "More authors", (110, 500))
        EVT_BUTTON(self, self.moreAuthor.GetId(), self.OnMoreAuthor)
        self.author = wxTextCtrl(id=-1,
                                 name="merchandise_author",
                                 parent=self,
                                 style=0)
        self.row5.Add(self.static4, 0, wxEXPAND | wxALL, 5)
        self.row5.Add(self.author, 1, wxGROW, 5, 1)
        self.row5.Add(self.moreAuthor, 0, wxEXPAND | wxALL, 5)
        self.master_sizer.Add(self.row5, 0, wxGROW, 5)

        self.row6 = wxBoxSizer(wxHORIZONTAL)
        self.static5 = wxStaticText(self, -1, "Category:")
        self.category = wxTextCtrl(id=-1,
                                   name="merchandise_category",
                                   parent=self,
                                   style=0)
        self.row6.Add(self.static5, 0, wxEXPAND | wxALL, 5)
        self.row6.Add(self.category, 1, wxGROW, 5, 1)
        self.master_sizer.Add(self.row6, 0, wxGROW, 5)

        self.row7 = wxBoxSizer(wxHORIZONTAL)
        self.static6 = wxStaticText(self, -1, "Distributor:")
        self.distributor = wxTextCtrl(id=-1,
                                      name="merchandise_distributor",
                                      parent=self,
                                      style=0)
        self.row7.Add(self.static6, 0, wxEXPAND | wxALL, 5)
        self.row7.Add(self.distributor, 1, wxGROW, 5, 1)
        self.master_sizer.Add(self.row7, 0, wxEXPAND | wxALL, 5)

        self.static7 = wxStaticText(self, -1, "Owner:")
        self.owner = wxTextCtrl(id=-1,
                                name="merchandise_owner",
                                parent=self,
                                style=0)
        self.owner.SetValue(cfg.get("default_owner"))

        self.master_sizer.Add(self.static7, 0, wxEXPAND | wxALL, 5)
        self.master_sizer.Add(self.owner, 0, wxEXPAND | wxALL, 5)

        if self.statuses:
            self.static8 = wxStaticText(self, -1, "Status:")
            self.status = wxRadioBox(id=-1,
                                     name="Radio box 1",
                                     parent=self,
                                     choices=self.statuses)

            self.master_sizer.Add(self.static8, 0, wxEXPAND | wxALL, 5)
            self.master_sizer.Add(self.status, 0, wxEXPAND | wxALL, 5)

        kinds = ["%s" % k.kindName for k in list(Kind.select())]

        self.static8 = wxStaticText(self, -1, "Kind:")
        self.kind = wxChoice(id=-1,
                             name="merchandise_kind",
                             parent=self,
                             choices=kinds,
                             style=0)

        position = self.kind.FindString(self.selected_kind)
        self.kind.SetSelection(position)

        self.master_sizer.Add(self.static8, 0, wxEXPAND | wxALL, 5)
        self.master_sizer.Add(self.kind, 0, wxEXPAND | wxALL, 5)

        self.static9 = wxStaticText(self, -1, "Notes:")
        self.notes = wxTextCtrl(id=-1,
                                name="merchandise_notes",
                                parent=self,
                                style=0)

        self.master_sizer.Add(self.static9, 0, wxEXPAND | wxALL, 5)
        self.master_sizer.Add(self.notes, 0, wxEXPAND | wxALL, 5)

        self.b = wxButton(self, -1, "Add and continue", (15, 500))
        EVT_BUTTON(self, self.b.GetId(), self.OnAddAndContinue)

        self.b2 = wxButton(self, -1, "Add and quit", (110, 500))
        EVT_BUTTON(self, self.b2.GetId(), self.OnAddAndQuit)
        self.b3 = wxButton(self, -1, "Cancel", (110, 500))
        EVT_BUTTON(self, self.b3.GetId(), self.OnCancel)

        self.bottomrow = wxBoxSizer(wxHORIZONTAL)
        self.bottomrow.Add(self.b, 1, wxGROW, 5)
        self.bottomrow.Add(self.b2, 1, wxGROW, 5)
        self.bottomrow.Add(self.b3, 1, wxGROW, 5)

        self.master_sizer.Add(self.bottomrow, 0, wxEXPAND | wxALL, 5)
        self.statusBar = wxStatusBar(self, -1, name="statusBar")
        self.master_sizer.Add(self.statusBar, 0, wxEXPAND | wxALL, 5)

        self.number.SetFocus()
        self.Fit()
        self.SetSizer(self.master_sizer)
        self.SetAutoLayout(1)
        self.master_sizer.Fit(self)
Ejemplo n.º 3
0
    def __init__(self,parent):
        self.known_title=False
        self.parent=parent
        try:
            self.selected_kind=etc.default_kind
        except:
            self.selected_kind="book"
            

	self.parent=parent
	self.selected_kind = cfg.get("default_kind")
        if isinstance(bookStatus, tuple):
            self.statuses=bookStatus
	else:
	    self.statuses = False
        self.keybuffer=""
        wxDialog.__init__(self, parent,-1,"Merchandise Details")
#        self.SetBackgroundColour("FIREBRICK")
        self.SetSize((400, 570))

        self.master_sizer=wxBoxSizer(wxVERTICAL)

        self.toprow=wxBoxSizer(wxHORIZONTAL)
        self.toprow_col1=wxBoxSizer(wxVERTICAL)
        self.toprow_col2=wxBoxSizer(wxVERTICAL)
        self.static0=wxStaticText(self, -1, "Item ID (UPC or ISBN):")
	self.isbn_dirty=False
        self.number=wxTextCtrl(id=-1,name="merchandise_id", parent=self, style=wxTE_PROCESS_ENTER)
        EVT_TEXT(self,self.number.GetId(), self.OnText)
        EVT_TEXT_ENTER(self,self.number.GetId(), self.OnTextEnter)
        #if ON_LINUX:
        EVT_CHAR(self.number, self.OnKeyDown)

        self.toprow_col1.Add(self.static0,0,wxEXPAND|wxALL,1)
        self.toprow_col1.Add(self.number,0,wxEXPAND|wxALL,1)
        

        self.static0a=wxStaticText(self, -1, "Quantity:")
        self.quantity=wxTextCtrl(id=-1,name="quantity", parent=self, style=0)
        self.quantity.SetValue("1")

        self.toprow_col2.Add(self.static0a,0,wxEXPAND|wxALL,1)
        self.toprow_col2.Add(self.quantity,0,wxEXPAND|wxALL,1)
        
        self.toprow.Add(self.toprow_col1,0,wxEXPAND|wxALL,1)
        self.toprow.Add(self.toprow_col2,0,wxEXPAND|wxALL,1)

        self.master_sizer.Add(self.toprow,0,wxEXPAND|wxALL,1)

        self.static1=wxStaticText(self, -1, "Title:")
        self.description=wxTextCtrl(id=-1,name="merchandise_description", parent=self, style=0)

        self.master_sizer.Add(self.static1,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.description,0,wxEXPAND|wxALL,1)


        self.prices=multiplePrices(self)
        self.prices.addPage(page_name="list price",master=True)
        for m in cfg.get("multiple_prices"):
            self.prices.addPage(page_name=m[0],proportion_of_master=m[1])

        self.prices.render()
        self.master_sizer.Add(self.prices.mp_sizer,1,wxEXPAND|wxALL,1)

        
        self.static3=wxStaticText(self, -1, "Publisher:")
        self.publisher=wxTextCtrl(id=-1,name="merchandise_publisher", parent=self, style=0)

        self.master_sizer.Add(self.static3,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.publisher,0,wxEXPAND|wxALL,1)

        self.static4=wxStaticText(self, -1, "Author:")
        self.author=wxTextCtrl(id=-1,name="merchandise_author", parent=self, style=0)

        self.master_sizer.Add(self.static4,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.author,0,wxEXPAND|wxALL,1)
        

        self.static5=wxStaticText(self, -1, "Keyword:")
        self.category=wxTextCtrl(id=-1,name="merchandise_category", parent=self, style=0)

        self.master_sizer.Add(self.static5,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.category,0,wxEXPAND|wxALL,1)

        conn=Book._connection
        query=Select( Book.q.distributor, groupBy=Book.q.distributor)
        results=conn.queryAll( conn.sqlrepr(query))
        distributors=[t[0] for t in results]

        self.static6=wxStaticText(self, -1, "Distributor:")
        self.distributor=wxComboBox(id=-1,name="merchandise_distributor", parent=self,choices=distributors, style=wx.CB_SORT|wx.CB_DROPDOWN)
        #self.distributor=wxTextCtrl(id=-1,name="merchandise_distributor", parent=self, style=0)
        self.master_sizer.Add(self.static6,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.distributor,0,wxEXPAND|wxALL,1)
 
        query=Select( Location.q.locationName, groupBy=Location.q.locationName)
        results=conn.queryAll( conn.sqlrepr(query))
        locations=[t[0] for t in results]
     
        self.static7=wxStaticText(self, -1, "Location:")
        self.location=wxComboBox(id=-1,name="merchandise_location", parent=self,choices=locations, style=wx.CB_SORT|wx.CB_DROPDOWN|wx.CB_READONLY)
        #self.location=wxTextCtrl(id=-1,name="location", parent=self, style=0)

        self.master_sizer.Add(self.static7,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.location,0,wxEXPAND|wxALL,1)

        self.static8=wxStaticText(self, -1, "Owner:")
        self.owner=wxTextCtrl(id=-1,name="merchandise_owner", parent=self, style=0)
        self.owner.SetValue(cfg.get("default_owner"))
        
        self.master_sizer.Add(self.static8,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.owner,0,wxEXPAND|wxALL,1)

        if self.statuses:
            self.static9=wxStaticText(self, -1, "Status:")
            self.status=wxRadioBox(id=-1,name="Radio box 1", parent=self, choices = self.statuses )

            self.master_sizer.Add(self.static9,0,wxEXPAND|wxALL,1)
            self.master_sizer.Add(self.status,0,wxEXPAND|wxALL,1)
        
        conn=Title._connection
        query=Select( Title.q.type, groupBy=Title.q.type)
        results=conn.queryAll( conn.sqlrepr(query))
        typelist=[t[0] for t in results] 
        print "TypeList: ", typelist
        
	self.static10=wxStaticText(self, -1, "Format:")
        self.types=wxChoice(id=-1,name="merchandise_type", parent=self,choices=typelist, style=0)
	self.master_sizer.Add(self.static10,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.types,0,wxEXPAND|wxALL,1)


        kinds=["%s" % k.kindName for k in list(Kind.select())]
                
        self.static8=wxStaticText(self, -1, "Kind:")
        self.kind=wxChoice(id=-1,name="merchandise_kind", parent=self,choices=kinds,style=0)

        position = self.kind.FindString(self.selected_kind)
    	self.kind.SetSelection(position)

        self.master_sizer.Add(self.static8,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.kind,0,wxEXPAND|wxALL,1)


        self.static9=wxStaticText(self, -1, "Notes:")
        self.notes=wxTextCtrl(id=-1,name="merchandise_notes", parent=self, style=0)
        
        self.master_sizer.Add(self.static9,0,wxEXPAND|wxALL,1)
        self.master_sizer.Add(self.notes,0,wxEXPAND|wxALL,1)


        self.b = wxButton(self, -1, "Cancel", (15, 500))
        EVT_BUTTON(self, self.b.GetId(), self.OnCancel)

        self.b2 = wxButton(self, -1, "Inventory Item", (110, 500))
        EVT_BUTTON(self, self.b2.GetId(), self.OnAdd)

        self.bottomrow=wxBoxSizer(wxHORIZONTAL)
        self.bottomrow.Add(self.b,0,wxEXPAND|wxALL)
        self.bottomrow.Add(self.b2,0,wxEXPAND|wxALL)
        
        self.master_sizer.Add(self.bottomrow,0,wxEXPAND|wxALL,1)
        
	self.statusBar = wxStatusBar(self, -1, name="statusBar")
        self.master_sizer.Add(self.statusBar,0,wxEXPAND|wxALL)
        
        self.number.SetFocus()  
        self.SetSizer(self.master_sizer)
        self.SetAutoLayout(1)
        self.master_sizer.Fit(self)