Commit c065bcd9 authored by Claes Sjofors's avatar Claes Sjofors Committed by Claes Sjöfors

Xtt eventlog and eventlist, analyse added to menu

parent 2ba953ba
...@@ -161,6 +161,11 @@ EvGtk::EvGtk(void* ev_parent_ctx, GtkWidget* ev_parent_wid, char* eve_name, ...@@ -161,6 +161,11 @@ EvGtk::EvGtk(void* ev_parent_ctx, GtkWidget* ev_parent_wid, char* eve_name,
g_signal_connect( g_signal_connect(
file_export, "activate", G_CALLBACK(eve_activate_export), this); file_export, "activate", G_CALLBACK(eve_activate_export), this);
GtkWidget* file_analyse = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("Open _Analyser"));
g_signal_connect(
file_analyse, "activate", G_CALLBACK(eve_activate_analyse), this);
GtkWidget* file_close = gtk_image_menu_item_new_with_mnemonic( GtkWidget* file_close = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Close")); CoWowGtk::translate_utf8("_Close"));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(file_close), gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(file_close),
...@@ -173,6 +178,7 @@ EvGtk::EvGtk(void* ev_parent_ctx, GtkWidget* ev_parent_wid, char* eve_name, ...@@ -173,6 +178,7 @@ EvGtk::EvGtk(void* ev_parent_ctx, GtkWidget* ev_parent_wid, char* eve_name,
GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL); GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_export); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_export);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_analyse);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget* file GtkWidget* file
...@@ -1225,6 +1231,11 @@ void EvGtk::eve_activate_export(GtkWidget* w, gpointer ev) ...@@ -1225,6 +1231,11 @@ void EvGtk::eve_activate_export(GtkWidget* w, gpointer ev)
((Ev*)ev)->eve_activate_export(); ((Ev*)ev)->eve_activate_export();
} }
void EvGtk::eve_activate_analyse(GtkWidget* w, gpointer ev)
{
((Ev*)ev)->eve_activate_analyse();
}
void EvGtk::eve_activate_ack_last(GtkWidget* w, gpointer ev) void EvGtk::eve_activate_ack_last(GtkWidget* w, gpointer ev)
{ {
Ev* ev = (Ev*)data; Ev* ev = (Ev*)data;
......
...@@ -95,6 +95,7 @@ public: ...@@ -95,6 +95,7 @@ public:
static void ala_activate_print(GtkWidget* w, gpointer data); static void ala_activate_print(GtkWidget* w, gpointer data);
static void blk_activate_print(GtkWidget* w, gpointer data); static void blk_activate_print(GtkWidget* w, gpointer data);
static void eve_activate_export(GtkWidget* w, gpointer data); static void eve_activate_export(GtkWidget* w, gpointer data);
static void eve_activate_analyse(GtkWidget* w, gpointer data);
static void eve_activate_ack_last(GtkWidget* w, gpointer data); static void eve_activate_ack_last(GtkWidget* w, gpointer data);
static void ala_activate_ack_last(GtkWidget* w, gpointer data); static void ala_activate_ack_last(GtkWidget* w, gpointer data);
static void ala_activate_ack_all(GtkWidget* w, gpointer data); static void ala_activate_ack_all(GtkWidget* w, gpointer data);
......
...@@ -126,6 +126,10 @@ HistGtk::HistGtk(void* hist_parent_ctx, GtkWidget* hist_parent_wid, ...@@ -126,6 +126,10 @@ HistGtk::HistGtk(void* hist_parent_ctx, GtkWidget* hist_parent_wid,
CoWowGtk::translate_utf8("_Export")); CoWowGtk::translate_utf8("_Export"));
g_signal_connect(file_export, "activate", G_CALLBACK(activate_export), this); g_signal_connect(file_export, "activate", G_CALLBACK(activate_export), this);
GtkWidget* file_analyse = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("Open _Analyser"));
g_signal_connect(file_analyse, "activate", G_CALLBACK(activate_analyse), this);
GtkWidget* file_close = gtk_image_menu_item_new_with_mnemonic( GtkWidget* file_close = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Close")); CoWowGtk::translate_utf8("_Close"));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(file_close), gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(file_close),
...@@ -137,6 +141,7 @@ HistGtk::HistGtk(void* hist_parent_ctx, GtkWidget* hist_parent_wid, ...@@ -137,6 +141,7 @@ HistGtk::HistGtk(void* hist_parent_ctx, GtkWidget* hist_parent_wid,
GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL); GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_export); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_export);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_analyse);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget* file GtkWidget* file
...@@ -729,6 +734,13 @@ void HistGtk::activate_export(GtkWidget* w, gpointer data) ...@@ -729,6 +734,13 @@ void HistGtk::activate_export(GtkWidget* w, gpointer data)
histOP->activate_export(); histOP->activate_export();
} }
void HistGtk::activate_analyse(GtkWidget* w, gpointer data)
{
Hist* histOP = (Hist*)data;
histOP->activate_analyse();
}
void HistGtk::activate_zoom_in(GtkWidget* w, gpointer data) void HistGtk::activate_zoom_in(GtkWidget* w, gpointer data)
{ {
Hist* histOP = (Hist*)data; Hist* histOP = (Hist*)data;
......
...@@ -93,6 +93,7 @@ public: ...@@ -93,6 +93,7 @@ public:
static void activate_exit(GtkWidget* w, gpointer data); static void activate_exit(GtkWidget* w, gpointer data);
static void activate_print(GtkWidget* w, gpointer data); static void activate_print(GtkWidget* w, gpointer data);
static void activate_export(GtkWidget* w, gpointer data); static void activate_export(GtkWidget* w, gpointer data);
static void activate_analyse(GtkWidget* w, gpointer data);
static void activate_zoom_in(GtkWidget* w, gpointer data); static void activate_zoom_in(GtkWidget* w, gpointer data);
static void activate_zoom_out(GtkWidget* w, gpointer data); static void activate_zoom_out(GtkWidget* w, gpointer data);
static void activate_zoom_reset(GtkWidget* w, gpointer data); static void activate_zoom_reset(GtkWidget* w, gpointer data);
......
...@@ -136,6 +136,7 @@ EvQt::EvQt(void* ev_parent_ctx, char* eve_name, char* ala_name, char* blk_name, ...@@ -136,6 +136,7 @@ EvQt::EvQt(void* ev_parent_ctx, char* eve_name, char* ala_name, char* blk_name,
addMenuItem(object, file, "&Print", SLOT(eve_activate_print()), "", addMenuItem(object, file, "&Print", SLOT(eve_activate_print()), "",
"document-print"); "document-print");
addMenuItem(object, file, "&Export", SLOT(eve_activate_export())); addMenuItem(object, file, "&Export", SLOT(eve_activate_export()));
addMenuItem(object, file, "&Analyse", SLOT(eve_activate_analyse()));
addMenuItem( addMenuItem(
object, file, "&Close", SLOT(eve_activate_exit()), "CTRL+W", "window-close"); object, file, "&Close", SLOT(eve_activate_exit()), "CTRL+W", "window-close");
...@@ -693,6 +694,11 @@ void EvQtObject::eve_activate_export() ...@@ -693,6 +694,11 @@ void EvQtObject::eve_activate_export()
ev->eve_activate_export(); ev->eve_activate_export();
} }
void EvQtObject::eve_activate_analyse()
{
ev->eve_activate_analyse();
}
void EvQtObject::eve_activate_ack_last() void EvQtObject::eve_activate_ack_last()
{ {
ev->eve_activate_ack_last(); ev->eve_activate_ack_last();
......
...@@ -100,6 +100,7 @@ public slots: ...@@ -100,6 +100,7 @@ public slots:
void ala_activate_print(); void ala_activate_print();
void blk_activate_print(); void blk_activate_print();
void eve_activate_export(); void eve_activate_export();
void eve_activate_analyse();
void eve_activate_ack_last(); void eve_activate_ack_last();
void ala_activate_ack_last(); void ala_activate_ack_last();
void ala_activate_ack_all(); void ala_activate_ack_all();
......
...@@ -90,6 +90,8 @@ HistQt::HistQt(void* hist_parent_ctx, char* hist_name, pwr_tAttrRef* arp, ...@@ -90,6 +90,8 @@ HistQt::HistQt(void* hist_parent_ctx, char* hist_name, pwr_tAttrRef* arp,
toplevel, file, "&Print", SLOT(activate_print()), "", "document-print"); toplevel, file, "&Print", SLOT(activate_print()), "", "document-print");
addMenuItem( addMenuItem(
toplevel, file, "&Export", SLOT(activate_export())); toplevel, file, "&Export", SLOT(activate_export()));
addMenuItem(
toplevel, file, "&Analyse", SLOT(activate_analyse()));
addMenuItem( addMenuItem(
toplevel, file, "&Close", SLOT(close()), "CTRL+W", "window-close"); toplevel, file, "&Close", SLOT(close()), "CTRL+W", "window-close");
...@@ -390,6 +392,11 @@ void HistQtWidget::activate_export() ...@@ -390,6 +392,11 @@ void HistQtWidget::activate_export()
hist->activate_export(); hist->activate_export();
} }
void HistQtWidget::activate_analyse()
{
hist->activate_analyse();
}
void HistQtWidget::activate_zoom_in() void HistQtWidget::activate_zoom_in()
{ {
hist->hist->zoom(1.2); hist->hist->zoom(1.2);
......
...@@ -107,6 +107,7 @@ protected: ...@@ -107,6 +107,7 @@ protected:
public slots: public slots:
void activate_print(); void activate_print();
void activate_export(); void activate_export();
void activate_analyse();
void activate_zoom_in(); void activate_zoom_in();
void activate_zoom_out(); void activate_zoom_out();
void activate_zoom_reset(); void activate_zoom_reset();
......
...@@ -297,7 +297,7 @@ int Ev::eve_export_events(const char *filename) ...@@ -297,7 +297,7 @@ int Ev::eve_export_events(const char *filename)
return 0; return 0;
fprintf(fp, "Time,Type,Prio,Text,Name,SupObject,Id,Status\n"); fprintf(fp, "Time,Type,Prio,Text,Name,SupObject,Id,Status\n");
brow_GetObjectList(eve->brow->ctx, &list, &list_cnt); brow_GetObjectList(eve->brow->ctx, &list, &list_cnt);
for (int i = 0; i < list_cnt; i++) { for (int i = list_cnt - 1; i >= 0; i--) {
brow_GetUserData(list[i], (void **)&item); brow_GetUserData(list[i], (void **)&item);
time_AtoAscii(&item->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr)); time_AtoAscii(&item->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
strcpy(supobjectstr, cdh_ObjidToString(item->supobject.Objid, 1)); strcpy(supobjectstr, cdh_ObjidToString(item->supobject.Objid, 1));
...@@ -312,6 +312,12 @@ int Ev::eve_export_events(const char *filename) ...@@ -312,6 +312,12 @@ int Ev::eve_export_events(const char *filename)
return 1; return 1;
} }
void Ev::eve_activate_analyse()
{
eve_export_events("$pwrp_tmp/pwr_eventlist.dat");
system("sev_eva.py -f $pwrp_tmp/pwr_eventlist.dat &");
}
void Ev::eve_activate_ack_last() void Ev::eve_activate_ack_last()
{ {
mh_sEventId* id; mh_sEventId* id;
......
...@@ -185,6 +185,7 @@ public: ...@@ -185,6 +185,7 @@ public:
void ala_activate_print(); void ala_activate_print();
void blk_activate_print(); void blk_activate_print();
void eve_activate_export(); void eve_activate_export();
void eve_activate_analyse();
void ala_activate_ack_last(); void ala_activate_ack_last();
void eve_activate_ack_last(); void eve_activate_ack_last();
void eve_activate_ack_all(); void eve_activate_ack_all();
......
...@@ -154,6 +154,12 @@ void Hist::activate_export() ...@@ -154,6 +154,12 @@ void Hist::activate_export()
export_file_selected_cb, wow_eFileSelType_Tmp, wow_eFileSelAction_Save); export_file_selected_cb, wow_eFileSelType_Tmp, wow_eFileSelAction_Save);
} }
void Hist::activate_analyse()
{
export_events("$pwrp_tmp/pwr_eventlog.dat");
system("sev_eva.py -f $pwrp_tmp/pwr_eventlog.dat &");
}
void Hist::export_file_selected_cb(void *ctx, char *filename, wow_eFileSelType file_type) void Hist::export_file_selected_cb(void *ctx, char *filename, wow_eFileSelType file_type)
{ {
((Hist *)ctx)->export_events(filename); ((Hist *)ctx)->export_events(filename);
...@@ -175,7 +181,7 @@ int Hist::export_events(const char *filename) ...@@ -175,7 +181,7 @@ int Hist::export_events(const char *filename)
return 0; return 0;
fprintf(fp, "Time,Type,Prio,Text,Name,SupObject,Id,Status\n"); fprintf(fp, "Time,Type,Prio,Text,Name,SupObject,Id,Status\n");
brow_GetObjectList(hist->brow->ctx, &list, &list_cnt); brow_GetObjectList(hist->brow->ctx, &list, &list_cnt);
for (int i = 0; i < list_cnt; i++) { for (int i = list_cnt - 1; i >= 0; i--) {
brow_GetUserData(list[i], (void **)&item); brow_GetUserData(list[i], (void **)&item);
time_AtoAscii(&item->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr)); time_AtoAscii(&item->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
strcpy(supobjectstr, cdh_ObjidToString(item->supobject.Objid, 1)); strcpy(supobjectstr, cdh_ObjidToString(item->supobject.Objid, 1));
......
...@@ -137,6 +137,7 @@ public: ...@@ -137,6 +137,7 @@ public:
void activate_print(); void activate_print();
void activate_export(); void activate_export();
void activate_analyse();
void activate_help(); void activate_help();
void activate_helpevent(); void activate_helpevent();
void time_cb(time_ePeriod period); void time_cb(time_ePeriod period);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment