[chronojump] session/more view data folder allows user to see specific dir if mode allows it and currentSession
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] session/more view data folder allows user to see specific dir if mode allows it and currentSession
- Date: Wed, 4 May 2022 12:11:42 +0000 (UTC)
commit 5dd7c37cf348cf2ae1736ee06fd6d862ecdbf167
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed May 4 14:10:52 2022 +0200
session/more view data folder allows user to see specific dir if mode allows it and currentSession
glade/app1.glade | 422 +++++++++++++++++++++++++++++++++++++++++--
src/gui/app1/session/main.cs | 88 ++++++++-
src/util.cs | 4 +
3 files changed, 496 insertions(+), 18 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index fcc50580e..8aa74e7dc 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -26359,6 +26359,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -32767,18 +32770,6 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Tests
will be filmed</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<widget class="GtkHBox"
id="hbox_video_encoder_capturing">
<property name="can_focus">False</property>
<property name="spacing">4</property>
@@ -32815,6 +32806,18 @@ Concentric</property>
</packing>
</child>
<child>
+ <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tests
will be filmed</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox"
id="hbox_video_encoder_no_capturing">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -42116,6 +42119,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -43202,13 +43208,13 @@ then click this button.</property>
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_data_folder_open">
+ <widget class="GtkButton"
id="button_view_data_folder">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property
name="receives_default">False</property>
<property name="relief">half</property>
<property name="use_underline">True</property>
- <signal name="clicked"
handler="on_button_data_folder_open_clicked" swapped="no"/>
+ <signal name="clicked"
handler="on_button_view_data_folder_clicked" swapped="no"/>
<child>
<widget class="GtkHBox" id="hbox430">
<property name="visible">True</property>
@@ -48249,6 +48255,394 @@ Since Chronojump 2.1.3, backups contain the complete data.</property>
<property name="type">tab</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox_session_view_data_folder">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="vbox96">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="vbox97">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">30</property>
+ <child>
+ <widget class="GtkFrame" id="frame5">
+ <property name="width_request">550</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">1</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <widget class="GtkViewport" id="viewport26">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">4</property>
+ <child>
+ <widget class="GtkVBox" id="vbox260">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">16</property>
+ <property name="spacing">25</property>
+ <child>
+ <widget class="GtkVBox"
id="app1s_vbox_view_data_folder1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">16</property>
+ <child>
+ <widget class="GtkVBox" id="vbox266">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label124">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Select
whether you want to view the Chronojump generic data folder …</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkButton"
id="button_view_data_folder_generic">
+ <property name="label" translatable="yes">View
generic data folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_view_data_folder_generic_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox267">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label125">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">… or
the data folder of the current mode and session:</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox126">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel"
id="app1s_label_view_data_folder_mode_name">
+ <property name="width_request">400</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="justify">center</property>
+ <property name="ellipsize">middle</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox146">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel"
id="app1s_label_view_data_folder_session">
+ <property name="width_request">400</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="justify">center</property>
+ <property name="ellipsize">middle</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVButtonBox"
id="app1s_vbuttonbox_button_view_data_folder_specific">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkButton"
id="button_view_data_folder_specific">
+ <property name="label" translatable="yes">View
specific data folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_view_data_folder_specific_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="app1s_label_view_data_folder_specific_no_data">
+ <property name="width_request">400</property>
+ <property name="height_request">30</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="justify">center</property>
+ <property name="ellipsize">middle</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox_session_more5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label133">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Session</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label134">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">/</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label448">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">More</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label656">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">/</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label658">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">View
data folder</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox25">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">spread</property>
+ <child>
+ <widget class="GtkButton"
id="app1s_button_view_data_folder_close">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property
name="receives_default">False</property>
+ <signal name="clicked"
handler="on_app1s_button_view_data_folder_close_clicked" swapped="no"/>
+ <accelerator key="Escape" signal="clicked"/>
+ <child>
+ <widget class="GtkEventBox"
id="app1s_eventbox_button_view_data_folder_close">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkHBox" id="hbox149">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkImage"
id="image_app1s_button_view_data_folder_close">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label659">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Close</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">9</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label41">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">view data folder</property>
+ </widget>
+ <packing>
+ <property name="position">9</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/gui/app1/session/main.cs b/src/gui/app1/session/main.cs
index 4bd32235c..da0f99f00 100644
--- a/src/gui/app1/session/main.cs
+++ b/src/gui/app1/session/main.cs
@@ -187,6 +187,15 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_app1s_button_export_close;
[Widget] Gtk.ProgressBar app1s_pulsebarExportActivity;
+ //notebook tab 9 (view_data_folder)
+ [Widget] Gtk.Label app1s_label_view_data_folder_mode_name;
+ [Widget] Gtk.Label app1s_label_view_data_folder_session;
+ [Widget] Gtk.Button button_view_data_folder_specific;
+ [Widget] Gtk.Label app1s_label_view_data_folder_specific_no_data;
+ [Widget] Gtk.EventBox app1s_eventbox_button_view_data_folder_close;
+ [Widget] Gtk.Image image_app1s_button_view_data_folder_close;
+
+
const int app1s_PAGE_MODES = 0;
const int app1s_PAGE_IMPORT_START = 1;
const int app1s_PAGE_SELECT_SESSION = 2; //for load session and for import
@@ -196,6 +205,7 @@ public partial class ChronoJumpWindow
const int app1s_PAGE_ADD_EDIT = 6;
const int app1s_PAGE_BACKUP = 7;
const int app1s_PAGE_EXPORT = 8;
+ const int app1s_PAGE_VIEW_DATA_FOLDER = 9;
private int app1s_notebook_sup_entered_from; //to store from which page we entered (to return at it)
@@ -233,6 +243,7 @@ public partial class ChronoJumpWindow
UtilGtk.EventBoxColorBackgroundActive (app1s_eventbox_button_backup_cancel_close,
UtilGtk.YELLOW, UtilGtk.YELLOW_LIGHT);
UtilGtk.EventBoxColorBackgroundActive (app1s_eventbox_button_export_cancel, UtilGtk.YELLOW,
UtilGtk.YELLOW_LIGHT);
UtilGtk.EventBoxColorBackgroundActive (app1s_eventbox_button_export_close, UtilGtk.YELLOW,
UtilGtk.YELLOW_LIGHT);
+ UtilGtk.EventBoxColorBackgroundActive (app1s_eventbox_button_view_data_folder_close,
UtilGtk.YELLOW, UtilGtk.YELLOW_LIGHT);
}
private void app1s_label_session_set_name()
@@ -243,7 +254,60 @@ public partial class ChronoJumpWindow
label_session_more_session_name.Text = currentSession.Name;
}
- void on_button_data_folder_open_clicked (object o, EventArgs args)
+ private void on_button_view_data_folder_clicked (object o, EventArgs args)
+ {
+ if (
+ ( current_mode != Constants.Modes.RUNSENCODER && //this 4 modes are the only
one who have a separate dir
+ current_mode != Constants.Modes.POWERGRAVITATORY &&
+ current_mode != Constants.Modes.POWERINERTIAL &&
+ current_mode != Constants.Modes.FORCESENSOR ) ||
+ currentSession == null || currentSession.UniqueID < 0)
+ {
+ string dir = app1s_getDataFolderGeneric ();
+ if(! Util.OpenURL (dir))
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ Catalog.GetString("Error. Cannot open directory.") + "\n\n" +
dir);
+ }
+ else {
+ app1s_label_view_data_folder_mode_name.Text = "<b>" + modePrint (current_mode) +
"</b>";
+ app1s_label_view_data_folder_mode_name.UseMarkup = true;
+
+ app1s_label_view_data_folder_session.Text = string.Format("({0}) <b>{1}</b>",
+ currentSession.UniqueID, currentSession.Name);
+ app1s_label_view_data_folder_session.UseMarkup = true;
+
+ string dir = app1s_getDataFolderSpecific ();
+ LogB.Information("dir: " + dir);
+ if (dir == "" || ! Util.DirectoryExists (dir)) {
+ button_view_data_folder_specific.Sensitive = false;
+ app1s_label_view_data_folder_specific_no_data.Text = "<b>" +
Catalog.GetString("No data. Please, perform tests.") + "</b>";
+ app1s_label_view_data_folder_specific_no_data.UseMarkup = true;
+ } else {
+ button_view_data_folder_specific.Sensitive = true;
+ app1s_label_view_data_folder_specific_no_data.Text = "";
+ }
+
+ app1s_notebook.CurrentPage = app1s_PAGE_VIEW_DATA_FOLDER;
+ }
+ }
+
+ private void on_button_view_data_folder_generic_clicked (object o, EventArgs args)
+ {
+ string dir = app1s_getDataFolderGeneric ();
+ if(! Util.OpenURL (dir))
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ Catalog.GetString("Error. Cannot open directory.") + "\n\n" + dir);
+ }
+
+ private void on_button_view_data_folder_specific_clicked (object o, EventArgs args)
+ {
+ string dir = app1s_getDataFolderSpecific ();
+ if(! Util.OpenURL (dir))
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ Catalog.GetString("Error. Cannot open directory.") + "\n\n" + dir);
+ }
+
+ private string app1s_getDataFolderGeneric ()
{
string databaseURL = Util.GetDatabaseDir() + System.IO.Path.DirectorySeparatorChar +
"chronojump.db";
string databaseTempURL = Util.GetDatabaseTempDir() + System.IO.Path.DirectorySeparatorChar +
"chronojump.db";
@@ -260,9 +324,25 @@ public partial class ChronoJumpWindow
else if(file2.Exists)
dir = Util.GetDatabaseTempDir();
- if(! Util.OpenURL (dir))
- new DialogMessage(Constants.MessageTypes.WARNING,
- Catalog.GetString("Error. Cannot open directory.") + "\n\n" + dir);
+ return dir;
+ }
+
+ private string app1s_getDataFolderSpecific ()
+ {
+ //extra checks
+ string modeFolder = Constants.ModeFolder (current_mode);
+ if (modeFolder == "")
+ return "";
+
+ if (currentSession == null || currentSession.UniqueID < 0)
+ return "";
+
+ return Path.Combine(app1s_getDataFolderGeneric (), modeFolder,
currentSession.UniqueID.ToString());
+ }
+
+ private void on_app1s_button_view_data_folder_close_clicked (object o, EventArgs args)
+ {
+ app1s_notebook.CurrentPage = app1s_PAGE_MODES;
}
}
diff --git a/src/util.cs b/src/util.cs
index 2544dab51..1be1405ff 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1521,6 +1521,10 @@ public class Util
return false;
}
+ public static bool DirectoryExists(string dirName){
+ return Directory.Exists(dirName);
+ }
+
public static bool FileExists(string fileName){
return File.Exists(fileName);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]