当前位置: 首页>>代码示例>>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;未经允许,请勿转载。