Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def layoutComponent(self):
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.header, 0, wx.EXPAND)
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
sizer.Add(self.navbar, 1, wx.EXPAND)
sizer.Add(self.console, 1, wx.EXPAND)
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
sizer.Add(self.footer, 0, wx.EXPAND)
self.SetMinSize((400, 300))
self.SetSize(self.buildSpec['default_size'])
self.SetSizer(sizer)
self.console.Hide()
self.Layout()
# Program Icon (Windows)
icon = wx.Icon(self.buildSpec['images']['programIcon'], wx.BITMAP_TYPE_PNG)
self.SetIcon(icon)
if sys.platform != 'win32':
# OSX needs to have its taskbar icon explicitly set
# bizarrely, wx requires the TaskBarIcon to be attached to the Frame
def layoutComponent(self):
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.header, 0, wx.EXPAND)
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
sizer.Add(self.navbar, 1, wx.EXPAND)
sizer.Add(self.console, 1, wx.EXPAND)
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
sizer.Add(self.footer, 0, wx.EXPAND)
self.SetMinSize((400, 300))
self.SetSize(self.buildSpec['default_size'])
self.SetSizer(sizer)
self.console.Hide()
self.Layout()
# Program Icon (Windows)
icon = wx.Icon(self.buildSpec['images']['programIcon'], wx.BITMAP_TYPE_PNG)
self.SetIcon(icon)
if sys.platform != 'win32':
# OSX needs to have its taskbar icon explicitly set
# bizarrely, wx requires the TaskBarIcon to be attached to the Frame
# as instance data (self.). Otherwise, it will not render correctly.
self.taskbarIcon = TaskBarIcon(iconType=wx.adv.TBI_DOCK)
self.taskbarIcon.SetIcon(icon)
def _do_layout(self):
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.head_panel, 0, wx.EXPAND)
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
if self.build_spec['layout_type'] == 'column':
self.config_panel = layouts.ColumnLayout(self, build_spec=self.build_spec)
sizer.Add(self.config_panel, 1, wx.EXPAND)
else:
self.config_panel = layouts.FlatLayout(self, build_spec=self.build_spec)
sizer.Add(self.config_panel, 1, wx.EXPAND)
sizer.Add(self.runtime_display, 1, wx.EXPAND)
self.runtime_display.Hide()
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
sizer.Add(self.foot_panel, 0, wx.EXPAND)
self.SetSizer(sizer)
self.sizer = sizer
def _do_layout(self):
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.head_panel, 0, wx.EXPAND)
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
if self.layout_type == layouts.COLUMN:
self.config_panel = layouts.ColumnLayout(self)
else:
self.config_panel = layouts.FlatLayout(self)
sizer.Add(self.config_panel, 1, wx.EXPAND)
sizer.Add(self.runtime_display, 1, wx.EXPAND)
self.runtime_display.Hide()
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
sizer.Add(self.foot_panel, 0, wx.EXPAND)
self.SetSizer(sizer)
self.sizer = sizer
groupName = wx_util.h1(parent, self.getName(group) or '')
groupName.SetForegroundColour(getin(group, ['options', 'label_color']))
boxSizer.Add(groupName, 0, wx.TOP | wx.BOTTOM | wx.LEFT, 8)
group_description = getin(group, ['description'])
if group_description:
description = AutoWrappedStaticText(parent, label=group_description, target=boxSizer)
description.SetForegroundColour(getin(group, ['options', 'description_color']))
description.SetMinSize((0, -1))
boxSizer.Add(description, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)
# apply an underline when a grouping border is not specified
# unless the user specifically requests not to show it
if not getin(group, ['options', 'show_border'], False) and group['name'] \
and getin(group, ['options', 'show_underline'], True):
boxSizer.Add(wx_util.horizontal_rule(parent), 0, wx.EXPAND | wx.LEFT, 10)
ui_groups = self.chunkWidgets(group)
for uigroup in ui_groups:
sizer = wx.BoxSizer(wx.HORIZONTAL)
for item in uigroup:
widget = self.reifyWidget(parent, item)
# !Mutate the reifiedWidgets instance variable in place
self.reifiedWidgets.append(widget)
sizer.Add(widget, 1, wx.ALL | wx.EXPAND, 5)
boxSizer.Add(sizer, 0, wx.ALL | wx.EXPAND, 5)
# apply the same layout rules recursively for subgroups
hs = wx.BoxSizer(wx.HORIZONTAL)
for e, subgroup in enumerate(group['groups']):
self.makeGroup(parent, hs, subgroup, 1, wx.EXPAND)
if self.widgets.required_args:
container.Add(wx_util.h1(self, i18n._("required_args_msg")), 0, wx.LEFT | wx.RIGHT, PADDING)
container.AddSpacer(5)
container.Add(wx_util.horizontal_rule(self), *STD_LAYOUT)
container.AddSpacer(20)
self.CreateComponentGrid(container, self.widgets.required_args, cols=self._num_req_cols)
container.AddSpacer(10)
if self.widgets.optional_args:
# container.AddSpacer(10)
container.Add(wx_util.h1(self, i18n._("optional_args_msg")), 0, wx.LEFT | wx.RIGHT, PADDING)
container.AddSpacer(5)
container.Add(wx_util.horizontal_rule(self), *STD_LAYOUT)
container.AddSpacer(20)
self.CreateComponentGrid(container, self.widgets.optional_args, cols=self._num_opt_cols)
self.SetSizer(container)
def layout(self, num_columns):
STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, PADDING)
if self.title:
self.container.Add(wx_util.h0(self, self.title), 0, wx.LEFT | wx.RIGHT, PADDING)
self.container.AddSpacer(30)
if self.widgets:
self.container.Add(wx_util.h1(self, self.section_name), 0, wx.LEFT | wx.RIGHT, PADDING)
self.container.AddSpacer(5)
self.container.Add(wx_util.horizontal_rule(self), *STD_LAYOUT)
self.container.AddSpacer(20)
self.create_component_grid(self.container, self.widgets, cols=num_columns)
self.container.AddSpacer(10)