Skip to content

Commit

Permalink
Improve V11 ergonomy for dictionary management
Browse files Browse the repository at this point in the history
Boite de dialogue "Dictionary management"
  - action "Insepect current dictionary" maintenant en menu popup, en plus du bouton
- impacts
  - KWClassManagementDialogView::KWClassManagementDialogView
    - ajout de l'action d'inspection maquette en style "PopupMenu"
  - UserInferface
    - UIAction: ajout de la pise en compte du style "PopupMenu"
  - NormGUI
    - GUITable::buildPopupMenu: prise en compte dans le menu uniquement si styme "PopupMenu"

Menu "Data dictionary"
- ajout d'un menu "Reload dictionary" Ctrl+R avant le menu Save
- ajout d'un accelarateur Ctrl+M pour le menu "Manage dictionaries"
- impacts: KWClassManagementActionView

Gestion par defaut de la representation des textes
- words par defaut, avant les ngrams
  - plus interpretable
  - en pratique, par defaut, mieux adaptes aux textes
  - les ngrams sont pertinents pour des texte plus petits, pour des blobs autre que du texte
  - imapcts: KDTextFeatureSpec et KDTextFeatureSpecView
- passer en minuscule pour la tokenisation des words?
  - non: la methode de tokenisation par defaut est basique, tres simple, et ne depend pas de utf8

Renommage de quelques libelle de "Class" en Dictionary", dans les methodes GetClassLabel()
- KDClassSelectionStats, KDClassSelectionOperandStats
- KDClassSelectionData, KDClassSelectionOperandData
- KWClassManagementDialogView
  • Loading branch information
marcboulle committed Nov 29, 2023
1 parent ea3466b commit ea37149
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/Learning/KDDomainKnowledge/KDSelectionOperandAnalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ void KDClassSelectionStats::Write(ostream& ost) const

const ALString KDClassSelectionStats::GetClassLabel() const
{
return "Class selection stats";
return "Dictionary selection stats";
}

const ALString KDClassSelectionStats::GetObjectLabel() const
Expand Down Expand Up @@ -1409,7 +1409,7 @@ void KDClassSelectionOperandStats::Write(ostream& ost) const

const ALString KDClassSelectionOperandStats::GetClassLabel() const
{
return "Class selection operand stats";
return "Dictionary selection operand stats";
}

const ALString KDClassSelectionOperandStats::GetObjectLabel() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ longint KDClassSelectionData::GetUsedMemory() const

const ALString KDClassSelectionData::GetClassLabel() const
{
return "Class selection data";
return "Dictionary selection data";
}

const ALString KDClassSelectionData::GetObjectLabel() const
Expand Down Expand Up @@ -1275,7 +1275,7 @@ longint KDClassSelectionOperandData::GetUsedMemory() const

const ALString KDClassSelectionOperandData::GetClassLabel() const
{
return "Class selection operand data";
return "Dictionary selection operand data";
}

const ALString KDClassSelectionOperandData::GetObjectLabel() const
Expand Down
2 changes: 1 addition & 1 deletion src/Learning/KDDomainKnowledge/KDTextFeatureSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ KDTextFeatureSpec::KDTextFeatureSpec()
{
// ## Custom constructor

sTextFeatures = "ngrams";
sTextFeatures = "words";

// ##
}
Expand Down
4 changes: 2 additions & 2 deletions src/Learning/KWUserInterface/KDTextFeatureSpecView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ KDTextFeatureSpecView::KDTextFeatureSpecView()

// ## Custom constructor

