def GetPythonExecutablePath(info): # Figure out what Python to use # 1) First check configuration # 2) Second check for it on the path localpythonpath = GetConfigValue(TLC_PYTHON_PATH) if not localpythonpath: localpythonpath = PyStudioUtils.GetDefaultPython() if localpythonpath: util.Log("[%s][info] Using Python: %s" % (info, localpythonpath)) return (True, localpythonpath) else: # No configured Python util.Log("[%s][info] %s" % (info, NOPYTHONERROR)) return (False, NOPYTHONERROR)
def __DoLayout(self): sizer = wx.BoxSizer(wx.VERTICAL) # Python executable configuration config = Profile_Get(PYTOOL_CONFIG, default=dict()) pythonpath = config.get(TLC_PYTHON_PATH, None) if not pythonpath: pythonpath = PyStudioUtils.GetDefaultPython() all_pythons = config.get(TLC_ALL_PYTHON_PATHS, []) if pythonpath: pythonpath = os.path.normcase( pythonpath ) #TODO: this will likely cause problems on non Windows config[TLC_PYTHON_PATH] = pythonpath if not pythonpath in all_pythons: all_pythons.append(pythonpath) config[TLC_ALL_PYTHON_PATHS] = all_pythons ## Layout Python path selections hsizer = wx.BoxSizer(wx.HORIZONTAL) self._python_path_combo.Items = all_pythons self._python_path_combo.StringSelection = pythonpath self._python_path_combo.ToolTip = wx.ToolTip( _("Currently active Python")) hsizer.Add(wx.StaticText(self, label=_("Python Path:")), 0, wx.ALL, 5) hsizer.Add(self._python_path_combo, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) hsizer.Add(self._add_path, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5) hsizer.Add(self._rm_path, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5) sizer.Add(hsizer, 0, wx.EXPAND | wx.ALL, 8) # Syntax check self._check_on_save_cb.ToolTip = wx.ToolTip( _("Mark syntax errors in buffer after save")) self._check_on_save_cb.SetValue( GetConfigValue(TLC_COMPILE_ON_SAVE, True)) sizer.Add(self._check_on_save_cb, 0, wx.ALL, 5) # Project self._load_proj_cb.ToolTip = wx.ToolTip( _("Automatically reload last project at startup.")) self._load_proj_cb.SetValue(GetConfigValue(TLC_LOAD_LAST_PROJECT, True)) sizer.Add(self._load_proj_cb, 0, wx.ALL, 5) self.SetSizer(sizer)