from ftplib import FTP import sys, os from wxPython.wx import * import Mk4py import string mk = Mk4py Starport_db = mk.Storage('People2.mk',1) Starport_vw = Starport_db.getas('starpeople[Name:S,Birthday:S,Time:S,AMPM:S,City:S,State:S,Countries:S,Province:S,name2:S,birthday2:S,time2:S,AMPM2:S,city2:S,state2:S,countrie2:S,province2:S,Email:S,BillingName:S,BillingEmail:S,Comments:S,StartTime:S,EndTime:S,NewCity:S,NewState:S,NewCountrie:S,NewProvince:S,ReportName:S,Sex:S,Preference:S]') class AddDatadase(wxMiniFrame): def __init__(self, parent, ID, title, pos, size, style): entry_list = ('Name','Birthday','Time','Am-Pm','City','State','Countries','Province','name2','birthday2','time2','Am-Pm2','city2','state2','countrie2','province2','Email','BillingName','BillingEmail','Comments','StartTime','EndTime','NewCity','NewState','NewCountrie','NewProvince','ReportName','Sex','Preference') wxMiniFrame.__init__(self, parent, ID, title, pos, size, style) panel = wxPanel(self, -1) self.textboxes = [] text_h = 27 text_dev = 150 wxStaticText(self, -1, entry_list[0], wxPoint(5, 5), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 5), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[1], wxPoint(5, 30), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 30), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[2], wxPoint(5, 55), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 55), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[3], wxPoint(5, 80), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 80), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[4], wxPoint(5, 105), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 105), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[5], wxPoint(5, 130), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 130), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[6], wxPoint(5, 155), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 155), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[7], wxPoint(5, 180), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 180), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[8], wxPoint(5, 205), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 205), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[9], wxPoint(5, 230), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 230), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[10], wxPoint(5, 255), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 255), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[11], wxPoint(5, 280), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 280), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[12], wxPoint(5, 305), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 305), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[13], wxPoint(5, 330), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 330), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[14], wxPoint(5, 355), wxSize(text_dev, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(text_dev, 355), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[15], wxPoint(310, 5), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 5), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[16], wxPoint(310, 30), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 30), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[17], wxPoint(310, 55), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 55), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[18], wxPoint(310, 80), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 80), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[19], wxPoint(310, 105), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 105), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[20], wxPoint(310, 130), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 130), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[21], wxPoint(310, 155), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 155), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[22], wxPoint(310, 180), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 180), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[23], wxPoint(310, 205), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 205), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[24], wxPoint(310, 230), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 230), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[25], wxPoint(310, 255), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 255), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[26], wxPoint(310, 280), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 280), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[27], wxPoint(310, 305), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 305), wxSize(150, 25)) self.textboxes.append(NameEntry) wxStaticText(self, -1, entry_list[28], wxPoint(310, 330), wxSize(150, text_h)) NameEntry = wxTextCtrl(self, -1, "", wxPoint(460, 330), wxSize(150, 25)) self.textboxes.append(NameEntry) button = wxButton(self, 1002, "Add") button.SetPosition(wxPoint(233, 420)) EVT_BUTTON(self, 1002, self.OnAdd) button = wxButton(self, 1003, "Close Me") button.SetPosition(wxPoint(466, 420)) EVT_BUTTON(self, 1003, self.OnCloseMe) def OnAdd(self, event): Starport_vw.append(Name = self.textboxes[0].GetLineText(0),Birthday = self.textboxes[1].GetLineText(0), Time = self.textboxes[2].GetLineText(0),AMPM = self.textboxes[3].GetLineText(0),City = self.textboxes[4].GetLineText(0), State = self.textboxes[5].GetLineText(0),Countries = self.textboxes[6].GetLineText(0),Province = self.textboxes[7].GetLineText(0), name2 = self.textboxes[8].GetLineText(0),birthday2 = self.textboxes[9].GetLineText(0),time2 = self.textboxes[10].GetLineText(0), AMPM2 = self.textboxes[11].GetLineText(0),city2 = self.textboxes[12].GetLineText(0),state2 = self.textboxes[13].GetLineText(0), countrie2 = self.textboxes[14].GetLineText(0),province2 = self.textboxes[15].GetLineText(0),Email = self.textboxes[16].GetLineText(0), BillingName = self.textboxes[17].GetLineText(0),BillingEmail = self.textboxes[18].GetLineText(0), Comments = self.textboxes[19].GetLineText(0),StartTime = self.textboxes[20].GetLineText(0), EndTime = self.textboxes[21].GetLineText(0),NewCity = self.textboxes[22].GetLineText(0),NewState = self.textboxes[23].GetLineText(0), NewCountrie = self.textboxes[24].GetLineText(0),NewProvince = self.textboxes[25].GetLineText(0), ReportName = self.textboxes[26].GetLineText(0),Sex = self.textboxes[27].GetLineText(0),Preference = self.textboxes[28].GetLineText(0)) Starport_db.commit() self.Destroy() def OnCloseMe(self, event): self.Destroy() def OnCloseWindow(self, event): self.Destroy() #--------------------------------------------------------------------------- def starline(starstring): # Strips Quouts,(Spaces) and commas then sepparate from commas into list newword=('') tmpfile =('') linelist = ([]) for x in range(len(starstring)): tmpfile = starstring[x] if starstring[x] == '"':# or starstring[x] == ' ': tmpfile =('') if starstring[x] == ',': linelist.append(newword) newword=('') tmpfile =('') newword = (newword) + (tmpfile) return linelist #------------------- class TomFrame(wx.wxFrame): def __init__(self, parent, id, title): # First, call the base class' __init__ method to create the frame wx.wxFrame.__init__(self, parent, id, title,wxPoint(100, 100), wxSize(800, 500)) if wxPlatform == '__WXMSW__': icon = wxIcon('Starport.ico', wxBITMAP_TYPE_ICO) self.SetIcon(icon) EVT_SIZE(self, self.OnSize)# Associate some events with methods of this class EVT_MOVE(self, self.OnMove) self.main_menu = wxMenuBar()# Make a File menu menu = wxMenu() exitID = wxNewId() menu.Append(exitID, 'Load Local Files', 'Load files from hard drive') EVT_MENU(self, exitID, self.OnFileLoadLocal) exitID = wxNewId() menu.Append(exitID, 'Download Files', 'Get the heck outta here!') EVT_MENU(self, exitID, self.OnFileDownload) exitID = wxNewId() menu.Append(exitID, 'E&xit', 'Get the heck outta here!') EVT_MENU(self, exitID, self.OnFileExit) self.main_menu.Append(menu, '&File') menu = wxMenu() exitID = wxNewId() menu.Append(exitID, 'Add Name', 'Add name to database') EVT_MENU(self, exitID, self.OnDatabaseAdd) exitID = wxNewId() menu.Append(exitID, 'Clean Database', 'Clean Database') EVT_MENU(self, exitID, self.OnDatabaseClean) self.main_menu.Append(menu, '&Database') menu = wxMenu() exitID = wxNewId() menu.Append(exitID, 'Cut', 'Cut') #EVT_MENU(self, exitID, self.OnEditCut) cleen_database exitID = wxNewId() menu.Append(exitID, 'Copy', 'Copy') #EVT_MENU(self, exitID, self.OnEditCopy) exitID = wxNewId() menu.Append(exitID, 'Paste', 'paste') #EVT_MENU(self, exitID, self.OnEditPaste) self.main_menu.Append(menu, '&Edit') self.SetMenuBar(self.main_menu) #make a notebook and 7 lists and one text window self.Note_Window = wxNotebook(self, -1, wxPoint(0,0),wxDefaultSize,wxSUNKEN_BORDER | wxEXPAND) self.Carrer_list = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT) for x in range(50):# add 50 items to each list testi = wxListItem() self.Carrer_list.InsertItem(testi) self.Compatibility_list = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT) for x in range(50): testi = wxListItem() self.Compatibility_list.InsertItem(testi) self.Forcast_list = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT) for x in range(50): testi = wxListItem() self.Forcast_list.InsertItem(testi) self.CompatibilityForcast_list = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT) for x in range(50): testi = wxListItem() self.CompatibilityForcast_list.InsertItem(testi) self.Comments_Window = wxTextCtrl(self, -1,'', wxPoint(0, 0), wxSize(500,500), wxSUNKEN_BORDER | wxEXPAND | wxTE_MULTILINE) self.Relocation_list = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT) for x in range(50): testi = wxListItem() self.Relocation_list.InsertItem(testi) self.Birth_list = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT ) for x in range(50): testi = wxListItem() self.Birth_list.InsertItem(testi) self.Starport_list = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT) for x in range(50): testi = wxListItem() self.Starport_list.InsertItem(testi) colum_list = ("Name","Birthday","Time","AM/PM","City","State","Countries","Province","Email","BillingName","BillingEmail","Comments") for x in range(len(colum_list)):# set the captions for each list self.Birth_list.InsertColumn(x, colum_list[x]) self.Birth_list.SetColumnWidth(x,120) colum_list = ("Name","Birthday","Time","AM/PM","City","State","Countries","Province","Email","BillingName","BillingEmail","Comments") for x in range(len(colum_list)): self.Carrer_list.InsertColumn(x, colum_list[x]) self.Carrer_list.SetColumnWidth(x,120) colum_list = ("Name 1","Birthday","Time","AM/PM","City","State","Countries","Province","Name 2","Birthday","Time","AM/PM","City","State","Countrie","Province","Email","BillingName","BillingEmail","Comments") for x in range(len(colum_list)): self.Compatibility_list.InsertColumn(x, colum_list[x]) self.Compatibility_list.SetColumnWidth(x,120) colum_list = ("Name","Birthday","Time","AM/PM","City","State","Countries","Province","Start Time","End Time","City","State","Countrie","Province","Email","BillingName","BillingEmail","Comments") for x in range(len(colum_list)): self.Forcast_list.InsertColumn(x, colum_list[x]) self.Forcast_list.SetColumnWidth(x,120) colum_list = ("Name","Birthday","Time","AM/PM","City","State","Countries","Province","$name2","$birthday2","time2","AM/PM","city2","state2","countrie2","province2","Start Time","End Time","New State","New Countrie","New Province","Email","BillingName","BillingEmail","Comments") for x in range(len(colum_list)): self.CompatibilityForcast_list.InsertColumn(x, colum_list[x]) self.CompatibilityForcast_list.SetColumnWidth(x,120) colum_list = ("Name","Birthday","Time","AM/PM","City","State","Countries","Province","New City","New State","new Countrie","New Province","Email","BillingName","BillingEmail","Comments") for x in range(len(colum_list)): self.Relocation_list.InsertColumn(x, colum_list[x]) self.Relocation_list.SetColumnWidth(x,120) colum_list = ("Name","Birthday","Time","AM/PM","City","State","Countries","Province","Sex","Preferance","Email","Comments") for x in range(len(colum_list)): self.Starport_list.InsertColumn(x, colum_list[x]) self.Starport_list.SetColumnWidth(x,120) self.Databas_list = wxListCtrl(self, -1, wxDefaultPosition, wxDefaultSize,wxLC_REPORT) colum_list = ('Name','Birthday','Time','Am-Pm','City','State','Countries','Province','name2','birthday2','time2','Am-Pm2','city2','state2','countrie2','province2','Email','BillingName','BillingEmail','Comments','StartTime','EndTime','NewCity','NewState','NewCountrie','NewProvince','ReportName','Sex','Preference') for x in range(len(colum_list)):# set the captions for each list self.Databas_list.InsertColumn(x, colum_list[x]) self.Databas_list.SetColumnWidth(x,120) count = 0 for x in Starport_vw: testi = wxListItem() self.Databas_list.InsertItem(testi) self.setdatawindow(Starport_vw) self.Note_Window.AddPage(self.Birth_list,'Birth')# add the 7 lists and text window self.Note_Window.AddPage(self.Carrer_list,'Carrer')#to the notebook self.Note_Window.AddPage(self.Compatibility_list,'Compatibility') self.Note_Window.AddPage(self.Forcast_list,'Forcast') self.Note_Window.AddPage(self.CompatibilityForcast_list,'Compatibility\nForcast') self.Note_Window.AddPage(self.Relocation_list,'Relocation') self.Note_Window.AddPage(self.Starport_list,'Starport') self.Note_Window.AddPage(self.Comments_Window,'Comments') self.Note_Window.AddPage(self.Databas_list,'Customer Database') def setdatawindow(self,view): count = 0 for i in range(self.Databas_list.GetItemCount()): self.Databas_list.SetStringItem(i,0,'', -1) self.Databas_list.SetStringItem(i,1,'', -1) self.Databas_list.SetStringItem(i,2,'', -1) self.Databas_list.SetStringItem(i,3,'', -1) self.Databas_list.SetStringItem(i,4,'', -1) self.Databas_list.SetStringItem(i,5,'', -1) self.Databas_list.SetStringItem(i,6,'', -1) self.Databas_list.SetStringItem(i,7,'', -1) self.Databas_list.SetStringItem(i,8,'', -1) self.Databas_list.SetStringItem(i,9,'', -1) self.Databas_list.SetStringItem(i,10,'', -1) self.Databas_list.SetStringItem(i,11,'', -1) self.Databas_list.SetStringItem(i,12,'', -1) self.Databas_list.SetStringItem(i,13,'', -1) self.Databas_list.SetStringItem(i,14,'', -1) self.Databas_list.SetStringItem(i,15,'', -1) self.Databas_list.SetStringItem(i,16,'', -1) self.Databas_list.SetStringItem(i,17,'', -1) self.Databas_list.SetStringItem(i,18,'', -1) self.Databas_list.SetStringItem(i,19,'', -1) self.Databas_list.SetStringItem(i,20,'', -1) self.Databas_list.SetStringItem(i,21,'', -1) self.Databas_list.SetStringItem(i,22,'', -1) self.Databas_list.SetStringItem(i,23,'', -1) self.Databas_list.SetStringItem(i,24,'', -1) self.Databas_list.SetStringItem(i,25,'', -1) self.Databas_list.SetStringItem(i,26,'', -1) self.Databas_list.SetStringItem(i,27,'', -1) self.Databas_list.SetStringItem(i,28,'', -1) for x in view: self.Databas_list.SetStringItem(count,0,x.Name, -1) self.Databas_list.SetStringItem(count,1,x.Birthday, -1) self.Databas_list.SetStringItem(count,2,x.Time, -1) self.Databas_list.SetStringItem(count,3,x.AMPM, -1) self.Databas_list.SetStringItem(count,4,x.City, -1) self.Databas_list.SetStringItem(count,5,x.State, -1) self.Databas_list.SetStringItem(count,6,x.Countries, -1) self.Databas_list.SetStringItem(count,7,x.Province, -1) self.Databas_list.SetStringItem(count,8,x.name2, -1) self.Databas_list.SetStringItem(count,9,x.birthday2, -1) self.Databas_list.SetStringItem(count,10,x.time2, -1) self.Databas_list.SetStringItem(count,11,x.AMPM2, -1) self.Databas_list.SetStringItem(count,12,x.city2, -1) self.Databas_list.SetStringItem(count,13,x.state2, -1) self.Databas_list.SetStringItem(count,14,x.countrie2, -1) self.Databas_list.SetStringItem(count,15,x.province2, -1) self.Databas_list.SetStringItem(count,16,x.Email, -1) self.Databas_list.SetStringItem(count,17,x.BillingName, -1) self.Databas_list.SetStringItem(count,18,x.BillingEmail, -1) self.Databas_list.SetStringItem(count,19,x.Comments, -1) self.Databas_list.SetStringItem(count,20,x.StartTime, -1) self.Databas_list.SetStringItem(count,21,x.EndTime, -1) self.Databas_list.SetStringItem(count,22,x.NewCity, -1) self.Databas_list.SetStringItem(count,23,x.NewState, -1) self.Databas_list.SetStringItem(count,24,x.NewCountrie, -1) self.Databas_list.SetStringItem(count,25,x.NewProvince, -1) self.Databas_list.SetStringItem(count,26,x.ReportName, -1) self.Databas_list.SetStringItem(count,27,x.Sex, -1) self.Databas_list.SetStringItem(count,28,x.Preference, -1) count = count + 1 def OnCloseWindow(self, event): # tell the window to kill itself #del Starport_db self.Destroy() def OnSize(self, event):#called by the System when the window is resized (see events above) size = event.GetSize()# tell the event system to continue looking for an event handler, event.Skip()# so the default handler will get called. def OnMove(self, event):# This method is called by the System when the window is moved pos = event.GetPosition() def OnFileExit(self,event):# exit event from file menu above #del Starport_db self.Destroy()# tell the window to kill itself def OnFileDownload(self,event):#download event from file menu above get_ftp(self)#call function to download files New_vw = Starport_db.getas('starpeople[Name:S,Birthday:S,Time:S,AMPM:S,City:S,State:S,Countries:S,Province:S,name2:S,birthday2:S,time2:S,AMPM2:S,city2:S,state2:S,countrie2:S,province2:S,Email:S,BillingName:S,BillingEmail:S,Comments:S,StartTime:S,EndTime:S,NewCity:S,NewState:S,NewCountrie:S,NewProvince:S,ReportName:S,Sex:S,Preference:S]') self.setdatawindow(New_vw) del New_vw def OnFileLoadLocal(self,event):#local event from file menu above get_local(self)#call function to get local files New_vw = Starport_db.getas('starpeople[Name:S,Birthday:S,Time:S,AMPM:S,City:S,State:S,Countries:S,Province:S,name2:S,birthday2:S,time2:S,AMPM2:S,city2:S,state2:S,countrie2:S,province2:S,Email:S,BillingName:S,BillingEmail:S,Comments:S,StartTime:S,EndTime:S,NewCity:S,NewState:S,NewCountrie:S,NewProvince:S,ReportName:S,Sex:S,Preference:S]') self.setdatawindow(New_vw) del New_vw def OnDatabaseAdd(self,event): win = AddDatadase(self, -1, "Data For Datadase",wxDefaultPosition, wxSize(700, 500),wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ) #win.MakeModal(true) win.Show(true) def OnDatabaseClean(self,event): #New_db = mk.Storage('People.mk',1) #New_vw = New_db.getas('starpeople[Name:S,Birthday:S,Time:S,AMPM:S,City:S,State:S,Countries:S,Province:S,name2:S,birthday2:S,time2:S,AMPM2:S,city2:S,state2:S,countrie2:S,province2:S,Email:S,BillingName:S,BillingEmail:S,Comments:S,StartTime:S,EndTime:S,NewCity:S,NewState:S,NewCountrie:S,NewProvince:S,ReportName:S,Sex:S,Preference:S]') s_inter = Starport_vw[:] counter = 0 for t in Starport_vw: counter2 = 0 for s in s_inter: if t.Name == s.Name and t.Birthday == s.Birthday and t.Time == s.Time and t.ReportName == s.ReportName and counter <> counter2: Starport_vw.delete(counter2) counter2 = counter2 +1 counter = counter + 1 Starport_db.commit() self.setdatawindow(Starport_vw) #del New_db def OnEditCut(self,event): pass def OnEditCopy(self,event): pass def OnEditPaste(self,event): pass #------------------------------------- def get_local(self):# display local files data_thing = open('burth.txt','r')# open file file_data = data_thing.readline()#read first line star_list = starline(file_data)#call starline function (see top) count = 0 #set up a row counter while file_data<>'':# go until the end of file for x in range(len(star_list)): self.Birth_list.SetStringItem(count,x, star_list[x], -1) file_data = data_thing.readline() star_list = starline(file_data) count = count + 1 data_thing.close() data_thing = open('carrer.txt','r') file_data = data_thing.readline() star_list = starline(file_data) count = 0 while file_data<>'': for x in range(len(star_list)): self.Carrer_list.SetStringItem(count,x, star_list[x], -1) file_data = data_thing.readline() star_list = starline(file_data) count = count + 1 data_thing.close() data_thing = open('comfor.txt','r') file_data = data_thing.readline() star_list = starline(file_data) count = 0 while file_data<>'': for x in range(len(star_list)): self.CompatibilityForcast_list.SetStringItem(count,x, star_list[x], -1) file_data = data_thing.readline() star_list = starline(file_data) count = count + 1 data_thing.close() data_thing = open('compatib.txt','r') file_data = data_thing.readline() star_list = starline(file_data) count = 0 while file_data<>'': for x in range(len(star_list)): self.Compatibility_list.SetStringItem(count,x, star_list[x], -1) file_data = data_thing.readline() star_list = starline(file_data) count = count + 1 data_thing.close() data_thing = open('forcast.txt','r') file_data = data_thing.readline() star_list = starline(file_data) count = 0 while file_data<>'': for x in range(len(star_list)): self.Forcast_list.SetStringItem(count,x, star_list[x], -1) file_data = data_thing.readline() star_list = starline(file_data) count = count + 1 data_thing.close() data_thing = open('relocat.txt','r') file_data = data_thing.readline() star_list = starline(file_data) count = 0 while file_data<>'': for x in range(len(star_list)): self.Relocation_list.SetStringItem(count,x, star_list[x], -1) file_data = data_thing.readline() star_list = starline(file_data) count = count + 1 data_thing.close() data_thing = open('starport.txt','r') file_data = data_thing.readline() star_list = starline(file_data) count = 0 while file_data<>'': for x in range(len(star_list)): self.Starport_list.SetStringItem(count,x, star_list[x], -1) file_data = data_thing.readline() star_list = starline(file_data) count = count + 1 data_thing.close() data_thing = open( 'comments.txt','r') file_data = data_thing.readline() while file_data<>'': self.Comments_Window.WriteText(file_data) file_data = data_thing.readline() data_thing.close() def set_local_db(self): data_thing = open( 'burth.txt','r')# open file file_data = data_thing.readline()#read first line star_list = starline(file_data)#call starline function (see top) if len(star_list)<12: for x in range(12-len(star_list)): star_list.append('') count = 0 #set up a row counter while file_data<>'':# go until the end of file Starport_vw.append(Name = star_list[0],Birthday = star_list[1],Time = star_list[2],AMPM = star_list[3],City = star_list[4],State = star_list[5],Countries = star_list[6],Province = star_list[7],name2 = '',birthday2 = '',time2 = '',AMPM2 = '',city2 = '',state2 = '',countrie2 = '',province2 = '',Email = star_list[8],BillingName = star_list[9],BillingEmail = star_list[10],Comments = '',StartTime = '',EndTime = '',NewCity = '',NewState = '',NewCountrie = '',NewProvince = '',ReportName = 'Birth',Sex = '',Preference = '') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<12: for x in range(12-len(star_list)): star_list.append('') count = count + 1 data_thing.close() data_thing = open( 'carrer.txt','r') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<12: for x in range(12-len(star_list)): star_list.append('') count = 0 while file_data<>'': Starport_vw.append(Name = star_list[0],Birthday = star_list[1],Time = star_list[2],AMPM = star_list[3],City = star_list[4],State = star_list[5],Countries = star_list[6],Province = star_list[7],name2 = '',birthday2 = '',time2 = '',AMPM2 = '',city2 = '',state2 = '',countrie2 = '',province2 = '',Email = star_list[8],BillingName = star_list[9],BillingEmail = star_list[10],Comments = star_list[11],StartTime = '',EndTime = '',NewCity = '',NewState = '',NewCountrie = '',NewProvince = '',ReportName = 'Carrer',Sex = '',Preference = '') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<12: for x in range(12-len(star_list)): star_list.append('') count = count + 1 data_thing.close() data_thing = open( 'comfor.txt','r') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<26: for x in range(26-len(star_list)): star_list.append('') count = 0 while file_data<>'': Starport_vw.append(Name = star_list[0],Birthday = star_list[1],Time = star_list[2],AMPM = star_list[3],City = star_list[4],State = star_list[5],Countries = star_list[6],Province = star_list[7],name2 = star_list[8],birthday2 = star_list[9],time2 = star_list[10],AMPM2 = star_list[11],city2 = star_list[12],state2 = star_list[13],countrie2 = star_list[14],province2 = star_list[15],Email = star_list[22],BillingName = star_list[23],BillingEmail = star_list[24],Comments = star_list[25],StartTime = star_list[16],EndTime = star_list[17],NewCity = star_list[18],NewState = star_list[19],NewCountrie = star_list[20],NewProvince = star_list[21],ReportName = 'Compatibility Forcast',Sex = '',Preference = '') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<26: for x in range(26-len(star_list)): star_list.append('') count = count + 1 data_thing.close() data_thing = open( 'compatib.txt','r') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<20: for x in range(20-len(star_list)): star_list.append('') count = 0 while file_data<>'': Starport_vw.append(Name = star_list[0],Birthday = star_list[1],Time = star_list[2],AMPM = star_list[3],City = star_list[4],State = star_list[5],Countries = star_list[6],Province = star_list[7],name2 = star_list[8],birthday2 = star_list[9],time2 = star_list[10],AMPM2 = star_list[11],city2 = star_list[12],state2 = star_list[13],countrie2 = star_list[14],province2 = star_list[15],Email = star_list[16],BillingName = star_list[17],BillingEmail = star_list[18],Comments = star_list[19],StartTime = '',EndTime = '',NewCity = '',NewState = '',NewCountrie = '',NewProvince = '',ReportName = 'Compatibility Forcast',Sex = '',Preference = '') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<20: for x in range(20-len(star_list)): star_list.append('') count = count + 1 data_thing.close() data_thing = open( 'forcast.txt','r') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<18: for x in range(18-len(star_list)): star_list.append('') count = 0 while file_data<>'': Starport_vw.append(Name = star_list[0],Birthday = star_list[1],Time = star_list[2],AMPM = star_list[3],City = star_list[4],State = star_list[5],Countries = star_list[6],Province = star_list[7],name2 = '',birthday2 = '',time2 = '',AMPM2 = '',city2 = '',state2 = '',countrie2 = '',province2 = '',Email = star_list[14],BillingName = star_list[15],BillingEmail = star_list[16],Comments = star_list[17],StartTime = star_list[8],EndTime = star_list[9],NewCity = star_list[10],NewState = star_list[11],NewCountrie = star_list[12],NewProvince = star_list[13],ReportName = 'Forcast',Sex = '',Preference = '') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<18: for x in range(18-len(star_list)): star_list.append('') count = count + 1 data_thing.close() data_thing = open('relocat.txt','r') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<16: for x in range(16-len(star_list)): star_list.append('') count = 0 while file_data<>'': Starport_vw.append(Name = star_list[0],Birthday = star_list[1],Time = star_list[2],AMPM = star_list[3],City = star_list[4],State = star_list[5],Countries = star_list[6],Province = star_list[7],name2 = '',birthday2 = '',time2 = '',AMPM2 = '',city2 = '',state2 = '',countrie2 = '',province2 = '',Email = star_list[12],BillingName = star_list[13],BillingEmail = star_list[14],Comments = star_list[15],StartTime = '',EndTime = '',NewCity = star_list[8],NewState = star_list[9],NewCountrie = star_list[10],NewProvince = star_list[11],ReportName = 'Relocation',Sex = '',Preference = '') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<16: for x in range(16-len(star_list)): star_list.append('') count = count + 1 data_thing.close() data_thing = open('starport.txt','r') file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<12: for x in range(12-len(star_list)): star_list.append('') count = 0 while file_data<>'': Starport_vw.append(Name = star_list[0],Birthday = star_list[1],Time = star_list[2],AMPM = star_list[3],City = star_list[4],State = star_list[5],Countries = star_list[6],Province = star_list[7],name2 = '',birthday2 = '',time2 = '',AMPM2 = '',city2 = '',state2 = '',countrie2 = '',province2 = '',Email = star_list[10],BillingName = '',BillingEmail = '',Comments = star_list[11],StartTime = '',EndTime = '',NewCity = '',NewState = '',NewCountrie = '',NewProvince = '',ReportName = 'Starport Entry',Sex = star_list[8],Preference = star_list[9]) file_data = data_thing.readline() star_list = starline(file_data) if len(star_list)<12: for x in range(12-len(star_list)): star_list.append('') count = count + 1 data_thing.close() data_thing = open('comments.txt','r') file_data = data_thing.readline() while file_data<>'': Starport_vw.append(Name = 'Comments',Birthday = '',Time = '',AMPM = '',City = '',State = '',Countries = '',Province = '',name2 = '',birthday2 = '',time2 = '',AMPM2 = '',city2 = '',state2 = '',countrie2 = '',province2 = '',Email = '',BillingName = '',BillingEmail = '',Comments = file_data,StartTime = '',EndTime = '',NewCity = '',NewState = '',NewCountrie = '',NewProvince = '',ReportName = 'Main Comments',Sex = '',Preference = '') file_data = data_thing.readline() data_thing.close() Starport_db.commit() get_local(self) #--------------------------------------------------------------------------- def get_ftp(self):#function to download files, first start a progress dialog dlg = wxProgressDialog("Downloading Starport Report Files","Birth Reports",8,self,wxPD_CAN_ABORT | wxPD_APP_MODAL) starsite = FTP('starport86331.htmlplanet.com','francesca1','conly')# open the site, starsite.retrbinary('RETR burth.txt',open('burth.txt','w+').write) dlg.Update(0, "Career Report")# reteve file , write into local file , update dialog starsite.retrbinary('RETR carrer.txt',open( 'carrer.txt','w+').write) dlg.Update(1, "Compatibility Forcast Report") starsite.retrbinary('RETR comfor.txt',open( 'comfor.txt','w+').write) dlg.Update(2, "Compatibility Report") starsite.retrbinary('RETR compatib.txt',open('compatib.txt','w+').write) dlg.Update(3, "Forcast Report") starsite.retrbinary('RETR forcast.txt',open('forcast.txt','w+').write) dlg.Update(4, "Comments") starsite.retrbinary('RETR comments.txt',open('comments.txt','w+').write) dlg.Update(5, "Emter Starport") starsite.retrbinary('RETR starport.txt',open( 'starport.txt','w+').write) dlg.Update(6, "Relocation Report") starsite.retrbinary('RETR relocat.txt',open('relocat.txt','w+').write) dlg.Update(7, "Closeing Connection") dlg.Destroy()# close the progress dialog set_local_db(self)#call the display local files routeen #------------------- #---------------------------------------------------------------------- class TomApp(wxApp):# Every wxWindows application must have a class derived from wxApp # wxWindows calls this method to initialize the application def OnInit(self):# Create an instance of our customized Frame class frame = TomFrame(NULL, -1, "Starport Online Assistant") frame.Show(true)# Tell wxWindows that this is our main window self.SetTopWindow(frame)# Return a success flag return true #--------------------------------------------------------------------------- def cleen_database(): New_db = mk.Storage('People.mk',1) New_vw = New_db.getas('starpeople[Name:S,Birthday:S,Time:S,AMPM:S,City:S,State:S,Countries:S,Province:S,name2:S,birthday2:S,time2:S,AMPM2:S,city2:S,state2:S,countrie2:S,province2:S,Email:S,BillingName:S,BillingEmail:S,Comments:S,StartTime:S,EndTime:S,NewCity:S,NewState:S,NewCountrie:S,NewProvince:S,ReportName:S,Sex:S,Preference:S]') #Starport_db.commit() s_old = Starport_vw[0:0] for s in Starport_vw.sort(Starport_vw.Name): if s_old <> s: New_vw.append(Name = s_old.Name,Birthday = s_old.Birthday,Time = s_old.Time,AMPM = s_old.AMPM,City = s_old.City,State = s_old.State,Countries = s_old.Countries,Province = s_old.Province,name2 = s_old.name2,birthday2 = s_old.birthday2,time2 = s_old.time2,AMPM2 = s_old.AMPM2,city2 = s_old.city2,state2 = s_old.state2,countrie2 = s_old.countrie2,province2 = s_old.province2,Email = s_old.Email,BillingName = s_old.BillingName,BillingEmail = s_old.BillingEmail,Comments = s_old.Comments,StartTime = s_old.StartTime,EndTime = s_old.EndTime,NewCity = s_old.NewCity,NewState = s_old.NewState,NewCountrie = s_old.NewCountrie,NewProvince = s_old.NewProvince,ReportName = s_old.ReportName,Sex = s_old.Sex,Preference = s_old.Preference) New_db.commit() s_old = s del New_db app = TomApp(0)# Create an instance of the application class app.MainLoop()# Tell it to start processing events del Starport_db