[chronojump] ChronopicWizard assigns ports to radios and discrimines alreadydetected
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] ChronopicWizard assigns ports to radios and discrimines alreadydetected
- Date: Wed, 7 Sep 2016 18:10:26 +0000 (UTC)
commit 44a837eee3986b693903eaf662df5058319cce71
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Sep 7 20:04:38 2016 +0200
ChronopicWizard assigns ports to radios and discrimines alreadydetected
glade/chronojump.glade | 379 +++++++++++++++++++++++++++++++++++++-------
src/gui/chronopicWizard.cs | 165 +++++++++++++++----
2 files changed, 448 insertions(+), 96 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 1e0cf11..cd53f8b 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -18344,6 +18344,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -20565,7 +20568,7 @@ Which devices are you going to use?</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <widget class="GtkRadioButton" id="radio_contacts">
+ <widget class="GtkRadioButton" id="radio_start_contacts">
<property name="label">Chronopic for jumps/runs</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -20580,14 +20583,14 @@ Which devices are you going to use?</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="radio_encoder">
+ <widget class="GtkRadioButton" id="radio_start_encoder">
<property name="label">Chronopic for encoder</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">radio_contacts</property>
+ <property name="group">radio_start_contacts</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -20596,14 +20599,14 @@ Which devices are you going to use?</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="radio_both">
+ <widget class="GtkRadioButton" id="radio_start_both">
<property name="label">Both</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">radio_contacts</property>
+ <property name="group">radio_start_contacts</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -20722,34 +20725,46 @@ Which devices are you going to use?</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox5">
+ <widget class="GtkHBox" id="hbox14">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label23">
+ <widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label">Detected ports:</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label23">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">Detected ports:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTextView" id="textview_detected_unplugged">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
- <child>
- <widget class="GtkTextView" id="textview_detected_unplugged">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</widget>
<packing>
<property name="position">1</property>
@@ -20886,9 +20901,36 @@ Which devices are you going to use?</property>
</packing>
</child>
<child>
- <widget class="GtkProgressBar" id="progressbar_contacts">
+ <widget class="GtkHBox" id="hbox_detection_contacts">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkProgressBar" id="progressbar_contacts">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_cancel_contacts">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked"
handler="on_button_cancel_contacts_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -20910,34 +20952,104 @@ Which devices are you going to use?</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox7">
+ <widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label5">
+ <widget class="GtkVBox" id="vbox10">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label">Detected ports:</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="label">New ports found:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">10</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_contacts1">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_contacts2">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_contacts1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_contacts3">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_contacts1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_contacts4">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_contacts1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_contacts5">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_contacts1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
- <child>
- <widget class="GtkTextView" id="textview_detected_contacts">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</widget>
<packing>
<property name="position">1</property>
@@ -21090,9 +21202,36 @@ Which devices are you going to use?</property>
</packing>
</child>
<child>
- <widget class="GtkProgressBar" id="progressbar_encoder">
+ <widget class="GtkHBox" id="hbox_detection_encoder">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkProgressBar" id="progressbar_encoder">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_cancel_encoder">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_button_cancel_encoder_clicked"
swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -21114,34 +21253,101 @@ Which devices are you going to use?</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox9">
+ <widget class="GtkHBox" id="hbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">20</property>
<child>
- <widget class="GtkLabel" id="label16">
+ <widget class="GtkVBox" id="vbox9">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label">Detected ports:</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="label">New ports found:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">10</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_encoder1">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_encoder2">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_encoder1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_encoder3">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_encoder1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_encoder4">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_encoder1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radio_encoder5">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_encoder1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
- <child>
- <widget class="GtkTextView" id="textview_detected_encoder">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</widget>
<packing>
<property name="position">1</property>
@@ -23935,6 +24141,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -25282,6 +25491,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -27121,6 +27333,9 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -28017,6 +28232,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -41627,6 +41845,24 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -44978,6 +45214,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -46056,9 +46304,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="label218">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -47405,6 +47650,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -52335,6 +52583,9 @@ Other</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -53346,6 +53597,9 @@ Other</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -54372,6 +54626,9 @@ Other</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/gui/chronopicWizard.cs b/src/gui/chronopicWizard.cs
index 988495e..e0f3502 100644
--- a/src/gui/chronopicWizard.cs
+++ b/src/gui/chronopicWizard.cs
@@ -24,6 +24,7 @@ using System.IO.Ports;
using Gtk;
using Glade;
using Mono.Unix;
+using System.Collections;
public class ChronopicWizardWindow
{
@@ -33,9 +34,9 @@ public class ChronopicWizardWindow
[Widget] Gtk.Button button_next;
//tab 0 start
- [Widget] Gtk.RadioButton radio_contacts;
- [Widget] Gtk.RadioButton radio_encoder;
- [Widget] Gtk.RadioButton radio_both;
+ [Widget] Gtk.RadioButton radio_start_contacts;
+ [Widget] Gtk.RadioButton radio_start_encoder;
+ [Widget] Gtk.RadioButton radio_start_both;
//tab 1 unplug
[Widget] Gtk.Label label_unplug;
@@ -47,21 +48,35 @@ public class ChronopicWizardWindow
[Widget] Gtk.Frame frame_detection_contacts;
[Widget] Gtk.Notebook notebook_contacts;
[Widget] Gtk.Button button_done_contacts;
+ [Widget] Gtk.HBox hbox_detection_contacts;
[Widget] Gtk.ProgressBar progressbar_contacts;
- [Widget] Gtk.TextView textview_detected_contacts;
+ [Widget] Gtk.Button button_cancel_contacts;
+ [Widget] Gtk.RadioButton radio_contacts1;
+ [Widget] Gtk.RadioButton radio_contacts2;
+ [Widget] Gtk.RadioButton radio_contacts3;
+ [Widget] Gtk.RadioButton radio_contacts4;
+ [Widget] Gtk.RadioButton radio_contacts5;
//tab 3 encoder
[Widget] Gtk.Frame frame_detection_encoder;
[Widget] Gtk.Notebook notebook_encoder;
[Widget] Gtk.Button button_done_encoder;
+ [Widget] Gtk.HBox hbox_detection_encoder;
[Widget] Gtk.ProgressBar progressbar_encoder;
- [Widget] Gtk.TextView textview_detected_encoder;
+ [Widget] Gtk.Button button_cancel_encoder;
+ [Widget] Gtk.RadioButton radio_encoder1;
+ [Widget] Gtk.RadioButton radio_encoder2;
+ [Widget] Gtk.RadioButton radio_encoder3;
+ [Widget] Gtk.RadioButton radio_encoder4;
+ [Widget] Gtk.RadioButton radio_encoder5;
static ChronopicWizardWindow ChronopicWizardWindowBox;
public string portContacts;
public string portEncoder;
+ private ArrayList portsAlreadyDetected;
+
ChronopicWizardWindow()
{
Glade.XML gladeXML;
@@ -85,37 +100,87 @@ public class ChronopicWizardWindow
void initialize()
{
+ portsAlreadyDetected = new ArrayList(0);
+
notebook_main.CurrentPage = 0;
notebook_unplugged.CurrentPage = 0;
notebook_contacts.CurrentPage = 0;
notebook_encoder.CurrentPage = 0;
button_done_contacts.Sensitive = true;
+ hbox_detection_contacts.Sensitive = false;
progressbar_contacts.Text = "";
+ radio_contacts1.Visible = false;
+ radio_contacts2.Visible = false;
+ radio_contacts3.Visible = false;
+ radio_contacts4.Visible = false;
+ radio_contacts5.Visible = false;
+
button_done_encoder.Sensitive = true;
+ hbox_detection_encoder.Sensitive = false;
progressbar_encoder.Text = "";
+
+ radio_encoder1.Visible = false;
+ radio_encoder2.Visible = false;
+ radio_encoder3.Visible = false;
+ radio_encoder4.Visible = false;
+ radio_encoder5.Visible = false;
button_next.Label = Catalog.GetString("Next");
button_next.Sensitive = true;
}
- string detectPorts()
+ ArrayList detectPorts()
{
+ //detect ports
string [] ports = {""};
if(UtilAll.IsWindows())
ports = SerialPort.GetPortNames();
else
ports = Directory.GetFiles("/dev/", "ttyUSB*");
- string messageDetected = "";
- string sep = "";
+ //get only new ports
+ ArrayList portsNew = new ArrayList(0);
+ foreach (string pNew in ports)
+ if(! Util.FoundInArrayList(portsAlreadyDetected, pNew))
+ {
+ portsAlreadyDetected.Add(pNew);
+ portsNew.Add(pNew);
+ }
+
+ return portsNew;
+ }
+
+ void assignPorts (ArrayList ports, Gtk.RadioButton radio1, Gtk.RadioButton radio2,
+ Gtk.RadioButton radio3, Gtk.RadioButton radio4, Gtk.RadioButton radio5)
+ {
+ int count = 1;
foreach (string port in ports) {
- messageDetected += sep + port;
- sep = "\n";
+ switch(count) {
+ case 1:
+ radio1.Label = port;
+ radio1.Visible = true;
+ break;
+ case 2:
+ radio2.Label = port;
+ radio2.Visible = true;
+ break;
+ case 3:
+ radio3.Label = port;
+ radio3.Visible = true;
+ break;
+ case 4:
+ radio4.Label = port;
+ radio4.Visible = true;
+ break;
+ case 5:
+ radio5.Label = port;
+ radio5.Visible = true;
+ break;
+ }
+ count ++;
}
-
- return messageDetected;
}
bool progressbarContinue = true;
@@ -133,10 +198,10 @@ public class ChronopicWizardWindow
LogB.Information("Wizard detecting contacts");
progressbarCount = 0;
- string detected = detectPorts();
- if(detected != "") {
+ ArrayList newPorts = detectPorts();
+ if(newPorts.Count > 0) {
progressbarContinue = false;
- detected_contacts(detected);
+ detectedContacts(newPorts);
return false;
}
} else
@@ -158,10 +223,10 @@ public class ChronopicWizardWindow
LogB.Information("Wizard detecting encoder");
progressbarCount = 0;
- string detected = detectPorts();
- if(detected != "") {
+ ArrayList newPorts = detectPorts();
+ if(newPorts.Count > 0) {
progressbarContinue = false;
- detected_encoder(detected);
+ detectedEncoder(newPorts);
return false;
}
} else
@@ -174,10 +239,19 @@ public class ChronopicWizardWindow
void on_button_done_unplugged_clicked (object o, EventArgs args)
{
- string str = detectPorts();
- if(str == "")
- str = "Correct! Nothing detected";
- textview_detected_unplugged.Buffer.Text = str;
+ ArrayList newPorts = detectPorts();
+
+ string messageDetected = "";
+ string sep = "";
+ foreach (string port in newPorts) {
+ messageDetected += sep + port;
+ sep = "\n";
+ }
+ if(messageDetected == "")
+ messageDetected = "None";
+
+ textview_detected_unplugged.Buffer.Text = messageDetected;
+
notebook_unplugged.CurrentPage = 1;
button_next.Sensitive = true;
}
@@ -185,34 +259,55 @@ public class ChronopicWizardWindow
void on_button_done_contacts_clicked (object o, EventArgs args)
{
button_done_contacts.Sensitive = false;
- progressbar_contacts.Text = "Detecting";
+ hbox_detection_contacts.Sensitive = true;
+ progressbar_contacts.Text = Catalog.GetString("Detecting");
progressbarContinue = true;
progressbarCount = 0;
GLib.Timeout.Add(50, new GLib.TimeoutHandler(progressbarContactsDo)); //each 50 ms
}
- void detected_contacts (string detected)
+ void detectedContacts (ArrayList newPorts)
{
progressbarContinue = false;
- textview_detected_contacts.Buffer.Text = detected;
+ hbox_detection_contacts.Sensitive = false;
+ assignPorts(newPorts, radio_contacts1, radio_contacts2,
+ radio_contacts3, radio_contacts4, radio_contacts5);
notebook_contacts.CurrentPage = 1;
button_next.Sensitive = true;
}
+ void on_button_cancel_contacts_clicked (object o, EventArgs args)
+ {
+ progressbarContinue = false;
+ progressbar_contacts.Text = Catalog.GetString("Cancelled");
+ hbox_detection_contacts.Sensitive = false;
+ button_done_contacts.Sensitive = true;
+ }
void on_button_done_encoder_clicked (object o, EventArgs args)
{
button_done_encoder.Sensitive = false;
- progressbar_encoder.Text = "Detecting";
+ hbox_detection_encoder.Sensitive = true;
+ progressbar_encoder.Text = Catalog.GetString("Detecting");
progressbarContinue = true;
progressbarCount = 0;
GLib.Timeout.Add(50, new GLib.TimeoutHandler(progressbarEncoderDo)); //each 50 ms
}
- void detected_encoder (string detected)
+ void detectedEncoder (ArrayList newPorts)
{
progressbarContinue = false;
- textview_detected_encoder.Buffer.Text = detected;
+ hbox_detection_encoder.Sensitive = false;
+ assignPorts(newPorts, radio_encoder1, radio_encoder2,
+ radio_encoder3, radio_encoder4, radio_encoder5);
notebook_encoder.CurrentPage = 1;
- button_next.Label = Catalog.GetString("Finish");
button_next.Sensitive = true;
+
+ button_next.Label = Catalog.GetString("Finish");
+ }
+ void on_button_cancel_encoder_clicked (object o, EventArgs args)
+ {
+ progressbarContinue = false;
+ progressbar_encoder.Text = Catalog.GetString("Cancelled");
+ hbox_detection_encoder.Sensitive = false;
+ button_done_encoder.Sensitive = true;
}
@@ -224,12 +319,12 @@ public class ChronopicWizardWindow
{
//from page 0 to page 1 show unplug message
int numCPs = 1;
- if(radio_both.Active)
+ if(radio_start_both.Active)
numCPs = 2;
label_unplug.Text = Catalog.GetPluralString(
- "Please unplug Chronopic USB cable.",
- "Please unplug Chronopic USB cables.", numCPs);
+ "Please, unplug Chronopic USB cable.",
+ "Please, unplug Chronopic USB cables.", numCPs);
button_next.Sensitive = false; //unsensitive until click on Done
}
@@ -238,11 +333,11 @@ public class ChronopicWizardWindow
//from page 1 to page 2 detect contacts
button_next.Sensitive = false; //unsensitive until click on Done
- if(radio_contacts.Active) {
+ if(radio_start_contacts.Active) {
//if there will be no encoder, rename Next to Finish
button_next.Label = Catalog.GetString("Finish");
}
- else if(radio_encoder.Active) {
+ else if(radio_start_encoder.Active) {
//if there will be no contacts, jump to encoder page
advancePages = 2;
}
@@ -251,7 +346,7 @@ public class ChronopicWizardWindow
{
//from page 2 to page 3 detect encoder
//exit if there's no encoder
- if(radio_contacts.Active)
+ if(radio_start_contacts.Active)
on_button_cancel_clicked(o, args); //TODO
else {
button_next.Sensitive = false; //unsensitive until click on Done
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]