This was my first major project, I started it but never ended up finishing it - it was a good challenge but in the end it would be a console program with no GUI, and something that would be of little use to me. It was still an interesting excersize <img src=\'
http://www.killanet.net/forum3/public/s ... /smile.gif\' class=\'bbc_emoticon\' alt=\':)\' />
[code]##########################################################
### NetLog Version 1.2 ###
### By Trinity ###
##########################################################
import os
import sys
import time
# -: Init :- #
print "Welcome To NetLog"
print "Version: 1.2"
print "By Trinity"
print ""
# -: Menus :- #
def menu_Root():
print """
Main Menu
|==========================|
| Option | Description |
|--------------------------|
| 1 | Internet Log |
| 2 | Address Book |
| 3 | Credits |
|--------------------------|
| m | Menu |
| x | Exit |
|==========================|
"""
def menu_Ilog():
curdate = time.strftime("%d/%m/%Y") + ".txt"
print """
Internet Log Menu
Logging to: %s
|==========================|
| Option | Description |
|--------------------------|
| 1 | Add Log |
| 2 | View Log |
| 3 | Open Log |
| 4 | Print Log |
|--------------------------|
| m | Menu |
| b | Back To Main |
|==========================|
""" % curdate
# -: Internet Log Options :- #
def ilog_Add():
os.system("cls")
print ""
print """
For the type of log, you may enter any of the following commands:
url, email, msn, security, program, info
Or you may enter your own type.
"""
type_ = raw_input("Please enter the type of log: ")
if type_ == "url":
notes = raw_input("Please enter the url: ")
elif type_ == "email":
notes = raw_input("Please enter the email address: ")
elif type_ == "msn":
notes = raw_input("Please enter the msn event: ")
elif type_ == "security":
notes = raw_input("Please enter the security event: ")
elif type_ == "info":
notes = raw_input("Please enter the information you have found: ")
elif type_ == "irc":
notes = raw_input("Please enter the irc server or information: ")
else:
notes = raw_input("Please enter the notes for your type: ")
curtime = time.strftime("%H:%M:%S")
print "Here is a preview of what you have entered:"
print "-"
print "Time: %s" % curtime
print "Type: %s" % type_
print "Notes: %s" % notes
print "-"
confirm = raw_input("Would you like to add this to the log? y/n: ")
if confirm == "y":
curdate = time.strftime("%d/%m/%Y")
filename = curdate.replace("/","-") + ".txt"
content = open(filename, "a")
space = "-"
content.write(space+"\n")
content.write("Time: "+curtime+"\n")
content.write("Type: "+type_+"\n")
content.write("Info: "+notes+"\n")
m_Ilog()
elif confirm == "n":
m_Ilog()
else:
print "Please enter y or n"
confirm = raw_input("Would you like to add this to the log? y/n: ")
if confirm == "y":
curdate = time.strftime("%d/%m/%Y")
filename = curdate.replace("/","-") + ".txt"
content = open(filename, "w")
space = "-"
content.write(space+"\n")
content.write("Time: "+curtime+"\n")
content.write("Type: "+type_+"\n")
content.write("Info: "+notes+"\n")
m_Ilog()
else:
m_Ilog()
def ilog_View():
os.system("cls")
filen = raw_input("Please enter the name of the file, followed by .txt. To view today's log, type current: ")
if filen == "current":
filename = time.strftime("%d-%m-%Y") + ".txt"
else:
filename = filen
print "File: %s" % filename
readfile = file(filename, "r")
for line in readfile.readlines():
print line
temp = raw_input("Press any key to return to the menu, or x to exit: ")
if temp == "x":
sys.exit()
else:
m_Ilog()
def ilog_Open():
os.system("cls")
filen = raw_input("Please enter the name of the file, followed by .txt. To view today's log, type current: ")
if filen == "current":
filename = time.strftime("%d-%m-%Y") + ".txt"
else:
filename = filen
print "Now opening: %s" % filename
print "Work out how to open this file!."
temp = raw_input("Press any key to return to the menu, or x to exit: ")
if temp == "x":
sys.exit()
else:
m_Ilog()
# -: Menu Operation :- #
def m_Root():
menu_Root()
m_Option = raw_input("Please enter your menu option: ")
if m_Option == "1":
m_Ilog()
elif m_Option == "2":
menu_Abook()
elif m_Option == "3":
credits()
elif m_Option == "m":
m_Root()
elif m_Option == "x":
sys.exit()
else:
print "Sorry that choice is not available. Please note that the menu is case sensitive and doesn't use CAPS."
m_Root()
def m_Ilog():
os.system("cls")
menu_Ilog()
m_Option = raw_input("Plase enter your menu option: ")
if m_Option == "1":
ilog_Add()
print "Success"
elif m_Option == "2":
ilog_View()
elif m_Option == "3":
ilog_Open()
elif m_Option == "4":
ilog_Print()
elif m_Option == "m":
m_Ilog()
elif m_Option == "b":
m_Root()
else:
print "Sorry that choice is not available. Please note that the menu is case sensitive and doesn't use CAPS."
m_Ilog()
m_Root()[/code]