def launch(): ds = pylax.Dynaset("SalesOrder", "SELECT OrderID, Customer, LE.Name AS CustomerName, OrderDate FROM SalesOrder JOIN le ON LeID=Customer;") ds.autoColumn = ds.add_column("OrderID", int, key=True) ds.add_column("Customer", int) ds.add_column("CustomerName", str, None) dt = ds.add_column("OrderDate", datetime.datetime, False, format="{:%Y-%m-%d}", default = datetime.datetime.now()) dsOrderLine = pylax.Dynaset("OrderLine", "SELECT OrderLine.OrderID AS OrderID, Item, Quantity, Price, Quantity * Price AS Amount, OrderLine.rowid AS RowID FROM OrderLine JOIN SalesOrder ON SalesOrder.OrderID=OrderLine.OrderID WHERE OrderLine.OrderID=:OrderID;", parent=ds) dsOrderLine.add_column("RowID", int, key=True) dsOrderLine.add_column("OrderID", int, parent = "OrderID") dsOrderLine.add_column("Item", int) dsOrderLine.add_column("Quantity", float) dsOrderLine.add_column("Price", float) dsOrderLine.add_column("Amount", key=None) #dsOrderLine.on_parent_changed=dsOrderLine__on_parent_changed #print(dsOrderLine.parent) #dsOrderLine.autoExecute = False form = pylax.Form(None, 20, 30, 640, 480, "Order", ds) form.icon = pylax.Image("Order.ico") #form.minWidth, form.minHeight = 640, 400 form.before_close=dsOrderLine__on_parent_changed tableSelect = pylax.Table(form, 20, 44, -20, 100, dynaset=ds) tableSelect.add_column("Customer", 150, "CustomerName") # title, width, Dynaset column name tableSelect.add_column("ID", 30, "OrderID") tableSelect.add_column("Date", 90, "OrderDate", format="{:%y-%m-%d}") entrySearch = pylax.Entry(form, 90, 20, 120, 20, "Search Name") #, label = pylax.Label(form, 20, 20, 70, 20, "Search")) #print(entrySearch.dataType) ds.buttonSearch = pylax.Button(form, 220, 20, 60, 20, "Search") ds.buttonSearch.on_click = searchButton__on_click; entryID = pylax.Entry(form, 100, 160, 120, 20, dynaset=ds, column="OrderID", dataType=int, label = pylax.Label(form, 20, 160, 70, 20, "ID")) entryDate = pylax.Entry(form, 100, 190, 120, 20, dynaset=ds, column="OrderDate", format="{:%Y-%m-%d %H:%M}", label = pylax.Label(form, 20, 190, 70, 20, "Date")) entryDate.editFormat = "{:%Y-%m-%d %H:%M:%S}" entryCustomer = pylax.Entry(form, 330, 160, 120, 20, dynaset=ds, column="CustomerName", format="{:%Y-%m-%d %H:%M}", label = pylax.Label(form, 240, 160, 90, 20, "Customer")) entryCustomer.verify = entryCustomer__verify tableOrderLine = pylax.Table(form, 20, 220, -20, -80, dynaset=dsOrderLine) tableOrderLine.add_column("Item ID", 50, "Item") tableOrderLine.add_column("Quantity", 50, "Quantity") entryQuantity = pylax.Entry(form, 120, -70, 120, 20, dynaset=dsOrderLine, column="Quantity", label = pylax.Label(form, 20, -70, 90, 20, "Quantity")) #print(entrySearch.alignHoriz) ds.buttonNew = pylax.Button(form, -370, -40, 60, 20, "New") ds.buttonEdit = pylax.Button(form, -300, -40, 60, 20, "Edit") ds.buttonUndo = pylax.Button(form, -230, -40, 60, 20, "Undo") ds.buttonSave = pylax.Button(form, -160, -40, 60, 20, "Save") ds.buttonDelete = pylax.Button(form, -90, -40, 60, 20, "Delete") labelFormCaption = pylax.Label(form, 2, 2, 20, 60, "FormCaption", dynaset=ds, column="CustomerName", visible = False) labelFormCaption.captionClient = form # passes any assigment to property 'data' on to property 'caption' of the captionClient r = ds.execute()
def launch(): form = pylax.Form(None, 20, 30, 680, 500, "Item") #form.minWidth, form.minHeight = 640, 480 ds = pylax.Dynaset( "Item", "SELECT ItemID, Name, Description, Picture, Parent FROM Item ORDER BY Name DESC LIMIT 100;" ) ds.autoColumn = ds.add_column("ItemID", int, format="{:,}", key=True) ds.add_column("Name") ds.add_column("Description", str) ds.add_column("Picture", bytes) ds.add_column("Parent", int) selectionTable = pylax.Table(form, 12, 88, -344, -170, dynaset=ds, label=pylax.Label(form, 12, 60, 90, 24, "Select")) selectionTable.add_column("Name", 70, "Name") selectionTable.add_column("Description", 100, "Description") selectionTable.showRowIndicator = True imagePicture = pylax.Image(form, -330, 20, 320, 320, dynaset=ds, column="Picture") ds.buttonEdit = pylax.Button(form, -328, -36, 60, 24, "Edit") ds.buttonNew = pylax.Button(form, -264, -36, 60, 24, "New") ds.buttonDelete = pylax.Button(form, -200, -36, 60, 24, "Delete") ds.buttonUndo = pylax.Button(form, -136, -36, 60, 24, "Undo") ds.buttonSave = pylax.Button(form, -72, -36, 60, 24, "Save") r = ds.execute()
detailTable = pylax.Table(tabPageMain, -320, 88, -12, -196, dynaset=dsDetail, label = pylax.Label(tabPageMain, -320, 60, 90, 24, "Sold To")) detailTable.showRowIndicator = True detailTable.add_column("Customer Name", 120, "CustomerName") detailTable.add_column("Quantity", 100, "Quantity", editable = True) #entryTotalQuanity = pylax.Label(tabPageMain, -185, -190, 50, 24, dataType=int) #label = pylax.Label(tabPageMain, -330, -190, 70, 20, "Total Quantity") entryTotalQuanity = pylax.Entry(tabPageMain, -112, -190, 100, 24, dataType=int, label = pylax.Label(tabPageMain, -320, -190, 70, 20, "Total Quantity")) entryTotalQuanity.format="{:,}" entryTotalQuanity.readOnly = True entryCustomer = pylax.Entry(tabPageMain, -250, -132, 180, 24, dynaset=dsDetail, column="CustomerName", dataType=str, label = pylax.Label(tabPageMain, -320, -132, 70, 20, "Customer")) entryCustomer.on_click_button = entryCustomer__on_click_button entryCustomer.validate = entryCustomer__validate entryQuanity = pylax.Entry(tabPageMain, -250, -104, 180, 24, dynaset=dsDetail, column="Quantity", dataType=int, label = pylax.Label(tabPageMain, -320, -104, 70, 20, "Quantity")) entryQuanity.validate = entryQuanity__validate splitter = pylax.Splitter(tabPagePicture, 10, 10, -20, -20) splitter.position = 380 image = pylax.Image(splitter.box1, 20, 50, -20, -24, dynaset=ds, column="Picture", label = pylax.Label(splitter.box1, 20, 20, 70, 24, "Picture")) entryDescription = pylax.MarkDownEntry(splitter.box2, 20, 50, -20, -20, dynaset=ds, column="Description", dataType=str, label = pylax.Label(splitter.box2, 20, 20, 70, 20, "Description")) dsDetail.buttonEdit = pylax.Button(tabPageMain, -156, -36, 24, 24) dsDetail.buttonNew = pylax.Button(tabPageMain, -126, -36, 24, 24) dsDetail.buttonDelete = pylax.Button(tabPageMain, -96, -36, 24, 24) dsDetail.buttonUndo = pylax.Button(tabPageMain, -66, -36, 24, 24) dsDetail.buttonSave = pylax.Button(tabPageMain, -36, -36, 24, 24) r = ds.execute({"Name": entrySearch.data})
def launch(): global ds, entrySearch, comboBoxSearch ds = pylax.Dynaset( "Person", "SELECT PersonID, FirstName, LastName, Picture FROM Person ORDER BY LastName DESC LIMIT 100;" ) ds.autoColumn = ds.add_column("PersonID", int, format="{:,}", key=True) ds.add_column("LastName", str, False) ds.add_column("FirstName", str, False, default="One") ds.add_column("Picture", bytes) # GUI form = pylax.Form(None, 10, 10, 680, 450, "Person", ds) form.minWidth, form.minHeight = 640, 480 labelFormCaption = pylax.Label(form, 1, 1, 40, 20, dynaset=ds, column="LastName", visible=False) labelFormCaption.captionClient = form # passes any assigment to property 'data' on to property 'caption' of the captionClient comboBoxSearch = pylax.ComboBox(form, 82, 12, 50, 20, label=pylax.Label(form, 12, 12, 70, 20, "Search by")) comboBoxSearch.append("ID") comboBoxSearch.append("Name") comboBoxSearch.data = "Name" entrySearch = pylax.Entry(form, 160, 20, -410, 20) buttonSearch = pylax.Button(form, -400, 20, 20, 20, "⏎") buttonSearch.on_click = buttonSearch__on_click buttonSearch.defaultEnter = True selectionTable = pylax.Table(form, 12, 88, -344, -170, dynaset=ds, label=pylax.Label(form, 12, 60, 90, 24, "Select")) selectionTable.add_column("First Name", 70, "FirstName") selectionTable.add_column("Last Name", 150, "LastName") selectionTable.showRowIndicator = True imagePicture = pylax.Image(form, -260, 10, 150, 150, dynaset=ds, column="Picture") entryID = pylax.Entry(form, -260, 180, 60, 20, dynaset=ds, column="PersonID", dataType=int, label=pylax.Label(form, -340, 180, 70, 20, "ID")) entryID.editFormat = "{:,}" entryID.alignHoriz = pylax.Align.left entryID.readOnly = True entryFirstName = pylax.Entry(form, -260, 210, 60, 20, dynaset=ds, column="FirstName", dataType=str, label=pylax.Label(form, -340, 210, 70, 20, "First Name")) entryLastName = pylax.Entry(form, -260, 240, 60, 20, dynaset=ds, column="LastName", dataType=str, label=pylax.Label(form, -340, 240, 70, 20, "Last Name")) #comboBox = pylax.ComboBox(form, -260, 270, 60, 20, dynaset=ds, column="PersonID", label = pylax.Label(form, -340, 270, 70, 20, "PersonID")) #comboBox.append("Zero", 0) #comboBox.append("One", 1) #comboBox.append("Two", 2) ds.buttonEdit = pylax.Button(form, -328, -36, 60, 24, "Edit") ds.buttonNew = pylax.Button(form, -264, -36, 60, 24, "New") ds.buttonDelete = pylax.Button(form, -200, -36, 60, 24, "Delete") ds.buttonUndo = pylax.Button(form, -136, -36, 60, 24, "Undo") ds.buttonSave = pylax.Button(form, -72, -36, 60, 24, "Save") r = ds.execute()
20, 80, -360, -130, dynaset=ds, label=pylax.Label(tabPageMain, 20, 60, 90, 20, "Select")) selectionTable.add_column("Name", 70, "Name") selectionTable.add_column("Description", 100, "Description") selectionTable.showRowIndicator = True image = pylax.Image(tabPagePicture, 20, 40, -20, 320, dynaset=ds, column="Picture", label=pylax.Label(tabPagePicture, 20, 20, 70, 20, "Picture")) entryID = pylax.Entry(tabPageMain, 100, -100, -360, 20, dynaset=ds, column="ItemID", dataType=int, label=pylax.Label(tabPageMain, 20, -100, 70, 20, "ID")) entryID.editFormat = "{:,}"