Python
  Home arrow Python arrow Page 2 - The PyMailGUI Module
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PYTHON

The PyMailGUI Module
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2007-08-08


    Table of Contents:
  • The PyMailGUI Module
  • SharedNames: Program-Wide Globals
  • ListWindows: Message List Windows
  • ViewWindows: Message View Windows

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    The PyMailGUI Module - SharedNames: Program-Wide Globals
    ( Page 2 of 4 )

    The module in Example 15-2 implements a shared, system-wide namespace that collects resources used in most modules in the system, and defines global objects that span files. This allows other files to avoid redundantly repeating common imports, and encapsulates the locations of package imports; it is the only file that must be updated if paths change in the future. Using globals can make programs harder to understand in general (the source of some names is not as clear), but it is reasonable if all such names are collected in a single expected module such as this one (because there is only one place to search for unknown names).

    Example 15-2. PP3E\Internet\Email\PyMailGui\SharedNames.py

    ################################################################ # objects shared by all window classes and main file: program-wide globals ###############################################################

    # used in all window, icon titles
    appname = 'PyMailGUI 2.1'

    # used for list save, open, delete; also for sent messages file
    saveMailSeparator = 'PyMailGUI' + ('-'*60) + 'PyMailGUI\n'

    # currently viewed mail save files; also for sent-mail file
    openSaveFiles     = {}           # 1 window per file,{name:win}

    # standard library services
    import sys, os, email, webbrowser
    from Tkinter       import *
    from tkFileDialog  import SaveAs, Open, Directory
    from tkMessageBox  import showinfo, showerror, askyesno

    # reuse book examples
    from PP3E.Gui.Tools  import windows     # window border, exit protocols
    from PP3E.Gui.Tools  import threadtools # thread callback queue checker

    from PP3E.Internet.Email import mailtools # load,send,parse,build utilities
    from PP3E.Gui.TextEditor import textEditor # component and pop up
    # modules defined here
    import mailconfig # user params: servers, fonts, etc.
    import popuputil # help, busy, passwd pop-up windows
    import wraplines # wrap long message lines
    import messagecache # remember already loaded mail
    import PyMailGuiHelp # user documentation
       

    def printStack(exc_info):
        # debugging: show exception and stack traceback on stdout
       
    print exc_info[0]
       
    print exc_info[1]
       
    import traceback
       
    traceback.print_tb(exc_info[2], file=sys.stdout)

    # thread busy counters for threads run by this GUI
    # sendingBusy shared by all send windows, used by main window quit

    loadingHdrsBusy = threadtools.ThreadCounter()   # only 1
    deletingBusy    = threadtools.ThreadCounter()   # only 1
    loadingMsgsBusy = threadtools.ThreadCounter()   # poss many
    sendingBusy     = threadtools.ThreadCounter()   # poss many



     
     
    >>> More Python Articles          >>> More By O'Reilly Media
     

       

    PYTHON ARTICLES

    - Tuples and Other Python Object Types
    - The Dictionary Python Object Type
    - String and List Python Object Types
    - Introducing Python Object Types
    - Mobile Programming using PyS60: Advanced UI ...
    - Nested Functions in Python
    - Python Parameters, Functions and Arguments
    - Python Statements and Functions
    - Statements and Iterators in Python
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek