Python wx.LC_REPORT Examples

The following are 30 code examples of wx.LC_REPORT(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 7 votes vote down vote up
def __init__(self, parent, id, evtList, ix, plugin):
        width = 205
        wx.ListCtrl.__init__(self, parent, id, style=wx.LC_REPORT |
            wx.LC_NO_HEADER | wx.LC_SINGLE_SEL, size = (width, -1))
        self.parent = parent
        self.id = id
        self.evtList = evtList
        self.ix = ix
        self.plugin = plugin
        self.sel = -1
        self.il = wx.ImageList(16, 16)
        self.il.Add(wx.BitmapFromImage(wx.Image(join(eg.imagesDir, "event.png"), wx.BITMAP_TYPE_PNG)))
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
        self.InsertColumn(0, '')
        self.SetColumnWidth(0, width - 5 - SYS_VSCROLL_X)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelect)
        self.Bind(wx.EVT_SET_FOCUS, self.OnChange)
        self.Bind(wx.EVT_LIST_INSERT_ITEM, self.OnChange)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnChange)
        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightClick)
        self.SetToolTipString(self.plugin.text.toolTip) 
Example #2
Source File: namesdlg.py    From trelby with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent):
        wx.ListCtrl.__init__(self, parent, -1,
            style = wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_SINGLE_SEL |
                    wx.LC_HRULES | wx.LC_VRULES)

        self.sex = ["Female", "Male"]

        self.InsertColumn(0, "Name")
        self.InsertColumn(1, "Type")
        self.InsertColumn(2, "Sex")
        self.SetColumnWidth(0, 120)
        self.SetColumnWidth(1, 120)

        # we can't use wx.LIST_AUTOSIZE since this is a virtual control,
        # so calculate the size ourselves since we know the longest string
        # possible.
        w = util.getTextExtent(self.GetFont(), "Female")[0] + 15
        self.SetColumnWidth(2, w)

        util.setWH(self, w = 120*2 + w + 25) 
Example #3
Source File: toplevels_no_size_Phoenix.py    From wxGlade with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: wxgMeasurementsByDayPnl.__init__
        kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)

        __szr_main = wx.BoxSizer(wx.HORIZONTAL)

        self._LCTRL_days = cReportListCtrl(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.LC_REPORT)
        self._LCTRL_days.SetMinSize((100, 100))
        __szr_main.Add(self._LCTRL_days, 1, wx.EXPAND | wx.RIGHT, 5)

        self._LCTRL_days_copy = cReportListCtrl(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.LC_REPORT)
        self._LCTRL_days_copy.SetMinSize((100, 100))
        __szr_main.Add(self._LCTRL_days_copy, 1, wx.EXPAND | wx.RIGHT, 5)

        self.SetSizer(__szr_main)
        __szr_main.Fit(self)

        self.Layout()

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_day_selected, self._LCTRL_days)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_day_selected, self._LCTRL_days_copy)
        # end wxGlade 
Example #4
Source File: toplevels_no_size_Classic.py    From wxGlade with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: wxgMeasurementsByDayPnl.__init__
        kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)

        __szr_main = wx.BoxSizer(wx.HORIZONTAL)

        self._LCTRL_days = cReportListCtrl(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.LC_REPORT)
        self._LCTRL_days.SetMinSize((100, 100))
        __szr_main.Add(self._LCTRL_days, 1, wx.EXPAND | wx.RIGHT, 5)

        self._LCTRL_days_copy = cReportListCtrl(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.LC_REPORT)
        self._LCTRL_days_copy.SetMinSize((100, 100))
        __szr_main.Add(self._LCTRL_days_copy, 1, wx.EXPAND | wx.RIGHT, 5)

        self.SetSizer(__szr_main)
        __szr_main.Fit(self)

        self.Layout()

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_day_selected, self._LCTRL_days)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_day_selected, self._LCTRL_days_copy)
        # end wxGlade 
