From 81154e2b4b05da5ebaeb43662d25668df2aa0feb Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Wed, 29 Jul 2015 18:12:17 -0700 Subject: Initial import --- show_cleanup.py | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 show_cleanup.py (limited to 'show_cleanup.py') 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 @@ +""" +Avolites Pearl Expert Show File Cleanup Program +for The Chapel in Akron +by Mike Crute (mcrute@gmail.com) +on February 20, 2008 + +This is a simple GUI program that allows for the cleanup of Avolites Pearl +Expert show files in the new (directory-based) format. It requires a recent +version of Python (originally designed for 2.6) and a copy of wxPython. + +The file is split into two parts, first is the Show File API that provides +very basic searching and interperation of the show files on disk. The +second part is all of the GUI code that renders the interface. The API code +has no dependency on the GUI code. +""" + +import os +import wx +from xml.etree import ElementTree + + +###################################################################### +# Core Functionality/API +###################################################################### +class AvoShow(object): + name = None + file_name = None + date = None + time = None + + +def list_show_files(directory): + """ + Get a list of all the show files in a given directory. + """ + shows = [] + + for item in os.listdir(directory): + if item.startswith('PEXP'): + shows.append('%(directory)s/%(item)s/pexpshw.xml' % locals()) + + return shows + + +def get_show_catalog(show_files): + """ + Get a catalog of show objects indexed by name of the show. + """ + catalog = {} + + for show_file in show_files: + xml = ElementTree.fromstring(open(show_file).read()) + + this_show = AvoShow() + this_show.name = xml.find('Name').text + this_show.date = xml.find('Date').text + this_show.time = xml.find('Time').text + + if this_show.name in catalog: + catalog[this_show.name].append(this_show) + else: + catalog[this_show.name] = [this_show] + + return catalog + + +###################################################################### +# GUI Code +###################################################################### +class CleanupPanel(wx.Panel): + pass + + +class CleanupInterface(wx.Frame): + + def __init__(self, *args, **kwargs): + kwargs['title'] = 'Avolites Show Cleanup' + wx.Frame.__init__(self, None, *args, **kwargs) + + +def gui_main(): + application = wx.App() + interface = CleanupInterface() + interface.Show() + appplication.MainLoop() + + +###################################################################### +# "main" Method +###################################################################### +if __name__ == '__main__': + gui_main() -- cgit v1.2.3