Commit 314371db3ef01063e895e05ceab327bc13d836b1

Authored by Thiago Franco de Moraes
1 parent 26095686
Exists in ffill_gui

Better gui to ffil fill and remove

Showing 1 changed file with 86 additions and 38 deletions   Show diff stats
invesalius/gui/dialogs.py
... ... @@ -1840,6 +1840,66 @@ def BitmapNotSameSize():
1840 1840 dlg.Destroy()
1841 1841  
1842 1842  
  1843 +class PanelTargeFFill(wx.Panel):
  1844 + def __init__(self, parent, ID=-1, style=wx.TAB_TRAVERSAL|wx.NO_BORDER):
  1845 + wx.Panel.__init__(self, parent, ID, style=style)
  1846 + self._init_gui()
  1847 +
  1848 + def _init_gui(self):
  1849 + self.target_2d = wx.RadioButton(self, -1, _(u"2D - Actual slice"), style=wx.RB_GROUP)
  1850 + self.target_3d = wx.RadioButton(self, -1, _(u"3D - All slices"))
  1851 +
  1852 + sizer = wx.GridBagSizer(10)
  1853 +
  1854 + sizer.Add(self.target_2d, (0, 0), (1, 6), flag=wx.LEFT, border=5)
  1855 + sizer.Add(self.target_3d, (1, 0), (1, 6), flag=wx.LEFT, border=5)
  1856 +
  1857 + self.SetSizer(sizer)
  1858 + sizer.Fit(self)
  1859 + self.Layout()
  1860 +
  1861 +class Panel2DConnectivity(wx.Panel):
  1862 + def __init__(self, parent, ID=-1, style=wx.TAB_TRAVERSAL|wx.NO_BORDER):
  1863 + wx.Panel.__init__(self, parent, ID, style=style)
  1864 + self._init_gui()
  1865 +
  1866 + def _init_gui(self):
  1867 + self.conect2D_4 = wx.RadioButton(self, -1, "4", style=wx.RB_GROUP)
  1868 + self.conect2D_8 = wx.RadioButton(self, -1, "8")
  1869 +
  1870 + sizer = wx.GridBagSizer(10)
  1871 +
  1872 + sizer.Add(wx.StaticText(self, -1, _(u"2D Connectivity")), (0, 0), (1, 6), flag=wx.LEFT, border=5)
  1873 + sizer.Add(self.conect2D_4, (1, 0), flag=wx.LEFT, border=7)
  1874 + sizer.Add(self.conect2D_8, (1, 1), flag=wx.LEFT, border=7)
  1875 +
  1876 + self.SetSizer(sizer)
  1877 + sizer.Fit(self)
  1878 + self.Layout()
  1879 +
  1880 +
  1881 +class Panel3DConnectivity(wx.Panel):
  1882 + def __init__(self, parent, ID=-1, style=wx.TAB_TRAVERSAL|wx.NO_BORDER):
  1883 + wx.Panel.__init__(self, parent, ID, style=style)
  1884 + self._init_gui()
  1885 +
  1886 + def _init_gui(self):
  1887 + self.conect3D_6 = wx.RadioButton(self, -1, "6", style=wx.RB_GROUP)
  1888 + self.conect3D_18 = wx.RadioButton(self, -1, "18")
  1889 + self.conect3D_26 = wx.RadioButton(self, -1, "26")
  1890 +
  1891 + sizer = wx.GridBagSizer(5, 5)
  1892 +
  1893 + sizer.Add(wx.StaticText(self, -1, _(u"3D Connectivity")), (0, 0), (1, 6), flag=wx.LEFT, border=5)
  1894 + sizer.Add(self.conect3D_6, (1, 0), flag=wx.LEFT, border=9)
  1895 + sizer.Add(self.conect3D_18, (1, 1), flag=wx.LEFT, border=9)
  1896 + sizer.Add(self.conect3D_26, (1, 2), flag=wx.LEFT, border=9)
  1897 +
  1898 + self.SetSizer(sizer)
  1899 + sizer.Fit(self)
  1900 + self.Layout()
  1901 +
  1902 +
