Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _do_layout(self):
self.SetDoubleBuffered(True)
self.SetBackgroundColour('#f2f2f2')
self.SetSize((180, 0))
self.SetMinSize((180, 0))
STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
container = wx.BoxSizer(wx.VERTICAL)
container.AddSpacer(15)
container.Add(wx_util.h1(self, 'Actions'), *STD_LAYOUT)
container.AddSpacer(5)
thing = wx.ListBox(self, -1, choices=self.contents)
container.Add(thing, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
container.AddSpacer(20)
self.SetSizer(container)
thing.SetSelection(0)
self.Bind(wx.EVT_LISTBOX, self.onClick, thing)
def layoutComponent(self):
self.SetBackgroundColour(self.buildSpec['header_bg_color'])
self.SetSize((30, self.buildSpec['header_height']))
self.SetMinSize((120, self.buildSpec['header_height']))
self._header = wx_util.h1(self, label=self.buildSpec['program_name'])
self._subheader = wx.StaticText(self, label=self.buildSpec['program_description'])
images = self.buildSpec['images']
targetHeight = self.buildSpec['header_height'] - 10
self.settings_img = self._load_image(images['configIcon'], targetHeight)
self.running_img = self._load_image(images['runningIcon'], targetHeight)
self.check_mark = self._load_image(images['successIcon'], targetHeight)
self.error_symbol = self._load_image(images['errorIcon'], targetHeight)
self.images = [
self.settings_img,
self.running_img,
self.check_mark,
self.error_symbol
]
Note! Mutates `self.reifiedWidgets` in place with the widgets as they're
instantiated! I cannot figure out how to split out the creation of the
widgets from their styling without WxPython violently exploding
TODO: sort out the WX quirks and clean this up.
'''
# determine the type of border , if any, the main sizer will use
if getin(group, ['options', 'show_border'], False):
boxDetails = wx.StaticBox(parent, -1, self.getName(group) or '')
boxSizer = wx.StaticBoxSizer(boxDetails, wx.VERTICAL)
else:
boxSizer = wx.BoxSizer(wx.VERTICAL)
boxSizer.AddSpacer(10)
if group['name']:
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)
def _init_components(self):
self._header = wx_util.h1(self, '')
self._subheader = wx.StaticText(self, label='')
self.settings_img = self._load_image(image_repository.config_icon, height=79)
self.running_img = self._load_image(image_repository.running_icon, 79)
self.check_mark = self._load_image(image_repository.success_icon, height=75)
self.error_symbol = self._load_image(image_repository.error_icon, height=75)
def _do_layout(self):
self.SetDoubleBuffered(True)
self.SetBackgroundColour('#f2f2f2')
self.SetSize((180, 0))
self.SetMinSize((180, 0))
STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
container = wx.BoxSizer(wx.VERTICAL)
container.AddSpacer(15)
container.Add(wx_util.h1(self, 'Actions'), *STD_LAYOUT)
container.AddSpacer(5)
thing = wx.ListBox(self, -1, choices=self.contents)
container.Add(thing, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
container.AddSpacer(20)
self.SetSizer(container)
thing.SetSelection(0)
self.Bind(wx.EVT_LISTBOX, self.onClick, thing)
def arrange(self, *args, **kwargs):
title = getin(self.widgetInfo, ['options', 'title'], _('choose_one'))
if getin(self.widgetInfo, ['options', 'show_border'], False):
boxDetails = wx.StaticBox(self, -1, title)
boxSizer = wx.StaticBoxSizer(boxDetails, wx.VERTICAL)
else:
boxSizer = wx.BoxSizer(wx.VERTICAL)
boxSizer.AddSpacer(10)
boxSizer.Add(wx_util.h1(self, title), 0)
for btn, widget in zip(self.radioButtons, self.widgets):
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(btn,0, wx.RIGHT, 4)
sizer.Add(widget, 1, wx.EXPAND)
boxSizer.Add(sizer, 1, wx.ALL | wx.EXPAND, 5)
self.SetSizer(boxSizer)
def _init_components(self, heading, subheading):
self._header = wx_util.h1(self, heading)
self._subheader = wx.StaticText(self, label=subheading)
self._settings_img = self._load_image(image_repository.settings2, height=79)
self._running_img = self._load_image(image_repository.computer3, 79)
self._check_mark = self._load_image(image_repository.alessandro_rei_checkmark, height=75)
self._error_symbol = self._load_image(image_repository.error, height=75)