diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-14 15:18:07 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-14 15:18:07 -0400 |
commit | e7d150fd7ca22b01defd0c615000b6bfc367aacf (patch) | |
tree | eacb8fbc153b3b15b48cc5d2ddfee9608d431c23 /interfaces/gui/wxbe | |
parent | c38907c85bbb62a2b3bb00dd05eeb588ecc6845d (diff) | |
download | bugseverywhere-e7d150fd7ca22b01defd0c615000b6bfc367aacf.tar.gz |
Reorganized directory structure, mostly to put all the interfaces in
one place and make things clearer to the uninitiated. Here's my
current understanding:
.
|-- libbe (the guts of BE)
|-- becommands (plugins for all "be *" commands)
|-- doc (documentation, currently just the man page)
|-- interfaces (non-commandline interface implementations)
| |-- web
| | |-- Bugs-Everywhere-Web (in Turbogears)
| |-- gui
| | |-- beg (in Tkinter)
| | `-- wxbe (in WX)
| |-- email
| `-- xml (xml <-> whatever conversion)
`-- misc (random odds and ends)
`-- completion (shell completion scripts)
Note that I haven't attempted to use the web or gui interfaces in a
while, so I'm not sure how well they're holding vs the core
development.
Diffstat (limited to 'interfaces/gui/wxbe')
-rwxr-xr-x | interfaces/gui/wxbe/wxbe | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/interfaces/gui/wxbe/wxbe b/interfaces/gui/wxbe/wxbe new file mode 100755 index 0000000..e71ae0c --- /dev/null +++ b/interfaces/gui/wxbe/wxbe @@ -0,0 +1,87 @@ +#!/usr/bin/env python +import wx +from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin +import sys, os.path +from libbe import bugdir, names +from libbe.bug import cmp_status, cmp_severity, cmp_time, cmp_full + +class MyApp(wx.App): + def OnInit(self): + frame = BugListFrame(None, title="Bug List") + frame.Show(True) + self.SetTopWindow(frame) + return True + +class BugListFrame(wx.Frame): + def __init__(self, *args, **kwargs): + wx.Frame.__init__(self, *args, **kwargs) + bugs = BugList(self) + + # Widgets to display/sort/edit will go in this panel + # for now it is just a placeholder + panel = wx.Panel(self) + panel.SetBackgroundColour("RED") + + vbox = wx.BoxSizer(wx.VERTICAL) + vbox.Add(panel, 0, wx.EXPAND) + vbox.Add(bugs, 1, wx.EXPAND) + + self.SetAutoLayout(True) + self.SetSizer(vbox) + self.Layout() + +class BugList(wx.ListCtrl, ListCtrlAutoWidthMixin): + def __init__(self, parent): + wx.ListCtrl.__init__(self, parent, + style=wx.LC_REPORT) + ListCtrlAutoWidthMixin.__init__(self) + + self.bugdir = bugdir.tree_root(".") + self.buglist = list(self.bugdir.list()) + self.buglist.sort() + self.columns = ("id", "status", "severity", "summary") + + dataIndex = 0 + for x in range(len(self.columns)): + self.InsertColumn(x, self.columns[x].capitalize()) + self.SetColumnWidth(x, wx.LIST_AUTOSIZE_USEHEADER) + for bug in [b for b in self.buglist if b.active]: + name = names.unique_name(bug, self.buglist) + id = self.InsertStringItem(self.GetItemCount(), name) + self.SetStringItem(id, 1, bug.status) + self.SetStringItem(id, 2, bug.severity) + self.SetStringItem(id, 3, bug.summary) + self.SetItemData(id, dataIndex) # set keys for each line + dataIndex += 1 + self.EnsureVisible(id) + for x in range(len(self.columns)): + self.SetColumnWidth(x, wx.LIST_AUTOSIZE) + conts_width = self.GetColumnWidth(x) + self.SetColumnWidth(x, wx.LIST_AUTOSIZE_USEHEADER) + if conts_width > self.GetColumnWidth(x): + self.SetColumnWidth(x, conts_width) + + self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColumnClick) + self.bugcmp_fn = cmp_full + # For reasons I don't understant, sorting is broken... + #self.SortItems(self.Sorter) + #self.Refresh() + def Sorter(self, key1, key2): + """Get bug info from the keys and pass to self.bugcmp_fn""" + bug1 = self.buglist[key1-1] + bug2 = self.buglist[key2-1] + # Another way of getting bug information + #bug1uuid = self.GetItem(key1, 0).GetText() + #bug2uuid = self.GetItem(key2, 0).GetText() + #print bug1uuid, bug2uuid + #bug1 = self.bugdir.get_bug(bug1uuid) + #bug2 = self.bugdir.get_bug(bug1uuid) + print self.bugcmp_fn(bug1,bug2) + return self.bugcmp_fn(bug1,bug2) + def OnColumnClick(self, event): + """Resort bug list depending on which column was clicked""" + print "TODO: sort by column %d" % event.Column + # change self.bugcmp_fn and resort, but I can't get it working + +app = MyApp() +app.MainLoop() |