Results 1 to 8 of 8

Thread: Lianja App Builder stop working after changes in python file

  1. #1
    Junior Member
    Join Date
    May 2016
    Posts
    5

    Unhappy Lianja App Builder stop working after changes in python file

    Hi, I have problem about Lianja App Builder.

    Sometimes to often my App Builder stop working immediately after changing my python file a switching from Apps to Pages.

    I'm using Windows 7 32 bit and Lianja full download with all services, but Trial.

    I'm going to add some code below to check if my code isn't bad.

    Before my Lianja stopped working, I had the following code:

    Code:
    #
    # Lianja custom Python section "page1_section1"
    #
    import Lianja
    #--------------------------------------------------------------------------
    # Step 1: Define the classes we need
    # Note that all Lianja UI Framework classes can be subclassed in Python
    class mySection(Lianja.Section):
        def add(self):
            Lianja.showMessage("add() was called")
     
        def delete(self):
            Lianja.showMessage("delete() was called")
     
        def first(self):
            Lianja.showMessage("first() was called")
     
        def previous(self):
            Lianja.showMessage("previous() was called")
     
        def next(self):
            Lianja.showMessage("next() was called")
     
        def last(self):
            Lianja.showMessage("last() was called")
            
        def refresh(self):
            pass
     
        def search(self):
            pass
             
        def watch(self):
            Lianja.showMessage("watch() was called")
     
        def edit(self):
            Lianja.showMessage("edit() was called")
     
        def save(self):
            Lianja.showMessage("save() was called")
     
        def cancel(self):
            Lianja.showMessage("cancel() was called")
     
    #--------------------------------------------------------------------------
    # Note how the click() event handler for the ListBox is defined in Python
    class myListbox(Lianja.Listbox):
        def click(self):
            ui_grid.clear( )
            # Note how the AddItems method of Grid, ListBox and ComboBox can take 
            # a SQL SELECT statement as an argument
            if ui_listbox.text == "All":
                ui_grid.additems('select * from southwind!example where last_name != " "')
            else: 
                ui_grid.additems('select * from southwind!example where upper(left(last_name,1)) \
                = "' + ui_listbox.text + '"')
            ui_grid.refresh( )
    This works when I changed from Apps to Pages.
    But when I added following lines of code, my Lianja stop working, and after restart I cannot access my App, It stop working again and again..

    Code:
    # Step 2: Create the Section object
    # Note that the CreateObject() method needs two args: objectname, classname
    oSection = Lianja.createObject("oSection", "mySection")
    oSection.backcolor = "lightgreen"
    oSection.caption = "This is a custom Python section
    Stop working means Windows pop-up dialog stop working, and just one way is to close the app.

  2. #2
    Hi juldou,

    Try to get to an earlier saved version. Lianja keeps track of changes.
    On the left hand side, click on "Versions", then select your app, and choose an earlier date.
    Then click on the counter-clockwise Icon on the top right to "Restore from Backup"

    If for some reason that doesnt work, you can open your file in notepad++(or any text editor) and add the closing comment on the caption.
    oSection.caption ="This is a custom Python section"

    You can find your file in c:\Lianja\apps\<yourappname>\page_section.py

    Herb

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Can I see all the code in the file.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #4
    Junior Member
    Join Date
    May 2016
    Posts
    5
    My first thread is all the code.

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    I understand that but nevertheless can you just paste it here so i can cut and paste it to test why a crash would occur.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Looking at your code... (and the reason I asked you to cut and paste the code is that Python syntax is all based on whitespace indentation).

    1. oSection.caption = "This is a custom Python section

    This is missing a closing quote.

    2. This is not a valid custom section as you have removed this code that was generated for you and is required.

    oSection = Lianja.createObject("oSection", "mySection")
    returnvalue = oSection

    3. On my system it does not crash. In fact a Python error is reported in the console.

    Mon Jun 13 09:36:35 2016
    **** Lianja Python error ****
    File "page1_section2.py" at line 63
    oSection.caption = "This is a custom Python section
    ^
    SyntaxError: EOL while scanning string literal



    As Herb originally replied, you can open the App Builder and revert to a previous version of any file in the "Versions" workspace.

    Clearly it should not crash but I am unable to reproduce this in the version that I am running.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  7. #7
    I have the same problem with Windows 10, 64bits, Lianja 3.4, Visual Fox Gadget. This is the code of the gadget who crash the IDE with any kind of code:
    define class Seleccion as Commandbutton
    procedure click(id)

    //a=messagebox("Hola Mundo")
    select employees
    browse
    endproc
    endclass
    proc gadget2
    gadget2 = createobject("gadget2")
    //
    // Create your section UI from the application framework classes here
    //
    // e.g. to add a tabbed section:
    //
    // gadget2.addobject("tabs", "pageframe")
    // tabs.addobject("tab1", "page")
    // tab1.caption = "Customers"
    // tabs.addobject("tab2", "page")
    // tab2.caption = "Orders"
    // tabs.addobject("tab3", "page")
    // tab3.caption = "Shippers"

    gadget2.addobject("Seleccion")


    gadget2.show
    //
    return gadget2
    Last edited by palmaresweb; 2017-08-10 at 17:17.

  8. #8
    Hi,

    Updating this:

    In Lianja, you would use define and endDefine for classes, not endclass.

    Herb
    Last edited by hmischel@diligentsystems.com; 2017-08-10 at 18:59.

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us