def __init__(self): self._print_profiles = [] self._material_profiles = [] self._material_in_print_profile = False for filename in resources.getSimpleModeProfiles(profile.getMachineSetting('machine_type')): pi = ProfileInfo(filename) self._print_profiles.append(pi) if pi.material is not None: self._material_in_print_profile = True if not self._material_in_print_profile and profile.getMachineSetting('gcode_flavor') != 'UltiGCode': for filename in resources.getSimpleModeMaterials(): pi = ProfileInfo(filename) self._material_profiles.append(pi) self._print_profiles.sort(cmp=lambda a, b: a.order - b.order) self._material_profiles.sort(cmp=lambda a, b: a.order - b.order)
def __init__(self, parent, callback): super(simpleModePanel, self).__init__(parent) self._callback = callback self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) ) self._nozzle_size_options = [0.25, 0.4, 0.5, 0.6, 0.8] self._print_profile_options = [] self._print_material_options = [] printTypePanel = wx.Panel(self) for filename in resources.getSimpleModeProfiles(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton(printTypePanel, -1, name, wx.DefaultPosition, wx.Size( -1,25 ), style=wx.RB_GROUP if len(self._print_profile_options) == 0 else 0) button.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) button.base_filename = base_filename button.filename = filename self._print_profile_options.append(button) if profile.getPreference('simpleModeProfile') == base_filename: button.SetValue(True) printMaterialPanel = wx.Panel(self) for filename in resources.getSimpleModeMaterials(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton(printMaterialPanel, -1, name, wx.DefaultPosition, wx.Size( -1,25 ), style=wx.RB_GROUP if len(self._print_material_options) == 0 else 0) button.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) button.base_filename = base_filename button.filename = filename self._print_material_options.append(button) if profile.getPreference('simpleModeMaterial') == base_filename: button.SetValue(True) if profile.getMachineSetting('gcode_flavor') == 'UltiGCode': printMaterialPanel.Show(False) self.nozzle_size_panel = wx.Panel(self) self.nozzle_size_label = wx.StaticText(self.nozzle_size_panel, -1, _("Diameter (mm):")) self.nozzle_size_label.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) choices = [] for i in self._nozzle_size_options: choices.append(_(str(i))) self.nozzle_size_combo = wx.ComboBox(self.nozzle_size_panel, -1, '', choices=choices, style=wx.CB_DROPDOWN|wx.CB_READONLY) self.nozzle_size_combo.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) index = 1 # fallback index try: nozzle = profile.getPreferenceFloat("active_nozzle") if nozzle is None or nozzle <= 0: nozzle = 0.4 index = self._nozzle_size_options.index(nozzle) except: pass self.nozzle_size_combo.SetSelection(index) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.nozzle_size_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP, 10) sizer.Add(self.nozzle_size_combo, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.EXPAND, 10) self.nozzle_size_panel.SetSizer(sizer) # self.printSupport = wx.CheckBox(self, -1, _("Print support structure")) # self.printSupport.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) self.platform_adhesion_panel = wx.Panel(self) self.platform_adhesion_label = wx.StaticText(self.platform_adhesion_panel, -1, _("Platform adhesion: ")) self.platform_adhesion_label.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) self.platform_adhesion_combo = wx.ComboBox(self.platform_adhesion_panel, -1, '', choices=[_("None"), _("Brim"), _("Raft")], style=wx.CB_DROPDOWN|wx.CB_READONLY) self.platform_adhesion_combo.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) self.platform_adhesion_combo.SetSelection(int(profile.getPreference('simpleModePlatformAdhesion'))) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.platform_adhesion_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP, 10) sizer.Add(self.platform_adhesion_combo, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.EXPAND, 10) self.platform_adhesion_panel.SetSizer(sizer) self.platform_support_panel = wx.Panel(self) self.platform_support_label = wx.StaticText(self.platform_support_panel, -1, _("Support Type:")) self.platform_support_label.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) self.platform_support_combo = wx.ComboBox(self.platform_support_panel, -1, '', choices=[_("None"), _("Touching buildplate"), _("Everywhere")], style=wx.CB_DROPDOWN|wx.CB_READONLY) self.platform_support_combo.SetFont( wx.Font( 12, 74, 90, 90, False, "Sans" ) ) self.platform_support_combo.SetSelection(int(profile.getPreference('simpleModeSupportType'))) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.platform_support_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP, 10) sizer.Add(self.platform_support_combo, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.EXPAND, 10) self.platform_support_panel.SetSizer(sizer) sizer = wx.GridBagSizer() self.SetSizer(sizer) sizer.Add((15, 15), (0, 0)) sb = wx.StaticBox(self, label=_("Nozzle:")) sb.SetFont( wx.Font( 12, 74, 90, 92, False, "Sans" ) ) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.nozzle_size_panel) sizer.Add(boxsizer, (1,0), flag=wx.EXPAND) sizer.Add((20, 20), (2, 0)) sb = wx.StaticBox(printTypePanel, label=_("Print Quality:")) sb.SetFont( wx.Font( 12, 74, 90, 92, False, "Sans" ) ) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_profile_options: boxsizer.Add(button) printTypePanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printTypePanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printTypePanel, (3,0), flag=wx.EXPAND) sizer.Add((20, 20), (4, 0)) sb = wx.StaticBox(printMaterialPanel, label=_("Material:")) sb.SetFont( wx.Font( 12, 74, 90, 92, False, "Sans" ) ) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_material_options: boxsizer.Add(button) printMaterialPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printMaterialPanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printMaterialPanel, (5,0), flag=wx.EXPAND) sizer.Add((20, 20), (6, 0)) sb = wx.StaticBox(self, label=_("Other:")) sb.SetFont( wx.Font( 12, 74, 90, 92, False, "Sans" ) ) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) # boxsizer.Add(self.printSupport) boxsizer.Add(self.platform_adhesion_panel) boxsizer.Add(self.platform_support_panel) sizer.Add(boxsizer, (7,0), flag=wx.EXPAND) for button in self._print_profile_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) for button in self._print_material_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) # self.printSupport.Bind(wx.EVT_CHECKBOX, self._update) self.nozzle_size_combo.Bind(wx.EVT_COMBOBOX, self._update) self.platform_adhesion_combo.Bind(wx.EVT_COMBOBOX, self._update) self.platform_support_combo.Bind(wx.EVT_COMBOBOX, self._update)
def __init__(self, parent, callback): super(simpleModePanel, self).__init__(parent) self._callback = callback self._print_profile_options = [] self._print_material_options = [] printTypePanel = wx.Panel(self) for filename in resources.getSimpleModeProfiles(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton( printTypePanel, -1, name, style=wx.RB_GROUP if len(self._print_profile_options) == 0 else 0) button.base_filename = base_filename button.filename = filename self._print_profile_options.append(button) if profile.getPreference('simpleModeProfile') == base_filename: button.SetValue(True) printMaterialPanel = wx.Panel(self) for filename in resources.getSimpleModeMaterials(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton( printMaterialPanel, -1, name, style=wx.RB_GROUP if len(self._print_material_options) == 0 else 0) button.base_filename = base_filename button.filename = filename self._print_material_options.append(button) if profile.getPreference('simpleModeMaterial') == base_filename: button.SetValue(True) if profile.getMachineSetting('gcode_flavor') == 'UltiGCode': printMaterialPanel.Show(False) self.printSupport = wx.CheckBox(self, -1, _("Print support structure")) sizer = wx.GridBagSizer() self.SetSizer(sizer) sb = wx.StaticBox(printTypePanel, label=_("Select a quickprint profile:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_profile_options: boxsizer.Add(button) printTypePanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printTypePanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printTypePanel, (0, 0), flag=wx.EXPAND) sb = wx.StaticBox(printMaterialPanel, label=_("Material:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_material_options: boxsizer.Add(button) printMaterialPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printMaterialPanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printMaterialPanel, (1, 0), flag=wx.EXPAND) sb = wx.StaticBox(self, label=_("Other:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printSupport) sizer.Add(boxsizer, (2, 0), flag=wx.EXPAND) for button in self._print_profile_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) for button in self._print_material_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) self.printSupport.Bind(wx.EVT_CHECKBOX, self._update)
def __init__(self, parent, callback): super(simpleModePanel, self).__init__(parent) self._use_nozzle_options = False self._callback = callback self._print_profile_options = [] self._print_material_options = [] self._print_nozzle_options = [] printTypePanel = wx.Panel(self) for filename in resources.getSimpleModeProfiles(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton(printTypePanel, -1, name, style=wx.RB_GROUP if len(self._print_profile_options) == 0 else 0) button.base_filename = base_filename button.filename = filename self._print_profile_options.append(button) if profile.getPreference('simpleModeProfile') == base_filename: button.SetValue(True) printMaterialPanel = wx.Panel(self) for filename in resources.getSimpleModeMaterials(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton(printMaterialPanel, -1, name, style=wx.RB_GROUP if len(self._print_material_options) == 0 else 0) button.base_filename = base_filename button.filename = filename self._print_material_options.append(button) if profile.getPreference('simpleModeMaterial') == base_filename: button.SetValue(True) printNozzlePanel = wx.Panel(self) for nozzle_size in [0.4, 0.25, 0.6, 0.8, 1.0]: name = str(nozzle_size) + "mm" button = wx.RadioButton(printNozzlePanel, -1, name, style=wx.RB_GROUP if len(self._print_nozzle_options) == 0 else 0) button.nozzle_size = nozzle_size button.nozzle_name = name self._print_nozzle_options.append(button) if profile.getPreference('simpleModeNozzle') == name: button.SetValue(True) if profile.getMachineSetting('gcode_flavor') == 'UltiGCode': printMaterialPanel.Show(False) if not self._use_nozzle_options or profile.getMachineSetting('gcode_flavor') != 'UltiGCode': printNozzlePanel.Show(False) self.printSupport = wx.CheckBox(self, -1, _("Print support structure")) sizer = wx.GridBagSizer() self.SetSizer(sizer) sb = wx.StaticBox(printTypePanel, label=_("Select a quickprint profile:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_profile_options: boxsizer.Add(button) printTypePanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printTypePanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printTypePanel, (0,0), flag=wx.EXPAND) sb = wx.StaticBox(printMaterialPanel, label=_("Material:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_material_options: boxsizer.Add(button) printMaterialPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printMaterialPanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printMaterialPanel, (1,0), flag=wx.EXPAND) sb = wx.StaticBox(printNozzlePanel, label=_("Nozzle:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_nozzle_options: boxsizer.Add(button) printNozzlePanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printNozzlePanel.GetSizer().Add(boxsizer, flag=wx.EXPAND) sizer.Add(printNozzlePanel, (2,0), flag=wx.EXPAND) sb = wx.StaticBox(self, label=_("Other:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(self.printSupport) sizer.Add(boxsizer, (3,0), flag=wx.EXPAND) for button in self._print_profile_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) for button in self._print_material_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) for button in self._print_nozzle_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) self.printSupport.Bind(wx.EVT_CHECKBOX, self._update)
def __init__(self, parent, callback): super(simpleModePanel, self).__init__(parent) self._callback = callback self._print_profile_options = [] self._print_material_options = [] self._print_other_options = [] printTypePanel = wx.Panel(self) for filename in resources.getSimpleModeProfiles(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton(printTypePanel, -1, name, style=wx.RB_GROUP if len(self._print_profile_options) == 0 else 0) button.base_filename = base_filename button.filename = filename self._print_profile_options.append(button) if profile.getProfileSetting('simpleModeProfile') == base_filename: button.SetValue(True) printMaterialPanel = wx.Panel(self) for filename in resources.getSimpleModeMaterials(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton(printMaterialPanel, -1, name, style=wx.RB_GROUP if len(self._print_material_options) == 0 else 0) button.base_filename = base_filename button.filename = filename self._print_material_options.append(button) if profile.getProfileSetting('simpleModeMaterial') == base_filename: button.SetValue(True) if profile.getMachineSetting('gcode_flavor') == 'UltiGCode': printMaterialPanel.Show(False) for filename in resources.getSimpleModeOptions(): cp = configparser.ConfigParser() cp.read(filename) base_filename = os.path.splitext(os.path.basename(filename))[0] name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.CheckBox(self, -1, name) button.base_filename = base_filename button.filename = filename self._print_other_options.append(button) sizer = wx.GridBagSizer() self.SetSizer(sizer) sb = wx.StaticBox(printTypePanel, label=_("Select a quickprint profile:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_profile_options: boxsizer.Add(button) printTypePanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printTypePanel.GetSizer().Add(boxsizer, border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP) sizer.Add(printTypePanel, (0,0), flag=wx.EXPAND) sb = wx.StaticBox(printMaterialPanel, label=_("Material:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_material_options: boxsizer.Add(button) printMaterialPanel.SetSizer(wx.BoxSizer(wx.VERTICAL)) printMaterialPanel.GetSizer().Add(boxsizer, border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP) sizer.Add(printMaterialPanel, (1,0), flag=wx.EXPAND) sb = wx.StaticBox(self, label=_("Other:")) boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) for button in self._print_other_options: boxsizer.Add(button) sizer.Add(boxsizer, (2,0), border=10, flag=wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP) for button in self._print_profile_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) for button in self._print_material_options: button.Bind(wx.EVT_RADIOBUTTON, self._update) for button in self._print_other_options: button.Bind(wx.EVT_CHECKBOX, self._update)