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, parent):
wx.Dialog.__init__(self, parent)
self.SetBackgroundColour('#ffffff')
self.ok_button = wx.Button(self, wx.ID_OK, label='Ok')
self.datepicker = Classes.DatePickerCtrl(self, style=Constants.WX_DP_DROPDOWN)
vertical_container = wx.BoxSizer(wx.VERTICAL)
vertical_container.AddSpacer(10)
vertical_container.Add(wx_util.h1(self, label='Select a Date'), 0, wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(10)
vertical_container.Add(self.datepicker, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(10)
button_sizer = wx.BoxSizer(wx.HORIZONTAL)
button_sizer.AddStretchSpacer(1)
button_sizer.Add(self.ok_button, 0)
vertical_container.Add(button_sizer, 0, wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(20)
self.SetSizerAndFit(vertical_container)
self.Bind(wx.EVT_BUTTON, self.OnOkButton, self.ok_button)
def __init__(self, parent):
wx.Dialog.__init__(self, parent)
self.SetBackgroundColour('#ffffff')
self.ok_button = wx.Button(self, wx.ID_OK, label=_('Ok'))
self.datepicker = Classes.DatePickerCtrl(self, style=Constants.WX_DP_DROPDOWN)
vertical_container = wx.BoxSizer(wx.VERTICAL)
vertical_container.AddSpacer(10)
vertical_container.Add(wx_util.h1(self, label=_('Select a Date')), 0, wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(10)
vertical_container.Add(self.datepicker, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(10)
button_sizer = wx.BoxSizer(wx.HORIZONTAL)
button_sizer.AddStretchSpacer(1)
button_sizer.Add(self.ok_button, 0)
vertical_container.Add(button_sizer, 0, wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(20)
self.SetSizerAndFit(vertical_container)
self.Bind(wx.EVT_BUTTON, self.OnOkButton, self.ok_button)
self.navbar = self.buildNavigation()
self.footer = Footer(self, buildSpec)
self.console = Console(self, buildSpec)
self.layoutComponent()
self.clientRunner = ProcessController(
self.buildSpec.get('progress_regex'),
self.buildSpec.get('progress_expr'),
self.buildSpec.get('hide_progress_msg'),
self.buildSpec.get('encoding'),
self.buildSpec.get('requires_shell'),
)
pub.subscribe(events.WINDOW_START, self.onStart)
pub.subscribe(events.WINDOW_RESTART, self.onStart)
pub.subscribe(events.WINDOW_STOP, self.onStopExecution)
pub.subscribe(events.WINDOW_CLOSE, self.onClose)
pub.subscribe(events.WINDOW_CANCEL, self.onCancel)
pub.subscribe(events.WINDOW_EDIT, self.onEdit)
pub.subscribe(events.CONSOLE_UPDATE, self.console.logOutput)
pub.subscribe(events.EXECUTION_COMPLETE, self.onComplete)
pub.subscribe(events.PROGRESS_UPDATE, self.footer.updateProgressBar)
# Top level wx close event
self.Bind(wx.EVT_CLOSE, self.onClose)
if self.buildSpec['poll_external_updates']:
self.fetchExternalUpdates()
if self.buildSpec.get('auto_start', False):
self.onStart()
self.configs = self.buildConfigPanels(self)
self.navbar = self.buildNavigation()
self.footer = Footer(self, buildSpec)
self.console = Console(self, buildSpec)
self.layoutComponent()
self.clientRunner = ProcessController(
self.buildSpec.get('progress_regex'),
self.buildSpec.get('progress_expr'),
self.buildSpec.get('hide_progress_msg'),
self.buildSpec.get('encoding'),
self.buildSpec.get('requires_shell'),
)
pub.subscribe(events.WINDOW_START, self.onStart)
pub.subscribe(events.WINDOW_RESTART, self.onStart)
pub.subscribe(events.WINDOW_STOP, self.onStopExecution)
pub.subscribe(events.WINDOW_CLOSE, self.onClose)
pub.subscribe(events.WINDOW_CANCEL, self.onCancel)
pub.subscribe(events.WINDOW_EDIT, self.onEdit)
pub.subscribe(events.CONSOLE_UPDATE, self.console.logOutput)
pub.subscribe(events.EXECUTION_COMPLETE, self.onComplete)
pub.subscribe(events.PROGRESS_UPDATE, self.footer.updateProgressBar)
# Top level wx close event
self.Bind(wx.EVT_CLOSE, self.onClose)
if self.buildSpec['poll_external_updates']:
self.fetchExternalUpdates()
if self.buildSpec.get('auto_start', False):
self.onStart()
self.clientRunner = ProcessController(
self.buildSpec.get('progress_regex'),
self.buildSpec.get('progress_expr'),
self.buildSpec.get('hide_progress_msg'),
self.buildSpec.get('encoding'),
self.buildSpec.get('requires_shell'),
)
pub.subscribe(events.WINDOW_START, self.onStart)
pub.subscribe(events.WINDOW_RESTART, self.onStart)
pub.subscribe(events.WINDOW_STOP, self.onStopExecution)
pub.subscribe(events.WINDOW_CLOSE, self.onClose)
pub.subscribe(events.WINDOW_CANCEL, self.onCancel)
pub.subscribe(events.WINDOW_EDIT, self.onEdit)
pub.subscribe(events.CONSOLE_UPDATE, self.console.logOutput)
pub.subscribe(events.EXECUTION_COMPLETE, self.onComplete)
pub.subscribe(events.PROGRESS_UPDATE, self.footer.updateProgressBar)
# Top level wx close event
self.Bind(wx.EVT_CLOSE, self.onClose)
if self.buildSpec['poll_external_updates']:
self.fetchExternalUpdates()
if self.buildSpec.get('auto_start', False):
self.onStart()
self.layoutComponent()
self.clientRunner = ProcessController(
self.buildSpec.get('progress_regex'),
self.buildSpec.get('progress_expr'),
self.buildSpec.get('hide_progress_msg'),
self.buildSpec.get('encoding'),
self.buildSpec.get('requires_shell'),
)
pub.subscribe(events.WINDOW_START, self.onStart)
pub.subscribe(events.WINDOW_RESTART, self.onStart)
pub.subscribe(events.WINDOW_STOP, self.onStopExecution)
pub.subscribe(events.WINDOW_CLOSE, self.onClose)
pub.subscribe(events.WINDOW_CANCEL, self.onCancel)
pub.subscribe(events.WINDOW_EDIT, self.onEdit)
pub.subscribe(events.CONSOLE_UPDATE, self.console.logOutput)
pub.subscribe(events.EXECUTION_COMPLETE, self.onComplete)
pub.subscribe(events.PROGRESS_UPDATE, self.footer.updateProgressBar)
# Top level wx close event
self.Bind(wx.EVT_CLOSE, self.onClose)
if self.buildSpec['poll_external_updates']:
self.fetchExternalUpdates()
if self.buildSpec.get('auto_start', False):
self.onStart()
def multiFileChooser(metadata, value):
paths = ' '.join(quote(x) for x in value.split(os.pathsep) if x)
if metadata['commands'] and paths:
return u'{} {}'.format(metadata['commands'][0], paths)
return paths or None
# TODO: split into stategy or subclass thingie
if self.type == 'CheckBox':
return self.commands[0] if self._value else None
if self.type == 'RadioGroup':
try:
return self.commands[self._value.index(True)][0]
except ValueError:
return None
if self.type == 'MultiFileChooser':
value = ' '.join(quote(x) for x in self._value.split(os.pathsep) if x)
if self.commands and value:
return u'{} {}'.format(self.commands[0], value)
return value or None
if self.type == 'Textarea':
if self.commands and self._value:
return '{} {}'.format(self.commands[0], quote(self._value.encode('unicode_escape')))
else:
return quote(self._value.encode('unicode_escape')) if self._value else ''
if self.type == 'CommandField':
if self.commands and self._value:
return u'{} {}'.format(self.commands[0], self._value)
else:
return self._value or None
if self.type == 'Counter':
'''
Returns
str(option_string * DropDown Value)
e.g.
-vvvvv
'''
if not str(self._value).isdigit():
def value(self):
# TODO: split into stategy or subclass thingie
if self.type == 'CheckBox':
return self.commands[0] if self._value else None
if self.type == 'RadioGroup':
try:
return self.commands[self._value.index(True)][0]
except ValueError:
return None
if self.type == 'MultiFileChooser':
value = ' '.join(quote(x) for x in self._value.split(os.pathsep) if x)
if self.commands and value:
return u'{} {}'.format(self.commands[0], value)
return value or None
if self.type == 'Textarea':
if self.commands and self._value:
return '{} {}'.format(self.commands[0], quote(self._value.encode('unicode_escape')))
else:
return quote(self._value.encode('unicode_escape')) if self._value else ''
if self.type == 'CommandField':
if self.commands and self._value:
return u'{} {}'.format(self.commands[0], self._value)
else:
return self._value or None
if self.type == 'Counter':
'''
return self.commands[0] if self._value else None
if self.type == 'RadioGroup':
try:
return self.commands[self._value.index(True)][0]
except ValueError:
return None
if self.type == 'MultiFileChooser':
value = ' '.join(quote(x) for x in self._value.split(os.pathsep) if x)
if self.commands and value:
return u'{} {}'.format(self.commands[0], value)
return value or None
if self.type == 'Textarea':
if self.commands and self._value:
return '{} {}'.format(self.commands[0], quote(self._value.encode('unicode_escape')))
else:
return quote(self._value.encode('unicode_escape')) if self._value else ''
if self.type == 'CommandField':
if self.commands and self._value:
return u'{} {}'.format(self.commands[0], self._value)
else:
return self._value or None
if self.type == 'Counter':
'''
Returns
str(option_string * DropDown Value)
e.g.
-vvvvv
'''
if not str(self._value).isdigit():
return None
arg = str(self.commands[0]).replace('-', '')