Difference between revisions of "Creating New Datagrid"

From LinuxMCE
Jump to: navigation, search
(Creating a new plugin that generates a datagrid)
 
Line 4: Line 4:
  
 
1)  Add a device template for the 'Games Plugin'.  Use Climate Plugin as the template; it's the simplest of the plugins.
 
1)  Add a device template for the 'Games Plugin'.  Use Climate Plugin as the template; it's the simplest of the plugins.
 +
 
2) Do an apt-get install pluto-dcegen, and run: /usr/pluto/bin/DCEGen -d [device template] from the bin directory where your sources are (cd /home/sources/trunk/src/bin for example).
 
2) Do an apt-get install pluto-dcegen, and run: /usr/pluto/bin/DCEGen -d [device template] from the bin directory where your sources are (cd /home/sources/trunk/src/bin for example).
 +
 
3) In Games_Plugin.h add an ! after the //<-dceag-decl-b-> line so that block of auto-gen'd code won't get overriden, and co-derive teh class from , public DataGridGeneratorPlugIn like climate plugin.
 
3) In Games_Plugin.h add an ! after the //<-dceag-decl-b-> line so that block of auto-gen'd code won't get overriden, and co-derive teh class from , public DataGridGeneratorPlugIn like climate plugin.
 +
 
4) Add the member: class Datagrid_Plugin *m_pDatagrid_Plugin;
 
4) Add the member: class Datagrid_Plugin *m_pDatagrid_Plugin;
 
and a function for your data grid: class DataGridTable *ClimateScenariosGrid(string GridID,string Parms,void *ExtraData,int *iPK_Variable,string *sValue_To_Assign,class Message *pMessage);
 
and a function for your data grid: class DataGridTable *ClimateScenariosGrid(string GridID,string Parms,void *ExtraData,int *iPK_Variable,string *sValue_To_Assign,class Message *pMessage);
 +
 
5) Add the code that initializes the datagrid engine like in climate plugin:
 
5) Add the code that initializes the datagrid engine like in climate plugin:
 
m_pDatagrid_Plugin=( Datagrid_Plugin * ) m_pRouter->FindPluginByTemplate(DEVICETEMPLATE_Datagrid_Plugin_CONST);
 
m_pDatagrid_Plugin=( Datagrid_Plugin * ) m_pRouter->FindPluginByTemplate(DEVICETEMPLATE_Datagrid_Plugin_CONST);
Line 21: Line 25:
  
 
6) Add a record in teh pluto_main.DataGrid table for your new datagrid, and edit pluto_main/Define_DataGrid.h to add your new record, and change the RegisterDataGrid to use your function for the datagrid and your DATAGRID_X_CONST.
 
6) Add a record in teh pluto_main.DataGrid table for your new datagrid, and edit pluto_main/Define_DataGrid.h to add your new record, and change the RegisterDataGrid to use your function for the datagrid and your DATAGRID_X_CONST.
 +
 
7) In Designer add a new DesignObj for the screen that will display your datagrid.  Use one of the other screens as a template.  To see what screens are being used, edit /etc/pluto.conf, comment out the LogLevels line, do: /usr/pluto/bin/MessageSend dcerouter 0 -1000 7 11  to force all devices to recheck the log levels and start logging verbosely. Tail the /var/log/pluto/20_LaunchOrbiter.log | grep Goto_DesignObj    Then as you change screens in Orbiter you can see what designobj's are being used.  Note that Designer is nasty, unfriendly, finicky, and only runs on Windows.  Sorry, this really needs work, but has been neglected since it's an in-house tool.
 
7) In Designer add a new DesignObj for the screen that will display your datagrid.  Use one of the other screens as a template.  To see what screens are being used, edit /etc/pluto.conf, comment out the LogLevels line, do: /usr/pluto/bin/MessageSend dcerouter 0 -1000 7 11  to force all devices to recheck the log levels and start logging verbosely. Tail the /var/log/pluto/20_LaunchOrbiter.log | grep Goto_DesignObj    Then as you change screens in Orbiter you can see what designobj's are being used.  Note that Designer is nasty, unfriendly, finicky, and only runs on Windows.  Sorry, this really needs work, but has been neglected since it's an in-house tool.
 +
 
8) When you add the new design obj of type datagrid, add your new data grid id.
 
8) When you add the new design obj of type datagrid, add your new data grid id.
 +
 
9) Add to the pluto_main.Screen table a record for this new screen and set the 'autoinclude' field to 1 for now so that screen will be generated even though nothing calls it.  Then add to Screen_DesignObj a record associating this screen with your new DesignObj.   
 