GetFieldAt("TextFeatures")->SetParameters("ngrams\nwords\ntokens");
GetFieldAt("TextFeatures")->SetParameters("words\nngrams\ntokens");
GetFieldAt("TextFeatures")
->SetHelpText(
"Type of constructed text features :"
"\n - words : text words obtained with an automatic tokenization process"
"\n - ngrams: ngrams of bytes; generic, fast, robust, but less interpretable"
"\n - words : text words obtained with an automatic process; more interpretable than ngrams"
"\n - tokens : text tokens whose interpretability and interest depend on the quality of the input text "
"preprocessing."
"\n"
Expand Down
13 changes: 13 additions & 0 deletions src/Learning/KWUserInterface/KWClassManagementActionView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ KWClassManagementActionView::KWClassManagementActionView()
// Declaration des actions
AddAction("OpenFile", "Open...", (ActionMethod)(&KWClassManagementActionView::OpenFile));
AddAction("CloseFile", "Close", (ActionMethod)(&KWClassManagementActionView::CloseFile));
AddAction("ReloadFile", "Reload", (ActionMethod)(&KWClassManagementActionView::ReloadFile));
AddAction("SaveFile", "Save", (ActionMethod)(&KWClassManagementActionView::SaveFile));
AddAction("SaveFileUnder", "Save as...", (ActionMethod)(&KWClassManagementActionView::SaveFileUnder));
AddAction("ExportAsJSON", "Export as JSON...", (ActionMethod)(&KWClassManagementActionView::ExportAsJSON));
Expand All @@ -26,13 +27,16 @@ KWClassManagementActionView::KWClassManagementActionView()

// Ajout d'accelerateurs sur les actions principales
GetActionAt("OpenFile")->SetAccelKey("control O");
GetActionAt("ReloadFile")->SetAccelKey("control R");
GetActionAt("SaveFile")->SetAccelKey("control S");
GetActionAt("ManageClasses")->SetAccelKey("control M");

// Info-bulles
GetActionAt("OpenFile")
->SetHelpText("Open a dictionary file to load its dictionaries into memory"
"\n and make them available for data analysis.");
GetActionAt("CloseFile")->SetHelpText("Remove the dictionaries from memory.");
GetActionAt("ReloadFile")->SetHelpText("Reload the current dictionary file into memory.");
GetActionAt("SaveFile")->SetHelpText("Save the dictionaries in the current dictionary file.");
GetActionAt("SaveFileUnder")->SetHelpText("Save the dictionaries in a new dictionary file.");
GetActionAt("ExportAsJSON")->SetHelpText("Export the dictionaries under a JSON format.");
Expand Down Expand Up @@ -133,6 +137,15 @@ void KWClassManagementActionView::CloseFile()
CopyDictionaryNameToDatabases();
}

void KWClassManagementActionView::ReloadFile()
{
require(CheckDictionaryName());

// On lit le dictionnaire
if (GetClassManagement()->GetClassFileName() != "")
GetClassManagement()->ReadClasses();
}

void KWClassManagementActionView::SaveFile()
{
require(CheckDictionaryName());
Expand Down
1 change: 1 addition & 0 deletions src/Learning/KWUserInterface/KWClassManagementActionView.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class KWClassManagementActionView : public UIObjectView
// Actions de menu
void OpenFile();
void CloseFile();
void ReloadFile();
void SaveFile();
void SaveFileUnder();
void ExportAsJSON();
Expand Down
23 changes: 17 additions & 6 deletions src/Learning/KWUserInterface/KWClassManagementDialogView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ KWClassManagementDialogView::KWClassManagementDialogView()
{
KWClassSpecArrayView* classSpecArrayView;
KWClassSpecView* classSpecView;
UIAction* inspectDictionaryAction;

// Identifiant et libelle
SetIdentifier("KWClassManagementDialog");
Expand All @@ -29,13 +30,21 @@ KWClassManagementDialogView::KWClassManagementDialogView()
GetActionAt("ReloadFileButton")->SetStyle("Button");
GetActionAt("EditFileButton")->SetStyle("Button");

// Ajout d'une donnee liste
// Ajout d'une donnee liste non editable pour les dictionnaire
classSpecArrayView = new KWClassSpecArrayView;
AddListField("Classes", "Dictionaries", classSpecArrayView);
classSpecArrayView->SetEditable(false);
classSpecArrayView->GetActionAt("InspectItem")->SetVisible(true);
classSpecArrayView->GetActionAt("InspectItem")->SetLabel("Inspect current dictionary");
classSpecArrayView->GetActionAt("InspectItem")->SetStyle("SmallButton");

// Parametrage de son action d'edition en menu popup
inspectDictionaryAction = classSpecArrayView->GetActionAt("InspectItem");
inspectDictionaryAction->SetVisible(true);
inspectDictionaryAction->SetLabel("Inspect current dictionary");
inspectDictionaryAction->SetStyle("PopupMenu");

// Ajout d'un bouton egalement pour l'action d'edition
classSpecArrayView->AddAction("InspectItemButton", inspectDictionaryAction->GetLabel(),
inspectDictionaryAction->GetActionMethod());
classSpecArrayView->GetActionAt("InspectItemButton")->SetStyle("SmallButton");

// On indique que les champs Used et Type des attributs sont editables dans
// la fiche d'inspection d'un dictionnaire
Expand All @@ -55,13 +64,15 @@ KWClassManagementDialogView::KWClassManagementDialogView()
->SetHelpText(
"Allow to inspect and partly modify a dictionary chosen among the list of available dictionaries."
"\n The dictionary to inspect must be selected among the dictionaries in file.");
classSpecArrayView->GetActionAt("InspectItemButton")
->SetHelpText(classSpecArrayView->GetActionAt("InspectItem")->GetHelpText());

// Short cuts
GetActionAt("BuildClassDefButton")->SetShortCut('B');
GetActionAt("ReloadFileButton")->SetShortCut('L');
GetActionAt("EditFileButton")->SetShortCut('E');
classSpecArrayView->SetShortCut('D');
classSpecArrayView->GetActionAt("InspectItem")->SetShortCut('I');
classSpecArrayView->GetActionAt("InspectItemButton")->SetShortCut('I');
}

KWClassManagementDialogView::~KWClassManagementDialogView() {}
Expand Down Expand Up @@ -94,7 +105,7 @@ void KWClassManagementDialogView::EventRefresh(Object* object)

const ALString KWClassManagementDialogView::GetClassLabel() const
{
return "Class management";
return "Dictionary management";
}

const ALString KWClassManagementDialogView::GetObjectLabel() const
Expand Down
2 changes: 1 addition & 1 deletion src/Learning/MODL/MODL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char** argv)
// Choix du repertoire de lancement pour le debugage sous Windows (a commenter apres fin du debug)
// SetWindowsDebugDir("Standard", "IrisLight");
// SetWindowsDebugDir("Standard", "Iris2D");
SetWindowsDebugDir("Rules", "DateTimeRules");
SetWindowsDebugDir("z_Work", "IrisLight");

// Parametrage des logs memoires depuis les variables d'environnement, pris en compte dans KWLearningProject
// KhiopsMemStatsLogFileName, KhiopsMemStatsLogFrequency, KhiopsMemStatsLogToCollect
Expand Down
4 changes: 2 additions & 2 deletions src/Norm/NormGUI/src/normGUI/engine/GUITable.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ public void valueChanged(ListSelectionEvent e)
*/
public void buildPopupMenu()
{
// Si la liste contient des actions, on construit le popmenu
// Si la liste contient des actions de type popup, on construit le popmenu
if (guiList.vectorOfGUIActions.size() > 0) {
popMenu = new JPopupMenu();
// Pour chaque action
for (int i = 0; i < guiList.vectorOfGUIActions.size(); i++) {
GUIAction action = (GUIAction)guiList.vectorOfGUIActions.get(i);
// Si l'action n'est pas un exit ni un refresh (actions standards des unites)
if (action.getVisible() && action.getStyle().equals("") &&
if (action.getVisible() && action.getStyle().equals("PopupMenu") &&
!action.getIdentifier().equals(GUIUnit.Exit) &&
!action.getIdentifier().equals(GUIUnit.Refresh)) {
JMenuItem menuItem = new JMenuItem(action.getLabel());
Expand Down
6 changes: 3 additions & 3 deletions src/Norm/NormGUI/src/normGUI/engine/GUIUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ public boolean hasHelpText()
GUIAction guiAction = (GUIAction)vectorOfGUIActions.get(i);
if (guiAction.getVisible() && !guiAction.getIdentifier().equals(Exit) &&
!guiAction.getIdentifier().equals(Refresh)) {
if (guiAction.getHelpText().length() > 0)
if (!guiAction.getHelpText().equals(""))
hasActionHelpText = true;
}
}
Expand All @@ -1077,15 +1077,15 @@ public boolean hasHelpText()
hasDataUnitHelpText = ((GUIUnit)guiData).hasHelpText();
// S'il s'agit d'un element
else {
if (guiData.getHelpText().length() > 0)
if (!guiData.getHelpText().equals(""))
hasDataElementHelpText = true;
}
}
}

// On ne considere que l'aide sur les unites, l'aide sur les elements terminaux
// etant fournie par les info-bulles
return (getHelpText().length() > 0 || hasDataUnitHelpText);
return ((!getHelpText().equals("")) || hasDataUnitHelpText);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Norm/base/UIElements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ boolean UIAction::Check() const
ALString sTmp;

// Verification du style
if (GetStyle() != "" and GetStyle() != "Button" and GetStyle() != "SmallButton")
if (GetStyle() != "" and GetStyle() != "PopupMenu" and GetStyle() != "Button" and GetStyle() != "SmallButton")
{
bOk = false;
AddError("Le style " + GetStyle() + " est inconnu");
Expand Down
8 changes: 5 additions & 3 deletions src/Norm/base/UserInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ class UIList : public UIUnit
void SetLastColumnExtraWidth(int nValue);
int GetLastColumnExtraWidth() const;

// Redefinition du SetEditable (pour la propagation aux composant et les
// Redefinition du SetEditable (pour la propagation aux composants et les
// actions d'edition de la liste)
void SetEditable(boolean bValue) override;

Expand Down Expand Up @@ -1734,8 +1734,10 @@ class UIAction : public UIObject
////////////////////////////////////////////////////////////////////////
// Style: par defaut vide
// Valeurs possibles:
// vide: action maquettee dans les menus, et en plus dans les popup
// pour les actions de liste
// vide: action maquettee dans les menus, y compris dans les UIList
// pour les actions d'edition predefinies
// PopupMenu: action maquettee dans les menus popup dans la cas d'une
// action de UIList
// Button: action maquettee sous forme de boutton
// SmallButton: action maquettee sous forme de boutton de plus petite taille
// et insere a gauche dans la colonne des libelles
Expand Down

0 comments on commit ea37149

Please sign in to comment.