diff --git a/bCNC/ControlPage.py b/bCNC/ControlPage.py index fd07aaacd..3dda2cece 100644 --- a/bCNC/ControlPage.py +++ b/bCNC/ControlPage.py @@ -149,15 +149,17 @@ def __init__(self, master, app): class UserGroup(CNCRibbon.ButtonGroup): def __init__(self, master, app): CNCRibbon.ButtonGroup.__init__(self, master, "User", app) - self.grid3rows() - n = Utils.getInt("Buttons", "n", 6) - for i in range(1, n): + numRows = Utils.getInt("Buttons", "nrows", 4) + self.gridNrows(numRows) + + n = Utils.getInt("Buttons", "n", 12) + for i in range(n): b = Utils.UserButton( - self.frame, self.app, i, anchor=W, + self.frame, self.app, i + 1, anchor=W, background=Ribbon._BACKGROUND ) - col, row = divmod(i - 1, 3) + col, row = divmod(i, numRows) b.grid(row=row, column=col, sticky=NSEW) self.addWidget(b) diff --git a/bCNC/Ribbon.py b/bCNC/Ribbon.py index 37ae3acd0..91817ba2e 100644 --- a/bCNC/Ribbon.py +++ b/bCNC/Ribbon.py @@ -103,15 +103,18 @@ def __init__(self, master, name, command=None, **kw): ) # Button takes 1px for border width self.label.pack(side=BOTTOM, fill=X, pady=0) + # ----------------------------------------------------------------------- + def gridNrows(self, numRows: int): + for i in range(numRows): + self.frame.grid_rowconfigure(i, weight=1) + # ----------------------------------------------------------------------- def grid2rows(self): - self.frame.grid_rowconfigure(0, weight=1) - self.frame.grid_rowconfigure(1, weight=1) + self.gridNrows(2) # ----------------------------------------------------------------------- def grid3rows(self): - self.grid2rows() - self.frame.grid_rowconfigure(2, weight=1) + self.gridNrows(3) # ============================================================================= diff --git a/bCNC/bCNC.ini b/bCNC/bCNC.ini index cfbf77030..55bf9932e 100644 --- a/bCNC/bCNC.ini +++ b/bCNC/bCNC.ini @@ -116,7 +116,8 @@ probe = dxfloopmerge = 0 [Buttons] -n = 13 +nrows = 3 +n = 12 name.0 = 0 icon.0 = tooltip.0 = Move to 0, 0, 0