當前位置: 首頁>>代碼示例>>Python>>正文


Python DBManager.getProductos方法代碼示例

本文整理匯總了Python中DBManager.DBManager.getProductos方法的典型用法代碼示例。如果您正苦於以下問題:Python DBManager.getProductos方法的具體用法?Python DBManager.getProductos怎麽用?Python DBManager.getProductos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBManager.DBManager的用法示例。


在下文中一共展示了DBManager.getProductos方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: StockAdmin

# 需要導入模塊: from DBManager import DBManager [as 別名]
# 或者: from DBManager.DBManager import getProductos [as 別名]
class StockAdmin( wx.Dialog ):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title)

        self.SetSize((800,600))
        self.SetMinSize((800,600))

        self.list_ctrl = wx.ListCtrl(self, style=wx.LC_REPORT)
        image1         = wx.Image('images/search10.png', 
                                  wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.btn_cal   = wx.BitmapButton(self, 
                                         id     = -1,
                                         bitmap = image1, 
                                         size   = (24,24))
        image2         = wx.Image('images/add.png', 
                                  wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.btn_add   = wx.BitmapButton(self,
                                         id     = -1,
                                         bitmap = image2, 
                                         size   = (24,24))
        image3         = wx.Image('images/print.png', 
                                  wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.btn_prt   = wx.BitmapButton(self,
                                         id     = -1,
                                         bitmap = image3,
                                         size   = (24,24))
        image4         = wx.Image('images/edit.png', 
                                  wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.btn_mod   = wx.BitmapButton(self,
                                         id     = -1,
                                         bitmap = image4, 
                                         size   = (24,24))
        image5         = wx.Image('images/delete.png', 
                                  wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.btn_del   = wx.BitmapButton(self, 
                                         id     = -1, 
                                         bitmap = image5,
                                         size   = (24,24))
        self.DBM       = DBManager()

        self.__generateContent()

    def __generateContent( self, myfilter=None ):
        rows = list()

        try:
           for row in self.DBM.getProductos(myfilter):
              rows.append( (row[1],
                            row[3],
                            row[2], 
                            str(row[4]), 
                            str(row[6]),
                            str(row[5])) )
        except TypeError:
              rows.append( ('Vacio', '', '', '', '', '') )

        self.list_ctrl.InsertColumn(0, "Codigo")
        self.list_ctrl.InsertColumn(1, "Marca")
        self.list_ctrl.InsertColumn(2, "Descripcion")
        self.list_ctrl.InsertColumn(3, "Precio")
        self.list_ctrl.InsertColumn(4, "Stock")
        self.list_ctrl.InsertColumn(5, "P-Pedido")

        index = 0
        for row in rows:
            if row[0] != '1000':
               self.list_ctrl.InsertStringItem(index, row[0])
               self.list_ctrl.SetStringItem(index, 1, row[1])
               self.list_ctrl.SetStringItem(index, 2, row[2])
               self.list_ctrl.SetStringItem(index, 3, row[3])
               self.list_ctrl.SetStringItem(index, 4, row[4])
               self.list_ctrl.SetStringItem(index, 5, row[5])
             
               if int( row[4] ) <= int( row[5] ):
                   self.list_ctrl.SetItemBackgroundColour(index, "red")
               else:
                   if index % 2:
                       self.list_ctrl.SetItemBackgroundColour(index, "white")
                   else:
                       self.list_ctrl.SetItemBackgroundColour(index, "gray")

               index += 1

        self.Bind(wx.EVT_BUTTON, self.onSearch, self.btn_cal)
        self.Bind(wx.EVT_BUTTON, self.onAdd, self.btn_add)
        self.Bind(wx.EVT_BUTTON, self.onPrint, self.btn_prt)
        self.Bind(wx.EVT_BUTTON, self.onDel, self.btn_del)

        sizer  = wx.BoxSizer(wx.VERTICAL)
        sizer2 = wx.BoxSizer(wx.HORIZONTAL)

        sizer2.Add(self.btn_cal, 0, wx.ALL, 1)
        sizer2.Add(self.btn_add, 0, wx.ALL, 1)
        sizer2.Add(self.btn_del, 0, wx.ALL, 1)
        sizer2.Add(self.btn_mod, 0, wx.ALL, 1)
        sizer2.Add(self.btn_prt, 0, wx.ALL, 1)
        sizer.Add(sizer2, 0, wx.ALL, 1)
        sizer.Add(self.list_ctrl, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Show(True)
#.........這裏部分代碼省略.........
開發者ID:gaccardo,項目名稱:canchas,代碼行數:103,代碼來源:CanchasMenuStock.py


注:本文中的DBManager.DBManager.getProductos方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。