Example #5
Source File: ListCtrl_Report_Classic.py    From wxGlade with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetTitle("frame")

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        self.list_ctrl_1 = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES)
        self.list_ctrl_1.InsertColumn(0, "A", format=wx.LIST_FORMAT_LEFT, width=-1)
        self.list_ctrl_1.InsertColumn(1, "B", format=wx.LIST_FORMAT_LEFT, width=-1)
        self.list_ctrl_1.InsertColumn(2, "C", format=wx.LIST_FORMAT_LEFT, width=-1)
        self.list_ctrl_1.InsertColumn(3, "D", format=wx.LIST_FORMAT_LEFT, width=-1)
        sizer_1.Add(self.list_ctrl_1, 1, wx.EXPAND, 0)

        self.SetSizer(sizer_1)
        sizer_1.Fit(self)

        self.Layout()
        # end wxGlade

# end of class MyFrame 
Example #6
Source File: dialog_dllog.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"控制台日志", pos=wx.DefaultPosition, size=wx.Size(500, 500),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        sizer_global = wx.BoxSizer(wx.VERTICAL)
        self.textctrl_log = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(427, 381),
                                           wx.TE_AUTO_URL | wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB)

        # self.listctrl_log = ListCtrl_DLLog(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT)
        sizer_global.Add(self.textctrl_log, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(sizer_global)
        self.Layout()

        self.Centre(wx.BOTH)
        self.Bind(wx.EVT_CLOSE, self.onClose) 
Example #7
Source File: dialog_copylink.py    From iqiyi-parser with MIT License 6 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"链接浏览窗口", pos=wx.DefaultPosition, size=wx.Size(500, 500),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        sizer_global = wx.BoxSizer(wx.VERTICAL)

        self.listctrl_links = ListCtrl_CopyLink(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT)
        sizer_global.Add(self.listctrl_links, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(sizer_global)
        self.Layout()

        self.Centre(wx.BOTH)
        self.Bind(wx.EVT_CLOSE, self.onClose) 
Example #8
Source File: MonitorsCtrl.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, pos, size = wx.DefaultSize):
        ID = wx.NewId()
        style = wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL
        wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
        mons = [(i[0], i[1], i[2] - i[0], i[3] - i[1]) for i in [j[2] for j in Edm()]]
        for j, header in enumerate(eg.text.General.monitorsHeader):
            self.InsertColumn(j, header, wx.LIST_FORMAT_RIGHT)
            self.SetColumnWidth(j, wx.LIST_AUTOSIZE_USEHEADER)
        for i, mon in enumerate(mons):
            self.InsertStringItem(i, str(i + 1))
            self.SetStringItem(i, 1, str(mon[0]))
            self.SetStringItem(i, 2, str(mon[1]))
            self.SetStringItem(i, 3, str(mon[2]))
            self.SetStringItem(i, 4, str(mon[3]))
        rect = self.GetItemRect(0, wx.LIST_RECT_BOUNDS)
        self.hh = rect[1]  #header height
        self.ih = rect[3]  #item height
        size = self.GetRealSize()
        self.SetMinSize(size)
        self.SetSize(size) 
Example #9
Source File: listviews.py    From pyFileFixity with MIT License 6 votes vote down vote up
def __init__(
        self, parent,
        id=-1,
        pos=wx.DefaultPosition, size=wx.DefaultSize,
        style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_VRULES|wx.LC_SINGLE_SEL,
        validator=wx.DefaultValidator,
        columns=None,
        sortOrder=None,
        name=_("ProfileView"),
    ):
        wx.ListCtrl.__init__(self, parent, id, pos, size, style, validator,
                             name)

        if columns is not None:
            self.columns = columns

        if not sortOrder:
            sortOrder = [(x.defaultOrder,x) for x in self.columns if x.sortDefault]
        self.sortOrder = sortOrder or []
        self.sorted = []
        self.CreateControls() 
Example #10
Source File: JobSpooler.py    From meerk40t with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: JobSpooler.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        Module.__init__(self)
        self.SetSize((661, 402))
        self.list_job_spool = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_LIST_BEGIN_DRAG, self.on_list_drag, self.list_job_spool)
        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.on_item_rightclick, self.list_job_spool)
        # end wxGlade
        self.dirty = False
        self.update_buffer_size = False
        self.update_spooler_state = False
        self.update_spooler = False

        self.elements_progress = 0
        self.elements_progress_total = 0
        self.command_index = 0
        self.listener_list = None
        self.list_lookup = {}
        self.Bind(wx.EVT_CLOSE, self.on_close, self) 
