[chronojump] At devices window show rfid only on compujump. hidden run wireless
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] At devices window show rfid only on compujump. hidden run wireless
- Date: Sun, 11 Oct 2020 07:24:43 +0000 (UTC)
commit 991ed29f24af612fece738f5b36d08d8449f8b41
Author: Xavier de Blas <xaviblas gmail com>
Date: Sun Oct 11 09:23:21 2020 +0200
At devices window show rfid only on compujump. hidden run wireless
src/chronopicRegister.cs | 28 ++++++++++++++--------------
src/gui/app1/chronojump.cs | 9 ++++++---
src/gui/chronopicRegister.cs | 34 ++++++++++++++++++++++++++++++++--
src/sqlite/chronopicRegister.cs | 9 ++++++++-
4 files changed, 60 insertions(+), 20 deletions(-)
---
diff --git a/src/chronopicRegister.cs b/src/chronopicRegister.cs
index fab88345..484b0ab8 100644
--- a/src/chronopicRegister.cs
+++ b/src/chronopicRegister.cs
@@ -93,9 +93,9 @@ public class ChronopicRegisterPortList
public List<ChronopicRegisterPort> L;
//constructor
- public ChronopicRegisterPortList ()
+ public ChronopicRegisterPortList (bool showArduinoRFID, bool showRunWireless)
{
- this.L = SqliteChronopicRegister.SelectAll(false);
+ this.L = SqliteChronopicRegister.SelectAll(false, showArduinoRFID, showRunWireless);
}
public void Print()
@@ -179,14 +179,14 @@ public class ChronopicRegisterSelectOS
public ChronopicRegisterSelectOS() {
}
- public ChronopicRegister Do()
+ public ChronopicRegister Do(bool compujump, bool showRunWireless)
{
if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX)
- return new ChronopicRegisterLinux();
+ return new ChronopicRegisterLinux(compujump, showRunWireless);
else if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX)
- return new ChronopicRegisterMac();
+ return new ChronopicRegisterMac(compujump, showRunWireless);
else // WINDOWS
- return new ChronopicRegisterWindows();
+ return new ChronopicRegisterWindows(compujump, showRunWireless);
}
}
@@ -194,10 +194,10 @@ public abstract class ChronopicRegister
{
protected ChronopicRegisterPortList crpl;
- protected void process()
+ protected void process(bool compujump, bool showRunWireless)
{
//1 print the registered ports on SQL
- crpl = new ChronopicRegisterPortList();
+ crpl = new ChronopicRegisterPortList(compujump, showRunWireless); //compujump means:
showArduinoRFID
crpl.Print();
//2 create list
@@ -328,9 +328,9 @@ public abstract class ChronopicRegister
public class ChronopicRegisterLinux : ChronopicRegister
{
- public ChronopicRegisterLinux ()
+ public ChronopicRegisterLinux (bool compujump, bool showRunWireless)
{
- process();
+ process(compujump, showRunWireless);
}
protected override ChronopicRegisterPort readFTDI(ChronopicRegisterPort crp)
@@ -378,9 +378,9 @@ public class ChronopicRegisterLinux : ChronopicRegister
public class ChronopicRegisterMac : ChronopicRegister
{
- public ChronopicRegisterMac ()
+ public ChronopicRegisterMac (bool compujump, bool showRunWireless)
{
- process();
+ process(compujump, showRunWireless);
}
protected override ChronopicRegisterPort readFTDI(ChronopicRegisterPort crp)
@@ -402,9 +402,9 @@ public class ChronopicRegisterWindows : ChronopicRegister
{
FTDI ftdiDeviceWin;
- public ChronopicRegisterWindows ()
+ public ChronopicRegisterWindows (bool compujump, bool showRunWireless)
{
- process();
+ process(compujump, showRunWireless);
}
protected override void createList()
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 9156ccd0..35270dc7 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -7492,6 +7492,7 @@ LogB.Debug("mc finished 5");
* sensitive GUI on executeAuto methods
*/
+ bool showRunWirelessDevice = false;
private void chronopicRegisterUpdate(bool openWindow)
{
//on Windows need to close the port before reading with FTDI dll
@@ -7499,7 +7500,7 @@ LogB.Debug("mc finished 5");
cp2016.SerialPortsCloseIfNeeded(false);
ChronopicRegisterSelectOS cros = new ChronopicRegisterSelectOS();
- chronopicRegister = cros.Do();
+ chronopicRegister = cros.Do(configChronojump.Compujump, showRunWirelessDevice);
/*
* If Chronopic has been disconnected on OSX, port gets blocked
@@ -7511,7 +7512,7 @@ LogB.Debug("mc finished 5");
{
cp2016.SerialPortsCloseIfNeeded(true);
Thread.Sleep(250);
- chronopicRegister = cros.Do();
+ chronopicRegister = cros.Do(configChronojump.Compujump, showRunWirelessDevice);
}
@@ -7529,7 +7530,9 @@ LogB.Debug("mc finished 5");
if(openWindow)
{
- chronopicRegisterWin = new ChronopicRegisterWindow(app1, chronopicRegister.Crpl.L);
+ chronopicRegisterWin = new ChronopicRegisterWindow(app1, chronopicRegister.Crpl.L,
+ configChronojump.Compujump, //to show/hide ARDUINO_RFID
+ showRunWirelessDevice);
cp2016.WindowOpened = true;
diff --git a/src/gui/chronopicRegister.cs b/src/gui/chronopicRegister.cs
index 8561202f..26c81a42 100644
--- a/src/gui/chronopicRegister.cs
+++ b/src/gui/chronopicRegister.cs
@@ -56,6 +56,26 @@ public static class TypePixList
l.Add(new TypePix(ChronopicRegisterPort.Types.RUN_WIRELESS, new Pixbuf (null,
Util.GetImagePath(false) + "board-run-wireless.png")));
}
+ //used to hide new unfinished devices on chronojump release
+ public static void RemovePix(ChronopicRegisterPort.Types type)
+ {
+ int i = 0;
+ int pos = -1;
+ foreach(TypePix tp in l)
+ {
+ if(tp.Type == type)
+ {
+ pos = i;
+ break;
+ }
+
+ i ++;
+ }
+
+ if(pos >= 0)
+ l.RemoveAt(pos);
+ }
+
public static Pixbuf GetPix(ChronopicRegisterPort.Types type)
{
foreach(TypePix tp in l)
@@ -105,8 +125,17 @@ public class ChronopicRegisterWindow
private List<ChronopicRegisterPort> listConnected;
public Gtk.Button FakeButtonCloseSerialPort;
- public ChronopicRegisterWindow(Gtk.Window app1, List<ChronopicRegisterPort> listAll)
+ public ChronopicRegisterWindow(Gtk.Window app1, List<ChronopicRegisterPort> listAll, bool compujump,
bool showRunWireless)
{
+ // 1) remove undesired Pixs from list
+ if(! compujump)
+ TypePixList.RemovePix(ChronopicRegisterPort.Types.ARDUINO_RFID);
+
+ if(! showRunWireless)
+ TypePixList.RemovePix(ChronopicRegisterPort.Types.RUN_WIRELESS);
+
+ // 2) create window
+
createWindow(app1);
UtilGtk.IconWindow(chronopic_register_win); //put an icon to window
@@ -116,7 +145,8 @@ public class ChronopicRegisterWindow
listConnected = new List<ChronopicRegisterPort>();
- //create listConnected with connected chronopics
+ // 3)create listConnected with connected chronopics
+
int connectedCount = 0;
int unknownCount = 0;
foreach(ChronopicRegisterPort crp in listAll)
diff --git a/src/sqlite/chronopicRegister.cs b/src/sqlite/chronopicRegister.cs
index 96ad35bb..2d3bc05c 100644
--- a/src/sqlite/chronopicRegister.cs
+++ b/src/sqlite/chronopicRegister.cs
@@ -46,7 +46,7 @@ class SqliteChronopicRegister : Sqlite
dbcmd.ExecuteNonQuery();
}
- public static List<ChronopicRegisterPort> SelectAll (bool dbconOpened)
+ public static List<ChronopicRegisterPort> SelectAll (bool dbconOpened, bool showArduinoRFID, bool
showRunWireless)
{
openIfNeeded(dbconOpened);
@@ -63,6 +63,13 @@ class SqliteChronopicRegister : Sqlite
(ChronopicRegisterPort.Types) Enum.Parse(
typeof(ChronopicRegisterPort.Types), reader[1].ToString())
//type
);
+
+ if(! showArduinoRFID && crp.Type == ChronopicRegisterPort.Types.ARDUINO_RFID)
+ crp.Type = ChronopicRegisterPort.Types.UNKNOWN;
+
+ if(! showRunWireless && crp.Type == ChronopicRegisterPort.Types.RUN_WIRELESS)
+ crp.Type = ChronopicRegisterPort.Types.UNKNOWN;
+
l.Add(crp);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]