class ImportImagePanel(Panel): """ Panel Principal para Importação de Imagem """ def __init__(self, parent, imagePath): Panel.__init__(self, parent) self._hbox = BoxSizer(HORIZONTAL) self._grid_layout = FlexGridSizer(1, 2, 1, 1) # self._grid_layout = GridBagSizer(2, 1) self._configurationAndImportPanel = ConfigurationAndImportPanel(self) self._bitmapPanel = BitmapPanel(self, imagePath) self._grid_layout.AddMany([(self._configurationAndImportPanel, 1, LEFT), (self._bitmapPanel, 1, EXPAND)]) self._grid_layout.AddGrowableCol(1, 1) self._grid_layout.AddGrowableRow(0, 1) self._hbox.Add(self._grid_layout, proportion=1, flag=ALL | EXPAND, border=0) self.SetSizer(self._hbox)
def __init__(self, panel: wx.Panel, gsizer: wx.FlexGridSizer, label: str, name: str, control: wx.Control, newentry: bool = False): self.label = wx.StaticText(panel, label=label) self.control = control self.newentry = newentry if not newentry: self.undo = wx.Button(panel, label="X", size=wx.Size(25, -1)) self.undo.Bind(wx.EVT_BUTTON, self.reset_ctrl) self.undo.Disable() gsizer.Add(self.label, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=3) gsizer.Add(self.control, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=3) if not newentry: gsizer.Add(self.undo, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=3)
def AppendRow(self, left_text: str, right_text: str, sizer: wx.FlexGridSizer): left = wx.StaticText(self, label=left_text, size=(self.left_width, 30), style=wx.ALIGN_RIGHT) left.SetFont(self.leftfont) right = wx.StaticText(self, label=right_text, size=(self.right_width, 30), style=wx.ALIGN_LEFT) right.SetFont(self.rightfont) sizer.Add(left, self.leftflags) sizer.Add(right, self.rightflags)
def construct_gui(self): """Constructs the page GUI""" self.scrolled_panel = ScrolledPanel(self) self.scrolled_panel.SetAutoLayout(1) self.scrolled_panel.SetupScrolling() self.main_sizer = BoxSizer(HORIZONTAL) self.grid_sizer = FlexGridSizer(1, 10, 10) for index, entry in enumerate(self.config): self.construct_entry_row(entry, index) self.grid_sizer.AddGrowableCol(0, 1) scroll_sizer = BoxSizer(HORIZONTAL) scroll_sizer.Add(self.grid_sizer, 1, EXPAND | ALL, 20) self.scrolled_panel.SetSizer(scroll_sizer) self.main_sizer.Add(self.scrolled_panel, 1, EXPAND) self.SetSizer(self.main_sizer)
def _createMethodInformation(self) -> FlexGridSizer: # Txt Ctrl Name lblName: StaticText = StaticText(self, ID_ANY, _("Name")) self._txtName: TextCtrl = TextCtrl(self, ID_TXT_METHOD_NAME, "", size=(125, -1)) self.Bind(EVT_TEXT, self._evtMethodText, id=ID_TXT_METHOD_NAME) # Txt Ctrl Modifiers lblModifiers: StaticText = StaticText(self, ID_ANY, _("Modifiers")) self._txtModifiers: TextCtrl = TextCtrl(self, ID_ANY, "", size=(125, -1)) # Txt Ctrl Return Type lblReturn: StaticText = StaticText(self, ID_ANY, _("Return type")) self._txtReturn: TextCtrl = TextCtrl(self, ID_ANY, "", size=(125, -1)) methodInfoContainer: FlexGridSizer = FlexGridSizer(cols=3, hgap=6, vgap=6) methodInfoContainer.AddMany([ lblName, lblModifiers, lblReturn, self._txtName, self._txtModifiers, self._txtReturn ]) return methodInfoContainer
def __init__(self, parent, imagePath): Panel.__init__(self, parent) #Cor do Fundo self.BackgroundColour = ((100, 100, 100)) #Tamanhos do BitMap self._bitmap_width = 510 self._bitmap_height = 720 #Grid do BitMap self._hbox = BoxSizer(HORIZONTAL) self._grid_layout = FlexGridSizer(1, 2, 0, 10) #Lê a Imagem self._image = cv2.imread(imagePath) defaultImage = self.GetImageDataInPanelSize(self._bitmap_width, self._bitmap_height, self._image) defaultImage_wx = EmptyImage(self._bitmap_width, self._bitmap_height) defaultImage_wx.SetData( defaultImage.tostring()) # convert from cv.iplimage to wxImage defaultImage_png = defaultImage_wx.ConvertToBitmap() # png = Image(image.GetWidth(), image.GetHeight(), imageData) # png = Image(imagePath, BITMAP_TYPE_ANY).ConvertToBitmap() # test1 = StaticBitmap(self, -1, png, size=(self._bitmap_width,self._bitmap_height)) # test2 = StaticBitmap(self, -1, png, size=(self._bitmap_width,self._bitmap_height)) test1 = StaticBitmap( self, -1, defaultImage_png, (0, 0), (defaultImage_wx.GetWidth(), defaultImage_wx.GetHeight())) test2 = StaticBitmap( self, -1, defaultImage_png, (0, 0), (defaultImage_wx.GetWidth(), defaultImage_wx.GetHeight())) self._grid_layout.AddMany([(test1, 1, EXPAND), (test2, 1, EXPAND)]) self._grid_layout.AddGrowableRow(0, 1) self._hbox.Add(self._grid_layout, proportion=1, flag=ALL | EXPAND, border=0) self.SetSizer(self._hbox)
def layout(self): master_grid = FlexGridSizer(rows=2, cols=1, gap=(0, 0)) grid = GridSizer(rows=2, cols=3, gap=(0, 0)) grid.Add(self.space_lbl, 0, ALIGN_CENTER) grid.Add(self.wrap_lbl, 0, ALIGN_CENTER) grid.Add(self.newline_lbl, 0, ALIGN_CENTER) grid.Add(self.space_display, 0, ALIGN_CENTER) grid.Add(self.wrap_length_display, 0, ALIGN_CENTER) grid.Add(self.newline_display, 0, ALIGN_CENTER) master_grid.Add(grid, 0, ALIGN_CENTER | ALL, 10) master_grid.Add(self.entry, 1, EXPAND) master_grid.AddGrowableRow(1) master_grid.AddGrowableCol(0) self.panel.SetSizer(master_grid) self.panel.Fit() self.Fit() width, height = self.GetSize() height = WINDOW_HEIGHT self.SetSize(-1, -1, width, height)
def __init__(self, theParent, theWindowId, fieldToEdit: PyutField, theMediator=None): super().__init__(theParent, theWindowId, _("Field Edit"), theStyle=RESIZE_BORDER | CAPTION | STAY_ON_TOP, theMediator=theMediator) self._fieldToEdit: PyutField = fieldToEdit # ---------------- # Design of dialog # ---------------- self.SetAutoLayout(True) # RadioBox Visibility self._rdbFieldVisibility: RadioBox = RadioBox(self, ID_ANY, "", Point(35, 30), DefaultSize, ["+", "-", "#"], style=RA_SPECIFY_ROWS) # Txt Ctrl Name lblFieldName = StaticText (self, ID_ANY, _("Name")) self._txtFieldName = TextCtrl(self, ID_TXT_FIELD_NAME, "", size=(125, -1)) self.Bind(EVT_TEXT, self._evtFieldText, id=ID_TXT_FIELD_NAME) # Txt Ctrl Type lblFieldType: StaticText = StaticText (self, ID_ANY, _("Type")) self._txtFieldType: TextCtrl = TextCtrl(self, ID_ANY, "", size=(125, -1)) # Txt Ctrl Default lblFieldDefault: StaticText = StaticText (self, ID_ANY, _("Default Value")) self._txtFieldDefault: TextCtrl = TextCtrl(self, ID_ANY, "", size=(125, -1)) # --------------------- # Buttons OK and Cancel # --------------------- self._btnFieldOk: Button = Button(self, ID_BTN_FIELD_OK, _("&Ok")) self.Bind(EVT_BUTTON, self._onFieldOk, id=ID_BTN_FIELD_OK) self._btnFieldOk.SetDefault() self._btnFieldCancel = Button(self, ID_BTN_FIELD_CANCEL, _("&Cancel")) self.Bind(EVT_BUTTON, self._onFieldCancel, id=ID_BTN_FIELD_CANCEL) szrButtons = BoxSizer (HORIZONTAL) szrButtons.Add(self._btnFieldOk, 0, ALL, 5) szrButtons.Add(self._btnFieldCancel, 0, ALL, 5) szrField1: FlexGridSizer = FlexGridSizer(cols=3, hgap=6, vgap=6) szrField1.AddMany([lblFieldName, lblFieldType, lblFieldDefault, self._txtFieldName, self._txtFieldType, self._txtFieldDefault]) szrField2 = BoxSizer(HORIZONTAL) szrField2.Add(self._rdbFieldVisibility, 0, ALL, 5) szrField2.Add(szrField1, 0, ALIGN_CENTER_VERTICAL | ALL, 5) szrField3 = BoxSizer(VERTICAL) szrField3.Add(szrField2, 0, ALL, 5) szrField3.Add(szrButtons, 0, ALL | ALIGN_RIGHT, 5) self.SetSizer(szrField3) self.SetAutoLayout(True) szrField3.Fit(self) # Fill the text controls with PyutField data self._txtFieldName.SetValue(self._fieldToEdit.getName()) self._txtFieldType.SetValue(str(self._fieldToEdit.getType())) self._txtFieldDefault.SetValue(self._convertNone(self._fieldToEdit.getDefaultValue())) self._rdbFieldVisibility.SetStringSelection(str(self._fieldToEdit.visibility)) # Fix state of buttons (enabled or not) self._fixBtnDlgFields() # Set the focus self._txtFieldName.SetFocus() self.Centre()
def __init__(self, parent, dpi=(1, 1)): Dialog.__init__(self, parent, id=ID_ANY, title=u"编辑/添加Hosts", pos=Point(600, 600), size=Size(394 * dpi[0], 210 * dpi[1]), style=DEFAULT_DIALOG_STYLE | FRAME_FLOAT_ON_PARENT) self.__window = parent self.SetSizeHints(DefaultSize, DefaultSize) font = Font(10, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL, False, EmptyString) inputSize = Size(260 * dpi[0], -1) self.SetFont(font) fgSizer3 = FlexGridSizer(0, 2, 0, 0) fgSizer3.SetFlexibleDirection(BOTH) fgSizer3.SetNonFlexibleGrowMode(FLEX_GROWMODE_SPECIFIED) self.localRadio = RadioButton(self, ID_ANY, u"本地Hosts", DefaultPosition, DefaultSize, 0) self.localRadio.SetFont(font) fgSizer3.Add(self.localRadio, 0, ALL, 5) self.localRadio.Bind(EVT_RADIOBUTTON, self.OnRadioChange) self.onlineRadio = RadioButton(self, ID_ANY, u"在线Hosts", DefaultPosition, DefaultSize, 0) fgSizer3.Add(self.onlineRadio, 0, ALL, 5) self.onlineRadio.Bind(EVT_RADIOBUTTON, self.OnRadioChange) self.m_staticText4 = StaticText(self, ID_ANY, u"名称", DefaultPosition, DefaultSize, 0) self.m_staticText4.Wrap(-1) fgSizer3.Add(self.m_staticText4, 0, ALL, 5) self.nameInput = TextCtrl(self, ID_ANY, EmptyString, DefaultPosition, inputSize, 0) fgSizer3.Add(self.nameInput, 0, ALL, 5) self.m_staticText5 = StaticText(self, ID_ANY, u"地址", DefaultPosition, DefaultSize, 0) self.m_staticText5.Wrap(-1) fgSizer3.Add(self.m_staticText5, 0, ALL, 5) self.urlInput = TextCtrl(self, ID_ANY, u"http://", DefaultPosition, inputSize, 0) fgSizer3.Add(self.urlInput, 0, ALL, 5) self.m_staticText3 = StaticText(self, ID_ANY, u"图标", DefaultPosition, DefaultSize, 0) self.m_staticText3.Wrap(-1) fgSizer3.Add(self.m_staticText3, 0, ALL, 5) self.iconComboBox = ComboBox(self, ID_ANY, u"请选择图标", DefaultPosition, inputSize, list(GetIcons().keys()), 0) self.iconComboBox.SetFont(font) fgSizer3.Add(self.iconComboBox, 0, ALL, 5) self.cancelButton = Button(self, ID_ANY, u"取消", DefaultPosition, DefaultSize, 0) fgSizer3.Add(self.cancelButton, 0, ALL, 5) self.saveButton = Button(self, ID_ANY, u"保存", DefaultPosition, DefaultSize, 0) fgSizer3.Add(self.saveButton, 0, ALL, 5) self.SetSizer(fgSizer3) self.Layout() self.Centre(BOTH) self.cancelButton.Bind(EVT_BUTTON, self.OnButtonClicked) self.saveButton.Bind(EVT_BUTTON, self.OnButtonClicked) self.Bind(EVT_CLOSE, self.OnClose)
def __init__(self, parent, ID, pyutLink: PyutLink): """ """ super().__init__(parent, ID, _("Link Edit"), style=RESIZE_BORDER | CAPTION) self.logger: Logger = getLogger(__name__) # Associated PyutLink self._pyutLink: PyutLink = pyutLink self._relationship = self._pyutLink.getName() self._aRoleInB = "" self._bRoleInA = "" # self._cardinalityA = self._pyutLink.getSourceCardinality() # self._cardinalityB = self._pyutLink.getDestinationCardinality() self._cardinalityA = self._pyutLink.sourceCardinality self._cardinalityB = self._pyutLink.destinationCardinality self._returnAction = CANCEL # #describe how user exited dialog box # labels lblCardA = StaticText(self, -1, _("Cardinality"), style=ALIGN_LEFT) lblRela = StaticText(self, -1, _("Relationship"), style=ALIGN_CENTRE) lblCardB = StaticText(self, -1, _("Cardinality"), style=ALIGN_RIGHT) lblA = StaticText(self, -1, "A", style=ALIGN_LEFT) self._lblArrow = StaticText(self, -1, "", style=ALIGN_CENTRE) self.updateLblArrow() lblB = StaticText(self, -1, "B", style=ALIGN_RIGHT) lblAinB = StaticText(self, -1, _("A's role in B"), style=ALIGN_LEFT) lblBinA = StaticText(self, -1, _("B's role in A"), style=ALIGN_RIGHT) # text self._txtCardinalityA = TextCtrl(self, TXT_CARDINALITY_A, "", size=Size(50, 20)) self._txtRelationship = TextCtrl(self, TXT_RELATIONSHIP, "", size=Size(100, 20)) self._txtCardinalityB = TextCtrl(self, TXT_CARDINALITY_B, "", size=Size(50, 20)) self._txtARoleB = TextCtrl(self, A_ROLE_IN_B, "") self._txtBRoleA = TextCtrl(self, B_ROLE_IN_A, "") self.setValues(self._relationship, self._aRoleInB, self._bRoleInA, self._cardinalityA, self._cardinalityB) self._txtARoleB.Enable(False) self._txtBRoleA.Enable(False) # text events self.Bind(EVT_TEXT, self._onTxtCardinalityAChange, id=TXT_CARDINALITY_A) self.Bind(EVT_TEXT, self._onTxtCardinalityBChange, id=TXT_CARDINALITY_B) self.Bind(EVT_TEXT, self._onTxtRelationshipChange, id=TXT_RELATIONSHIP) self.Bind(EVT_TEXT, self._onTxtARoleBChange, id=A_ROLE_IN_B) self.Bind(EVT_TEXT, self._onTxtBRoleAChange, id=B_ROLE_IN_A) # Ok/Cancel btnOk = Button(self, OK, _("&Ok")) btnCancel = Button(self, CANCEL, _("&Cancel")) btnRemove = Button(self, BTN_REMOVE, _("&Remove")) btnOk.SetDefault() # button events self.Bind(EVT_BUTTON, self._onCmdOk, id=OK) self.Bind(EVT_BUTTON, self._onCmdCancel, id=CANCEL) self.Bind(EVT_BUTTON, self._onRemove, id=BTN_REMOVE) szr1 = FlexGridSizer(cols=3, hgap=30, vgap=5) szr1.AddMany([(lblCardA, 0, ALIGN_LEFT), (lblRela, 0, ALIGN_CENTER_HORIZONTAL), (lblCardB, 0, ALIGN_RIGHT), (self._txtCardinalityA, 0, ALIGN_LEFT), (self._txtRelationship, 0, ALIGN_CENTER_HORIZONTAL), (self._txtCardinalityB, 0, ALIGN_RIGHT)]) szr1.AddGrowableCol(0) szr1.AddGrowableCol(1) szr1.AddGrowableCol(2) szr2 = BoxSizer(HORIZONTAL) szr2.Add(lblA, 1, GROW | RIGHT, 10) szr2.Add(self._lblArrow, 1, GROW, 10) szr2.Add(lblB, 1, GROW) # szr3 : # lblAinB, lblBinA # self._txtARoleB, self._txtBRoleA szr3 = FlexGridSizer(cols=2, hgap=30, vgap=5) szr3.AddMany([(lblAinB, 0), (lblBinA, 0, ALIGN_RIGHT), (self._txtARoleB, 0), (self._txtBRoleA, 0, ALIGN_RIGHT | BOTTOM, 20)]) szr3.AddGrowableCol(0) szr3.AddGrowableCol(1) # szr4 : # btnRemove, btnOk, btnCancel szr4 = BoxSizer(HORIZONTAL) szr4.Add(btnRemove, 0, RIGHT, 10) szr4.Add(btnOk, 0, RIGHT, 10) szr4.Add(btnCancel, 0) # szr5 : # szr1 # szr2 # szr3 # szr4 szr5 = BoxSizer(VERTICAL) szr5.Add(szr1, 0, GROW | ALL, 10) szr5.Add(szr2, 0, GROW | ALL, 10) szr5.Add(szr3, 0, GROW | ALL, 10) szr5.Add(szr4, 0, ALIGN_RIGHT | ALL, 10) self.SetSizer(szr5) self.SetAutoLayout(True) szr5.Fit(self)
class BitmapPanel(Panel): def __init__(self, parent, imagePath): Panel.__init__(self, parent) #Cor do Fundo self.BackgroundColour = ((100, 100, 100)) #Tamanhos do BitMap self._bitmap_width = 510 self._bitmap_height = 720 #Grid do BitMap self._hbox = BoxSizer(HORIZONTAL) self._grid_layout = FlexGridSizer(1, 2, 0, 10) #Lê a Imagem self._image = cv2.imread(imagePath) defaultImage = self.GetImageDataInPanelSize(self._bitmap_width, self._bitmap_height, self._image) defaultImage_wx = EmptyImage(self._bitmap_width, self._bitmap_height) defaultImage_wx.SetData( defaultImage.tostring()) # convert from cv.iplimage to wxImage defaultImage_png = defaultImage_wx.ConvertToBitmap() # png = Image(image.GetWidth(), image.GetHeight(), imageData) # png = Image(imagePath, BITMAP_TYPE_ANY).ConvertToBitmap() # test1 = StaticBitmap(self, -1, png, size=(self._bitmap_width,self._bitmap_height)) # test2 = StaticBitmap(self, -1, png, size=(self._bitmap_width,self._bitmap_height)) test1 = StaticBitmap( self, -1, defaultImage_png, (0, 0), (defaultImage_wx.GetWidth(), defaultImage_wx.GetHeight())) test2 = StaticBitmap( self, -1, defaultImage_png, (0, 0), (defaultImage_wx.GetWidth(), defaultImage_wx.GetHeight())) self._grid_layout.AddMany([(test1, 1, EXPAND), (test2, 1, EXPAND)]) self._grid_layout.AddGrowableRow(0, 1) self._hbox.Add(self._grid_layout, proportion=1, flag=ALL | EXPAND, border=0) self.SetSizer(self._hbox) def GetImageDataInPanelSize(self, f_width, f_height, image): copy = image.copy() h, w, _ = copy.shape #Partindo da premissa que imagens 360 possui largura esparsas aspect = f_width / w print(h * aspect) resize = cv2.resize(copy, (int(w * aspect), int(h * aspect))) h, w, _ = resize.shape h_up = h // 2 h_down = h - h_up result = np.full((f_height, f_width, 3), 0, dtype=np.uint8) result[(f_height // 2) - h_up:(f_height // 2) + h_down, 0:f_width] = resize return cv2.cvtColor(result, cv2.COLOR_BGR2RGB)
class ConfigPage(Panel): """ConfigPage holds the GUI for a single tab pane""" config = None grid_sizer = None main_sizer = None scrolled_panel = None def __init__(self, parent, config): Panel.__init__(self, parent=parent, id=ID_ANY) self.config = config self.header_font = Font(FontInfo(24).Bold()) self.construct_gui() def construct_horizontal_rule(self): """Adds a horizontal rule to the grid""" rule = StaticLine( self.scrolled_panel, style=LI_HORIZONTAL, size=(-1, 2) ) self.grid_sizer.Add( rule, proportion=1, flag=EXPAND | TOP | BOTTOM, border=10 ) def construct_docs_label(self, kind, value): """Constructs a documentation label""" sizer = BoxSizer(HORIZONTAL) label = HidableAutoWrapStaticText( parent=self.scrolled_panel, label=value, kind=kind, ) sizer.Add(label, -1, EXPAND) self.grid_sizer.Add(sizer, -1, EXPAND) def construct_entry_label(self, value): """Creates the primary entry label""" sizer = BoxSizer(HORIZONTAL) label = StaticText( self.scrolled_panel, label=value, style=ALIGN_LEFT ) label.SetFont(self.header_font) sizer.Add(label, -1, EXPAND) self.grid_sizer.Add(sizer, -1, EXPAND) def construct_entry_control(self, entry): """Creates the primary entry control""" if 'boolean' == entry.var_type: control = CheckBox( self.scrolled_panel, name=entry.key_name ) control.SetValue(entry.current) elif 'number' == entry.var_type: control = SpinCtrl( self.scrolled_panel, name=entry.key_name, ) control.SetValue(entry.current) else: control = TextCtrl( self.scrolled_panel, value=str(entry.current), name=entry.key_name, size=(-1, -1) ) self.grid_sizer.Add(control, -1, EXPAND) def construct_entry_row(self, entry, index=0): """Constructs all the necessary rows for a single entry""" if index > 0: self.construct_horizontal_rule() self.construct_entry_label(entry.key_name) if entry.help_value: self.construct_docs_label('help_value', entry.help_value) self.construct_entry_control(entry) if entry.man: self.construct_docs_label('man', entry.man) def construct_gui(self): """Constructs the page GUI""" self.scrolled_panel = ScrolledPanel(self) self.scrolled_panel.SetAutoLayout(1) self.scrolled_panel.SetupScrolling() self.main_sizer = BoxSizer(HORIZONTAL) self.grid_sizer = FlexGridSizer(1, 10, 10) for index, entry in enumerate(self.config): self.construct_entry_row(entry, index) self.grid_sizer.AddGrowableCol(0, 1) scroll_sizer = BoxSizer(HORIZONTAL) scroll_sizer.Add(self.grid_sizer, 1, EXPAND | ALL, 20) self.scrolled_panel.SetSizer(scroll_sizer) self.main_sizer.Add(self.scrolled_panel, 1, EXPAND) self.SetSizer(self.main_sizer)
def __init__(self, parent, windowId, parameterToEdit: PyutParam, mediator=None): """ The Dialog for parameter editing Args: parent: windowId: parameterToEdit: The parameter that is being edited mediator: """ super().__init__(parent, windowId, _("Parameter Edit"), theStyle=RESIZE_BORDER | CAPTION | STAY_ON_TOP, theMediator=mediator) self._parameterToEdit: PyutParam = parameterToEdit # ---------------- # Design of dialog # ---------------- self.SetAutoLayout(True) # Txt Ctrl Name lblName: StaticText = StaticText(self, ID_ANY, _("Name")) self._txtName: TextCtrl = TextCtrl(self, ID_TXT_PARAM_NAME, "", size=(125, -1)) self.Bind(EVT_TEXT, self._evtParamText, id=ID_TXT_PARAM_NAME) # Txt Ctrl Type lblType: StaticText = StaticText(self, ID_ANY, _("Type")) self._txtType: TextCtrl = TextCtrl(self, ID_ANY, "", size=(125, -1)) # Txt Ctrl Default lblDefault: StaticText = StaticText(self, ID_ANY, _("Default Value")) self._txtDefault: TextCtrl = TextCtrl(self, ID_ANY, "", size=(125, -1)) # --------------------- # Buttons OK and cancel self._btnOk: Button = Button(self, ID_BTN_PARAM_OK, _("&Ok")) self.Bind(EVT_BUTTON, self._onParamOk, id=ID_BTN_PARAM_OK) self._btnOk.SetDefault() self._btnCancel: Button = Button(self, ID_BTN_PARAM_CANCEL, _("&Cancel")) self.Bind(EVT_BUTTON, self._onParamCancel, id=ID_BTN_PARAM_CANCEL) szrButtons: BoxSizer = BoxSizer(HORIZONTAL) szrButtons.Add(self._btnOk, 0, ALL, 5) szrButtons.Add(self._btnCancel, 0, ALL, 5) szr1: FlexGridSizer = FlexGridSizer(cols=3, hgap=6, vgap=6) szr1.AddMany([ lblName, lblType, lblDefault, self._txtName, self._txtType, self._txtDefault ]) szr2: BoxSizer = BoxSizer(VERTICAL) szr2.Add(szr1, 0, ALL | ALIGN_CENTER_HORIZONTAL, 5) szr2.Add(szrButtons, 0, ALL | ALIGN_RIGHT, 5) self.SetSizer(szr2) self.SetAutoLayout(True) szr2.Fit(self) # Fill the text controls with PyutParam data self._txtName.SetValue(self._parameterToEdit.getName()) paramType: PyutType = self._parameterToEdit.getType() self._txtType.SetValue(paramType.value) self._txtDefault.SetValue( self._convertNone(self._parameterToEdit.getDefaultValue())) # Fix state of buttons (enabled or not) self._fixBtnDlgParams() # Set the focus self._txtName.SetFocus() self.Centre()