1843 1903 class FFillOptionsDialog(wx.Dialog):
1844 1904 def __init__(self, title, config):
1845 1905 pre = wx.PreDialog()
... ... @@ -1855,57 +1915,45 @@ class FFillOptionsDialog(wx.Dialog):
1855 1915 Create the widgets.
1856 1916 """
1857 1917 # Target
1858   - self.target_2d = wx.RadioButton(self, -1, _(u"2D - Actual slice"), style=wx.RB_GROUP)
1859   - self.target_3d = wx.RadioButton(self, -1, _(u"3D - All slices"))
  1918 + self.panel_target = PanelTargeFFill(self, style=wx.SUNKEN_BORDER)
1860 1919  
1861 1920 if self.config.target == "2D":
1862   - self.target_2d.SetValue(1)
  1921 + self.panel_target.target_2d.SetValue(1)
1863 1922 else:
1864   - self.target_3d.SetValue(1)
  1923 + self.panel_target.target_3d.SetValue(1)
1865 1924  
1866 1925 # Connectivity 2D
1867   - self.conect2D_4 = wx.RadioButton(self, -1, "4", style=wx.RB_GROUP)
1868   - self.conect2D_8 = wx.RadioButton(self, -1, "8")
  1926 + self.panel2dcon = Panel2DConnectivity(self, style=wx.SUNKEN_BORDER)
1869 1927  
1870 1928 if self.config.con_2d == 8:
1871   - self.conect2D_8.SetValue(1)
  1929 + self.panel2dcon.conect2D_8.SetValue(1)
1872 1930 else:
1873   - self.conect2D_4.SetValue(1)
  1931 + self.panel2dcon.conect2D_4.SetValue(1)
1874 1932 self.config.con_2d = 4
1875 1933  
1876 1934 # Connectivity 3D
1877   - self.conect3D_6 = wx.RadioButton(self, -1, "6", style=wx.RB_GROUP)
1878   - self.conect3D_18 = wx.RadioButton(self, -1, "18")
1879   - self.conect3D_26 = wx.RadioButton(self, -1, "26")
  1935 + self.panel3dcon = Panel3DConnectivity(self, style=wx.SUNKEN_BORDER)
1880 1936  
1881 1937 if self.config.con_3d == 18:
1882   - self.conect3D_18.SetValue(1)
  1938 + self.panel3dcon.conect3D_18.SetValue(1)
1883 1939 elif self.config.con_3d == 26:
1884   - self.conect3D_26.SetValue(1)
  1940 + self.panel3dcon.conect3D_26.SetValue(1)
1885 1941 else:
1886   - self.conect3D_6.SetValue(1)
  1942 + self.panel3dcon.conect3D_6.SetValue(1)
1887 1943  
1888 1944 # Sizer
1889   - sizer = wx.GridBagSizer(11, 6)
1890   - sizer.AddStretchSpacer((0, 0))
1891   -
1892   - sizer.Add(wx.StaticText(self, -1, _(u"Parameters")), (1, 0), (1, 6), flag=wx.LEFT, border=7)
1893   - sizer.Add(self.target_2d, (2, 0), (1, 6), flag=wx.LEFT, border=9)
1894   - sizer.Add(self.target_3d, (3, 0), (1, 6), flag=wx.LEFT, border=9)
1895   -
1896   - sizer.AddStretchSpacer((4, 0))
1897   -
1898   - sizer.Add(wx.StaticText(self, -1, _(u"2D Connectivity")), (5, 0), (1, 6), flag=wx.LEFT, border=9)
1899   - sizer.Add(self.conect2D_4, (6, 0), flag=wx.LEFT, border=9)
1900   - sizer.Add(self.conect2D_8, (6, 1), flag=wx.LEFT, border=9)
  1945 + sizer = wx.BoxSizer(wx.VERTICAL)
1901 1946  
1902   - sizer.AddStretchSpacer((7, 0))
  1947 + sizer.AddSpacer(5)
  1948 + sizer.Add(wx.StaticText(self, -1, _(u"Parameters")), flag=wx.LEFT, border=5)
  1949 + sizer.AddSpacer(5)
  1950 + sizer.Add(self.panel_target, flag=wx.LEFT|wx.RIGHT|wx.EXPAND, border=7)
  1951 + sizer.AddSpacer(5)
  1952 + sizer.Add(self.panel2dcon, flag=wx.LEFT|wx.RIGHT|wx.EXPAND, border=7)
  1953 + sizer.AddSpacer(5)
  1954 + sizer.Add(self.panel3dcon, flag=wx.LEFT|wx.RIGHT|wx.EXPAND, border=7)
  1955 + sizer.AddSpacer(5)
1903 1956  
1904   - sizer.Add(wx.StaticText(self, -1, _(u"3D Connectivity")), (8, 0), (1, 6), flag=wx.LEFT, border=9)
1905   - sizer.Add(self.conect3D_6, (9, 0), flag=wx.LEFT, border=9)
1906   - sizer.Add(self.conect3D_18, (9, 1), flag=wx.LEFT, border=9)
1907   - sizer.Add(self.conect3D_26, (9, 2), flag=wx.LEFT, border=9)
1908   - sizer.AddStretchSpacer((10, 0))
1909 1957  
1910 1958 self.SetSizer(sizer)
1911 1959 sizer.Fit(self)
... ... @@ -1916,23 +1964,23 @@ class FFillOptionsDialog(wx.Dialog):
1916 1964  
1917 1965 def OnSetRadio(self, evt):
1918 1966 # Target
1919   - if self.target_2d.GetValue():
  1967 + if self.panel_target.target_2d.GetValue():
1920 1968 self.config.target = "2D"
1921 1969 else:
1922 1970 self.config.target = "3D"
1923 1971  
1924 1972 # 2D
1925   - if self.conect2D_4.GetValue():
  1973 + if self.panel2dcon.conect2D_4.GetValue():
1926 1974 self.config.con_2d = 4
1927   - elif self.conect2D_8.GetValue():
  1975 + elif self.panel2dcon.conect2D_8.GetValue():
1928 1976 self.config.con_2d = 8
1929 1977  
1930 1978 # 3D
1931   - if self.conect3D_6.GetValue():
  1979 + if self.panel3dcon.conect3D_6.GetValue():
1932 1980 self.config.con_3d = 6
1933   - elif self.conect3D_18.GetValue():
  1981 + elif self.panel3dcon.conect3D_18.GetValue():
1934 1982 self.config.con_3d = 18
1935   - elif self.conect3D_26.GetValue():
  1983 + elif self.panel3dcon.conect3D_26.GetValue():
1936 1984 self.config.con_3d = 26
1937 1985  
1938 1986 def OnClose(self, evt):
... ...