News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

personalities

Started by jmccay, February 23, 2007, 06:53:57 PM

Previous topic - Next topic

jmccay

I tried the tests explained in the wiki documentation for personalities.  I created the '--personality="Lite"' as described in the instructions.  Then I crated another desktop shortcut with --personality="ask".  After running the lite version, I ran the ask version.  The were no personalities listed.  Did I do something wrong?  Also, is there a way to edit these from the menu?
jmccay
OS: WinXP, Win98 SE, & sometimes Linux

a little light reading from the wxWidgets 2.6.2 readme: A detailed 2000-page reference manual is supplied in HTML, PDF and Windows Help form: see the docs hierarchy.

stahta01

No, you did it right. I am trying to find why the code is not looking in the right folder to find the .conf files. I just have not had the time to determine where the code is wrong.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Partial untested patch. Tim S
I ran it once and it gave me a list of configs, but picking one did not seem to work.


Index: src/sdk/personalitymanager.cpp
===================================================================
--- src/sdk/personalitymanager.cpp (revision 3635)
+++ src/sdk/personalitymanager.cpp (working copy)
@@ -55,7 +55,7 @@
const wxArrayString PersonalityManager::GetPersonalitiesList()
{
wxArrayString list;
- wxDir::GetAllFiles(ConfigManager::GetConfigFolder(), &list, _T("*.conf"), wxDIR_FILES);
+ wxDir::GetAllFiles(ConfigManager::GetFolder(sdConfig), &list, _T("*.conf"), wxDIR_FILES);

for(size_t i = 0; i < list.GetCount(); ++i)
         list[i] = wxFileName(list[i]).GetName();
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

#3
I am giving up for tonight may or may not try tomorrow, the problem is it is being set to default before the selected config can be set and it never looks for the set config that I can find.

Edit: Thought of something else to try, it failed, but the next thing worked.
Working on finding out what of the several changes I did are needed.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

#4
Here's the patch that works for me.

Submitted [ Patch #1897 ] Windows XP --personality=ask not working
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1897&group_id=5358

File 1: src/sdk/personalitymanager.cpp
Problem 1: ConfigManager::GetConfigFolder() returns empty string or null string.
Solution 1: Replaced with ConfigManager::GetFolder(sdConfig).

File 2: src/src/app.cpp
Problem 2: Under windows XP SP2, my guess is that wxSingleChoiceDialog has some unknown side effect that prevents code from working.
Solution 2: re-wrote logic using wxGetSingleChoiceIndex


Index: src/sdk/personalitymanager.cpp
===================================================================
--- src/sdk/personalitymanager.cpp (revision 3639)
+++ src/sdk/personalitymanager.cpp (working copy)
@@ -55,7 +55,7 @@
const wxArrayString PersonalityManager::GetPersonalitiesList()
{
wxArrayString list;
- wxDir::GetAllFiles(ConfigManager::GetConfigFolder(), &list, _T("*.conf"), wxDIR_FILES);
+ wxDir::GetAllFiles(ConfigManager::GetFolder(sdConfig), &list, _T("*.conf"), wxDIR_FILES);

for(size_t i = 0; i < list.GetCount(); ++i)
         list[i] = wxFileName(list[i]).GetName();
Index: src/src/app.cpp
===================================================================
--- src/src/app.cpp (revision 3639)
+++ src/src/app.cpp (working copy)
@@ -880,6 +880,7 @@
{
     if (personality.CmpNoCase(_T("ask")) == 0)
     {
+/* This Code failed to work under windows XP SP2 reason unkwown
#if (wxMAJOR_VERSION == 2) && (wxMINOR_VERSION < 5)
         // wx < 2.5.x single choice dialog wants wxString*
         const wxArrayString& list = Manager::Get()->GetPersonalityManager()->GetPersonalitiesList();
@@ -902,6 +903,21 @@
#if (wxMAJOR_VERSION == 2) && (wxMINOR_VERSION < 5)
         delete[] strings;
#endif
+*/
+        wxArrayString persNames = Manager::Get()->GetPersonalityManager()->GetPersonalitiesList();
+        int persIndex;
+        persIndex = wxGetSingleChoiceIndex
+              (
+                _("Please choose which personality (profile) to load:"),
+                _("Personalities (profiles)"),
+                persNames
+              );
+
+        if ( persIndex != -1 )
+            Manager::Get()->GetPersonalityManager()->SetPersonality(persNames[persIndex]);
+        else
+            Manager::Get()->GetPersonalityManager()->SetPersonality(_T("default"));
+
     }
     else
         Manager::Get()->GetPersonalityManager()->SetPersonality(personality, true);
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

jmccay

Cool.  Thanks for your work.  Now if we could get the patch applied to the SVN code.
jmccay
OS: WinXP, Win98 SE, & sometimes Linux

a little light reading from the wxWidgets 2.6.2 readme: A detailed 2000-page reference manual is supplied in HTML, PDF and Windows Help form: see the docs hierarchy.

stahta01

I updated the patch to work with the changes to SVN.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]