Example #11
Source File: Keymap.py    From meerk40t with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: Keymap.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        Module.__init__(self)
        self.SetSize((500, 530))
        self.list_keymap = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES)
        self.button_add = wx.Button(self, wx.ID_ANY, _("Add Hotkey"))
        self.text_key_name = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_command_name = wx.TextCtrl(self, wx.ID_ANY, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_button_add_hotkey, self.button_add)
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        self.text_key_name.Bind(wx.EVT_KEY_DOWN, self.on_key_press)
        self.SetFocus() 
Example #12
Source File: DiscoveryPanel.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def _init_list_ctrl(self):
        # Set up list control
        listID = wx.NewId()
        self.ServicesList = AutoWidthListCtrl(
            id=listID,
            name='ServicesList', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0),
            style=wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_SINGLE_SEL)
        self.ServicesList.InsertColumn(0, _('NAME'))
        self.ServicesList.InsertColumn(1, _('TYPE'))
        self.ServicesList.InsertColumn(2, _('IP'))
        self.ServicesList.InsertColumn(3, _('PORT'))
        self.ServicesList.SetColumnWidth(0, 150)
        self.ServicesList.SetColumnWidth(1, 150)
        self.ServicesList.SetColumnWidth(2, 150)
        self.ServicesList.SetColumnWidth(3, 150)
        self.ServicesList.SetInitialSize(wx.Size(-1, 300))
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, id=listID)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, id=listID) 
Example #13
Source File: ObjectListView.py    From bookhub with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        self.lastGetObjectIndex = -1
        self.lastGetObject = None
        self.objectGetter = None
        self.listItemAttr = None
        #self.cacheHit = 0
        #self.cacheMiss = 0

        self.SetObjectGetter(kwargs.pop("getter", None))

        # We have to set the item count after the list has been created
        if "count" in kwargs:
            wx.CallAfter(self.SetItemCount, kwargs.pop("count"))

        # Virtual lists have to be in report format
        kwargs["style"] = kwargs.get("style", 0) | wx.LC_REPORT | wx.LC_VIRTUAL

        ObjectListView.__init__(self, *args, **kwargs)


    #----------------------------------------------------------------------------
    # Commands 
Example #14
Source File: DeviceManager.py    From meerk40t with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: DeviceManager.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((707, 337))
        self.devices_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES)
        self.new_device_button = wx.BitmapButton(self, wx.ID_ANY, icons8_plus_50.GetBitmap())
        self.remove_device_button = wx.BitmapButton(self, wx.ID_ANY, icons8_trash_50.GetBitmap())
        self.device_properties_button = wx.BitmapButton(self, wx.ID_ANY, icons8_administrative_tools_50.GetBitmap())
        self.move_item_up_button = wx.BitmapButton(self, wx.ID_ANY, icons8up.GetBitmap())
        self.move_item_down_button = wx.BitmapButton(self, wx.ID_ANY, icons8_down.GetBitmap())

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_LIST_BEGIN_DRAG, self.on_list_drag, self.devices_list)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.on_list_item_activated, self.devices_list)
        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.on_list_right_click, self.devices_list)
        self.Bind(wx.EVT_BUTTON, self.on_button_new, self.new_device_button)
        self.Bind(wx.EVT_BUTTON, self.on_button_remove, self.remove_device_button)
        self.Bind(wx.EVT_BUTTON, self.on_button_properties, self.device_properties_button)
        self.Bind(wx.EVT_BUTTON, self.on_button_up, self.move_item_up_button)
        self.Bind(wx.EVT_BUTTON, self.on_button_down, self.move_item_down_button)
        # end wxGlade

        self.Bind(wx.EVT_CLOSE, self.on_close, self) 
