Commit 94b03a85d99bb40b6dfa4e41b914fb2e9941c5b4
1 parent
3a3d1ea6
Exists in
wxgtk3_bkp
better spacings
Showing
1 changed file
with
50 additions
and
22 deletions
Show diff stats
invesalius/gui/task_slice.py
@@ -412,7 +412,7 @@ class MaskProperties(wx.Panel): | @@ -412,7 +412,7 @@ class MaskProperties(wx.Panel): | ||
412 | # Sizer which represents the first line | 412 | # Sizer which represents the first line |
413 | line1 = wx.BoxSizer(wx.HORIZONTAL) | 413 | line1 = wx.BoxSizer(wx.HORIZONTAL) |
414 | line1.Add(combo_mask_name, 1, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2) | 414 | line1.Add(combo_mask_name, 1, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2) |
415 | - line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2) | 415 | + line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL , 2) |
416 | 416 | ||
417 | ### LINE 2 | 417 | ### LINE 2 |
418 | text_thresh = wx.StaticText(self, -1, | 418 | text_thresh = wx.StaticText(self, -1, |
@@ -436,10 +436,18 @@ class MaskProperties(wx.Panel): | @@ -436,10 +436,18 @@ class MaskProperties(wx.Panel): | ||
436 | 436 | ||
437 | # Add all lines into main sizer | 437 | # Add all lines into main sizer |
438 | sizer = wx.BoxSizer(wx.VERTICAL) | 438 | sizer = wx.BoxSizer(wx.VERTICAL) |
439 | - sizer.Add(line1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | ||
440 | - sizer.Add(text_thresh, 0, wx.GROW|wx.EXPAND|wx.ALL, 5) | ||
441 | - sizer.Add(combo_thresh, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2) | ||
442 | - sizer.Add(gradient, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 6) | 439 | + sizer.AddSpacer(7) |
440 | + sizer.Add(line1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
441 | + | ||
442 | + sizer.AddSpacer(5) | ||
443 | + sizer.Add(text_thresh, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
444 | + sizer.AddSpacer(2) | ||
445 | + sizer.Add(combo_thresh, 0, wx.EXPAND|wx.GROW|wx.LEFT|wx.RIGHT, 5) | ||
446 | + | ||
447 | + sizer.AddSpacer(5) | ||
448 | + sizer.Add(gradient, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
449 | + sizer.AddSpacer(7) | ||
450 | + | ||
443 | sizer.Fit(self) | 451 | sizer.Fit(self) |
444 | 452 | ||
445 | self.SetSizerAndFit(sizer) | 453 | self.SetSizerAndFit(sizer) |
@@ -663,7 +671,12 @@ class EditionTools(wx.Panel): | @@ -663,7 +671,12 @@ class EditionTools(wx.Panel): | ||
663 | btn_brush_format.SetMenu(menu) | 671 | btn_brush_format.SetMenu(menu) |
664 | self.btn_brush_format = btn_brush_format | 672 | self.btn_brush_format = btn_brush_format |
665 | 673 | ||
666 | - spin_brush_size = wx.SpinCtrl(self, -1, "", (20, 50)) | 674 | + # To calculate best width to spinctrl |
675 | + dc = wx.WindowDC(self) | ||
676 | + dc.SetFont(self.GetFont()) | ||
677 | + width, height = dc.GetTextExtent("MMM") | ||
678 | + | ||
679 | + spin_brush_size = wx.SpinCtrl(self, -1, "", size=(width + 20, -1)) | ||
667 | spin_brush_size.SetRange(1,100) | 680 | spin_brush_size.SetRange(1,100) |
668 | spin_brush_size.SetValue(const.BRUSH_SIZE) | 681 | spin_brush_size.SetValue(const.BRUSH_SIZE) |
669 | spin_brush_size.Bind(wx.EVT_TEXT, self.OnBrushSize) | 682 | spin_brush_size.Bind(wx.EVT_TEXT, self.OnBrushSize) |
@@ -679,9 +692,9 @@ class EditionTools(wx.Panel): | @@ -679,9 +692,9 @@ class EditionTools(wx.Panel): | ||
679 | 692 | ||
680 | # Sizer which represents the second line | 693 | # Sizer which represents the second line |
681 | line2 = wx.BoxSizer(wx.HORIZONTAL) | 694 | line2 = wx.BoxSizer(wx.HORIZONTAL) |
682 | - line2.Add(btn_brush_format, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 0) | ||
683 | - line2.Add(spin_brush_size, 0, wx.RIGHT, 5) | ||
684 | - line2.Add(combo_brush_op, 1, wx.EXPAND|wx.TOP|wx.RIGHT|wx.LEFT, 5) | 695 | + line2.Add(btn_brush_format, 0, wx.EXPAND|wx.GROW|wx.RIGHT, 5) |
696 | + line2.Add(spin_brush_size, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5) | ||
697 | + line2.Add(combo_brush_op, 1, wx.RIGHT|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 5) | ||
685 | 698 | ||
686 | ## LINE 3 | 699 | ## LINE 3 |
687 | text_thresh = wx.StaticText(self, -1, _("Brush threshold range:")) | 700 | text_thresh = wx.StaticText(self, -1, _("Brush threshold range:")) |
@@ -694,11 +707,15 @@ class EditionTools(wx.Panel): | @@ -694,11 +707,15 @@ class EditionTools(wx.Panel): | ||
694 | 707 | ||
695 | # Add lines into main sizer | 708 | # Add lines into main sizer |
696 | sizer = wx.BoxSizer(wx.VERTICAL) | 709 | sizer = wx.BoxSizer(wx.VERTICAL) |
697 | - sizer.Add(text1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | ||
698 | - sizer.Add(line2, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | ||
699 | - sizer.Add(text_thresh, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | ||
700 | - sizer.Add(gradient_thresh, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT| | ||
701 | - wx.BOTTOM, 6) | 710 | + sizer.AddSpacer(7) |
711 | + sizer.Add(text1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
712 | + sizer.AddSpacer(2) | ||
713 | + sizer.Add(line2, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
714 | + sizer.AddSpacer(5) | ||
715 | + sizer.Add(text_thresh, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
716 | + sizer.AddSpacer(5) | ||
717 | + sizer.Add(gradient_thresh, 0, wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
718 | + sizer.AddSpacer(7) | ||
702 | sizer.Fit(self) | 719 | sizer.Fit(self) |
703 | 720 | ||
704 | self.SetSizerAndFit(sizer) | 721 | self.SetSizerAndFit(sizer) |
@@ -809,7 +826,12 @@ class WatershedTool(EditionTools): | @@ -809,7 +826,12 @@ class WatershedTool(EditionTools): | ||
809 | btn_brush_format.SetMenu(menu) | 826 | btn_brush_format.SetMenu(menu) |
810 | self.btn_brush_format = btn_brush_format | 827 | self.btn_brush_format = btn_brush_format |
811 | 828 | ||
812 | - spin_brush_size = wx.SpinCtrl(self, -1, "", (20, 50)) | 829 | + # To calculate best width to spinctrl |
830 | + dc = wx.WindowDC(self) | ||
831 | + dc.SetFont(self.GetFont()) | ||
832 | + width, height = dc.GetTextExtent("MMM") | ||
833 | + | ||
834 | + spin_brush_size = wx.SpinCtrl(self, -1, "", size=(width + 20, -1)) | ||
813 | spin_brush_size.SetRange(1,100) | 835 | spin_brush_size.SetRange(1,100) |
814 | spin_brush_size.SetValue(const.BRUSH_SIZE) | 836 | spin_brush_size.SetValue(const.BRUSH_SIZE) |
815 | spin_brush_size.Bind(wx.EVT_TEXT, self.OnBrushSize) | 837 | spin_brush_size.Bind(wx.EVT_TEXT, self.OnBrushSize) |
@@ -827,9 +849,9 @@ class WatershedTool(EditionTools): | @@ -827,9 +849,9 @@ class WatershedTool(EditionTools): | ||
827 | 849 | ||
828 | # Sizer which represents the second line | 850 | # Sizer which represents the second line |
829 | line2 = wx.BoxSizer(wx.HORIZONTAL) | 851 | line2 = wx.BoxSizer(wx.HORIZONTAL) |
830 | - line2.Add(btn_brush_format, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 0) | ||
831 | - line2.Add(spin_brush_size, 0, wx.RIGHT, 5) | ||
832 | - line2.Add(combo_brush_op, 1, wx.EXPAND|wx.TOP|wx.RIGHT|wx.LEFT, 5) | 852 | + line2.Add(btn_brush_format, 0, wx.EXPAND|wx.GROW|wx.RIGHT, 5) |
853 | + line2.Add(spin_brush_size, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5) | ||
854 | + line2.Add(combo_brush_op, 1, wx.RIGHT|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 5) | ||
833 | 855 | ||
834 | ## LINE 3 | 856 | ## LINE 3 |
835 | 857 | ||
@@ -854,11 +876,17 @@ class WatershedTool(EditionTools): | @@ -854,11 +876,17 @@ class WatershedTool(EditionTools): | ||
854 | 876 | ||
855 | # Add lines into main sizer | 877 | # Add lines into main sizer |
856 | sizer = wx.BoxSizer(wx.VERTICAL) | 878 | sizer = wx.BoxSizer(wx.VERTICAL) |
857 | - sizer.Add(text1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | ||
858 | - sizer.Add(line2, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | ||
859 | - sizer.Add(check_box, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | ||
860 | - sizer.Add(ww_wl_cbox, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | 879 | + sizer.AddSpacer(7) |
880 | + sizer.Add(text1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
881 | + sizer.AddSpacer(2) | ||
882 | + sizer.Add(line2, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
883 | + sizer.AddSpacer(5) | ||
884 | + sizer.Add(check_box, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
885 | + sizer.AddSpacer(2) | ||
886 | + sizer.Add(ww_wl_cbox, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
887 | + sizer.AddSpacer(5) | ||
861 | sizer.Add(sizer_btns, 0, wx.EXPAND) | 888 | sizer.Add(sizer_btns, 0, wx.EXPAND) |
889 | + sizer.AddSpacer(7) | ||
862 | sizer.Fit(self) | 890 | sizer.Fit(self) |
863 | 891 | ||
864 | self.SetSizerAndFit(sizer) | 892 | self.SetSizerAndFit(sizer) |