def OnSaveProfile(self, e): dlg=wx.FileDialog(self, language.getText("Select profile file to save"), os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE) dlg.SetWildcard("ini files (*.ini)|*.ini") if dlg.ShowModal() == wx.ID_OK: profileFile = dlg.GetPath() profile.saveProfile(profileFile) dlg.Destroy()
def OnSaveProfile(self, e): dlg=wx.FileDialog(self, "Select profile file to save", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE) dlg.SetWildcard("ini files (*.ini)|*.ini") if dlg.ShowModal() == wx.ID_OK: profileFile = dlg.GetPath() profile.saveProfile(profileFile) dlg.Destroy()
def OnClose(self, e): profile.saveProfile(profile.getDefaultProfilePath(), True) # Save the window position, size & state from the preferences file # 从参数选择文件中,保存窗口的位置,大小,状态 profile.putPreference('window_maximized', self.IsMaximized()) if not self.IsMaximized() and not self.IsIconized(): (posx, posy) = self.GetPosition() profile.putPreference('window_pos_x', posx) profile.putPreference('window_pos_y', posy) (width, height) = self.GetSize() profile.putPreference('window_width', width) profile.putPreference('window_height', height) # Save normal sash position. If in normal mode (!simple mode), get last position of sash before saving it... isSimple = profile.getPreference('startMode') == 'Simple' if not isSimple: self.normalSashPos = self.splitter.GetSashPosition() profile.putPreference('window_normal_sash', self.normalSashPos) #HACK: Set the paint function of the glCanvas to nothing so it won't keep refreshing. Which can keep wxWidgets from quiting. print "Closing down" self.scene.OnPaint = lambda e : e self.scene._engine.cleanup() self.Destroy()
def OnSaveProfile(self, e): dlg=wx.FileDialog(self, _("Select profile file to save"), os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE) dlg.SetWildcard("ini files (*.ini)|*.ini") if dlg.ShowModal() == wx.ID_OK: profile_filename = dlg.GetPath() if not profile_filename.lower().endswith('.ini'): #hack for linux, as for some reason the .ini is not appended. profile_filename += '.ini' profile.saveProfile(profile_filename) dlg.Destroy()
def __init__(self, parent, callback = None): super(normalSettingsPanel, self).__init__(parent, callback) self.parent = parent self.loadxml() self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Filament :")) self.label_4 = wx.StaticText(self, wx.ID_ANY, _("Température (°C) :".decode('utf-8'))) self.spin_ctrl_1 = wx.SpinCtrl(self, wx.ID_ANY, "190", min=175, max=235, style=wx.SP_ARROW_KEYS | wx.TE_AUTO_URL) self.button_1 = wx.Button(self, wx.ID_ANY, _('Préparer l\'Impression'.decode('utf-8'))) self.__set_properties() self.__do_layout() #Refresh ALL Value self.Refresh_Preci() self.Refresh_Fila() self.Refresh_Rempli() self.Refresh_Checkboxsupp() self.Refresh_Checkboxbrim() profile.saveProfile(profile.getDefaultProfilePath(), True) # Main tabs # self.nb = wx.Notebook(self) # self.SetSizer(wx.BoxSizer(wx.HORIZONTAL)) # self.GetSizer().Add(self.nb, 1, wx.EXPAND) # (left, right, self.printPanel) = self.CreateDynamicConfigTab(self.nb, 'Basic') # self._addSettingsToPanels('basic', left, right) # self.SizeLabelWidths(left, right) # (left, right, self.advancedPanel) = self.CreateDynamicConfigTab(self.nb, 'Advanced') # self._addSettingsToPanels('advanced', left, right) # self.SizeLabelWidths(left, right) # #Plugin page # self.pluginPanel = pluginPanel.pluginPanel(self.nb, callback) # self.nb.AddPage(self.pluginPanel, _("Plugins")) # self.nb.Hide() #Alteration page # if profile.getMachineSetting('machine_name') == 'Discovery': # self.alterationPanel = alterationPanel.alterationPanel(self, callback) # if profile.getMachineSetting('gcode_flavor') == 'UltiGCode': # self.alterationPanel = None # else: # self.alterationPanel = alterationPanel.alterationPanel(self.nb, callback) # self.nb.AddPage(self.alterationPanel, "Start/End-GCode") #Evt Select Filament if sys.platform == 'darwin': self.Bind(wx.EVT_CHOICE, self.EVT_Fila, self.combo_box_1) else: self.Bind(wx.EVT_COMBOBOX, self.EVT_Fila, self.combo_box_1) self.Bind(wx.EVT_TEXT, self.EVT_Fila, self.combo_box_1) self.Bind(wx.EVT_TEXT_ENTER, self.EVT_Fila, self.combo_box_1) #Evt Select Précision self.Bind(wx.EVT_RADIOBOX, self.EVT_Preci, self.radio_box_1) #Evt Select Remplissage self.Bind(wx.EVT_RADIOBOX, self.EVT_Rempl, self.radio_box_2) #Evt CheckboxSupport self.Bind(wx.EVT_CHECKBOX, self.EVT_Checkboxsupp,self.printsupp) #Evt CheckboxBrim self.Bind(wx.EVT_CHECKBOX, self.EVT_Checkboxbrim,self.printbrim) #Evt Print Button self.Bind(wx.EVT_BUTTON, self.Click_Button, self.button_1) self.Bind(wx.EVT_SIZE, self.OnSize)
def Click_Button(self, event): profile.putProfileSetting('print_temperature', str(self.spin_ctrl_1.GetValue() + self.temp_preci)) self.Print_All() profile.saveProfile(profile.getDefaultProfilePath(), True) self.GetParent().GetParent().GetParent().scene.OnPrintButton(1) event.Skip()
def EVT_Fila(self, event): self.Refresh_Fila() profile.saveProfile(profile.getDefaultProfilePath(), True) self.GetParent().GetParent().GetParent().scene.updateProfileToControls() self.GetParent().GetParent().GetParent().scene.sceneUpdated() event.Skip()