Page layout editor: impossible to create an empty page layout.

Bug #1486031 reported by Konstantin Baranovskiy
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
Low
Jeff Young

Bug Description

To reproduce:
1) launch pl_editor (will loaded default page layout);
2) delete all elements in tree on the left side bar;
3) after deleting last element, in preview area will shown default page layout, but tree with elements are still empty.
4) save it to the file;
5) open the file - will loaded default page layout.

Application: kicad
Version: (2015-08-17 BZR 6097)-product release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.8.4,wx containers,compatible with 2.8)
Platform: Linux 3.13.0-61-generic i686, 32 bit, Little endian, wxGTK
Boost version: 1.54.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Tags: pleditor
Jon Evans (craftyjon)
Changed in kicad:
status: New → Confirmed
importance: Undecided → Low
ronnie (ronnie81)
tags: added: pleditor
Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

Attached patch enables creation and use of an empty page layout file and also defaults the new page layout to be empty. This behavior seems more intuitive, the user can always navigate to and open the installed KiCad default in the template folder and save as if they wish to modify it.

If a page layout file is not specified in Eeschema/Pcbnew Page Settings then it defaults to the standard KiCad template as before.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

It makes sense to me, but to have the patch committed we need to provide the default template as a file (attached) and install it. Perhaps the layout browser should also start in the default system page layout directory. Eeschema also needs to have fixed the 'show page limits' option, but I will take care of that.

Another thing is, your patch changes the current behavior - user gets an empty layout instead of the default one. IMHO it is right, but I want to hear other voices too.

Revision history for this message
Jeff Young (jeyjey) wrote :

I'd have a slight preference for getting the default template by default (rather than empty), but it's only slight.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

My preference would be the default as well. On advantage of this is that you can change your default template so you don't have to set it every time you create a new project.

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

The default file is currently installed to
macOS: /Library/Application Support/kicad/template/pagelayout_default.kicad_wks
Windows: C:\Program Files\KiCad\share\kicad\template\pagelayout_default.kicad_wks
along with some other templates (gost_landscape, gost_portrait, pagelayout_logo)

See: https://github.com/KiCad/kicad-templates.

The user only gets an empty layout in the page layout editor, the behavior in Eeschema and Pcbnew is unchanged (no kicad_wks specified, the default is used)

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

The "default" page layout (when no kicad_wks is specified in the Eeschema/Pcbnew Page Settings dialog) is hard coded in:

common/page_layout/page_layout_default_description.cpp

meaning you can't edit the default (unspecified) even if you wanted (I believe that's what you meant @Wayne?).

IMHO this is incorrect and instead the template (new) project file should specify the installed kicad_wks file in the template directory (or suitable alternative). However this is a bigger change that might mean the majority of older KiCad projects that don't specify a kicad_wks file (currently the default) are displayed with no border at all in future versions?

Revision history for this message
Seth Hillbrand (sethh) wrote :

I think Michael's approach is correct when starting pleditor. That is, don't load a file by default.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Michael,

With the patch applied, pcbnew starts with an empty page layout here. Once I open a design, the default layout is loaded and since that moment creating a new board will load the default layout as well. Are you seeing this or is it just my machine glitch?

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

No page layout is shown when there is no .pro with the same filename as the schematic or pcb in the same directory.

When Eeschema/Pcbnew opens a file in standalone mode and there is no accompanying .pro file, it creates one and loads its settings, hence the (default) page layout is then rendered (since the default .pro file specifies no .kicad_wks file).

What is the desired behavior here?

Revision history for this message
jean-pierre charras (jp-charras) wrote :

Hi Michael,

The desired behavior is to try to not change the old behavior when possible.
So if the .pro file is found, the default page layout *must be* shown.

This is especially true when Pcbnew or Eeschema is launch as stand alone without filename to open.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

"So if the .pro file is found"
^^^^^^^^^^^^^^^^^^^*is not found*
Sorry.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Michael, where do we stand on this? It sounds like all the issues up to comment #9 are addressed. Does the original patch meet JP's constraint in comments #10/11? If so, should I merge it?

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

@Jeff, I (or someone else) needs to have another crack at this. I need to do a more thorough job at untangling the loading of the default (hardcoded) worksheet and the "empty worksheet" hack used for EAGLE imports. I never had time to get to the bottom of it all, so I forgot about this patch.

Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

You can now *create* an empty page layout in the page layout editor, but when using it the default is still rendered because the *.kicad_wks file is empty.

Changed in kicad:
milestone: none → 6.0.0-rc1
Revision history for this message
Jeff Young (jeyjey) wrote :

I just tried this in a recent build, and deleting all the content and saving a page layout puts this in the file:

(page_layout
  (setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)
  (left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))
)

which seems to be enough to keep Kicad from thinking it's empty (at least I still get no content when I open it).

Revision history for this message
Jeff Young (jeyjey) wrote :

Can we close this based on the latest code?

Jeff Young (jeyjey)
Changed in kicad:
status: Confirmed → Fix Committed
Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

@Jeff, there is no content when opening it in PL editor, but try using it in Pcbnew/Eeschema and the default will still be rendered. Have a look at common/page_layout/ws_draw_item.cpp:458.

Changed in kicad:
status: Fix Committed → Triaged
Jeff Young (jeyjey)
Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
status: Triaged → In Progress
Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

@Jeff, don't know whether its helpful but I had a branch where I started to play with this: https://git.launchpad.net/~michaelkavanagh/kicad?h=empty-pl

I think its a better approach to pre-populate the new projects .pro file with the default installed .kicad_wks path rather than use a hard coded version inaccessible to the user, but I haven't had time to finish it. Problem is this approach breaks existing projects (suddenly no page layout loaded by default), so this would need to be fixed on opening new old projects.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Michael, I would agree with your approach 100% if we were starting from scratch.

I still think it's a better approach even from where we are today -- I'm just not sure it's worth the effort.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision bb8096497a9dc498283cce55279c051d35e8aef5
https://git.launchpad.net/kicad/patch/?id=bb8096497a9dc498283cce55279c051d35e8aef5

Changed in kicad:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.