Пример #1
0
def entryCustomer__on_click_button(self):
    def selectorSearchButton__on_click(data):
        if entrySearch.data == None:
            r = ds.execute(query="SELECT CustomerID, Name FROM Customer;")
        else:
            r = ds.execute(
                {"Name": entrySearch.data},
                "SELECT CustomerID, Name FROM Customer WHERE Name LIKE :Name;")

    def selectorOkButton__on_click(data):
        self.dynaset.set_data("Customer", ds.get_row_data()["CustomerID"])
        self.dynaset.set_data("CustomerName", ds.get_row_data()["Name"])
        selector.close()

    ds = pylax.Dynaset("LE", "SELECT CustomerID, Name FROM Customer;")
    ds.autoColumn = ds.add_column("CustomerID", int, key=True)
    ds.add_column("Name")
    selector = pylax.Window(None, 0, 0, 320, 220, "Select Customer", ds)

    entrySearch = pylax.Entry(selector, 20, 20, -70, 20, "Search Name")
    ds.buttonSearch = pylax.Button(selector, -60, 20, 20, 20, "⏎")
    ds.buttonSearch.on_click = selectorSearchButton__on_click

    table = pylax.Table(selector, 20, 60, -20, -70, dynaset=ds)
    table.add_column("Name", 150, "Name")
    table.add_column("ID", 30, "CustomerID")
    ds.buttonOK = pylax.Button(selector, -60, -50, 40, 20, "OK")
    ds.buttonOK.on_click = selectorOkButton__on_click
    #selector.buttonCancel = pylax.Button(selector, -60, -40, 50, 20, "Cancel")
    r = ds.execute()
Пример #2
0
    def dialog(self, data):
        self.window = pylax.Window(None, 0, 0, 320, 220, "Select Customer", self.dynaset)

        self.entrySearch= pylax.Entry(self.window, 20, 20, -70, 20, "Search Name")
        self.entrySearch.data = data + "%"
        buttonSearch = pylax.Button(self.window, -60, 20, 20, 20, "⏎")
        buttonSearch.on_click = self.buttonSearch__on_click

        table = pylax.Table(self.window, 20, 60, -20, -70, dynaset=self.dynaset)
        table.add_column("Name", 150, "Name")
        table.add_column("ID", 30, "CustomerID")
        self.dynaset.buttonOK = pylax.Button(self.window, -60, -50, 40, 20, "OK")
        self.dynaset.buttonOK.on_click = self.buttonOK__on_click;
        self.dynaset.execute({"Name": self.entrySearch.data}, self.query_browse)
        self.window.wait_for_close()
Пример #3
0
def create_selector_Customer():
    ds = pylax.Dynaset("LE", "SELECT LeID, Name FROM LE;")
    ds.autoColumn = ds.add_column("LeID", int, key=True)
    ds.add_column("Name")
    selector = pylax.Window(None,  30, 20, 480, 280, "Select Customer", ds)

    entrySearch= pylax.Entry(selector, 90, 20, 120, 20, "Search Name")
    ds.buttonSearch = pylax.Button(selector, 220, 20, 60, 20, "Search")
    ds.buttonSearch.on_click = selectorSearchButton__on_click;

    table = pylax.Table(selector, 20, 44, -20, 100, dynaset=ds)
    table.add_column("Name", 150, "Name")
    table.add_column("ID", 30, "LeID")
    ds.buttonOK = pylax.Button(selector, -120, -40, 50, 20, "OK")
    selector.buttonCancel = pylax.Button(selector, -60, -40, 50, 20, "Cancel")
    r=ds.execute()
    return selector
Пример #4
0
def entryCustomer__validate(widget, data):

    def buttonSearch__on_click(data):
        if entrySearch.data == None:
            r = ds.execute(query = "SELECT LeID, Name FROM LE LIMIT 100;")
        else:
            r = ds.execute({"Name": entrySearch.data}, "SELECT LeID, Name FROM LE WHERE Name LIKE :Name LIMIT 100;")

    def buttonOK__on_click(data):
        widget.dynaset.set_data("Customer", ds.get_row_data()["LeID"])
        widget.dynaset.set_data("CustomerName", ds.get_row_data()["Name"])
        window.close()

    ds = pylax.Dynaset("LE", "SELECT LeID, Name FROM LE WHERE Name = :Name LIMIT 100;")
    ds.autoColumn = ds.add_column("LeID", int, key=True)
    ds.add_column("Name")
    rows = ds.execute({"Name": data})
    if rows == 1:
        ds.row = 0
        widget.dynaset.set_data("Customer", ds.get_row_data()["LeID"])
        widget.dynaset.set_data("CustomerName", ds.get_row_data()["Name"])
        return True
    else:
        window = pylax.Window(None, 0, 0, 320, 220, "Select Customer", ds)

        entrySearch= pylax.Entry(window, 20, 20, -70, 24, "Search Name")
        entrySearch.data = data + "%"
        buttonSearch = pylax.Button(window, -60, 20, 20, 24, "⏎")
        buttonSearch.on_click = buttonSearch__on_click;

        table = pylax.Table(window, 20, 60, -20, -70, dynaset=ds)
        table.add_column("Name", 150, "Name")
        table.add_column("ID", 30, "LeID")
        ds.buttonOK = pylax.Button(window, -60, -50, 40, 24, "OK")
        ds.buttonOK.on_click = buttonOK__on_click;
        r = ds.execute({"Name": entrySearch.data}, "SELECT LeID, Name FROM LE WHERE Name LIKE :Name;")
        return False
Пример #5
0
def aboutBoxMenuItem__on_click():
    aboutBox = pylax.Window(None,  0, 0, 320, 160, "About")
    aboutBox.minHeight = 100
    label = pylax.Label(aboutBox, 30, 30, -20, -20, "Pylax test form")
    label.alignHoriz, label.alignVert = pylax.Align.center, pylax.Align.center
    aboutBox.visible = True