def coletarDadosDoProduto(Self, v): produto = wx.Dialog(Self, -1, title="Adicionar produto para cálculo", name="Adicionar produto para cálculo") Self.texto_estatico_produto = wx.StaticText(produto, label="Digite o produto:") Self.formula_produto = wx.TextCtrl(produto, -1, name="Digite o produto:") Self.Texto_estatico_preco = wx.StaticText( produto, label="Digite o preço total do produto no formato real.Centavo:") Self.formula_preco = wx.TextCtrl( produto, -1, name="Digite o preço total do produto no formato real.centavo:") Self.texto_estatico_quantidade = wx.StaticText( produto, label="Digite a quantidade do produto:") Self.formula_quantidade = IntCtrl( produto, -1, name="Digite a quantidade do protudo:") Self.texto_estatico_porcentagem = wx.StaticText( produto, label="Digite a porcentagem que será a base para o seu lucro:") Self.formula_porcentagem = IntCtrl( produto, -1, name="Digite a porcentagem que será a base para o seu lucro:") botaoCalcular = wx.Button(produto, wx.ID_OK, label="Calcular preço") botaoCancelar = wx.Button(produto, wx.ID_CANCEL, label="Cancelar") informacoesProduto = produto.ShowModal() if informacoesProduto == wx.ID_OK: Self.tratarDadosDigitadosPeloUsuario()
def __init__(self, parent): wx.Panel.__init__(self, parent) self.parent = parent #Attributes self.scoreLabel = wx.StaticText(self, label="blub", size=(self.width, -1)) self.scoreLabel.SetBackgroundColour(wx.WHITE) self.add(self.scoreLabel) self.aiSpeedLabel = wx.StaticText(self, label="AISpeed", size=(self.width / 2, -1)) self.add(self.aiSpeedLabel) self.aiSpeedCtrl = IntCtrl(self, size=(self.width / 2, -1)) self.add(self.aiSpeedCtrl) self.aiSelectLabel = wx.StaticText(self, label="AI", size=(self.width / 4, -1)) self.add(self.aiSelectLabel) self.aiSelectCB = wx.ComboBox(self, style=wx.CB_DROPDOWN | wx.CB_READONLY, choices=self.parent.aiList.keys(), size=(self.width / 4 * 3, -1)) self.aiSelectCB.SetSelection(3) self.add(self.aiSelectCB) self.runCountLabel = wx.StaticText(self, label="Runs", size=(self.width / 2, -1)) self.add(self.runCountLabel) self.runCountCtrl = IntCtrl(self, size=(self.width / 2, -1)) self.add(self.runCountCtrl) self.runAIButton = wx.Button(self, label="Run AI", size=(self.width, -1)) self.add(self.runAIButton) # self.trainAIButton = wx.Button(self, label="Train AI", size=(self.width,-1)) # self.add(self.trainAIButton) self.stopAIButton = wx.Button(self, label="Stop AI", size=(self.width, -1)) self.add(self.stopAIButton) self.restartButton = wx.Button(self, label="Restart", size=(self.width, -1)) self.add(self.restartButton) #Layout self.__doLayout() #Event Handlers self.restartButton.Bind(wx.EVT_BUTTON, self.parent.onRestart) self.runAIButton.Bind(wx.EVT_BUTTON, self.parent.onRunAI) self.stopAIButton.Bind(wx.EVT_BUTTON, self.parent.onStopAI)
def createControls(self): self.OrderType = wx.RadioBox(self.pnl, label='OrderType', pos=(80, 30), choices=["LMT", "MKT"], majorDimension=1, style=wx.RA_SPECIFY_ROWS) self.Action = wx.RadioBox(self.pnl, label='Action', pos=(60, 30), choices=["BUY", "SELL"], majorDimension=1, style=wx.RA_SPECIFY_ROWS) self.hbox1 = wx.BoxSizer(wx.VERTICAL) l1 = wx.StaticText(self.pnl, -1, "Symbol") self.hbox1.Add(l1, 1, wx.ALIGN_LEFT | wx.ALL, 5) self.Symbol = wx.TextCtrl(self.pnl) self.hbox1.Add(self.Symbol) self.hbox2 = wx.BoxSizer(wx.VERTICAL) l2 = wx.StaticText(self.pnl, -1, "Quantity") self.hbox2.Add(l2, 1, wx.ALIGN_LEFT | wx.ALL, 5) self.Quantity = IntCtrl(self.pnl) self.hbox2.Add(self.Quantity) self.hbox3 = wx.BoxSizer(wx.VERTICAL) l3 = wx.StaticText(self.pnl, -1, "LmtPrice") self.hbox3.Add(l3, 1, wx.ALIGN_LEFT | wx.ALL, 5) self.LmtPrice = NumCtrl(self.pnl, fractionWidth=2, min=0, max=None) self.hbox3.Add(self.LmtPrice)
def __init__(self, parent): self.main_frame = gui.main_frame.MainFrame.get_instance() super().__init__(parent, id=wx.ID_ANY, title='Edit frame', style=wx.BORDER_THEME | wx.FRAME_NO_WINDOW_MENU, size=(165, 40)) self.sizer = wx.BoxSizer(wx.VERTICAL) self.data_sizer = wx.BoxSizer() self.control_sizer = wx.BoxSizer() self.label = wx.StaticText(self, id=wx.ID_ANY, label='Установить кол-во: ') self.int_ctrl = IntCtrl(self, id=wx.ID_ANY, default_color=wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHTTEXT)) self.btn_submit = wx.Button(self, id=101, label='Submit') self.btn_cancel = wx.Button(self, id=102, label='Cancel') self.btn_submit.Bind(wx.EVT_BUTTON, self._action) self.btn_cancel.Bind(wx.EVT_BUTTON, self._action) self.int_ctrl.Bind(wx.EVT_KEY_DOWN, self._btn_push) self.data_sizer.Add(self.label) self.data_sizer.Add(self.int_ctrl) self.sizer.Add(self.data_sizer) self.control_sizer.Add(self.btn_submit, flag=wx.ALIGN_CENTRE) self.control_sizer.Add(self.btn_cancel, flag=wx.ALIGN_CENTRE) self.sizer.Add(self.control_sizer) self.SetSizer(self.sizer)
def __init__(self, *args, **kwargs): super(TextEditPanel, self).__init__(*args, **kwargs) sizer = wx.BoxSizer(wx.VERTICAL) self.text_ctrl = wx.TextCtrl(self, style=wx.TE_MULTILINE) self.check_zero = wx.CheckBox(self, label='Zero-terminated') self.combo_empty = wx.ComboBox( self, style=wx.CB_READONLY | wx.CB_DROPDOWN, value="empty string", choices=["empty string", "null", "zero"]) self.tlk_id = IntCtrl(self, min=0, max=0xFFFFFFFF, limited=False, allow_long=True, style=wx.ALIGN_RIGHT) # SpinCtrl for TlkString sizer.Add(self.text_ctrl, 1, wx.EXPAND) sizer2 = wx.BoxSizer(wx.HORIZONTAL) sizer2.Add(self.check_zero, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) sizer2.Add(self.combo_empty, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) sizer2.Add(self.tlk_id, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) sizer.Add(sizer2, 0, wx.EXPAND) self.SetSizer(sizer)
def __init__(self, parent, value, message='', externinfo=None, size=(-1, -1), enabledflag=None): """create an Int input control @type value: number or string @para m value: initial value @type externinfo: tuple or list @param externinfo: {"min":0, "max":100} @type size: tuple @param size: control's size """ IElement.__init__(self, parent, 'int', message, externinfo, size, enabledflag) if not isinstance(value, int): try: value = int(value) except ValueError: value = 0 if externinfo: obj = wx.SpinCtrl(parent, min=externinfo["min"], max=externinfo["max"]) else: obj = IntCtrl(parent) self.obj = obj self.setValue(value)
def create_shift_element(self, parent, value): field = IntCtrl(parent, value=value, style=wx.TE_PROCESS_ENTER | wx.TE_RIGHT, size=self.element_size) field.index = self.shift_vector.GetItemCount() self.shift_vector.Add(field, flag=wx.EXPAND | wx.RIGHT, border=5) self.Bind(wx.EVT_TEXT_ENTER, self.on_shift_field, field)
def __init__(self, parent, strategy=None): wx.Dialog.__init__(self, parent) sizer = wx.GridSizer(5, 2) self.strategy = strategy if self.strategy is None: self.SetTitle("Add Strategy") else: self.SetTitle("Edit Strategy") self._name = wx.TextCtrl(self) self._fnoType = wx.ComboBox(self, choices=["future", "call", "put"]) self._buyWeek = wx.ComboBox(self, choices=['0', '1', '2', '3', '4']) self._buyWeek.SetValue('0') self._sellWeek = wx.ComboBox(self, choices=['0', '1', '2', '3', '4']) self._sellWeek.SetValue('0') self._priceTarget = IntCtrl(self, min=-20, max=20) sizer.Add(wx.StaticText(self, label="Name:")) sizer.Add(self._name) sizer.Add(wx.StaticText(self, label="FnO Type:")) sizer.Add(self._fnoType) sizer.Add(wx.StaticText(self, label="Buy Week:")) sizer.Add(self._buyWeek) sizer.Add(wx.StaticText(self, label="Sell Week:")) sizer.Add(self._sellWeek) sizer.Add(wx.StaticText(self, label="Price Target %:")) sizer.Add(self._priceTarget) if self.strategy is None: label = "Add" else: label = "Edit" okBtn = wx.Button(self, id=wx.ID_OK, label=label) okBtn.Bind(wx.EVT_BUTTON, self._onOk) cancelBtn = wx.Button(self, id=wx.ID_CANCEL, label="Cancel") btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(okBtn) btnSizer.Add(cancelBtn) sizer.Add(btnSizer) self.update() self.SetSizerAndFit(sizer) self.Center()
def CreatePlotPanel(self, main_sizer): sizer = wx.BoxSizer(wx.VERTICAL) #control_sizer = wx.BoxSizer(wx.HORIZONTAL) control_sizer = wx.GridSizer(cols=4, vgap=10, hgap=5) panel = wx.Panel(self, -1) button_panel = wx.Panel(panel, -1) self.canvas = CanvasPanel(panel) btn_save_plot = wx.Button(button_panel, -1, "Export Image") btn_save_csv = wx.Button(button_panel, -1, "Export CSV") legend_chk = wx.CheckBox(button_panel, -1, "Legend") btn_edit_label = wx.Button(button_panel, -1, "Edit Labels") legend_pos_text = wx.StaticText(button_panel, -1, "Location: ", style=wx.ALIGN_RIGHT) legend_font_text = wx.StaticText(button_panel, -1, "Font Size: ", style=wx.ALIGN_RIGHT) legend_font_ctrl = IntCtrl(button_panel, -1, LEGEND_FONT_SIZE, min=1, max=100, allow_none=False, style=wx.TE_PROCESS_ENTER) self.legend_pos = wx.Choice(button_panel, -1, choices=legend_positions) self.legend_pos.SetSelection(0) btn_save_plot.Bind(wx.EVT_BUTTON, self.SavePlot) btn_save_csv.Bind(wx.EVT_BUTTON, self.SaveCSV) legend_chk.Bind(wx.EVT_CHECKBOX, self.toggleLegend) self.legend_pos.Bind(wx.EVT_CHOICE, self.set_legend_position) btn_edit_label.Bind(wx.EVT_BUTTON, self.open_label_dialog) legend_font_ctrl.Bind(wx.EVT_TEXT_ENTER, self.onFontChange) legend_font_ctrl.Bind(wx.EVT_TEXT, self.onFontChange) #main_sizer.Add(panel, 5, wx.EXPAND | wx.ALL) main_sizer.Add(panel, 4) sizer.Add(self.canvas, 6, wx.EXPAND) sizer.Add(button_panel, 1, wx.EXPAND | wx.ALL | wx.GROW) control_sizer.Add(legend_chk, 1) control_sizer.Add(btn_edit_label, 1) control_sizer.Add(legend_pos_text, 1, wx.ALIGN_RIGHT) control_sizer.Add(self.legend_pos, 1, wx.ALIGN_LEFT) control_sizer.Add(legend_font_text, 1) control_sizer.Add(legend_font_ctrl, 1) control_sizer.Add(btn_save_plot, 1) control_sizer.Add(btn_save_csv, 1) button_panel.SetSizer(control_sizer) panel.SetSizer(sizer)
def create_df_head(self, parent): rb1 = wx.RadioButton(parent, 11, label="Head", style=wx.RB_GROUP) rb2 = wx.RadioButton(parent, 22, label="Tail") l1 = wx.StaticText(parent, -1, "No. of records: ") tc1 = IntCtrl(parent, -1, value=5, size=(40, -1), style=wx.TE_PROCESS_ENTER, min=1, max=50) tc1.Bind(wx.EVT_TEXT_ENTER, self.on_records_no) df_filter_sizer = wx.BoxSizer(wx.HORIZONTAL) df_filter_sizer.Add(rb1) df_filter_sizer.Add(rb2) df_filter_sizer.Add(l1) df_filter_sizer.Add(tc1) return df_filter_sizer
def __init__(self, buffer=None, *args, **kwargs): super(JumpToPostDialog, self).__init__(title=_("Jump to Item in %s" % buffer.display_name), *args, **kwargs) #First Row wx.StaticText(parent=self.pane, label=_("Enter item number to jump to, 1 to %s:") % str(len(buffer))) self.number = IntCtrl(parent=self.pane) self.number.SetValue(int(len(buffer) - buffer.index)) self.number.SetSizerProps(expand=True) self.finish_setup()
def __init__(self, parent, message="Please enter a number.", caption="Number Entry", prompt="Number:", value=None, min=None, max=None): super(NumberEntryDialog, self).__init__(parent, title=caption) kwargs = { 'parent': self, 'min': min, 'max': max, 'value': value, 'limited': True, 'allow_none': False, } self.intctrl = IntCtrl( **{k: v for k, v in kwargs.iteritems() if v is not None}) sizer = wx.BoxSizer(wx.VERTICAL) if message: sizer.Add(wx.StaticText(self, label=message), flag=wx.ALL, border=4) hSizer = wx.BoxSizer(wx.HORIZONTAL) if prompt: hSizer.Add(wx.StaticText(self, label=prompt), flag=wx.ALIGN_CENTER_VERTICAL) hSizer.Add(self.intctrl, 1, flag=wx.EXPAND) sizer.Add(hSizer, flag=wx.ALL | wx.EXPAND, border=4) btnsizer = wx.StdDialogButtonSizer() btn = wx.Button(self, wx.ID_OK) btn.SetDefault() btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_CANCEL) btnsizer.AddButton(btn) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SetSizer(sizer) self.SetSize(200, 50 * (2 + int(bool(message)))) #self.Fit() self.CenterOnParent()
def crete_edit_ctrl(self, editable, par, parent, val, validator): """ Creates the edit control for a parameter :param editable: flag to indicate if the parameter is editable :param par: parameter name :param parent: parent of the control :param val: value of the parameter :param validator: validator of the control :return: a wx control object (subclass of wx.Control)? """ if type(validator) == type([]): # There should be a list of choices validator = validator[:] ctrl = wx.Choice(parent, -1, choices=validator) # Since we work with strings we have to find the right # strings positons to initilize the choice box. pos = 0 if type(val) == type(''): pos = validator.index(val) elif type(par) == type(1): pos = par ctrl.SetSelection(pos) elif isinstance(validator, bool): # Parameter is a boolean ctrl = wx.CheckBox(self, -1) ctrl.SetValue(val) # Create a non-editable box if needed # ctrl.SetEditable(editable) elif isinstance(validator, int): # Parameter is an integer ctrl = IntCtrl(self, -1, val) # Create a non-editable box if needed ctrl.SetEditable(editable) if not editable: ctrl.SetBackgroundColour(self.not_editable_bkg_color) # Otherwise it should be a validator ... else: validator = validator.Clone() ctrl = wx.TextCtrl(parent, -1, str(val), validator=validator, style=wx.TE_RIGHT | wx.TE_RICH) # Create a non-editable box if needed ctrl.SetEditable(editable) if not editable: ctrl.SetBackgroundColour(self.not_editable_bkg_color) return ctrl
def __init__(self): super(AudioOptions, self).__init__(application.frame, title='Audio Options') p = self.GetContentsPane() add_accelerator(self, 'ESCAPE', lambda event: self.Close(True)) self.default_volume = config.system['volume'] self.default_frequency = config.system['frequency'] self.default_pan = config.system['pan'] p.SetSizerType('form') wx.StaticText(p, label='&Output Device') self.device = wx.Choice(p, choices=sorted( application.output.get_device_names())) self.device.SetStringSelection(config.system['output_device_name']) self.device.Bind( wx.EVT_CHOICE, lambda event: set_output_device(self.device.GetStringSelection())) wx.StaticText(p, label='&Volume') self.volume = wx.Slider(p, style=wx.VERTICAL) self.volume.SetValue(self.default_volume) self.volume.Bind(wx.EVT_SLIDER, lambda event: set_volume(self.volume.GetValue())) wx.StaticText(p, label='&Pan') self.pan = wx.Slider(p, style=wx.HORIZONTAL) self.pan.SetValue(self.default_pan) self.pan.Bind(wx.EVT_SLIDER, lambda event: set_pan(self.pan.GetValue())) wx.StaticText(p, label='&Frequency') self.frequency = IntCtrl(p, value=self.default_frequency, min=min_frequency, max=max_frequency, limited=True) self.frequency.Bind(EVT_INT, set_frequency(self.frequency.GetValue())) add_accelerator( self.frequency, 'UP', lambda event: self.update_frequency( min(self.frequency.GetMax(), self.frequency.GetValue() + 100))) add_accelerator( self.frequency, 'DOWN', lambda event: self.update_frequency( max(self.frequency.GetMin(), self.frequency.GetValue() - 100))) self.ok = wx.Button(p, label='&OK') self.ok.Bind(wx.EVT_BUTTON, lambda event: self.Close(True)) self.restore = wx.Button(p, label='&Restore Defaults') self.restore.Bind(wx.EVT_BUTTON, self.on_restore) self.Show(True) self.Maximize(True)
def __init__(self, parent, *args, **kwds): kwds["style"] = wx.DEFAULT_FRAME_STYLE try: self.filetype = kwds.pop("filetype").lower() except KeyError: self.filetype = "pdf" self.parent = parent wx.Dialog.__init__(self, parent, *args, **kwds) if self.filetype != "print": # If printing and not exporting then page info is # gathered from printer dialog self.portrait_landscape_radio_box = \ wx.RadioBox(self, wx.ID_ANY, _("Layout"), choices=[_("Portrait"), _("Landscape")], majorDimension=2, style=wx.RA_SPECIFY_COLS) self.page_width_label = wx.StaticText(self, wx.ID_ANY, _("Width")) self.page_width_text_ctrl = wx.TextCtrl(self, wx.ID_ANY) self.page_height_label = wx.StaticText(self, wx.ID_ANY, _("Height")) self.page_height_text_ctrl = wx.TextCtrl(self, wx.ID_ANY) self.page_layout_choice = \ wx.Choice(self, wx.ID_ANY, choices=self.paper_sizes_points.keys()) self.sizer_2_staticbox = wx.StaticBox(self, wx.ID_ANY, _("Page")) self.page_layout_choice.Bind(wx.EVT_CHOICE, self.on_page_layout_choice) self.top_row_label = wx.StaticText(self, wx.ID_ANY, _("Top row")) self.top_row_text_ctrl = IntCtrl(self, wx.ID_ANY) self.bottom_row_label = wx.StaticText(self, wx.ID_ANY, _("Bottom row")) self.bottom_row_text_ctrl = IntCtrl(self, wx.ID_ANY) self.left_col_label = wx.StaticText(self, wx.ID_ANY, _("Left column")) self.left_col_text_ctrl = IntCtrl(self, wx.ID_ANY) self.right_col_label = wx.StaticText(self, wx.ID_ANY, _("Right column")) self.right_col_text_ctrl = IntCtrl(self, wx.ID_ANY) self.first_tab_label = wx.StaticText(self, wx.ID_ANY, _("First table")) self.first_tab_text_ctrl = IntCtrl(self, wx.ID_ANY) self.last_tab_label = wx.StaticText(self, wx.ID_ANY, _("Last table")) self.last_tab_text_ctrl = IntCtrl(self, wx.ID_ANY) self.sizer_3_staticbox = wx.StaticBox(self, wx.ID_ANY, _("Grid")) self.empty_panel = wx.Panel(self, wx.ID_ANY) self.cancel_button = wx.Button(self, wx.ID_CANCEL, "") self.ok_button = wx.Button(self, wx.ID_OK, "") self.__set_properties() self.__do_layout()
def __init__(self, *args, **kwargs): super(IntegerEditPanel, self).__init__(*args, **kwargs) sizer = wx.BoxSizer(wx.HORIZONTAL) self.intspin = wx.SpinCtrl(self, style=wx.ALIGN_RIGHT | wx.SP_ARROW_KEYS) self.intctrl = IntCtrl(self, limited=True, allow_long=True, style=wx.ALIGN_RIGHT) self.floatctrl = wx.TextCtrl(self, style=wx.ALIGN_RIGHT) self.floatchk = wx.CheckBox(self, label='Treat as floating-point') sizer.Add(self.intspin, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.intctrl, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.floatctrl, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.floatchk, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=10) self.Bind(wx.EVT_CHECKBOX, self.OnFloatToggle, self.floatchk) self.SetSizer(sizer)
def __init__(self, parent, id, title): pre = wx.PreDialog() pre.Create(parent, id, title) self.this = pre.this sizer = wx.BoxSizer(wx.VERTICAL) self.input = IntCtrl(self, -1) self.input.SetValue(0) sizer.Add(self.input, 0, wx.ALL, 5) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(wx.Button(self, wx.ID_OK), 0, wx.ALIGN_CENTRE | wx.ALL, 5), box.Add(wx.Button(self, wx.ID_CANCEL), 0, wx.ALIGN_CENTRE | wx.ALL, 5), sizer.AddSizer(box, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self) self.SetAutoLayout(True)
def script_addTextButton(self, r_text, g_text, b_text, r_button, g_button, b_button, button_text, command, data): x_text, y_text, w_text, h_text = self._getColoredRect(r_text, g_text, b_text) if x_text < 0: return x_button, y_button, w_button, h_button = self._getColoredRect(r_button, g_button, b_button) if x_button < 0: return from wx.lib.intctrl import IntCtrl text = IntCtrl(self, -1) text.SetBounds(0, 300) text.SetPosition((x_text, y_text)) text.SetSize((w_text, h_text)) button = wx.Button(self, -1, _(button_text)) button.SetPosition((x_button, y_button)) button.SetSize((w_button, h_button)) button.command = command button.data = data self._buttonList.append(button) self.Bind(wx.EVT_BUTTON, lambda e: command(data % text.GetValue()), button)
def __init__(self, parent, callback): super(TemperatureField, self).__init__(parent) self.callback = callback self.SetBackgroundColour(wx.WHITE) self.text = IntCtrl(self, -1) self.text.SetBounds(0, 300) self.text.SetSize((60, 28)) self.unit = wx.StaticBitmap(self, -1, wx.BitmapFromImage(wx.Image( resources.getPathForImage('print-window-temperature-unit.png'))), (0, 0)) self.button = wx.Button(self, -1, _("Set")) self.button.SetSize((35, 25)) self.Bind(wx.EVT_BUTTON, lambda e: self.callback(self.text.GetValue()), self.button) self.text.SetPosition((0, 0)) self.unit.SetPosition((60, 0)) self.button.SetPosition((90, 0))
def __init__(self, parent): wx.Panel.__init__(self, parent) box = wx.BoxSizer(wx.VERTICAL) self.SetSizer(box) self.dataDir = os.path.join(os.path.dirname(__file__), 'data/task') self.tasks = {} self.taskChoser = wx.ComboBox(self, style=wx.CB_READONLY) self.taskChoser.Bind(wx.EVT_COMBOBOX, self.OnSelect) box.Add(self.taskChoser) grid = wx.GridSizer(4, 2) box.Add(grid) self.taskName = wx.TextCtrl(self) self.appsInput = wx.TextCtrl(self) self.maxDistractionInput = IntCtrl(self, value=0, min=0) deleteButton = wx.Button(self, label='Delete') deleteButton.Bind(wx.EVT_BUTTON, self.OnDelete) cancelButton = wx.Button(self, label='Cancel') cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel) saveButton = wx.Button(self, label='Save') saveButton.Bind(wx.EVT_BUTTON, self.OnSave) grid.AddMany([(wx.StaticText(self, label='Name:'), 0, wx.EXPAND), (self.taskName, 0, wx.EXPAND), (wx.StaticText(self, label='Apps:'), 0, wx.EXPAND), (self.appsInput, 0, wx.EXPAND), (wx.StaticText(self, label='Max. Distraction:'), 0, wx.EXPAND), (self.maxDistractionInput, 0, wx.EXPAND), (deleteButton), (cancelButton), (saveButton)]) self.refresh()
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id) self.sizer = wx.BoxSizer() self.timer = TimerWidget(self, -1, title, self.myCallable) self.sizer.Add(self.timer) pidlabel = wx.StaticText(self, label='Process ID') self.pidvalue = IntCtrl(self, size=(60, 25), allow_none=True, value=None) self.sizer.Add(pidlabel) self.sizer.Add(self.pidvalue) self.testbutton = wx.Button(self, label='Test') self.Bind(wx.EVT_BUTTON, self.onTest, self.testbutton) self.sizer.Add(self.testbutton) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self) self.Show(True)
def __init__(self, parent, title, label): wx.Dialog.__init__(self, parent, 20, title, wx.DefaultPosition, wx.Size(300, 140)) vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) buttonbox = wx.BoxSizer(wx.HORIZONTAL) fgs = wx.FlexGridSizer(3, 2, 9, 5) self.title_tc1 = wx.StaticText(self, label=label) self.tc1 = wx.TextCtrl(self, size=(150, 25)) self.max = IntCtrl(self, size=(150, 25)) self.max.Enable(True) self.max.Hide() fgs.AddMany([(self.title_tc1), (self.tc1, 1, wx.EXPAND)]) fgs.AddMany([(self.title_tc1), (self.max, 1, wx.EXPAND)]) fgs.AddGrowableRow(2, 1) fgs.AddGrowableCol(1, 1) hbox.Add(fgs, flag=wx.ALL | wx.EXPAND, border=15) self.b_ok = wx.Button(self, label='Ok', id=OK_DIALOG) self.b_cancel = wx.Button(self, label='Cancel', id=CANCEL_DIALOG) buttonbox.Add(self.b_ok, 1, border=15) buttonbox.Add(self.b_cancel, 1, border=15) vbox.Add(hbox, flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND) vbox.Add(buttonbox, flag=wx.ALIGN_CENTER) self.SetSizer(vbox)
def parse_integer(self, node, frame, parent, sizer): """Create a control that accepts integers.""" a = node.attrib min_value = a.get('min', None) if min_value is not None: min_value = int(min_value) max_value = a.get('max', None) if max_value is not None: max_value = int(max_value) limited = int(a.get('limited', 0)) allow_none = int(a.get('allow_none', 0)) allow_long = int(a.get('allow_long', 0)) value = node.text if value is None: value = 0 else: value = int(value) return IntCtrl(parent, min=min_value, max=max_value, limited=limited, allow_none=allow_none, allow_long=allow_long, value=value)
def populatePanel(self, panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.sFit = Fit.getInstance() helpCursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW) mainSizer = wx.BoxSizer(wx.VERTICAL) self.stTitle = wx.StaticText(panel, wx.ID_ANY, "Market && Prices", wx.DefaultPosition, wx.DefaultSize, 0) self.stTitle.Wrap(-1) self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) mainSizer.Add(self.stTitle, 0, wx.ALL, 5) self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) delayTimer = wx.BoxSizer(wx.HORIZONTAL) self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) self.stMarketDelay.Wrap(-1) if "wxGTK" not in wx.PlatformInfo: self.stMarketDelay.SetCursor(helpCursor) self.stMarketDelay.SetToolTip( wx.ToolTip( 'The delay between a keystroke and the market search. Can help reduce lag when typing fast in the market search box.' )) delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.intDelay = IntCtrl(panel, max=1000, limited=True) delayTimer.Add(self.intDelay, 0, wx.ALL, 5) mainSizer.Add(delayTimer, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.intDelay.SetValue( self.sFit.serviceFittingOptions["marketSearchDelay"]) self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbMarketShortcuts, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.cbMarketShortcuts.SetValue( self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) priceSizer = wx.BoxSizer(wx.HORIZONTAL) self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, "Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) self.stDefaultSystem.Wrap(-1) priceSizer.Add(self.stDefaultSystem, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) if "wxGTK" not in wx.PlatformInfo: self.stDefaultSystem.SetCursor(helpCursor) self.stDefaultSystem.SetToolTip( wx.ToolTip( 'The source you choose will be tried first, but subsequent sources will be used if the preferred source fails. ' 'The system you choose will also be tried first, and if no data is available, global price will be used.' )) self.chPriceSource = wx.Choice(panel, choices=sorted(Price.sources.keys())) self.chPriceSystem = wx.Choice(panel, choices=list(Price.systemsList.keys())) priceSizer.Add(self.chPriceSource, 1, wx.ALL | wx.EXPAND, 5) priceSizer.Add(self.chPriceSystem, 1, wx.ALL | wx.EXPAND, 5) mainSizer.Add(priceSizer, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.chPriceSource.SetStringSelection( self.sFit.serviceFittingOptions["priceSource"]) self.chPriceSource.Bind(wx.EVT_CHOICE, self.onPricesSourceSelection) self.chPriceSystem.SetStringSelection( self.sFit.serviceFittingOptions["priceSystem"]) self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection) self.tbTotalPriceBox = wx.StaticBoxSizer(wx.VERTICAL, panel, "Total Price Includes") self.tbTotalPriceDrones = wx.CheckBox(panel, -1, "Drones", wx.DefaultPosition, wx.DefaultSize, 1) self.tbTotalPriceDrones.SetValue(self.priceSettings.get("drones")) self.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange) self.tbTotalPriceBox.Add(self.tbTotalPriceDrones, 0, wx.LEFT | wx.RIGHT | wx.TOP, 5) self.tbTotalPriceCargo = wx.CheckBox(panel, -1, "Cargo", wx.DefaultPosition, wx.DefaultSize, 1) self.tbTotalPriceCargo.SetValue(self.priceSettings.get("cargo")) self.tbTotalPriceCargo.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCargoChange) self.tbTotalPriceBox.Add(self.tbTotalPriceCargo, 0, wx.LEFT | wx.RIGHT, 5) self.tbTotalPriceCharacter = wx.CheckBox(panel, -1, "Implants && Boosters", wx.DefaultPosition, wx.DefaultSize, 1) self.tbTotalPriceCharacter.SetValue( self.priceSettings.get("character")) self.tbTotalPriceCharacter.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCharacterChange) self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) mainSizer.Add(self.tbTotalPriceBox, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketSearch = wx.RadioBox( panel, -1, "Market Search && Recent Items", wx.DefaultPosition, wx.DefaultSize, [ "No changes to meta buttons", "Enable all meta buttons for a duration of search / recents", "Enable all meta buttons" ], 1, wx.RA_SPECIFY_COLS) self.rbMarketSearch.SetSelection( self.priceSettings.get('marketMGSearchMode')) mainSizer.Add(self.rbMarketSearch, 0, wx.RIGHT | wx.TOP | wx.EXPAND, 10) self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) self.rbMarketEmpty = wx.RadioBox( panel, -1, "Market Group Selection", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketEmpty.SetSelection( self.priceSettings.get('marketMGMarketSelectMode')) mainSizer.Add(self.rbMarketEmpty, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketGroupSelectionChange) self.rbMarketEmpty = wx.RadioBox( panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, [ "No changes to meta buttons", "Enable leftmost available meta button", "Enable all available meta buttons" ], 1, wx.RA_SPECIFY_COLS) self.rbMarketEmpty.SetSelection( self.priceSettings.get('marketMGEmptyMode')) mainSizer.Add(self.rbMarketEmpty, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) self.rbMarketJump = wx.RadioBox( panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, [ "No changes to meta buttons", "Enable item's meta button", "Enable item's meta button, disable others", "Enable all meta buttons" ], 1, wx.RA_SPECIFY_COLS) self.rbMarketJump.SetSelection( self.priceSettings.get('marketMGJumpMode')) mainSizer.Add(self.rbMarketJump, 0, wx.EXPAND | wx.TOP | wx.RIGHT | wx.BOTTOM, 10) self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) panel.SetSizer(mainSizer) panel.Layout()
def run_mouse(self, background_image, image_set_number): """Define a grid by running the UI Returns a CPGridInfo object """ import matplotlib import matplotlib.backends.backend_wxagg as backend import wx from wx.lib.intctrl import IntCtrl # # Make up a dialog box. It has the following structure: # # Dialog: # top_sizer: # Canvas # Figure # Axis # control_sizer # first_sizer # first_row # first_col # second_sizer # second_row # second_col # button_sizer # Redisplay # OK # cancel # status bar # figure = matplotlib.figure.Figure() frame = wx.Dialog(wx.GetApp().TopWindow, title="Select grid cells, image cycle #%d:" % (image_set_number)) top_sizer = wx.BoxSizer(wx.VERTICAL) frame.SetSizer(top_sizer) canvas = backend.FigureCanvasWxAgg(frame, -1, figure) top_sizer.Add(canvas, 1, wx.EXPAND) top_sizer.Add( wx.StaticText( frame, -1, "Select the center of a grid cell with the left mouse button.\n", ), 0, wx.EXPAND | wx.ALL, 5, ) control_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.Add(control_sizer, 0, wx.EXPAND | wx.ALL, 5) FIRST_CELL = "First cell" SECOND_CELL = "Second cell" cell_choice = wx.RadioBox( frame, label="Choose current cell", choices=[FIRST_CELL, SECOND_CELL], style=wx.RA_VERTICAL, ) control_sizer.Add(cell_choice) # # Text boxes for the first cell's row and column # first_sizer = wx.GridBagSizer(2, 2) control_sizer.Add(first_sizer, 1, wx.EXPAND | wx.ALL, 5) first_sizer.Add( wx.StaticText(frame, -1, "First cell column:"), wx.GBPosition(0, 0), flag=wx.EXPAND, ) first_column = IntCtrl(frame, -1, 1, min=1, max=self.grid_columns.value) first_sizer.Add(first_column, wx.GBPosition(0, 1), flag=wx.EXPAND) first_sizer.Add( wx.StaticText(frame, -1, "First cell row:"), wx.GBPosition(1, 0), flag=wx.EXPAND, ) first_row = IntCtrl(frame, -1, 1, min=1, max=self.grid_rows.value) first_sizer.Add(first_row, wx.GBPosition(1, 1), flag=wx.EXPAND) first_sizer.Add(wx.StaticText(frame, -1, "X:"), wx.GBPosition(0, 2)) first_x = IntCtrl(frame, -1, 100, min=1) first_sizer.Add(first_x, wx.GBPosition(0, 3)) first_sizer.Add(wx.StaticText(frame, -1, "Y:"), wx.GBPosition(1, 2)) first_y = IntCtrl(frame, -1, 100, min=1) first_sizer.Add(first_y, wx.GBPosition(1, 3)) # # Text boxes for the second cell's row and column # second_sizer = wx.GridBagSizer(2, 2) control_sizer.Add(second_sizer, 1, wx.EXPAND | wx.ALL, 5) second_sizer.Add( wx.StaticText(frame, -1, "Second cell column:"), wx.GBPosition(0, 0), flag=wx.EXPAND, ) second_column = IntCtrl(frame, -1, self.grid_columns.value, min=1, max=self.grid_columns.value) second_sizer.Add(second_column, wx.GBPosition(0, 1), flag=wx.EXPAND) second_sizer.Add( wx.StaticText(frame, -1, "Second cell row:"), wx.GBPosition(1, 0), flag=wx.EXPAND, ) second_row = IntCtrl(frame, -1, self.grid_rows.value, min=1, max=self.grid_rows.value) second_sizer.Add(second_row, wx.GBPosition(1, 1), flag=wx.EXPAND) second_sizer.Add(wx.StaticText(frame, -1, "X:"), wx.GBPosition(0, 2)) second_x = IntCtrl(frame, -1, 200, min=1) second_sizer.Add(second_x, wx.GBPosition(0, 3)) second_sizer.Add(wx.StaticText(frame, -1, "Y:"), wx.GBPosition(1, 2)) second_y = IntCtrl(frame, -1, 200, min=1) second_sizer.Add(second_y, wx.GBPosition(1, 3)) # # Buttons # button_sizer = wx.BoxSizer(wx.VERTICAL) control_sizer.Add(button_sizer, 0, wx.EXPAND | wx.ALL, 5) redisplay_button = wx.Button(frame, -1, "Redisplay") button_sizer.Add(redisplay_button) button_sizer.Add(wx.Button(frame, wx.OK, "OK")) button_sizer.Add(wx.Button(frame, wx.CANCEL, "Cancel")) # # Status bar # status_bar = wx.StatusBar(frame, style=0) top_sizer.Add(status_bar, 0, wx.EXPAND) status_bar.SetFieldsCount(1) SELECT_FIRST_CELL = "Select the center of the first cell" SELECT_SECOND_CELL = "Select the center of the second cell" status_bar.SetStatusText(SELECT_FIRST_CELL) status = [wx.OK] gridding = [None] if self.display_image_name == "Leave blank": image_shape = None else: image_shape = background_image.shape[:2] def redisplay(event): figure.clf() axes = figure.add_subplot(1, 1, 1) if (event is not None) or (gridding[0] is None): do_gridding(first_x.Value, first_y.Value, second_x.Value, second_y.Value) self.display_grid(background_image, gridding[0], image_set_number, axes) canvas.draw() def cancel(event): status[0] = wx.CANCEL frame.SetReturnCode(wx.CANCEL) frame.Close(True) def ok(event): status[0] = wx.OK frame.SetReturnCode(wx.OK) frame.Close(True) def on_cell_selection(event): if cell_choice.Selection == 0: status_bar.SetStatusText(SELECT_FIRST_CELL) else: status_bar.SetStatusText(SELECT_SECOND_CELL) def do_gridding(x1, y1, x2, y2): try: gridding[0] = self.build_grid_info( int(x1), int(y1), int(first_row.Value), int(first_column.Value), int(x2), int(y2), int(second_row.Value), int(second_column.Value), image_shape, ) except Exception as e: logger.error(e.message, exc_info=True) status_bar.SetStatusText(e.message) return False return True def button_release(event): if event.inaxes == figure.axes[0]: if cell_choice.Selection == 0: new_first_x = str(int(event.xdata)) new_first_y = str(int(event.ydata)) if do_gridding(new_first_x, new_first_y, second_x.Value, second_y.Value): first_x.Value = new_first_x first_y.Value = new_first_y cell_choice.Selection = 1 status_bar.SetStatusText(SELECT_SECOND_CELL) else: new_second_x = str(int(event.xdata)) new_second_y = str(int(event.ydata)) if do_gridding(first_x.Value, first_y.Value, new_second_x, new_second_y): second_x.Value = new_second_x second_y.Value = new_second_y cell_choice.Selection = 0 status_bar.SetStatusText(SELECT_FIRST_CELL) redisplay(None) redisplay(None) frame.Fit() frame.Bind(wx.EVT_BUTTON, redisplay, redisplay_button) frame.Bind(wx.EVT_BUTTON, cancel, id=wx.CANCEL) frame.Bind(wx.EVT_BUTTON, ok, id=wx.OK) frame.Bind(wx.EVT_RADIOBOX, on_cell_selection, cell_choice) canvas.mpl_connect("button_release_event", button_release) frame.ShowModal() do_gridding(first_x.Value, first_y.Value, second_x.Value, second_y.Value) frame.Destroy() if status[0] != wx.OK: raise RuntimeError("Pipeline aborted during grid editing") return gridding[0]
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Damage Pattern Editor", size=wx.Size(400, 240)) self.block = False self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) mainSizer = wx.BoxSizer(wx.VERTICAL) self.entityEditor = DmgPatternEntityEditor(self) mainSizer.Add(self.entityEditor, 0, wx.ALL | wx.EXPAND, 2) self.sl = wx.StaticLine(self) mainSizer.Add(self.sl, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) contentSizer = wx.BoxSizer(wx.VERTICAL) self.embitmap = BitmapLoader.getBitmap("em_big", "gui") self.thermbitmap = BitmapLoader.getBitmap("thermal_big", "gui") self.kinbitmap = BitmapLoader.getBitmap("kinetic_big", "gui") self.expbitmap = BitmapLoader.getBitmap("explosive_big", "gui") dmgeditSizer = wx.FlexGridSizer(2, 6, 0, 2) dmgeditSizer.AddGrowableCol(0) dmgeditSizer.AddGrowableCol(5) dmgeditSizer.SetFlexibleDirection(wx.BOTH) dmgeditSizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) width = -1 defSize = wx.Size(width, -1) for i, type in enumerate(self.DAMAGE_TYPES): bmp = wx.StaticBitmap( self, wx.ID_ANY, BitmapLoader.getBitmap("%s_big" % type, "gui")) if i % 2: style = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT border = 20 else: style = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT border = 5 # set text edit setattr(self, "%sEdit" % type, IntCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize)) setattr(self, "%sPerc" % type, wx.StaticText(self, wx.ID_ANY, u"0%")) editObj = getattr(self, "%sEdit" % type) dmgeditSizer.Add(bmp, 0, style, border) dmgeditSizer.Add(editObj, 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5) dmgeditSizer.Add(getattr(self, "%sPerc" % type), 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5) editObj.Bind(wx.EVT_TEXT, self.ValuesUpdated) editObj.SetLimited(True) editObj.SetMin(0) editObj.SetMax(2000000) contentSizer.Add(dmgeditSizer, 1, wx.EXPAND | wx.ALL, 5) self.slfooter = wx.StaticLine(self) contentSizer.Add(self.slfooter, 0, wx.EXPAND | wx.TOP, 5) footerSizer = wx.BoxSizer(wx.HORIZONTAL) perSizer = wx.BoxSizer(wx.VERTICAL) self.stNotice = wx.StaticText(self, wx.ID_ANY, u"") self.stNotice.Wrap(-1) perSizer.Add(self.stNotice, 0, wx.BOTTOM | wx.TOP | wx.LEFT, 5) footerSizer.Add(perSizer, 1, wx.ALIGN_CENTER_VERTICAL, 5) self.totSizer = wx.BoxSizer(wx.VERTICAL) contentSizer.Add(footerSizer, 0, wx.EXPAND, 5) mainSizer.Add(contentSizer, 1, wx.EXPAND, 0) if "wxGTK" in wx.PlatformInfo: self.closeBtn = wx.Button(self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.closeBtn, 0, wx.ALL | wx.ALIGN_RIGHT, 5) self.closeBtn.Bind(wx.EVT_BUTTON, self.closeEvent) self.SetSizer(mainSizer) importExport = (("Import", wx.ART_FILE_OPEN, "from"), ("Export", wx.ART_FILE_SAVE_AS, "to")) for name, art, direction in importExport: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) btn = wx.BitmapButton(self, wx.ID_ANY, bitmap) btn.SetMinSize(btn.GetSize()) btn.SetMaxSize(btn.GetSize()) btn.Layout() setattr(self, name, btn) btn.Enable(True) btn.SetToolTipString("%s patterns %s clipboard" % (name, direction)) footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT) btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower()))) self.Layout() bsize = self.GetBestSize() self.SetSize((-1, bsize.height)) self.CenterOnParent() self.Bind(wx.EVT_CHOICE, self.patternChanged) self.patternChanged()
def run_mouse(self, background_image, image_set_number): '''Define a grid by running the UI Returns a CPGridInfo object ''' import matplotlib import matplotlib.backends.backend_wxagg as backend import wx from wx.lib.intctrl import IntCtrl # # Make up a dialog box. It has the following structure: # # Dialog: # top_sizer: # Canvas # Figure # Axis # control_sizer # first_sizer # first_row # first_col # second_sizer # second_row # second_col # button_sizer # Redisplay # OK # cancel # status bar # figure = matplotlib.figure.Figure() frame = wx.Dialog(wx.GetApp().TopWindow, title="Select grid cells") top_sizer = wx.BoxSizer(wx.VERTICAL) frame.SetSizer(top_sizer) canvas = backend.FigureCanvasWxAgg(frame, -1, figure) top_sizer.Add(canvas, 1, wx.EXPAND) top_sizer.Add( wx.StaticText( frame, -1, "Select the center of a grid cell with the left mouse button.\n" ), 0, wx.EXPAND | wx.ALL, 5) control_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.Add(control_sizer, 0, wx.EXPAND | wx.ALL, 5) FIRST_CELL = "First cell" SECOND_CELL = "Second cell" cell_choice = wx.RadioBox(frame, label="Choose current cell", choices=[FIRST_CELL, SECOND_CELL], style=wx.RA_VERTICAL) control_sizer.Add(cell_choice) # # Text boxes for the first cell's row and column # first_sizer = wx.GridBagSizer(2, 2) control_sizer.Add(first_sizer, 1, wx.EXPAND | wx.ALL, 5) first_sizer.Add(wx.StaticText(frame, -1, "First cell column:"), wx.GBPosition(0, 0), flag=wx.EXPAND) first_column = IntCtrl(frame, -1, 1, min=1, max=self.grid_columns.value) first_sizer.Add(first_column, wx.GBPosition(0, 1), flag=wx.EXPAND) first_sizer.Add(wx.StaticText(frame, -1, "First cell row:"), wx.GBPosition(1, 0), flag=wx.EXPAND) first_row = IntCtrl(frame, -1, 1, min=1, max=self.grid_rows.value) first_sizer.Add(first_row, wx.GBPosition(1, 1), flag=wx.EXPAND) first_sizer.Add(wx.StaticText(frame, -1, "X:"), wx.GBPosition(0, 2)) first_x = IntCtrl(frame, -1, 100, min=1) first_sizer.Add(first_x, wx.GBPosition(0, 3)) first_sizer.Add(wx.StaticText(frame, -1, "Y:"), wx.GBPosition(1, 2)) first_y = IntCtrl(frame, -1, 100, min=1) first_sizer.Add(first_y, wx.GBPosition(1, 3)) # # Text boxes for the second cell's row and column # second_sizer = wx.GridBagSizer(2, 2) control_sizer.Add(second_sizer, 1, wx.EXPAND | wx.ALL, 5) second_sizer.Add(wx.StaticText(frame, -1, "Second cell column:"), wx.GBPosition(0, 0), flag=wx.EXPAND) second_column = IntCtrl(frame, -1, self.grid_columns.value, min=1, max=self.grid_columns.value) second_sizer.Add(second_column, wx.GBPosition(0, 1), flag=wx.EXPAND) second_sizer.Add(wx.StaticText(frame, -1, "Second cell row:"), wx.GBPosition(1, 0), flag=wx.EXPAND) second_row = IntCtrl(frame, -1, self.grid_rows.value, min=1, max=self.grid_rows.value) second_sizer.Add(second_row, wx.GBPosition(1, 1), flag=wx.EXPAND) second_sizer.Add(wx.StaticText(frame, -1, "X:"), wx.GBPosition(0, 2)) second_x = IntCtrl(frame, -1, 200, min=1) second_sizer.Add(second_x, wx.GBPosition(0, 3)) second_sizer.Add(wx.StaticText(frame, -1, "Y:"), wx.GBPosition(1, 2)) second_y = IntCtrl(frame, -1, 200, min=1) second_sizer.Add(second_y, wx.GBPosition(1, 3)) # # Buttons # button_sizer = wx.BoxSizer(wx.VERTICAL) control_sizer.Add(button_sizer, 0, wx.EXPAND | wx.ALL, 5) redisplay_button = wx.Button(frame, -1, "Redisplay") button_sizer.Add(redisplay_button) button_sizer.Add(wx.Button(frame, wx.OK, "OK")) button_sizer.Add(wx.Button(frame, wx.CANCEL, "Cancel")) # # Status bar # status_bar = wx.StatusBar(frame, style=0) top_sizer.Add(status_bar, 0, wx.EXPAND) status_bar.SetFieldsCount(1) SELECT_FIRST_CELL = "Select the center of the first cell" SELECT_SECOND_CELL = "Select the center of the second cell" status_bar.SetStatusText(SELECT_FIRST_CELL) status = [wx.OK] gridding = [None] if self.display_image_name == cps.LEAVE_BLANK: image_shape = None else: image_shape = background_image.shape[:2] def redisplay(event): figure.clf() axes = figure.add_subplot(1, 1, 1) if (event is not None) or (gridding[0] is None): do_gridding(first_x.Value, first_y.Value, second_x.Value, second_y.Value) self.display_grid(background_image, gridding[0], image_set_number, axes) canvas.draw() def cancel(event): status[0] = wx.CANCEL frame.SetReturnCode(wx.CANCEL) frame.Close(True) def ok(event): status[0] = wx.OK frame.SetReturnCode(wx.OK) frame.Close(True) def on_cell_selection(event): if cell_choice.Selection == 0: status_bar.SetStatusText(SELECT_FIRST_CELL) else: status_bar.SetStatusText(SELECT_SECOND_CELL) def do_gridding(x1, y1, x2, y2): try: gridding[0] = self.build_grid_info(int(x1), int(y1), int(first_row.Value), int(first_column.Value), int(x2), int(y2), int(second_row.Value), int(second_column.Value), image_shape) except Exception, e: logger.error(e.message, exc_info=True) status_bar.SetStatusText(e.message) return False return True
def __init__(self): wx.Frame.__init__(self, None, -1, "Eye Probe", size=(1024, 620)) panel = wx.Panel(self, -1) self.fbb_waveform_path = filebrowse.FileBrowseButton( panel, -1, size=(300, -1), labelText="Waveform") self.int_npui = IntCtrl(panel, -1, 32, min=1, max=99999, limited=True, size=(50, -1)) self.fs_datarate = FS.FloatSpin(panel, -1, size=(65, -1), min_val=0, max_val=9999, increment=0.1, value=10, agwStyle=FS.FS_LEFT) self.fs_datarate.SetFormat("%G") self.fs_datarate.SetDigits(5) self.cb_sinc_interp_n = wx.ComboBox( panel, -1, "Off", (-1, -1), (-1, -1), ["Off", "2pts", "4pts", "8pts", "16pts"], wx.CB_DROPDOWN | wx.CB_READONLY) self.cb_CRU = wx.ComboBox(panel, -1, "Constant clock", (-1, -1), (-1, -1), ["Constant clock", "Clock times file"], wx.CB_DROPDOWN | wx.CB_READONLY) self.fbb_clock_time_file = filebrowse.FileBrowseButton( panel, -1, size=(300, -1), labelText="Clock times") self.fbb_clock_time_file.Enable(False) self.int_ignor_cycles = IntCtrl(panel, -1, 0, min=0, max=9999999, limited=True, size=(50, -1)) self.int_ignor_cycles.Enable(False) self.cb_colorbar_en = wx.CheckBox(panel, -1, "Enable Colorbar") self.cb_mask_en = wx.CheckBox(panel, -1, "Enable Mask") self.sld_maskadj = wx.Slider(panel, -1, 0, -100, 100, size=(300, -1)) self.fbb_mask_path = filebrowse.FileBrowseButton(panel, -1, size=(300, -1), labelText="Mask") self.fbb_mask_path.Enable(False) self.sld_maskadj.Enable(False) self.btn_plot = wx.Button(panel, -1, "Plot Eye") self.canvas = FigureCanvas(panel, -1, Figure()) self.figure = self.canvas.figure self.axes1 = self.figure.add_subplot(1, 1, 1) self.axes1.set_axis_bgcolor('k') self.axes1.grid(c="w") self.axes2 = None toolbar = NavigationToolbar2Wx(self.canvas) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer_left = wx.GridBagSizer(hgap=5, vgap=10) sizer_left.Add(self.fbb_waveform_path, pos=(0, 0), span=(1, 3), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(wx.StaticText(panel, -1, "Samples per UI"), pos=(1, 0), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.int_npui, pos=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(wx.StaticText(panel, -1, "Data Rate"), pos=(2, 0), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.fs_datarate, pos=(2, 1), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(wx.StaticText(panel, -1, "Gbps"), pos=(2, 2), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(wx.StaticText(panel, -1, "Sin(x)/x Interp"), pos=(3, 0), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.cb_sinc_interp_n, pos=(3, 1), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(wx.StaticText(panel, -1, "Clock Recovery"), pos=(4, 0), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.cb_CRU, pos=(4, 1), span=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.fbb_clock_time_file, pos=(5, 0), span=(1, 3), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(wx.StaticText(panel, -1, "Ignore cycles"), pos=(6, 0), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.int_ignor_cycles, pos=(6, 1), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.cb_colorbar_en, pos=(7, 0), span=(1, 3), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.cb_mask_en, pos=(8, 0), span=(1, 3), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.fbb_mask_path, pos=(9, 0), span=(1, 3), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.sld_maskadj, pos=(10, 0), span=(1, 3), flag=wx.ALIGN_CENTER_VERTICAL) sizer_left.Add(self.btn_plot, pos=(11, 0), span=(1, 3), flag=wx.ALIGN_CENTER_VERTICAL) sizer_right = wx.BoxSizer(wx.VERTICAL) sizer_right.Add(toolbar, 0, wx.EXPAND | wx.RIGHT) sizer_right.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) sizer.Add(sizer_left, 0, wx.ALL, 10) sizer.Add(sizer_right, 1, wx.GROW) panel.SetSizer(sizer) sizer.Fit(panel) self.eye_mask_en = True self.btn_plot.Bind(wx.EVT_BUTTON, self.OnPlot) self.sld_maskadj.Bind(wx.EVT_SCROLL_CHANGED, self.OnAdjustMask) self.cb_mask_en.Bind(wx.EVT_CHECKBOX, self.OnEnableEyeMask) self.cb_CRU.Bind(wx.EVT_COMBOBOX, self.OnChangeCRU)
def populatePanel(self, panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() mainSizer = wx.BoxSizer(wx.VERTICAL) helpCursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW) self.engine_settings = EOSSettings.getInstance() self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0) self.stTitle.Wrap(-1) self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) mainSizer.Add(self.stTitle, 0, wx.EXPAND | wx.ALL, 5) self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.cbGlobalForceReload = wx.CheckBox(panel, wx.ID_ANY, "Factor in reload time when calculating capacitor usage, damage, and tank.", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGlobalForceReload, 0, wx.ALL | wx.EXPAND, 5) self.cbStrictSkillLevels = wx.CheckBox(panel, wx.ID_ANY, "Enforce strict skill level requirements", wx.DefaultPosition, wx.DefaultSize, 0) self.cbStrictSkillLevels.SetCursor(helpCursor) self.cbStrictSkillLevels.SetToolTip(wx.ToolTip( 'When enabled, skills will check their dependencies\' requirements when their levels change and reset ' + 'skills that no longer meet the requirement.\neg: Setting Drones from level V to IV will reset the Heavy ' + 'Drone Operation skill, as that requires Drones V')) mainSizer.Add(self.cbStrictSkillLevels, 0, wx.ALL | wx.EXPAND, 5) self.cbUniversalAdaptiveArmorHardener = wx.CheckBox(panel, wx.ID_ANY, "When damage profile is Uniform, set Reactive Armor " + "Hardener to match (old behavior).", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbUniversalAdaptiveArmorHardener, 0, wx.ALL | wx.EXPAND, 5) spoolup_sizer = wx.BoxSizer(wx.HORIZONTAL) self.spool_up_label = wx.StaticText(panel, wx.ID_ANY, "Global Default Spoolup Percentage:", wx.DefaultPosition, wx.DefaultSize, 0) self.spool_up_label.Wrap(-1) self.spool_up_label.SetCursor(helpCursor) self.spool_up_label.SetToolTip( wx.ToolTip('The amount of spoolup to use by default on module which support it. Can be changed on a per-module basis')) spoolup_sizer.Add(self.spool_up_label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.spoolup_value = IntCtrl(panel, min=0, max=100, limited=True) spoolup_sizer.Add(self.spoolup_value , 0, wx.ALL, 5) mainSizer.Add(spoolup_sizer, 0, wx.ALL | wx.EXPAND, 0) # Future code once new cap sim is implemented ''' self.cbGlobalForceReactivationTimer = wx.CheckBox( panel, wx.ID_ANY, "Factor in reactivation timer", wx.DefaultPosition, wx.DefaultSize, 0 ) mainSizer.Add( self.cbGlobalForceReactivationTimer, 0, wx.ALL|wx.EXPAND, 5 ) text = " Ignores reactivation timer when calculating capacitor usage,\n damage, and tank." self.cbGlobalForceReactivationTimerText = wx.StaticText( panel, wx.ID_ANY, text, wx.DefaultPosition, wx.DefaultSize, 0 ) self.cbGlobalForceReactivationTimerText.Wrap( -1 ) self.cbGlobalForceReactivationTimerText.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) mainSizer.Add( self.cbGlobalForceReactivationTimerText, 0, wx.ALL, 5 ) ''' # Future code for mining laser crystal ''' self.cbGlobalMiningSpecialtyCrystal = wx.CheckBox( panel, wx.ID_ANY, "Factor in reactivation timer", wx.DefaultPosition, wx.DefaultSize, 0 ) mainSizer.Add( self.cbGlobalMiningSpecialtyCrystal, 0, wx.ALL|wx.EXPAND, 5 ) text = " If enabled, displays the Specialty Crystal mining amount.\n This is the amount mined when using crystals and mining the matching asteroid." self.cbGlobalMiningSpecialtyCrystalText = wx.StaticText( panel, wx.ID_ANY, text, wx.DefaultPosition, wx.DefaultSize, 0 ) self.cbGlobalMiningSpecialtyCrystalText.Wrap( -1 ) self.cbGlobalMiningSpecialtyCrystalText.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) ) mainSizer.Add( self.cbGlobalMiningSpecialtyCrystalText, 0, wx.ALL, 5 ) ''' self.sFit = Fit.getInstance() self.cbGlobalForceReload.SetValue(self.sFit.serviceFittingOptions["useGlobalForceReload"]) self.cbGlobalForceReload.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalForceReloadStateChange) self.cbStrictSkillLevels.SetValue(self.engine_settings.get("strictSkillLevels")) self.cbStrictSkillLevels.Bind(wx.EVT_CHECKBOX, self.OnCBStrictSkillLevelsChange) self.cbUniversalAdaptiveArmorHardener.SetValue(self.engine_settings.get("useStaticAdaptiveArmorHardener")) self.cbUniversalAdaptiveArmorHardener.Bind(wx.EVT_CHECKBOX, self.OnCBUniversalAdaptiveArmorHardenerChange) self.spoolup_value.SetValue(int(self.engine_settings.get("globalDefaultSpoolupPercentage") * 100)) self.spoolup_value.Bind(wx.lib.intctrl.EVT_INT, self.OnSpoolupChange) panel.SetSizer(mainSizer) panel.Layout()
def populatePanel(self, panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.dirtySettings = False self.openFitsSettings = SettingsProvider.getInstance().getSettings( "pyfaPrevOpenFits", { "enabled": False, "pyfaOpenFits": [] }) helpCursor = wx.StockCursor(wx.CURSOR_QUESTION_ARROW) mainSizer = wx.BoxSizer(wx.VERTICAL) self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0) self.stTitle.Wrap(-1) self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) mainSizer.Add(self.stTitle, 0, wx.ALL, 5) self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.cbGlobalChar = wx.CheckBox(panel, wx.ID_ANY, u"Use global character", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGlobalChar, 0, wx.ALL | wx.EXPAND, 5) self.cbGlobalDmgPattern = wx.CheckBox(panel, wx.ID_ANY, u"Use global damage pattern", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGlobalDmgPattern, 0, wx.ALL | wx.EXPAND, 5) self.cbCompactSkills = wx.CheckBox(panel, wx.ID_ANY, u"Compact skills needed tooltip", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbCompactSkills, 0, wx.ALL | wx.EXPAND, 5) self.cbFitColorSlots = wx.CheckBox(panel, wx.ID_ANY, u"Color fitting view by slot", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbFitColorSlots, 0, wx.ALL | wx.EXPAND, 5) self.cbReopenFits = wx.CheckBox(panel, wx.ID_ANY, u"Reopen previous fits on startup", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbReopenFits, 0, wx.ALL | wx.EXPAND, 5) self.cbRackSlots = wx.CheckBox(panel, wx.ID_ANY, u"Separate Racks", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbRackSlots, 0, wx.ALL | wx.EXPAND, 5) labelSizer = wx.BoxSizer(wx.VERTICAL) self.cbRackLabels = wx.CheckBox(panel, wx.ID_ANY, u"Show Rack Labels", wx.DefaultPosition, wx.DefaultSize, 0) labelSizer.Add(self.cbRackLabels, 0, wx.ALL | wx.EXPAND, 5) mainSizer.Add(labelSizer, 0, wx.LEFT | wx.EXPAND, 30) self.cbShowTooltip = wx.CheckBox(panel, wx.ID_ANY, u"Show tab tooltips", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbShowTooltip, 0, wx.ALL | wx.EXPAND, 5) self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, u"Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbMarketShortcuts, 0, wx.ALL | wx.EXPAND, 5) self.cbGaugeAnimation = wx.CheckBox(panel, wx.ID_ANY, u"Animate gauges", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGaugeAnimation, 0, wx.ALL | wx.EXPAND, 5) self.cbExportCharges = wx.CheckBox(panel, wx.ID_ANY, u"Export loaded charges", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbExportCharges, 0, wx.ALL | wx.EXPAND, 5) self.cbOpenFitInNew = wx.CheckBox( panel, wx.ID_ANY, u"Open fittings in a new page by default", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbOpenFitInNew, 0, wx.ALL | wx.EXPAND, 5) self.cbShowShipBrowserTooltip = wx.CheckBox( panel, wx.ID_ANY, u"Show ship browser tooltip", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbShowShipBrowserTooltip, 0, wx.ALL | wx.EXPAND, 5) priceSizer = wx.BoxSizer(wx.HORIZONTAL) self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, u"Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) self.stDefaultSystem.Wrap(-1) priceSizer.Add(self.stDefaultSystem, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.chPriceSource = wx.Choice(panel, choices=sorted(Price.sources.keys())) self.chPriceSystem = wx.Choice(panel, choices=Price.systemsList.keys()) priceSizer.Add(self.chPriceSource, 1, wx.ALL | wx.EXPAND, 5) priceSizer.Add(self.chPriceSystem, 1, wx.ALL | wx.EXPAND, 5) mainSizer.Add(priceSizer, 0, wx.ALL | wx.EXPAND, 0) delayTimer = wx.BoxSizer(wx.HORIZONTAL) self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, u"Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) self.stMarketDelay.Wrap(-1) self.stMarketDelay.SetCursor(helpCursor) self.stMarketDelay.SetToolTip( wx.ToolTip( 'The delay between a keystroke and the market search. Can help reduce lag when typing fast in the market search box.' )) delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.intDelay = IntCtrl(panel, max=1000, limited=True) delayTimer.Add(self.intDelay, 0, wx.ALL, 5) mainSizer.Add(delayTimer, 0, wx.ALL | wx.EXPAND, 0) self.sFit = Fit.getInstance() self.cbGlobalChar.SetValue( self.sFit.serviceFittingOptions["useGlobalCharacter"]) self.cbGlobalDmgPattern.SetValue( self.sFit.serviceFittingOptions["useGlobalDamagePattern"]) self.cbFitColorSlots.SetValue( self.sFit.serviceFittingOptions["colorFitBySlot"] or False) self.cbRackSlots.SetValue(self.sFit.serviceFittingOptions["rackSlots"] or False) self.cbRackLabels.SetValue( self.sFit.serviceFittingOptions["rackLabels"] or False) self.cbCompactSkills.SetValue( self.sFit.serviceFittingOptions["compactSkills"] or False) self.cbReopenFits.SetValue(self.openFitsSettings["enabled"]) self.cbShowTooltip.SetValue( self.sFit.serviceFittingOptions["showTooltip"] or False) self.cbMarketShortcuts.SetValue( self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) self.cbGaugeAnimation.SetValue( self.sFit.serviceFittingOptions["enableGaugeAnimation"]) self.cbExportCharges.SetValue( self.sFit.serviceFittingOptions["exportCharges"]) self.cbOpenFitInNew.SetValue( self.sFit.serviceFittingOptions["openFitInNew"]) self.chPriceSource.SetStringSelection( self.sFit.serviceFittingOptions["priceSource"]) self.chPriceSystem.SetStringSelection( self.sFit.serviceFittingOptions["priceSystem"]) self.cbShowShipBrowserTooltip.SetValue( self.sFit.serviceFittingOptions["showShipBrowserTooltip"]) self.intDelay.SetValue( self.sFit.serviceFittingOptions["marketSearchDelay"]) self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange) self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange) self.cbFitColorSlots.Bind(wx.EVT_CHECKBOX, self.onCBGlobalColorBySlot) self.cbRackSlots.Bind(wx.EVT_CHECKBOX, self.onCBGlobalRackSlots) self.cbRackLabels.Bind(wx.EVT_CHECKBOX, self.onCBGlobalRackLabels) self.cbCompactSkills.Bind(wx.EVT_CHECKBOX, self.onCBCompactSkills) self.cbReopenFits.Bind(wx.EVT_CHECKBOX, self.onCBReopenFits) self.cbShowTooltip.Bind(wx.EVT_CHECKBOX, self.onCBShowTooltip) self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) self.cbGaugeAnimation.Bind(wx.EVT_CHECKBOX, self.onCBGaugeAnimation) self.cbExportCharges.Bind(wx.EVT_CHECKBOX, self.onCBExportCharges) self.cbOpenFitInNew.Bind(wx.EVT_CHECKBOX, self.onCBOpenFitInNew) self.chPriceSource.Bind(wx.EVT_CHOICE, self.onPricesSourceSelection) self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection) self.cbShowShipBrowserTooltip.Bind(wx.EVT_CHECKBOX, self.onCBShowShipBrowserTooltip) self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) self.cbRackLabels.Enable(self.sFit.serviceFittingOptions["rackSlots"] or False) panel.SetSizer(mainSizer) panel.Layout()