Technical tools ·

Interface Designer and Code Editor: one project, no copies

Drawing a window in the Interface Designer and writing its Python with the comforts of an editor used to be two separate places. Not any more: the project open in the Designer shows up in the Code Editor, inside the Code app, and both work on the same text. There is no file to export and no two copies to overwrite each other. This guide explains how to work, what happens to unsaved changes and what it still does not do.

ERPSqlite screenshot: The open project in the Editor's explorer, with its code and the generated Python
The open project in the Editor's explorer, with its code and the generated Python

What you see in the Editor

With a project open in the Designer, the Editor's explorer shows it at the top, above the folder, with its name in capitals and a dot if there are unsaved changes. Two files appear below it:

  • The code: the file named after the window, such as Form1.py. This is what you write, and you can edit it.
  • The generated Python: what comes out of the design and the code together, marked “Read only”. A notice at the top says: “Generated from the design: it can't be edited here.”
ERPSqlite screenshot: The same project in the Interface Designer
The same project in the Interface Designer

How to work

  1. Open the project in “Interface designer”, desktop or web.
  2. Go to “Editor”, in the same Code app.
  3. Click the code file in the explorer: it opens in a tab, like any other.
  4. Type. Each change reaches the Designer at once, because it is the same text.
  5. Save from either one: design and code are saved together, because they change together.
ERPSqlite screenshot: An unsaved change: the dot shows on the tab and on the project
An unsaved change: the dot shows on the tab and on the project

One single text

The Designer and the Editor do not pass copies around: there is one in memory, and the Editor tab writes into it with every change. With the app's split view you see both at once, and what you type in one shows up in the other. The generated file follows the design: change a button and it is rebuilt.

Undo in the Designer does not overwrite hand-written code either. The design goes back and the code stays; if going back to that step would lose what you wrote, the code is kept and the Designer warns you.

ERPSqlite screenshot: The generated Python, read only
The generated Python, read only

Unsaved work is not lost

Switching apps inside the ERP does not close the project: when you come back, it is as you left it. If you close the project in the Designer with code pending in the Editor, the dialog warns you: “Save the changes before closing? If you discard them, the design changes are lost; the unsaved code stays in its Editor tab.”

That tab stays open with its text and explains what happens: on saving, the code is written to the project and the tab closes. If you reopen the project in the Designer before saving, it picks up that same copy, not a second one.

ERPSqlite screenshot: Closing in the Designer with code pending in the Editor
Closing in the Designer with code pending in the Editor

What it does not do

  • It does not put the project in a folder: it lives in the ERP database, so git and the folder open in the Editor do not see it. For a .py file, export it from the Designer.
  • It does not let you edit the generated Python: that is rebuilt from the design.
  • It does not show a closed project: the section only appears with one open in the Designer.
  • It does not appear in another database or company, and it does not save there: it says so and asks you to go back.
  • It does not keep pending design changes on closing: if you discard them, only the code in the tab remains.
  • It is for administrators with access to Code only, and only in the desktop version.
ERPSqlite screenshot: The tab keeps the text and explains what happens on saving
The tab keeps the text and explains what happens on saving

Frequently asked questions

Do I have to export the project to open it in the Editor?

No. Having it open in the Designer is enough: it appears in the Editor's explorer on its own.

Can I have a folder open at the same time?

Yes. The project sits above the folder and does not affect it, and opening another folder does not close its tabs.

Does anything change if I do not use the Designer?

No. With no project open, the Editor stays as it always was.

Try Code in ERPSqlite

90-day trial with every app included, on Windows, macOS or in your browser.

Keep reading

← All blog guides