Example #15
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def Configure(self, *args):
        result = [None]
        panel = eg.ConfigPanel()
        panel.dialog.buttonRow.okButton.Enable(False)
        panel.dialog.buttonRow.applyButton.Enable(False)

        def OnButton(event):
            FillList(eg.WinApi.Display.GetDisplayModes())
            panel.dialog.buttonRow.okButton.Enable(True)
            panel.dialog.buttonRow.applyButton.Enable(True)

        button = wx.Button(panel, -1, self.text.query)
        button.Bind(wx.EVT_BUTTON, OnButton)
        panel.sizer.Add(button)
        panel.sizer.Add((5, 5))
        listCtrl = wx.ListCtrl(panel, style=wx.LC_REPORT)
        fields = self.text.fields
        for col, name in enumerate(fields):
            listCtrl.InsertColumn(col, name)

        def FillList(args):
            result[0] = args
            listCtrl.DeleteAllItems()
            for i, argLine in enumerate(args):
                listCtrl.InsertStringItem(i, "")
                for col, arg in enumerate(argLine):
                    listCtrl.SetStringItem(i, col, str(arg))
        FillList(args)

        for i in range(1, len(fields)):
            listCtrl.SetColumnWidth(i, -2)
        x = 0
        for i in range(len(fields)):
            x += listCtrl.GetColumnWidth(i)
        listCtrl.SetMinSize((x + 4, -1))
        panel.sizer.Add(listCtrl, 1, wx.EXPAND)

        while panel.Affirmed():
            panel.SetResult(*result[0]) 
Example #16
Source File: EventRemapDialog.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, mapping=None):
        eg.Dialog.__init__(
            self, parent, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        )
        listCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT)
        listCtrl.InsertColumn(0, "New event name")
        listCtrl.InsertColumn(1, "Events")
        listCtrl.InsertColumn(2, "Repeat events")
        listCtrl.InsertColumn(3, "Timeout")

        newEventCtrl = self.TextCtrl()
        eventsCtrl = self.TextCtrl()
        repeatEventsCtrl = self.TextCtrl()

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(listCtrl, 1, wx.EXPAND)

        editSizer = wx.GridSizer(1, 2)
        editSizer.Add(
            self.StaticText("New event name:"),
            wx.ALIGN_CENTER_VERTICAL
        )
        editSizer.Add(newEventCtrl, 0)
        editSizer.Add(
            self.StaticText("Events:"),
            wx.ALIGN_CENTER_VERTICAL
        )
        editSizer.Add(eventsCtrl, 0)
        editSizer.Add(
            self.StaticText("Repeat events:"),
            wx.ALIGN_CENTER_VERTICAL
        )
        editSizer.Add(repeatEventsCtrl, 0)

        sizer.Add(editSizer)
        self.SetSizerAndFit(sizer) 
Example #17
Source File: WindowList.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, hwnds):
        wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
        listmix.ListCtrlAutoWidthMixin.__init__(self)
        imageList = wx.ImageList(16, 16)
        imageList.Add(GetInternalBitmap("cwindow"))
        self.AssignImageList(imageList, wx.IMAGE_LIST_SMALL)
        self.InsertColumn(0, "Program")
        self.InsertColumn(1, "Name")
        self.InsertColumn(2, "Class")
        self.InsertColumn(3, "Handle", wx.LIST_FORMAT_RIGHT)
        for hwnd in hwnds:
            imageIdx = 0
            icon = GetHwndIcon(hwnd)
            if icon:
                imageIdx = imageList.AddIcon(icon)
            idx = self.InsertImageStringItem(
                sys.maxint,
                GetWindowProcessName(hwnd),
                imageIdx
            )
            self.SetStringItem(idx, 1, GetWindowText(hwnd))
            self.SetStringItem(idx, 2, GetClassName(hwnd))
            self.SetStringItem(idx, 3, str(hwnd))
        for i in range(4):
            self.SetColumnWidth(i, -2)
            headerSize = self.GetColumnWidth(i)
            self.SetColumnWidth(i, -1)
            labelSize = self.GetColumnWidth(i)
            if headerSize > labelSize:
                self.SetColumnWidth(i, headerSize) 
Example #18
Source File: frame_overview.py    From bookhub with MIT License 5 votes vote down vote up
def BuildUI(self):
        self.SearchFile = wx.SearchCtrl(self)
        self.myOlv = ObjectListView(self, -1,
                                    style=wx.LC_REPORT | wx.SUNKEN_BORDER)
        size_main = wx.BoxSizer(wx.VERTICAL)
        size_main.Add(self.SearchFile, 1, wx.ALL | wx.EXPAND, 2)
        size_main.Add(self.myOlv, 20, wx.ALL | wx.EXPAND, 4)
        self.SetSizer(size_main)
        self.Layout()
        self.CenterOnScreen()

        self.myOlv.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnOpenFile)
        self.myOlv.Bind(wx.EVT_LIST_KEY_DOWN, self.OnKeyDown) 
