| 1 | #! /usr/bin/env python
|
|---|
| 2 |
|
|---|
| 3 | # Scan MH folder, display results in window
|
|---|
| 4 |
|
|---|
| 5 | import os
|
|---|
| 6 | import sys
|
|---|
| 7 | import re
|
|---|
| 8 | import getopt
|
|---|
| 9 | import string
|
|---|
| 10 | import mhlib
|
|---|
| 11 |
|
|---|
| 12 | from Tkinter import *
|
|---|
| 13 |
|
|---|
| 14 | from dialog import dialog
|
|---|
| 15 |
|
|---|
| 16 | mailbox = os.environ['HOME'] + '/Mail'
|
|---|
| 17 |
|
|---|
| 18 | def main():
|
|---|
| 19 | global root, tk, top, mid, bot
|
|---|
| 20 | global folderbox, foldermenu, scanbox, scanmenu, viewer
|
|---|
| 21 | global folder, seq
|
|---|
| 22 | global mh, mhf
|
|---|
| 23 |
|
|---|
| 24 | # Parse command line options
|
|---|
| 25 |
|
|---|
| 26 | folder = 'inbox'
|
|---|
| 27 | seq = 'all'
|
|---|
| 28 | try:
|
|---|
| 29 | opts, args = getopt.getopt(sys.argv[1:], '')
|
|---|
| 30 | except getopt.error, msg:
|
|---|
| 31 | print msg
|
|---|
| 32 | sys.exit(2)
|
|---|
| 33 | for arg in args:
|
|---|
| 34 | if arg[:1] == '+':
|
|---|
| 35 | folder = arg[1:]
|
|---|
| 36 | else:
|
|---|
| 37 | seq = arg
|
|---|
| 38 |
|
|---|
| 39 | # Initialize MH
|
|---|
| 40 |
|
|---|
| 41 | mh = mhlib.MH()
|
|---|
| 42 | mhf = mh.openfolder(folder)
|
|---|
| 43 |
|
|---|
| 44 | # Build widget hierarchy
|
|---|
| 45 |
|
|---|
| 46 | root = Tk()
|
|---|
| 47 | tk = root.tk
|
|---|
| 48 |
|
|---|
|
|---|