#!/usr/bin/env python ## CURSES BASIC-MAIL GUI # This is the Basic-Mail program, a basic email client written in python # with a curses interface. # # To Run: Go to the Basic-Mail directory and type "python Basic-Mail.py", # without the quotes. # If it doesn't open, make sure that the size of the console window # is at least 80 x 30 pixels. ## ## Filename: variables.py ## # This file contains the all the variables for the basic-mail program. ## ## IMPORTS ## import curses, curses.ascii, curses.panel # Curses imports import traceback, os, sys, select, string # Random imports # Initializes and Globalizes (?) the Menus, Tabs, and Title. global program_title, directory, email_address, menu, tabs # Changed by Jim M on May 2 to match setup on cs.marlboro.edu directory = "/home/rdolan/Basic-Mail/" email_address = "rdolan@marlboro.com" program_title = "Basic-Mail Client - " + email_address +\ " - Press Ctrl-C to Exit" # Menu Matrix: # Menu[0] = Menu options. # Menu[1] = The character in each menu option to be highlighted. # Menu[2:] = The options within each menu option. menu = [["File","Edit","View","Message"],\ [0,0,0,0],\ ["Close Tab","Quit"],\ [0,0],\ ["Accounts"],\ [0],\ ["Inbox","Address Book","Compose"],\ [0,0,0],\ ["New Message","Reply"],\ [0,0]] # Tab Array: An array of the open tabs. tabs = [["\Inbox:1/"],\ [-2,-2,-2,-2,-2]] # Letter to highlight in each corresponding word # Initializes Main Window and Curses Options. global stdscr stdscr = curses.initscr() # Open Curses Window curses.cbreak() # Takes input before the enter key is pressed curses.noecho() # Stops echo of input to screen # Commented this out after seeing it give an error - Jim M # curses.curs_set(1) # Sets the cursor visibility, 0-2 # Initializes default color combinations. curses.start_color() curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK) curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_CYAN) curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) # Creating the Menu Bar and Tab Bar. global bar_width, bar_height, menu_bar bar_width = 80 bar_height = 1 menu_bar = curses.newwin(bar_height, bar_width, 1, 0) global tab_bar tab_bar = curses.newwin(bar_height, bar_width, 29, 0) # Window Sizes global main_height, main_width main_height = 27 main_width = 78 # Create Function Windows global inbox_win, outbox_win, sentmail_win, addressbook_win, compose_win inbox_win = curses.newwin(main_height, main_width, 2, 1) addressbook_win = curses.newwin(main_height, main_width, 2, 1) compose_win = curses.newwin(main_height, main_width, 2, 1) message_1_win = curses.newwin(main_height, main_width, 2, 1) message_2_win = curses.newwin(main_height, main_width, 2, 1) message_3_win = curses.newwin(main_height, main_width, 2, 1) message_4_win = curses.newwin(main_height, main_width, 2, 1) blank_win = curses.newwin(main_height, main_width, 2, 1) # Create Function Window Objects global inbox_bar, inbox_line inbox_bar = [["From:","To:","Subject:"],\ [24,24,28]] # Selects which message is highlighted on the Inbox screen inbox_line = 0 # Number of messages currently open messages_open = 0 # Initialize Tabs global tab1, tab2, tab3, tab4, tab5 tab2 = curses.panel.new_panel(blank_win) tab3 = curses.panel.new_panel(blank_win) tab4 = curses.panel.new_panel(blank_win) tab5 = curses.panel.new_panel(blank_win) tab1 = curses.panel.new_panel(inbox_win) global active_tab, active_win tabs.append([inbox_win]) active_tab = tab1 active_win = inbox_win curses.panel.update_panels()