Example #19
Source File: OLVPrinter.py    From bookhub with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
            kwds["style"] = wx.DEFAULT_FRAME_STYLE
            wx.Frame.__init__(self, *args, **kwds)

            self.panel = wx.Panel(self, -1)
            self.olv = ObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            self.olv = GroupListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            #self.olv = FastObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            #self.olv = VirtualObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)

            sizer_2 = wx.BoxSizer(wx.VERTICAL)
            sizer_2.Add(self.olv, 1, wx.ALL|wx.EXPAND, 4)
            self.panel.SetSizer(sizer_2)
            self.panel.Layout()

            sizer_1 = wx.BoxSizer(wx.VERTICAL)
            sizer_1.Add(self.panel, 1, wx.EXPAND)
            self.SetSizer(sizer_1)
            self.Layout()

            groupImage = self.olv.AddImages(ExampleImages.getGroup16Bitmap(), ExampleImages.getGroup32Bitmap())
            userImage = self.olv.AddImages(ExampleImages.getUser16Bitmap(), ExampleImages.getUser32Bitmap())
            musicImage = self.olv.AddImages(ExampleImages.getMusic16Bitmap(), ExampleImages.getMusic32Bitmap())

            self.olv.SetColumns([
                ColumnDefn("Title", "left", 120, "title", imageGetter=musicImage),
                ColumnDefn("Artist", "left", 120, "artist", imageGetter=groupImage),
                ColumnDefn("Last Played", "left", 100, "lastPlayed"),
                ColumnDefn("Size", "center", 100, "sizeInBytes"),
                ColumnDefn("Rating", "center", 100, "rating")
            ])
            #self.olv.CreateCheckStateColumn()
            self.olv.SetSortColumn(self.olv.columns[2])
            self.olv.SetObjects(ExampleModel.GetTracks())

            wx.CallLater(50, self.run) 
Example #20
Source File: ListCtrlPrinter.py    From bookhub with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwds):
            kwds["style"] = wx.DEFAULT_FRAME_STYLE
            wx.Frame.__init__(self, *args, **kwds)

            self.panel = wx.Panel(self, -1)
            #self.lv = ObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            self.lv = GroupListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
            #self.lv = FastObjectListView(self.panel, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)

            sizer_2 = wx.BoxSizer(wx.VERTICAL)
            sizer_2.Add(self.lv, 1, wx.ALL|wx.EXPAND, 4)
            self.panel.SetSizer(sizer_2)
            self.panel.Layout()

            sizer_1 = wx.BoxSizer(wx.VERTICAL)
            sizer_1.Add(self.panel, 1, wx.EXPAND)
            self.SetSizer(sizer_1)
            self.Layout()

            musicImage = self.lv.AddImages(ExampleImages.getMusic16Bitmap(), ExampleImages.getMusic32Bitmap())
            artistImage = self.lv.AddImages(ExampleImages.getUser16Bitmap(), ExampleImages.getUser32Bitmap())

            self.lv.SetColumns([
                ColumnDefn("Title", "left", 200, "title", imageGetter=musicImage),
                ColumnDefn("Artist", "left", 150, "artist", imageGetter=artistImage),
                ColumnDefn("Last Played", "left", 100, "lastPlayed"),
                ColumnDefn("Size", "center", 100, "sizeInBytes"),
                ColumnDefn("Rating", "center", 100, "rating"),
             ])

            #self.lv.CreateCheckStateColumn()
            self.lv.SetSortColumn(self.lv.columns[2])
            self.lv.SetObjects(ExampleModel.GetTracks())

            wx.CallLater(50, self.run) 
