Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
def _init_components(self):
self.cancel_button = self.button(_('cancel'), wx.ID_CANCEL, event_id=events.WINDOW_CANCEL)
self.stop_button = self.button(_('stop'), wx.ID_OK, event_id=events.WINDOW_STOP)
self.start_button = self.button(_('start'), wx.ID_OK, event_id=int(events.WINDOW_START))
self.close_button = self.button(_("close"), wx.ID_OK, event_id=int(events.WINDOW_CLOSE))
self.restart_button = self.button(_('restart'), wx.ID_OK, event_id=int(events.WINDOW_RESTART))
self.edit_button = self.button(_('edit'), wx.ID_OK, event_id=int(events.WINDOW_EDIT))
self.progress_bar = wx.Gauge(self, range=100)
self.buttons = [self.cancel_button, self.start_button,
self.stop_button, self.close_button,
self.restart_button, self.edit_button]
if self.buildSpec['disable_stop_button']:
self.stop_button.Enable(False)
def __init__(self, view, model):
self.view = view
self.model = model
self.client_runner = ProcessController(
self.model.progress_regex,
self.model.progress_expr
)
pub.subscribe(self.on_cancel, events.WINDOW_CANCEL)
pub.subscribe(self.on_stop, events.WINDOW_STOP)
pub.subscribe(self.on_start, events.WINDOW_START)
pub.subscribe(self.on_restart, events.WINDOW_RESTART)
pub.subscribe(self.on_edit, events.WINDOW_EDIT)
pub.subscribe(self.on_close, events.WINDOW_CLOSE)
# console statuses from the other thread
pub.subscribe(self.on_new_message, 'console_update')
pub.subscribe(self.on_progress_change, 'progress_update')
pub.subscribe(self.on_client_done, 'execution_complete')
pub.subscribe(self.on_selection_change, events.LIST_BOX)