Author: jerome
Date: 2008-08-17 17:06:29 +0200 (Sun, 17 Aug 2008)
New Revision: 1542
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
Log:
* Added "add" function complete interface.
Modified:
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
===================================================================
---
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
2008-08-17 14:44:22 UTC (rev 1541)
+++
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
2008-08-17 15:06:29 UTC (rev 1542)
@@ -71,7 +71,7 @@
private JButton cancel;
private JButton okEdition;
private JButton deleteEdition;
- private JButton add; //TODO
+ private JButton add;
/* Voice configuration */
private JComboBox locutorSet;
@@ -86,6 +86,14 @@
private JTextField ttsSet;
private JSpinner manyValue;
+ /* Add new Chatter Tux value objects */
+ private JComboBox addAction;
+ private JComboBox addTuxBody;
+ private JSpinner addMany;
+ private JTextField addTtsText;
+ private JTextField chatterTuxValue;
+ private JLabel addHowMany = new JLabel("How many time");
+
private File iniFile = new
File("c:\\tuxdroid\\bin\\chattertux\\ChatterTux.ini");
//Current tts parsed action.
@@ -107,7 +115,7 @@
public ConfInterface(){
if(iniFile.isFile()){
-
+ ChatterTuxServer.stop(); //makes sure do not have too
many python process.
//Getting ini file.
this.ini = new IniFile(this.iniFile);
this.properties = new
Properties(this.ini.getHashtable());
@@ -168,9 +176,9 @@
}
frame = new JFrame("Chatter Tux configuration");
- frame.setSize(new Dimension(400, 500));
+ frame.setSize(new Dimension(390, 550));
frame.setPreferredSize(frame.getSize());
-
+ frame.setResizable(false);
frame.add(this.getJContentPane());
frame.setVisible(true);
frame.pack();
@@ -184,9 +192,8 @@
this.jContentPane = new JPanel();
this.jContentPane.setLayout(null);
this.jContentPane.add(this.getVoiceConfigurationPanel());
- //Adding edition and add Chatter Tux entries panel.
this.jContentPane.add(this.getEditPanel());
- //this.jContentPane.add(this.getAddEntry());
+ this.jContentPane.add(this.getAddEntry());
this.jContentPane.add(this.getActionsPanel());
this.jContentPane.add(this.getButtonsPanel());
@@ -396,8 +403,8 @@
this.buttonsPanel.add(this.getCancelButton());
this.buttonsPanel.setSize(this.actionModifier.getWidth(), this.ok.getHeight()
+8);
this.buttonsPanel.setPreferredSize(this.buttonsPanel.getSize());
- int x = this.editPanel.getX();
- int y = this.editPanel.getY() + 24 +
this.actionModifier.getHeight();
+ int x = this.addPanel.getX();
+ int y = this.addPanel.getY() + 24 +
this.actionModifier.getHeight();
this.buttonsPanel.setLocation(new Point(x, y));
}
return this.buttonsPanel;
@@ -507,21 +514,111 @@
return this.editPanel;
}
- //TODO
+
//Gets new Chatter Tux entry panel.
public JPanel getAddEntry(){
if(this.addPanel == null){
+ this.addPanel = new JPanel();
+ this.addPanel.setLayout(null);
+
this.addPanel.setBorder(BorderFactory.createTitledBorder("Add Chatter Tux
action"));
+ this.addPanel.setSize(this.editPanel.getSize());
+ this.addPanel.setPreferredSize(this.addPanel.getSize());
+ //Create add button.
+ this.add = new JButton("Add");
+ add.setSize(this.okEdition.getSize());
+ add.setPreferredSize(this.add.getSize());
+ add.setFocusPainted(false);
+
+ this.add.addMouseListener(new
java.awt.event.MouseAdapter(){
+ public void
mousePressed(java.awt.event.MouseEvent event){
+ storeAsIni(chatterTuxValue.getText());
+ }
+ });
+ this.add.setLocation(okEdition.getLocation());
+
+ this.addPanel.add(this.add);
+ int x = this.editPanel.getX();
+ int y = this.editPanel.getY() + 135;
+ this.addPanel.setLocation(new Point(x, y));
+
+ //Create components.
+ this.addAction = new JComboBox(new String[]{"Tux
movement", "Tux TTS"});
+ this.addAction.setSize(this.actionType.getSize());
+
this.addAction.setPreferredSize(this.actionType.getSize());
+ this.addAction.setLocation(new Point(190,
this.actionType.getY()));
+
+ this.chatterTuxValue = new JTextField();
+ this.chatterTuxValue.setSize(this.locutorSet.getSize());
+
this.chatterTuxValue.setPreferredSize(this.chatterTuxValue.getSize());
+
this.chatterTuxValue.setLocation(this.locutorSet.getLocation());
+
+ this.addTuxBody = new JComboBox();
+ this.addTuxBody.addItem("Mouth");
+ this.addTuxBody.addItem("Flippers");
+ this.addTuxBody.addItem("Eyes");
+ this.addTuxBody.addItem("Right led");
+ this.addTuxBody.addItem("Left led");
+ this.addTuxBody.addItem("Both leds");
+ this.addTuxBody.addItem("Spin left");
+ this.addTuxBody.addItem("Spin right");
+ this.addTuxBody.setSize(this.actionType.getSize());
+
this.addTuxBody.setPreferredSize(this.tuxBody.getSize());
+ this.addTuxBody.setFocusable(false);
+ this.addTuxBody.setLocation(new
Point(this.actionType.getX(), 60));
+ this.editPanel.add(this.tuxBody);
+
+ Integer[] values = new Integer[10];
+ for(int i=1; i < 11; i++){
+ values[i-1] = Integer.valueOf(i);
+ }
+ this.addMany = new JSpinner(new
SpinnerListModel(values));
+ this.addMany.setSize(this.pitchSet.getSize());
+ this.addMany.setPreferredSize(this.addMany.getSize());
+ this.addMany.setLocation(new Point(280,
this.addTuxBody.getY()));
+
+ this.addHowMany.setSize(this.tuxBody.getSize());
+ this.addHowMany.setLocation(180, this.tuxBody.getY());
+ this.addHowMany.setVisible(false);
+
+ this.addPanel.add(this.addAction);
+ this.addPanel.add(this.chatterTuxValue);
+ this.addPanel.add(this.addTuxBody);
+ this.addPanel.add(this.addMany);
+ this.addPanel.add(this.addHowMany);
+
+ //Create not visible component.
+ this.addTtsText = new JTextField();
+ this.addTtsText.setSize(this.actionType.getSize());
+ this.addTtsText.setPreferredSize(this.ttsSet.getSize());
+ this.addTtsText.setLocation(new
Point(this.actionType.getX(), 60));
+ this.addTtsText.setVisible(false);
+ this.addPanel.add(this.addTtsText);
+
+ this.addAction.addActionListener(new ActionListener(){
+
+ public void actionPerformed(ActionEvent arg0) {
+
if(arg0.getActionCommand().equalsIgnoreCase("comboboxchanged")){
+ String selection =
addAction.getModel().getSelectedItem().toString();
+
if(selection.equals(addAction.getItemAt(0))){
+
setAPIAddComponentsVisible(true);
+ }else{
+
setTTSAddComponentsVisible(true);
+ }
+ }
+ }
+ });
}
return this.addPanel;
}
// TODO Store to ini file.
- public void storeAsIni(){
+ public void storeAsIni(String key){
}
- //TODO store modifications.
+
+ //Stor modifications.
public void storeModificationsToIni(String key){
String action = this.actionType.getSelectedItem().toString();
if(action.equals("Tux TTS")){
@@ -625,6 +722,22 @@
this.manyValue.setVisible(true);
}
+
+ public void setAPIAddComponentsVisible(boolean arg0){
+ this.addTtsText.setVisible(false);
+ this.addTuxBody.setVisible(true);
+ this.addHowMany.setVisible(true);
+ this.addMany.setVisible(true);
+ }
+
+
+ public void setTTSAddComponentsVisible(boolean arg0){
+ this.addTtsText.setVisible(true);
+ this.addTuxBody.setVisible(false);
+ this.addHowMany.setVisible(false);
+ this.addMany.setVisible(false);
+ }
+
/*
* Parse tux api command to return a human comprehensive sentense.
*/
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn