Exemplo n.º 1
0
    def __init__(self, parent):
        FrmMain.FrmMain.__init__(self, parent)
        bsLocs = self.btnDestroy.GetContainingSizer()
        self.btnDestroy.Destroy()
        for loc in locations:
            loc_id = loc.replace(" ", "_")
            loc_box = BoxSizer()
            loc_box.SetOrientation(wx.VERTICAL)
            cbl_lbl = StaticText(self)
            cbl_lbl.Label = str(loc)
            cbl_lbl.SetName("col_{}".format(loc_id))
            cbl_lbl.Bind(wx.EVT_LEFT_UP, self.btnSelectLoc_Click)
            cbl_loc = CheckListBox(self)
            cbl_loc.SetName(loc_id)
            loc_box.Add(cbl_lbl, 0, wx.ALL, 5)
            loc_box.Add(cbl_loc, 0, wx.ALL, 5)
            bsLocs.Add(loc_box, 0, wx.ALL, 5)
        for p in printers:
            lid = p["Location"].replace(" ", "_")
            loc_list = self.FindWindowByName(lid, self)
            index = len(loc_list.Items) - 1
            if index < 0:
                index = 0

            loc_list.InsertItems([p["Path"]], index)
            # loc_list.SetString(index, p["Printer"])

        self.Layout()
        self.Fit()
        self.Show(True)
Exemplo n.º 2
0
def statictext(element, instance: wx.StaticText):
    # TODO: it does NOT response to 'SetValue'
    # this means set_basic needs to accept a map, not use
    # a fixed list.
    props = element['props']
    set_basic_props(instance, props)
    instance.Unbind(wx.EVT_LEFT_DOWN)
    if 'on_click' in props:
        instance.Bind(wx.EVT_LEFT_DOWN, props['on_click'])
    return instance