Coverage for src/robotide/widgets/sizers.py: 90%

20 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-06 10:40 +0100

1# Copyright 2008-2015 Nokia Networks 

2# Copyright 2016- Robot Framework Foundation 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); 

5# you may not use this file except in compliance with the License. 

6# You may obtain a copy of the License at 

7# 

8# http://www.apache.org/licenses/LICENSE-2.0 

9# 

10# Unless required by applicable law or agreed to in writing, software 

11# distributed under the License is distributed on an "AS IS" BASIS, 

12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

13# See the License for the specific language governing permissions and 

14# limitations under the License. 

15 

16import wx 1ab

17 

18 

19class _BoxSizer(wx.BoxSizer): 1ab

20 

21 def __init__(self): 1ab

22 wx.BoxSizer.__init__(self, orient=self.orientation) 1acdefghijklmnopq

23 # print(f"DEBUG: _BoxSizer __init__ after super init, orientation is {self.orientation}") 

24 

25 def add_sizer(self, component, proportion=0, flag=0): 1ab

26 # self.Add(component, proportion=proportion, flag=flag) 

27 self.Add(component, wx.SizerFlags(proportion).Align(flag)) 

28 

29 def add_with_padding(self, component, padding=5): 1ab

30 # self.Add(component, flag=wx.ALL, border=padding) 

31 self.Add(component, wx.SizerFlags(0).Border(wx.ALL, padding)) 

32 

33 def add_expanding(self, component, propotion=1, padding=0): 1ab

34 # self.Add(component, proportion=propotion, flag=wx.EXPAND | wx.ALL, 

35 # border=) 

36 self.Add(component, wx.SizerFlags(propotion).Expand().Border(wx.ALL, padding)) 1acdefghijk

37 

38 

39class VerticalSizer(_BoxSizer): 1ab

40 

41 def __init__(self): 1ab

42 self.orientation = wx.VERTICAL 1acdefghijklmnopq

43 _BoxSizer.__init__(self) 1acdefghijklmnopq

44 

45 

46class HorizontalSizer(_BoxSizer): 1ab

47 

48 def __init__(self): 1ab

49 self.orientation = wx.HORIZONTAL 

50 _BoxSizer.__init__(self) 

51 

52 def add_to_end(self, component): 1ab

53 # self.Add(component, flag=wx.ALIGN_RIGHT) 

54 self.Add(component, wx.SizerFlags().Align(wx.ALIGN_RIGHT))