Example #21
Source File: ObjectListView.py    From bookhub with MIT License 5 votes vote down vote up
def _HandleTabKey(self, isShiftDown):
        """
        Handle a Tab key during a cell edit operation
        """
        (rowBeingEdited, subItem) = self.cellBeingEdited

        # Prevent a nasty flicker when tabbing between fields where the selected rows
        # are restored at the end of one cell edit, and removed at the start of the next
        shadowSelection = self.selectionBeforeCellEdit
        self.selectionBeforeCellEdit = []
        self.FinishCellEdit()

        # If we are in report view, move to the next (or previous) editable subitem,
        # wrapping at the edges
        if self.HasFlag(wx.LC_REPORT):
            columnCount = self.GetColumnCount()
            for ignored in range(columnCount-1):
                if isShiftDown:
                    subItem = (columnCount + subItem - 1) % columnCount
                else:
                    subItem = (subItem + 1) % columnCount
                if self.columns[subItem].isEditable and self.GetColumnWidth(subItem) > 0:
                    self.StartCellEdit(rowBeingEdited, subItem)
                    break

        self.selectionBeforeCellEdit = shadowSelection


    #--------------------------------------------------------------#000000#FFFFFF
    # Sorting 
Example #22
Source File: esafenet_gui.py    From E-Safenet with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MainFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        
        # Menu Bar
        self.frame_2_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        self.opf = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "Open folder..", "", wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendItem(self.opf)

        self.opfi = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "Open file..", "", wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendItem(self.opfi)
        wxglade_tmp_menu.AppendSeparator()
        self.ana = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "Analyze", "", wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendItem(self.ana)
        self.frame_2_menubar.Append(wxglade_tmp_menu, "File")
        self.SetMenuBar(self.frame_2_menubar)
        # Menu Bar end
        self.list_ctrl_1 = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER)
        for i in range(512):
            self.list_ctrl_1.InsertColumn(i, str(i), width=30)
        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_MENU, self.of, self.opf)
        self.Bind(wx.EVT_MENU, self.anlz, self.ana)
        self.Bind(wx.EVT_MENU, self.ofi, self.opfi)
        # end wxGlade 
Example #23
Source File: dnd_list.py    From PandasDataFrameGUI with MIT License 5 votes vote down vote up
def __init__(self, *arg, **kw):
        if 'style' in kw and (kw['style']&wx.LC_LIST or kw['style']&wx.LC_REPORT):
            kw['style'] |= wx.LC_SINGLE_SEL
        else:
            kw['style'] = wx.LC_SINGLE_SEL|wx.LC_LIST

        wx.ListCtrl.__init__(self, *arg, **kw)

        self.Bind(wx.EVT_LIST_BEGIN_DRAG, self._startDrag)

        dt = ListDrop(self._insert)
        self.SetDropTarget(dt) 
Example #24
Source File: CAN-USB-stick.py    From openplotter with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, width,height):
		wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT, size=(width, height))
		CheckListCtrlMixin.__init__(self)
		ListCtrlAutoWidthMixin.__init__(self) 
Example #25
Source File: NMEA_2000_generator.py    From openplotter with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, height):
		wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER, size=(565, height))
		CheckListCtrlMixin.__init__(self)
		ListCtrlAutoWidthMixin.__init__(self) 
Example #26
Source File: gui.py    From superpaper with MIT License 5 votes vote down vote up
def create_sizer_paths(self):
        self.sizer_setting_paths = wx.StaticBoxSizer(wx.VERTICAL, self, "Wallpaper paths")
        self.statbox_parent_paths = self.sizer_setting_paths.GetStaticBox()
        st_paths_info = wx.StaticText(self.statbox_parent_paths, -1, "Browse to add your wallpaper files or source folders here:")
        if self.use_multi_image:
            self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1,
                                              style=wx.LC_REPORT
                                              | wx.BORDER_SIMPLE
                                              | wx.LC_SORT_ASCENDING
                                             )
            self.path_listctrl.InsertColumn(0, 'Display', wx.LIST_FORMAT_RIGHT, width = 100)
            self.path_listctrl.InsertColumn(1, 'Source', width = 400)
        else:
            # show simpler listing without header if only one wallpaper target
            self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1,
                                              style=wx.LC_REPORT
                                              | wx.BORDER_SIMPLE
                                              | wx.LC_NO_HEADER
                                             )
            self.path_listctrl.InsertColumn(0, 'Source', width = 500)
        self.path_listctrl.SetImageList(self.image_list, wx.IMAGE_LIST_SMALL)

        self.sizer_setting_paths.Add(st_paths_info, 0, wx.ALIGN_LEFT|wx.ALL, 5)
        self.sizer_setting_paths.Add(
            self.path_listctrl, 1, wx.CENTER|wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5
            )
        # Buttons
        self.sizer_setting_paths_buttons = wx.BoxSizer(wx.HORIZONTAL)
        self.button_browse = wx.Button(self.statbox_parent_paths, label="Browse")
        self.button_remove_source = wx.Button(self.statbox_parent_paths, label="Remove selected source")
        self.button_browse.Bind(wx.EVT_BUTTON, self.onBrowsePaths)
        self.button_remove_source.Bind(wx.EVT_BUTTON, self.onRemoveSource)
        self.sizer_setting_paths_buttons.Add(self.button_browse, 0, wx.CENTER|wx.ALL, 5)
        self.sizer_setting_paths_buttons.Add(self.button_remove_source, 0, wx.CENTER|wx.ALL, 5)
        # add button sizer to parent paths sizer
        self.sizer_setting_paths.Add(self.sizer_setting_paths_buttons, 0, wx.CENTER|wx.EXPAND|wx.ALL, 0)

        self.sizer_settings_right.Add(
            self.sizer_setting_paths, 1, wx.CENTER|wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5
        ) 
