summaryrefslogtreecommitdiff
path: root/show_cleanup.py
diff options
context:
space:
mode:
Diffstat (limited to 'show_cleanup.py')
-rw-r--r--show_cleanup.py92
1 files changed, 92 insertions, 0 deletions
diff --git a/show_cleanup.py b/show_cleanup.py
new file mode 100644
index 0000000..0e25657
--- /dev/null
+++ b/show_cleanup.py
@@ -0,0 +1,92 @@
1"""
2Avolites Pearl Expert Show File Cleanup Program
3for The Chapel in Akron
4by Mike Crute (mcrute@gmail.com)
5on February 20, 2008
6
7This is a simple GUI program that allows for the cleanup of Avolites Pearl
8Expert show files in the new (directory-based) format. It requires a recent
9version of Python (originally designed for 2.6) and a copy of wxPython.
10
11The file is split into two parts, first is the Show File API that provides
12very basic searching and interperation of the show files on disk. The
13second part is all of the GUI code that renders the interface. The API code
14has no dependency on the GUI code.
15"""
16
17import os
18import wx
19from xml.etree import ElementTree
20
21
22######################################################################
23# Core Functionality/API
24######################################################################
25class AvoShow(object):
26 name = None
27 file_name = None
28 date = None
29 time = None
30
31
32def list_show_files(directory):
33 """
34 Get a list of all the show files in a given directory.
35 """
36 shows = []
37
38 for item in os.listdir(directory):
39 if item.startswith('PEXP'):
40 shows.append('%(directory)s/%(item)s/pexpshw.xml' % locals())
41
42 return shows
43
44
45def get_show_catalog(show_files):
46 """
47 Get a catalog of show objects indexed by name of the show.
48 """
49 catalog = {}
50
51 for show_file in show_files:
52 xml = ElementTree.fromstring(open(show_file).read())
53
54 this_show = AvoShow()
55 this_show.name = xml.find('Name').text
56 this_show.date = xml.find('Date').text
57 this_show.time = xml.find('Time').text
58
59 if this_show.name in catalog:
60 catalog[this_show.name].append(this_show)
61 else:
62 catalog[this_show.name] = [this_show]
63
64 return catalog
65
66
67######################################################################
68# GUI Code
69######################################################################
70class CleanupPanel(wx.Panel):
71 pass
72
73
74class CleanupInterface(wx.Frame):
75
76 def __init__(self, *args, **kwargs):
77 kwargs['title'] = 'Avolites Show Cleanup'
78 wx.Frame.__init__(self, None, *args, **kwargs)
79
80
81def gui_main():
82 application = wx.App()
83 interface = CleanupInterface()
84 interface.Show()
85 appplication.MainLoop()
86
87
88######################################################################
89# "main" Method
90######################################################################
91if __name__ == '__main__':
92 gui_main()