9) Add to the pluto_main.Screen table a record for this new screen and set the 'autoinclude' field to 1 for now so that screen will be generated even though nothing calls it.  Then add to Screen_DesignObj a record associating this screen with your new DesignObj.   
9) In the admin site, add an instance of your game plugin under DCERouter (next to the other plugins).
+
 
10) Go into the admin site and under Advanced, Configuration, Scenarios, add a scenario with a command going to "the local orbiter" "Goto Screen" with our new screen as teh parameter for PK_Screen.
+
10) In the admin site, add an instance of your game plugin under DCERouter (next to the other plugins).
 +
 
 +
11) Go into the admin site and under Advanced, Configuration, Scenarios, add a scenario with a command going to "the local orbiter" "Goto Screen" with our new screen as teh parameter for PK_Screen.
  
 
Now, after you reload the router and regen the Orbiter's UI, then when the user navigates to your screen by choosing the scenario you created, it will call that data grid generator function, and you can populate the grid with data like in Climate_Plugin::ClimateScenariosGrid and it will appear.
 
Now, after you reload the router and regen the Orbiter's UI, then when the user navigates to your screen by choosing the scenario you created, it will call that data grid generator function, and you can populate the grid with data like in Climate_Plugin::ClimateScenariosGrid and it will appear.

Revision as of 20:00, 9 September 2007

>> A user asked how to create a new games plugin that generates a datagrid showing games on screen

Here is how I would do it:

1) Add a device template for the 'Games Plugin'. Use Climate Plugin as the template; it's the simplest of the plugins.

2) Do an apt-get install pluto-dcegen, and run: /usr/pluto/bin/DCEGen -d [device template] from the bin directory where your sources are (cd /home/sources/trunk/src/bin for example).

3) In Games_Plugin.h add an ! after the //<-dceag-decl-b-> line so that block of auto-gen'd code won't get overriden, and co-derive teh class from , public DataGridGeneratorPlugIn like climate plugin.

4) Add the member: class Datagrid_Plugin *m_pDatagrid_Plugin; and a function for your data grid: class DataGridTable *ClimateScenariosGrid(string GridID,string Parms,void *ExtraData,int *iPK_Variable,string *sValue_To_Assign,class Message *pMessage);

5) Add the code that initializes the datagrid engine like in climate plugin: m_pDatagrid_Plugin=( Datagrid_Plugin * ) m_pRouter->FindPluginByTemplate(DEVICETEMPLATE_Datagrid_Plugin_CONST); if( !m_pDatagrid_Plugin ) { LoggerWrapper::GetInstance()->Write(LV_CRITICAL,"Cannot find sister plugins to climate plugin"); return false; }

m_pDatagrid_Plugin->RegisterDatagridGenerator( new DataGridGeneratorCallBack(this,(DCEDataGridGeneratorFn)(&Climate_Plugin::ClimateScenariosGrid)) ,DATAGRID_Climate_Scenarios_CONST,PK_DeviceTemplate_get());

6) Add a record in teh pluto_main.DataGrid table for your new datagrid, and edit pluto_main/Define_DataGrid.h to add your new record, and change the RegisterDataGrid to use your function for the datagrid and your DATAGRID_X_CONST.

7) In Designer add a new DesignObj for the screen that will display your datagrid. Use one of the other screens as a template. To see what screens are being used, edit /etc/pluto.conf, comment out the LogLevels line, do: /usr/pluto/bin/MessageSend dcerouter 0 -1000 7 11 to force all devices to recheck the log levels and start logging verbosely. Tail the /var/log/pluto/20_LaunchOrbiter.log | grep Goto_DesignObj Then as you change screens in Orbiter you can see what designobj's are being used. Note that Designer is nasty, unfriendly, finicky, and only runs on Windows. Sorry, this really needs work, but has been neglected since it's an in-house tool.

8) When you add the new design obj of type datagrid, add your new data grid id.

9) Add to the pluto_main.Screen table a record for this new screen and set the 'autoinclude' field to 1 for now so that screen will be generated even though nothing calls it. Then add to Screen_DesignObj a record associating this screen with your new DesignObj.

10) In the admin site, add an instance of your game plugin under DCERouter (next to the other plugins).

11) Go into the admin site and under Advanced, Configuration, Scenarios, add a scenario with a command going to "the local orbiter" "Goto Screen" with our new screen as teh parameter for PK_Screen.

Now, after you reload the router and regen the Orbiter's UI, then when the user navigates to your screen by choosing the scenario you created, it will call that data grid generator function, and you can populate the grid with data like in Climate_Plugin::ClimateScenariosGrid and it will appear.