Example #27
Source File: gui.py    From superpaper with MIT License 5 votes vote down vote up
def refresh_path_listctrl(self, use_multi_image, migrate_paths=False):
        if use_multi_image == self.multi_column_listc and migrate_paths:
            self.sizer_main.Layout()
        else:
            if migrate_paths and self.path_listctrl.GetItemCount():
                # warn that paths can't be migrated
                msg = ("Wallpaper sources cannot be migrated between span"
                       " and multi image, continue?"
                       "\n"
                       "Saved sources are not affected until you overwrite.")
                res = show_message_dialog(msg, style="YES_NO")
                if not res:
                    # user canceled
                    return False
            self.path_listctrl.Destroy()
            self.image_list.RemoveAll()
            if use_multi_image:
                self.multi_column_listc = True
                self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1,
                                                 style=wx.LC_REPORT
                                                 | wx.BORDER_SIMPLE
                                                 | wx.LC_SORT_ASCENDING
                                                )
                self.path_listctrl.InsertColumn(0, 'Display', wx.LIST_FORMAT_RIGHT, width=100)
                self.path_listctrl.InsertColumn(1, 'Source', width=400)
            else:
                self.multi_column_listc = False
                # show simpler listing without header if only one wallpaper target
                self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1,
                                                 style=wx.LC_REPORT
                                                 | wx.BORDER_SIMPLE
                                                 | wx.LC_NO_HEADER
                                                )
                self.path_listctrl.InsertColumn(0, 'Source', width=500)
            self.path_listctrl.SetImageList(self.image_list, wx.IMAGE_LIST_SMALL)
            self.sizer_setting_paths.Insert(1, self.path_listctrl, 1,
                                            wx.CENTER | wx.EXPAND | wx.ALL, 5)
            self.path_listctrl.InvalidateBestSize()
            self.sizer_main.Layout()
        return True 
