def __init__(self, program): HDialog.__init__(self, "Program") self.program = program self.ignore_event_functions = True sizerMain = wx.BoxSizer(wx.VERTICAL) # add the controls in one column self.machines = program.GetMachines() choices = [] for machine in self.machines: choices.append(machine.description) self.cmbMachine = wx.ComboBox(self, choices=choices) self.AddLabelAndControl(sizerMain, "machine", self.cmbMachine) self.chkOutputSame = wx.CheckBox( self, label="output file name follows data file name") sizerMain.Add(self.chkOutputSame, 0, wx.ALL, self.control_border) self.txtOutputFile = wx.TextCtrl(self) self.lblOutputFile, self.btnOutputFile = self.AddFileNameControl( sizerMain, "output file", self.txtOutputFile) self.cmbUnits = wx.ComboBox(self, choices=["mm", "inch"]) self.AddLabelAndControl(sizerMain, "units", self.cmbUnits) # to do "Raw Material" and "Brinell Hardness of raw material" # add OK and Cancel sizerOKCancel = self.MakeOkAndCancel(wx.HORIZONTAL) sizerMain.Add(sizerOKCancel, 0, wx.ALL + wx.ALIGN_RIGHT + wx.ALIGN_BOTTOM, self.control_border) self.SetFromData() self.EnableControls() self.SetSizer(sizerMain) sizerMain.SetSizeHints(self) sizerMain.Fit(self) self.cmbMachine.SetFocus() self.ignore_event_functions = False self.Bind(wx.EVT_CHECKBOX, self.OnCheckOutputSame, self.chkOutputSame)
def __init__(self, program): HDialog.__init__(self, "Program") self.program = program self.ignore_event_functions = True sizerMain = wx.BoxSizer(wx.VERTICAL) # add the controls in one column self.machines = program.GetMachines() choices = [] for machine in self.machines: choices.append(machine.description) self.cmbMachine = wx.ComboBox(self, choices = choices) self.AddLabelAndControl(sizerMain, "machine", self.cmbMachine) self.chkOutputSame = wx.CheckBox( self, label = "output file name follows data file name" ) sizerMain.Add( self.chkOutputSame, 0, wx.ALL, self.control_border ) self.txtOutputFile = wx.TextCtrl(self) self.lblOutputFile, self.btnOutputFile = self.AddFileNameControl(sizerMain, "output file", self.txtOutputFile) self.cmbUnits = wx.ComboBox(self, choices = ["mm", "inch"]) self.AddLabelAndControl(sizerMain, "units", self.cmbUnits) # to do "Raw Material" and "Brinell Hardness of raw material" # add OK and Cancel sizerOKCancel = self.MakeOkAndCancel(wx.HORIZONTAL) sizerMain.Add( sizerOKCancel, 0, wx.ALL + wx.ALIGN_RIGHT + wx.ALIGN_BOTTOM, self.control_border ) self.SetFromData() self.EnableControls() self.SetSizer( sizerMain ) sizerMain.SetSizeHints(self) sizerMain.Fit(self) self.cmbMachine.SetFocus() self.ignore_event_functions = False self.Bind(wx.EVT_CHECKBOX, self.OnCheckOutputSame, self.chkOutputSame)
def __init__(self, pocket): HDialog.__init__(self, "Pocket Operation") self.pocket = pocket self.general_bitmap = None self.step_over_bitmap = None self.material_allowance_bitmap = None self.starting_center_bitmap = None self.starting_boundary_bitmap = None self.tool_down_bitmap = None self.not_tool_down_bitmap = None self.use_zig_zag_bitmap = None self.zig_angle_bitmap = None self.clearance_height_bitmap = None self.rapid_down_to_bitmap = None self.start_depth_bitmap = None self.final_depth_bitmap = None self.step_down_bitmap = None self.entry_move_bitmap = None self.ignore_event_functions = True sizerMain = wx.BoxSizer(wx.HORIZONTAL) #add left sizer sizerLeft = wx.BoxSizer(wx.VERTICAL) sizerMain.Add( sizerLeft, 0, wx.ALL, self.control_border ) # add right sizer sizerRight = wx.BoxSizer(wx.VERTICAL) sizerMain.Add( sizerRight, 0, wx.ALL, self.control_border ) # add picture to right side self.picture = PictureWindow(self, wx.Size(300, 200)) pictureSizer = wx.BoxSizer(wx.VERTICAL) pictureSizer.Add(self.picture, 1, wx.GROW) sizerRight.Add( pictureSizer, 0, wx.ALL, self.control_border ) # add some of the controls to the right side self.cmbAbsMode = wx.ComboBox(self, ID_ABS_MODE, choices = ["absolute", "incremental"]) self.AddLabelAndControl(sizerRight, "absolute mode", self.cmbAbsMode) self.lgthHFeed = LengthCtrl(self, ID_HFEED) self.AddLabelAndControl(sizerRight, "horizontal feedrate", self.lgthHFeed) self.lgthVFeed = LengthCtrl(self, ID_VFEED) self.AddLabelAndControl(sizerRight, "vertical feedrate", self.lgthVFeed) self.dblSpindleSpeed = DoubleCtrl(self, ID_SPINDLE_SPEED) self.AddLabelAndControl(sizerRight, "spindle speed", self.dblSpindleSpeed) self.txtComment = wx.TextCtrl(self, ID_COMMENT) self.AddLabelAndControl(sizerRight, "comment", self.txtComment) self.chkActive = wx.CheckBox( self, ID_ACTIVE, "active" ) sizerRight.Add( self.chkActive, 0, wx.ALL, self.control_border ) self.txtTitle = wx.TextCtrl(self, ID_TITLE) self.AddLabelAndControl(sizerRight, "title", self.txtTitle) # add OK and Cancel to right side sizerOKCancel = self.MakeOkAndCancel(wx.HORIZONTAL) sizerRight.Add( sizerOKCancel, 0, wx.ALL + wx.ALIGN_RIGHT + wx.ALIGN_BOTTOM, self.control_border ) # add all the controls to the left side self.idsSketches = GeomCtrl(self, ID_SKETCHES) self.AddLabelAndControl(sizerLeft, "sketches", self.idsSketches) btn_pick_sketches = wx.Button(self, ID_PICK_SKETCHES) self.AddLabelAndControl(sizerLeft, "pick sketches", btn_pick_sketches) self.lgthStepOver = LengthCtrl(self, ID_STEP_OVER) self.AddLabelAndControl(sizerLeft, "step over", self.lgthStepOver) self.lgthMaterialAllowance = LengthCtrl(self, ID_MATERIAL_ALLOWANCE) self.AddLabelAndControl(sizerLeft, "material allowance", self.lgthMaterialAllowance) self.cmbStartingPlace = wx.ComboBox(self, ID_STARTING_PLACE, choices = ["boundary", "center"]) self.AddLabelAndControl(sizerLeft, "starting place", self.cmbStartingPlace) self.cmbEntryMove = wx.ComboBox(self, ID_DESCENT_STRATGEY, choices = ["Plunge", "Ramp", "Helical"]) self.AddLabelAndControl(sizerLeft, "entry move", self.cmbEntryMove) self.tools_for_combo = HeeksCNC.program.tools.FindAllTools() tool_choices = [] for tool in self.tools_for_combo: tool_choices.append(tool[1]) self.cmbTool = wx.ComboBox(self, ID_TOOL, choices = tool_choices) self.AddLabelAndControl(sizerLeft, "Tool", self.cmbTool) self.chkUseZigZag = wx.CheckBox( self, ID_USE_ZIG_ZAG, "use zig zag" ) sizerLeft.Add( self.chkUseZigZag, 0, wx.ALL, self.control_border ) self.chkKeepToolDown = wx.CheckBox( self, ID_KEEP_TOOL_DOWN, "keep tool down" ) sizerLeft.Add( self.chkKeepToolDown, 0, wx.ALL, self.control_border ) self.dblZigAngle = DoubleCtrl(self, ID_ZIG_ANGLE) self.AddLabelAndControl(sizerLeft, "zig zag angle", self.dblZigAngle) self.lgthClearanceHeight = LengthCtrl(self, ID_CLEARANCE_HEIGHT) self.AddLabelAndControl(sizerLeft, "clearance height", self.lgthClearanceHeight) self.lgthRapidDownToHeight = LengthCtrl(self, ID_RAPID_SAFETY_SPACE) self.AddLabelAndControl(sizerLeft, "rapid safety space", self.lgthRapidDownToHeight) self.lgthStartDepth = LengthCtrl(self, ID_START_DEPTH) self.AddLabelAndControl(sizerLeft, "start depth", self.lgthStartDepth) self.lgthFinalDepth = LengthCtrl(self, ID_FINAL_DEPTH) self.AddLabelAndControl(sizerLeft, "final depth", self.lgthFinalDepth) self.lgthStepDown = LengthCtrl(self, ID_STEP_DOWN) self.AddLabelAndControl(sizerLeft, "step down", self.lgthStepDown) self.SetFromData() self.SetSizer( sizerMain ) sizerMain.SetSizeHints(self) sizerMain.Fit(self) self.idsSketches.SetFocus() self.ignore_event_functions = False self.SetPicture() self.Bind(wx.EVT_CHILD_FOCUS, self.OnChildFocus) self.Bind(wx.EVT_COMBOBOX, self.OnComboStartingPlace, self.cmbStartingPlace) self.Bind(wx.EVT_CHECKBOX, self.OnCheckKeepToolDown, self.chkKeepToolDown) self.Bind(wx.EVT_CHECKBOX, self.OnCheckUseZigZag, self.chkUseZigZag) self.Bind(wx.EVT_COMBOBOX, self.OnComboTool, self.cmbTool) self.Bind(wx.EVT_BUTTON, self.OnPickSketches, btn_pick_sketches)
def __init__(self, pocket): HDialog.__init__(self, "Pocket Operation") self.pocket = pocket self.general_bitmap = None self.step_over_bitmap = None self.material_allowance_bitmap = None self.starting_center_bitmap = None self.starting_boundary_bitmap = None self.tool_down_bitmap = None self.not_tool_down_bitmap = None self.use_zig_zag_bitmap = None self.zig_angle_bitmap = None self.clearance_height_bitmap = None self.rapid_down_to_bitmap = None self.start_depth_bitmap = None self.final_depth_bitmap = None self.step_down_bitmap = None self.entry_move_bitmap = None self.ignore_event_functions = True sizerMain = wx.BoxSizer(wx.HORIZONTAL) #add left sizer sizerLeft = wx.BoxSizer(wx.VERTICAL) sizerMain.Add(sizerLeft, 0, wx.ALL, self.control_border) # add right sizer sizerRight = wx.BoxSizer(wx.VERTICAL) sizerMain.Add(sizerRight, 0, wx.ALL, self.control_border) # add picture to right side self.picture = PictureWindow(self, wx.Size(300, 200)) pictureSizer = wx.BoxSizer(wx.VERTICAL) pictureSizer.Add(self.picture, 1, wx.GROW) sizerRight.Add(pictureSizer, 0, wx.ALL, self.control_border) # add some of the controls to the right side self.cmbAbsMode = wx.ComboBox(self, ID_ABS_MODE, choices=["absolute", "incremental"]) self.AddLabelAndControl(sizerRight, "absolute mode", self.cmbAbsMode) self.lgthHFeed = LengthCtrl(self, ID_HFEED) self.AddLabelAndControl(sizerRight, "horizontal feedrate", self.lgthHFeed) self.lgthVFeed = LengthCtrl(self, ID_VFEED) self.AddLabelAndControl(sizerRight, "vertical feedrate", self.lgthVFeed) self.dblSpindleSpeed = DoubleCtrl(self, ID_SPINDLE_SPEED) self.AddLabelAndControl(sizerRight, "spindle speed", self.dblSpindleSpeed) self.txtComment = wx.TextCtrl(self, ID_COMMENT) self.AddLabelAndControl(sizerRight, "comment", self.txtComment) self.chkActive = wx.CheckBox(self, ID_ACTIVE, "active") sizerRight.Add(self.chkActive, 0, wx.ALL, self.control_border) self.txtTitle = wx.TextCtrl(self, ID_TITLE) self.AddLabelAndControl(sizerRight, "title", self.txtTitle) # add OK and Cancel to right side sizerOKCancel = self.MakeOkAndCancel(wx.HORIZONTAL) sizerRight.Add(sizerOKCancel, 0, wx.ALL + wx.ALIGN_RIGHT + wx.ALIGN_BOTTOM, self.control_border) # add all the controls to the left side self.idsSketches = GeomCtrl(self, ID_SKETCHES) self.AddLabelAndControl(sizerLeft, "sketches", self.idsSketches) btn_pick_sketches = wx.Button(self, ID_PICK_SKETCHES) self.AddLabelAndControl(sizerLeft, "pick sketches", btn_pick_sketches) self.lgthStepOver = LengthCtrl(self, ID_STEP_OVER) self.AddLabelAndControl(sizerLeft, "step over", self.lgthStepOver) self.lgthMaterialAllowance = LengthCtrl(self, ID_MATERIAL_ALLOWANCE) self.AddLabelAndControl(sizerLeft, "material allowance", self.lgthMaterialAllowance) self.cmbStartingPlace = wx.ComboBox(self, ID_STARTING_PLACE, choices=["boundary", "center"]) self.AddLabelAndControl(sizerLeft, "starting place", self.cmbStartingPlace) self.cmbEntryMove = wx.ComboBox(self, ID_DESCENT_STRATGEY, choices=["Plunge", "Ramp", "Helical"]) self.AddLabelAndControl(sizerLeft, "entry move", self.cmbEntryMove) self.tools_for_combo = HeeksCNC.program.tools.FindAllTools() tool_choices = [] for tool in self.tools_for_combo: tool_choices.append(tool[1]) self.cmbTool = wx.ComboBox(self, ID_TOOL, choices=tool_choices) self.AddLabelAndControl(sizerLeft, "Tool", self.cmbTool) self.chkUseZigZag = wx.CheckBox(self, ID_USE_ZIG_ZAG, "use zig zag") sizerLeft.Add(self.chkUseZigZag, 0, wx.ALL, self.control_border) self.chkKeepToolDown = wx.CheckBox(self, ID_KEEP_TOOL_DOWN, "keep tool down") sizerLeft.Add(self.chkKeepToolDown, 0, wx.ALL, self.control_border) self.dblZigAngle = DoubleCtrl(self, ID_ZIG_ANGLE) self.AddLabelAndControl(sizerLeft, "zig zag angle", self.dblZigAngle) self.lgthClearanceHeight = LengthCtrl(self, ID_CLEARANCE_HEIGHT) self.AddLabelAndControl(sizerLeft, "clearance height", self.lgthClearanceHeight) self.lgthRapidDownToHeight = LengthCtrl(self, ID_RAPID_SAFETY_SPACE) self.AddLabelAndControl(sizerLeft, "rapid safety space", self.lgthRapidDownToHeight) self.lgthStartDepth = LengthCtrl(self, ID_START_DEPTH) self.AddLabelAndControl(sizerLeft, "start depth", self.lgthStartDepth) self.lgthFinalDepth = LengthCtrl(self, ID_FINAL_DEPTH) self.AddLabelAndControl(sizerLeft, "final depth", self.lgthFinalDepth) self.lgthStepDown = LengthCtrl(self, ID_STEP_DOWN) self.AddLabelAndControl(sizerLeft, "step down", self.lgthStepDown) self.SetFromData() self.SetSizer(sizerMain) sizerMain.SetSizeHints(self) sizerMain.Fit(self) self.idsSketches.SetFocus() self.ignore_event_functions = False self.SetPicture() self.Bind(wx.EVT_CHILD_FOCUS, self.OnChildFocus) self.Bind(wx.EVT_COMBOBOX, self.OnComboStartingPlace, self.cmbStartingPlace) self.Bind(wx.EVT_CHECKBOX, self.OnCheckKeepToolDown, self.chkKeepToolDown) self.Bind(wx.EVT_CHECKBOX, self.OnCheckUseZigZag, self.chkUseZigZag) self.Bind(wx.EVT_COMBOBOX, self.OnComboTool, self.cmbTool) self.Bind(wx.EVT_BUTTON, self.OnPickSketches, btn_pick_sketches)