PCLAlgorithm

PCLAlgorithm.LayoutCommand(Layout, Random=True, Sorting='BS')

This definition is to support WindowConstructor.PanelCustomLayout. This definition helps the user with generating the following parameters: CommandLst and PanelSize. These variables are used by the panelcustomlayout definition to create panels. But because it is not always easy to create the instructions for that algorithm by hand. With WindowConstructor.PanelCustomLayout and LayoutCommand you can create almost any layout for the panels that you want. Below are the four steps to create them:

[[“A”,”A”], [“A”,”A”], [“B”,”B”]]

  • Think about what you want the layout to look like. It is important think about if one of the panels should be resizable or not. A 2D list is made with strings. Strings can have two parts seperated by a “/”.
  • Second every different first part of the string represents a different panel. So fill in all the panel names.
  • Third Every different second part of the string represents were a resizable border is. To determine if a border is resizable both panels next to each other must be resizable.
  • Fourth return with the CommandLst and PanelSize are put in the PanelCustomLayout.

Remarks

  • If the program has no solution initially, you can try manipulating the variables Random and Sorting, this is due to the fact that the algorightm starts in a certain location and tries to come up with a solution working it’s way from there, changing the parameters might help with converting to a solution. If Random is checked True and Sorting is “None” the programm always finds a solution if possible in the end.
  • If the algorithm has trouble finding the right solution you can help by making one resizable panel (this doesn’t result in a resizable panel (because it is just one panel), but the algorithm gets a hint where to start)
  • The keys from the PanelNameLst (That is needed for PanelCustomLayout) are the same as the first part of the string.

Warnings

  • If a “0” is used as a second letter. It is seen as a panel that can not be resized.
Parameters:
  • Layout (list with lists) – A 2D list with a map where all the panels need to go. The panels are represented with strings. The strings can consist out of two part seperated with a “/”. Every different first part of the strings are a different panels. Every different second part determines where resizable panels have to be.
  • Random (boolean) – Random determines where the algorithm starts looking for alignment between panels. When False it starts at the topleft and goes row for row. When True it starts at a random position and the order is random as well. (default is True)
  • Sorting (string) – If Random is true this string can be used to order where the algorithm starts. From the biggest panel to smallest (“BS”) or reversed (“SB”). If no order is desired fill in any other string. (default is “BS”)
Returns:

List with CommandLst and PanelSize. CommandLst is the list with the commands to build the desired panel layout (this list is needed in PanelCustomLayout). PanelSize is a list with the final size of the panel in weights this list has no influance on non Resizable panels.

Type:

list with lists