def InitUI(self): self.controller.DisableWidgets() self.panel = wx.Panel(self) self.defaultColor = self.panel.GetBackgroundColour() self.stepButton = wx.Button(self.panel, label="Step") self.inputTextBoxes = [] self.inputSizer = wx.GridBagSizer() self.btnSizer = wx.GridBagSizer() self.index = 0 self.resultLabel = wx.StaticText(self.panel) self.font = wx.Font(18, wx.DECORATIVE, wx.NORMAL, wx.BOLD) self.windowSizer = wx.BoxSizer() self.windowSizer.Add(self.panel, 1, wx.ALL | wx.EXPAND) self.sizer = wx.GridBagSizer(5, 5) i = 0 for c in self.input: newTextBox = wx.StaticText(self.panel) newTextBox.SetLabel(c) newTextBox.SetFont(self.font) newTextBox.SetForegroundColour('Black') self.inputTextBoxes.append(newTextBox) self.inputSizer.Add(newTextBox, (0, i)) i += 1 self.sizer.Add(self.inputSizer, (0, 0)) self.btnSizer.Add(self.stepButton, (0, 0)) self.sizer.Add(self.resultLabel, (1, 0)) self.sizer.Add(self.btnSizer, (2, 0)) self.border = wx.BoxSizer() self.border.Add(self.sizer, 1, wx.ALL | wx.EXPAND, 5) self.panel.SetSizerAndFit(self.border) self.SetSizerAndFit(self.windowSizer)
def initUI(self): self.controller.Disable() self.panel = wx.Panel(self) self.runButton = wx.Button(self.panel, label="Run") self.runLabel = wx.StaticText(self.panel, label="Input:") self.resultLabel = wx.StaticText(self.panel) self.simulationButton = wx.Button(self.panel, label="Step by step simulation") self.input = wx.TextCtrl(self.panel, size=(140, -1)) self.windowSizer = wx.BoxSizer() self.windowSizer.Add(self.panel, 1, wx.ALL | wx.EXPAND) self.sizer = wx.GridBagSizer(5, 5) self.sizer.Add(self.runLabel, (0, 0)) self.sizer.Add(self.input, (0, 1)) self.sizer.Add(self.resultLabel, (1, 0)) self.sizer.Add(self.runButton, (2, 0)) self.sizer.Add(self.simulationButton, (2, 1)) self.border = wx.BoxSizer() self.border.Add(self.sizer, 1, wx.ALL | wx.EXPAND, 5) self.panel.SetSizerAndFit(self.border) self.SetSizerAndFit(self.windowSizer) if not self.graph.HasStartState(): self.runButton.Disable() self.input.Disable() self.simulationButton.Disable() self.resultLabel.SetLabel('No Start State') else: self.runButton.Disable() self.simulationButton.Disable() self.resultLabel.SetLabel('No input')
def newPredecessorPickerHorizontalSizer(self, ): predecessor_picker_horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL) self.addToSizerWithSpace( predecessor_picker_horizontal_sizer, self.newPredeccesorLabel(self.getEntityType())) predecessor_picker_horizontal_sizer.Add(self.newPredecessorSelector()) return predecessor_picker_horizontal_sizer
def newDescriptionAreaVerticalSizer(self): descriptionAreaVerticalSizer = wx.BoxSizer(wx.VERTICAL) descriptionAreaVerticalSizer.Add( self.newDescriptionFieldLabel(self.getEntityType()), 0, wx.CENTER) descriptionAreaVerticalSizer.Add(self.newDescriptionArea(), 0, wx.CENTER) return descriptionAreaVerticalSizer
def newButtonsPanelHorizontalSizer(self, onSubmit): buttons_panel_horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL) buttons_panel_horizontal_sizer.Add( self.newCreateEntityButton(onSubmit)) buttons_panel_horizontal_sizer.Add( self.newCancelButton(self.moveToMainPanel)) return buttons_panel_horizontal_sizer
def newLogAreaVerticalSizer(self): log_area_vertical_sizer = wx.BoxSizer(wx.VERTICAL) log_area_vertical_sizer.Add(self.newLogAreaLabel(), 0, wx.CENTER) self.addToSizerWithSpace(log_area_vertical_sizer, self.newLogArea(), space=50) return log_area_vertical_sizer
def newEntityIconHorizontalSizer(self): entityIconHorizontalSizer = wx.BoxSizer(wx.HORIZONTAL) self.addToSizerWithSpace(entityIconHorizontalSizer, self.newImageInfoLabel()) self.addToSizerWithSpace(entityIconHorizontalSizer, self.newEntityBmp()) entityIconHorizontalSizer.Add(self.newImageSelectorButton()) return entityIconHorizontalSizer
def newEntityNameHorizontalSizer(self, defaultName=None): entityNameHorizontalSizer = wx.BoxSizer(wx.HORIZONTAL) self.addToSizerWithSpace(entityNameHorizontalSizer, self.newNameFieldLabel(self.getEntityType())) entityNameHorizontalSizer.Add( self.newNameInput(defaultName if defaultName is not None else self. getEntityType())) return entityNameHorizontalSizer
def newBasicCharacteristicsVerticalSizer(self): basicCharacteristicsVerticalSizer = wx.BoxSizer(wx.VERTICAL) self.addToSizerWithSpace(basicCharacteristicsVerticalSizer, self.newDescriptionAreaVerticalSizer()) self.addToSizerWithSpace(basicCharacteristicsVerticalSizer, self.newPredecessorPickerHorizontalSizer(), space=5) self.addToSizerWithSpace(basicCharacteristicsVerticalSizer, self.newSuccesorPickerHorizontalSizer()) self.addToSizerWithSpace(basicCharacteristicsVerticalSizer, self.newEntityIconHorizontalSizer()) return basicCharacteristicsVerticalSizer
def newMainSheetPartHorizontalSizer(self, entityCharacteristicsVerticalSizer): mainSheetPartHorizontalSizer = wx.BoxSizer(wx.HORIZONTAL) self.addToSizerWithSpace(mainSheetPartHorizontalSizer, entityCharacteristicsVerticalSizer, space=50, alignment=wx.LEFT) self.addToSizerWithSpace(mainSheetPartHorizontalSizer, self.newLine(wx.VERTICAL), space=50, alignment=wx.EXPAND) mainSheetPartHorizontalSizer.Add(self.newLogAreaVerticalSizer(), 0, wx.RIGHT) return mainSheetPartHorizontalSizer
def newRootSizer(self, characteristicVerticalSizer, topPadding): rootSizer = wx.BoxSizer(wx.VERTICAL) rootSizer.AddSpacer(topPadding) self.addToSizerWithSpace( rootSizer, self.newEntityNameHorizontalSizer(self.getEntityType())) self.addToSizerWithSpace(rootSizer, self.newLine(), space=10, alignment=wx.EXPAND) self.addToSizerWithSpace( rootSizer, self.newMainSheetPartHorizontalSizer(characteristicVerticalSizer)) self.addToSizerWithSpace(rootSizer, self.newLine(), space=10, alignment=wx.EXPAND) self.addToSizerWithSpace(rootSizer, self.newButtonsPanelHorizontalSizer( self.submit), space=75) return rootSizer