if queryWindow.state() == "withdrawn": # show query window queryWindow.deiconify() #------------------- start the GUI code -------------------# min_x = 475 min_y = 380 #root = Tk() root.title("altro") root.minsize(min_x, min_y) # width, height, x-pos, y-pos root.geometry("1024x768+10+10") Mx.init() # create a toolbar toolbar = Frame(root) menubar = Menu(root) # this creates a menu tied to the top of the screen # FILE menubar item filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Open", command=openFile) filemenu.add_command(label="Insert", command=insertFile) filemenu.add_command(label="Append", command=appendFile) filemenu.add_command(label="Save as…", command=saveAs) filemenu.add_separator() filemenu.add_command(label="Exit", command=exitApp)
# show query window queryWindow.deiconify() #------------------- start the GUI code -------------------# min_x = 475 min_y = 380 #root = Tk() root.title( "altro" ) root.minsize( min_x, min_y ) # width, height, x-pos, y-pos root.geometry( "1024x768+10+10" ) Mx.init() # create a toolbar toolbar = Frame(root) menubar = Menu( root ) # this creates a menu tied to the top of the screen # FILE menubar item filemenu = Menu( menubar, tearoff = 0 ) filemenu.add_command ( label = "Open", command = openFile ) filemenu.add_command ( label = "Insert", command = insertFile ) filemenu.add_command ( label = "Append", command = appendFile ) filemenu.add_command ( label = "Save as…", command = saveAs ) filemenu.add_separator() filemenu.add_command ( label = "Exit", command = exitApp )
except: print "Could Not Connect to Database" else: print "No Username Provided" if (dbConnect == 1): root = Tk() root.minsize(width=740, height=270) root.title(string="Altro") root.option_add('*font', 'Helvetica -12') m = MainWindow(root, QueryWindow(root)) root.config(menu=m) MXTOOL_XSD = os.getenv("MXTOOL_XSD") while True: status = Mx.init() #initilize libxml2 if (status != 0): result = tkMessageBox.askyesno("Warning!", "No XSD environment variable found. Do you wish to set a variable?", icon="warning") if result is True: schema = askopenfilename(filetypes=[("XSD Files",".xsd")]) os.putenv("MXTOOL_XSD", schema) os.system("make mxtool") else: break else: break if (status != 0): quit() #try: create table bibrec - will throw exception if table is already created make sure to commit conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
global numRecs status('Deleting Selected Records') items = display.curselection() #get indexes of selected items offset = 0 deleted = 0 #loop through selected items and delete for i in items: index = int(i) - offset display.delete(index,index) offset = offset + 1 deleted = deleted + 1 numRecs = numRecs - 1 status( str(deleted) + ' records deleted.' + str(numRecs) + ' left in total') value = Mx.init() if value == 0: status('Schema Validated') else: status('Failed to Validate Schema') menu = Menu(root) root.config(menu = menu) # Adding 'File' tab menuBar = Menu(menu) menu.add_cascade(label= 'File', menu = menuBar) menuBar.add_command(label = 'Open', command = Open) menuBar.add_command(label = 'Insert', command = insert) menuBar.add_command(label = 'Append', command = append)