Пример #1
0
    def __init__(self, parent, title):
        wx.Dialog.__init__(self, parent, title=title, size=(350, 330))
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.sizer)

        self.gridsizer = wx.FlexGridSizer(3, 2)
        self.sizer.Add(self.gridsizer, 1)

        self.bomtext = wx.StaticText(self, label="BOM")
        self.gridsizer.Add(self.bomtext,
                           0,
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                           border=3)
        self.bomctrl = kpm_common.AutoWidthListCtrl(
            self,
            style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_NO_HEADER,
            size=(300, 100))
        self.bomctrl.InsertColumn(0, 'BOM')
        self.gridsizer.Add(self.bomctrl, 0, flag=wx.ALL | wx.EXPAND, border=5)

        self.counttext = wx.StaticText(self, label="Count")
        self.gridsizer.Add(self.counttext,
                           0,
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                           border=3)
        self.countctrl = wx.TextCtrl(self, -1, size=(300, 25))
        self.gridsizer.Add(self.countctrl,
                           0,
                           flag=wx.ALL | wx.EXPAND,
                           border=5)

        self.descrtext = wx.StaticText(self, label="Description")
        self.gridsizer.Add(self.descrtext, 0, flag=wx.ALL, border=3)
        self.description = wx.TextCtrl(self,
                                       -1,
                                       size=(300, 90),
                                       style=wx.TE_MULTILINE)
        self.gridsizer.Add(self.description,
                           0,
                           flag=wx.ALL | wx.EXPAND,
                           border=5)

        self.btnOk = wx.Button(self, wx.ID_OK)
        self.btnCancel = wx.Button(self, wx.ID_CANCEL)

        self.btnSizer = wx.StdDialogButtonSizer()
        self.btnSizer.AddButton(self.btnOk)
        self.btnSizer.AddButton(self.btnCancel)
        self.btnSizer.Realize()

        self.sizer.Add(self.btnSizer,
                       0,
                       flag=wx.ALL | wx.ALIGN_CENTER,
                       border=5)
        self.db = kpm_db.Kpm_Db(kpm_config.sqlconfig)
        self.UpdateBOMs()
        self.bomid = 0

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnBOM, self.bomctrl)
Пример #2
0
    def __init__(self,
                 parent,
                 title,
                 shortname="",
                 fullname="",
                 value1="",
                 value2="",
                 value3="",
                 description=""):
        wx.Dialog.__init__(self,
                           parent,
                           title=title,
                           size=(800, 500),
                           style=wx.RESIZE_BORDER)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.sizer)

        id = wx.NewId()
        self.sup_ctrl = wx.ListCtrl(self,
                                    id,
                                    style=wx.LC_REPORT | wx.SUNKEN_BORDER,
                                    size=(800, 500))
        self.sizer.Add(self.sup_ctrl, 1, wx.ALL | wx.EXPAND)
        self.sup_ctrl.InsertColumn(0, 'ID', width=30)
        self.sup_ctrl.InsertColumn(1, 'Short name', width=80)
        self.sup_ctrl.InsertColumn(2, 'Full name', width=150)
        self.sup_ctrl.InsertColumn(3, 'WWW', width=150)
        self.sup_ctrl.InsertColumn(4, 'Address', width=150)
        self.sup_ctrl.InsertColumn(5, 'Note', width=200)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelect, self.sup_ctrl)

        self.btnClose = wx.Button(self, wx.ID_CLOSE)
        self.btnAdd = wx.Button(self, wx.ID_NEW)
        self.btnEdit = wx.Button(self, wx.ID_EDIT)
        self.btnDelete = wx.Button(self, wx.ID_DELETE)

        self.btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.btnSizer.Add(self.btnAdd)
        self.btnSizer.Add(self.btnEdit)
        self.btnSizer.Add(self.btnDelete)
        self.btnSizer.Add(self.btnClose)

        self.sizer.Add(self.btnSizer,
                       0,
                       flag=wx.ALL | wx.ALIGN_CENTER,
                       border=5)
        self.Fit()

        self.Bind(wx.EVT_BUTTON, self.OnClose, self.btnClose)
        self.Bind(wx.EVT_BUTTON, self.OnAdd, self.btnAdd)
        self.Bind(wx.EVT_BUTTON, self.OnEdit, self.btnEdit)
        self.Bind(wx.EVT_BUTTON, self.OnDelete, self.btnDelete)

        self.db = kpm_db.Kpm_Db(kpm_config.sqlconfig)
        self.UpdateSuppliers()
        self.selected_id = 0
Пример #3
0
    def __init__(self, parent, title="Stock flow"):
        wx.Dialog.__init__(self,
                           parent,
                           title=title,
                           size=(800, 500),
                           style=wx.RESIZE_BORDER)
        self.sizer = wx.FlexGridSizer(3, 1)
        #self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.AddGrowableRow(1, 10)
        self.sizer.AddGrowableCol(0, 1)
        self.SetSizer(self.sizer)

        self.datesizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.datesizer, 1, wx.ALL)

        self.fromtext = wx.StaticText(self, label="From")
        self.datesizer.Add(self.fromtext, 1, wx.ALL)
        t = wx.DateTime().Today()
        sub = wx.DateSpan().Month()
        t = t - sub
        self.datefrom = wx.DatePickerCtrl(self,
                                          -1,
                                          size=(100, 25),
                                          style=wx.DP_DROPDOWN)
        self.datefrom.SetValue(t)
        self.datesizer.Add(self.datefrom, 1, wx.ALL)
        self.totext = wx.StaticText(self, label="      To")
        self.datesizer.Add(self.totext, 1, wx.ALL)
        self.dateto = wx.DatePickerCtrl(self,
                                        -1,
                                        size=(100, 25),
                                        style=wx.DP_DROPDOWN)
        self.datesizer.Add(self.dateto, 1, wx.ALL)

        id = wx.NewId()
        self.flowctrl = wx.ListCtrl(self,
                                    id,
                                    style=wx.LC_REPORT | wx.SUNKEN_BORDER,
                                    size=(200, 100))
        self.sizer.Add(self.flowctrl, 1, wx.ALL | wx.EXPAND)
        self.flowctrl.InsertColumn(0, 'ID', width=50)
        self.flowctrl.InsertColumn(1, 'Date', width=150)
        self.flowctrl.InsertColumn(2, 'Part', width=100)
        self.flowctrl.InsertColumn(3, 'Change', width=100)
        self.flowctrl.InsertColumn(4, 'Price', width=100)
        self.flowctrl.InsertColumn(5, 'Description', width=200)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelect, self.flowctrl)

        self.btnClose = wx.Button(self, wx.ID_CLOSE)

        self.btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.btnSizer.Add(self.btnClose)

        self.sizer.Add(self.btnSizer,
                       1,
                       flag=wx.ALL | wx.ALIGN_CENTER,
                       border=5)
        #self.Fit()

        self.Bind(wx.EVT_BUTTON, self.OnClose, self.btnClose)

        self.db = kpm_db.Kpm_Db(kpm_config.sqlconfig)
        self.UpdateFlow()
        self.selected_id = 0