Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, base_frame, build_spec):
'''
:type base_frame: BaseWindow
:type build_spec: dict
'''
self.core_gui = base_frame
self.build_spec = build_spec
# wire up all the observers
pub.subscribe(self.on_cancel, events.WINDOW_CANCEL)
pub.subscribe(self.on_start, events.WINDOW_START)
pub.subscribe(self.on_restart, events.WINDOW_RESTART)
pub.subscribe(self.on_close, events.WINDOW_CLOSE)
pub.subscribe(self.on_edit, events.WINDOW_EDIT)
self.SetDoubleBuffered(True)
self.sidebar = Sidebar(self, contents=self._build_spec['widgets'].keys())
self.config_panels = self.build_panels(self._build_spec)
self.active_panel = self.config_panels.keys()[0]
self.config_panels[self.active_panel].Show()
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.sidebar, 1, wx.EXPAND)
sizer.Add(wx_util.vertical_rule(self), 0, wx.EXPAND)
for panel in self.config_panels.values():
sizer.Add(panel, 3, wx.EXPAND)
self.SetSizer(sizer)
pub.subscribe(self.load_view, events.PANEL_CHANGE)
self._header = None
self._subheader = None
self._settings_img = None
self._running_img = None
self._check_mark = None
self._error_symbol = None
self.layouts = {}
self._init_properties()
self._init_components(heading, subheading)
self._init_pages()
self._do_layout()
pub.subscribe(self.load_view, events.WINDOW_CHANGE)
def onClick(self, evt):
pub.send_message(events.PANEL_CHANGE, view_name=evt.GetString())
evt.Skip()
def onClose(self, evt):
if evt.CanVeto():
evt.Veto()
pub.send_message(str(events.WINDOW_CLOSE))
def on_start(self):
if not self.skipping_config() and not self.required_section_complete():
return self.show_dialog(i18n._('error_title'), i18n._('error_required_fields'), wx.ICON_ERROR)
cmd_line_args = self.core_gui.GetOptions()
command = '{0} --ignore-gooey {1}'.format(self.build_spec['target'], cmd_line_args)
pub.send_message(events.WINDOW_CHANGE, view_name=views.RUNNING_SCREEN)
self.run_client_code(command)
# components
self.cancel_button = None
self.start_button = None
self.running_animation = None
self.close_button = None
self.stop_button = None
self.restart_button = None
self.buttons = None
self.layouts = {}
self._init_components()
self._init_pages()
self._do_layout()
pub.subscribe(self.load_view, events.WINDOW_CHANGE)
def onClick(self, evt):
pub.send_message(events.PANEL_CHANGE, view_name=evt.GetString())
evt.Skip()
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
pub.subscribe(self.myListener, "panelListener")
pub.subscribe(self.load_view, events.WINDOW_CHANGE)
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
pub.subscribe(self.myListener, "panelListener")
pub.subscribe(self.load_view, events.WINDOW_CHANGE)