Example #28
Source File: systray.py    From p2ptv-pi with MIT License 5 votes vote down vote up
def __init__(self, bgapp, title):
        wx.Frame.__init__(self, None, title=title, pos=(50, 10), size=(1100, 450))
        self.bgapp = bgapp
        self.spewwait = clock()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.SetBackgroundColour(wx.Colour(255, 255, 255))
        fw = 12
        spewList = wx.ListCtrl(self, pos=(0, 0), size=(1000, 300), style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES)
        spewList.InsertColumn(0, 'Optimistic Unchoke', format=wx.LIST_FORMAT_CENTER, width=fw * 2)
        spewList.InsertColumn(1, 'Peer ID', width=0)
        spewList.InsertColumn(2, 'IP', width=fw * 11)
        spewList.InsertColumn(3, 'Local/Remote', format=wx.LIST_FORMAT_CENTER, width=fw * 2)
        spewList.InsertColumn(4, 'Up', format=wx.LIST_FORMAT_RIGHT, width=fw * 2)
        spewList.InsertColumn(5, 'Interested', format=wx.LIST_FORMAT_CENTER, width=fw * 2)
        spewList.InsertColumn(6, 'Choking', format=wx.LIST_FORMAT_CENTER, width=fw * 2)
        spewList.InsertColumn(7, 'Down', format=wx.LIST_FORMAT_RIGHT, width=fw * 8)
        spewList.InsertColumn(8, 'Interesting', format=wx.LIST_FORMAT_CENTER, width=fw * 2)
        spewList.InsertColumn(9, 'Choked', format=wx.LIST_FORMAT_CENTER, width=fw * 2)
        spewList.InsertColumn(10, 'Snubbed', format=wx.LIST_FORMAT_CENTER, width=fw * 2)
        spewList.InsertColumn(11, 'Downloaded', format=wx.LIST_FORMAT_RIGHT, width=fw * 5)
        spewList.InsertColumn(12, 'Uploaded', format=wx.LIST_FORMAT_RIGHT, width=fw * 5)
        spewList.InsertColumn(13, 'Completed', format=wx.LIST_FORMAT_RIGHT, width=fw * 6)
        spewList.InsertColumn(14, 'Peer Download Speed', format=wx.LIST_FORMAT_RIGHT, width=fw * 10)
        spewList.InsertColumn(15, 'Requested Piece', format=wx.LIST_FORMAT_CENTER, width=fw * 6)
        spewList.InsertColumn(16, 'Received Piece', format=wx.LIST_FORMAT_CENTER, width=fw * 6)
        self.spewList = spewList
        labelVOD = wx.StaticText(self, -1, 'static text')
        self.labelVOD = labelVOD
        gridSizer = wx.FlexGridSizer(cols=1, vgap=5)
        gridSizer.Add(spewList, -1, wx.EXPAND)
        gridSizer.Add(labelVOD, -1, wx.EXPAND)
        self.SetSizer(gridSizer)
        self.bgapp.statFrame = self 
Example #29
Source File: dfgui.py    From PandasDataFrameGUI with MIT License 5 votes vote down vote up
def __init__(self, parent, df, status_bar_callback):
        wx.ListCtrl.__init__(
            self, parent, -1,
            style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES | wx.LC_VRULES | wx.LB_MULTIPLE
        )
        self.status_bar_callback = status_bar_callback

        self.df_orig = df
        self.original_columns = self.df_orig.columns[:]
        if isinstance(self.original_columns,(pd.RangeIndex,pd.Int64Index)):
            # RangeIndex is not supported by self._update_columns
            self.original_columns = pd.Index([str(i) for i in self.original_columns])
        self.current_columns = self.df_orig.columns[:]

        self.sort_by_column = None

        self._reset_mask()

        # prepare attribute for alternating colors of rows
        self.attr_light_blue = wx.ListItemAttr()
        self.attr_light_blue.SetBackgroundColour("#D6EBFF")

        self.Bind(wx.EVT_LIST_COL_CLICK, self._on_col_click)
        self.Bind(wx.EVT_RIGHT_DOWN, self._on_right_click)

        self.df = pd.DataFrame({})  # init empty to force initial update
        self._update_rows()
        self._update_columns(self.original_columns) 
Example #30
Source File: ListCtrl.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent):
        wx.ListCtrl.__init__(self, parent, wx.ID_ANY, style=wx.LC_REPORT)
        ContextMenuMixin.__init__(self)

        self.il = wx.ImageList(self.icon_size, self.icon_size)
        # TODO: use a real icon
        self.il.Add(self.draw_blank())
        self.il.Add(self.draw_sort_arrow('up'))
        self.il.Add(self.draw_sort_arrow('down'))
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)

        self.update_enabled_columns()

        for i, name in enumerate(self.enabled_columns):
            column = self.columns[name]
            column.SetColumn(i)
            self.InsertColumnItem(i, column)

        self.itemData_to_row = {}
        self.index_to_itemData = {}

        self.selected_column = None
        self.SelectColumn(self.enabled_columns[0])

        cmenu = wx.Menu()
        for name in self.column_order:
            column = self.columns[name]
            id = wx.NewId()
            cmenu.AppendCheckItem(id, column.GetText())
            cmenu.Check(id, column.enabled)
            self.Bind(wx.EVT_MENU,
                      lambda e, c=column, id=id: self.toggle_column(c, id, e),
                      id=id)
        self.SetColumnContextMenu(cmenu)

        ColumnSorterMixin.__init__(self, len(self.enabled_columns))
        self._last_scrollpos = 0
        if sys.platform != "darwin":
            self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)

        self.default_rect = wx.Rect(0,0)