From dd858caadfb9f13b6a016c7bdd6d47e9894e118d Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Mon, 1 Dec 2003 05:51:03 +0000 Subject: [PATCH] * Se modifica la UI del cliente para que quede mas linda. * Se agrega una imagen que contiene una animacion para indicar que se estan recibiendo frames de la simulacion --- Client/dialogs/client.glade | 317 +++++++++--------------------------- Client/include/principal.h | 6 +- Client/pixmaps/Makefile.am | 7 +- Client/pixmaps/anim_0.png | Bin 0 -> 393 bytes Client/pixmaps/anim_1.png | Bin 0 -> 289 bytes Client/pixmaps/anim_2.png | Bin 0 -> 287 bytes Client/pixmaps/anim_3.png | Bin 0 -> 290 bytes Client/pixmaps/anim_4.png | Bin 0 -> 288 bytes Client/src/principal.cpp | 65 ++++---- 9 files changed, 121 insertions(+), 274 deletions(-) create mode 100644 Client/pixmaps/anim_0.png create mode 100644 Client/pixmaps/anim_1.png create mode 100644 Client/pixmaps/anim_2.png create mode 100644 Client/pixmaps/anim_3.png create mode 100644 Client/pixmaps/anim_4.png diff --git a/Client/dialogs/client.glade b/Client/dialogs/client.glade index f141e54..bac40c9 100644 --- a/Client/dialogs/client.glade +++ b/Client/dialogs/client.glade @@ -41,7 +41,7 @@ - + True gtk-execute 1 @@ -62,7 +62,7 @@ - + True gtk-stop 1 @@ -111,7 +111,7 @@ - + True gtk-properties 1 @@ -123,13 +123,38 @@ + + + + + + + + True + Comandos + True + + + - + True - Alarmas + Detener Servidor True - + + + + + True + gtk-stop + 1 + 0.5 + 0.5 + 0 + 0 + + @@ -154,7 +179,7 @@ - + True gtk-dialog-info 1 @@ -319,165 +344,30 @@ GTK_SHADOW_ETCHED_IN - + True - 3 - 3 - False - 0 - 0 - - - - True - Target : - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Command : - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - Arguments : - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT - + True True True - True - 0 + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 - True - * - False - - 1 - 2 - 2 - 3 - - - - - - - True - True - Enviar - True - GTK_RELIEF_NORMAL - - - 2 - 3 - 0 - 3 - fill - fill - @@ -485,7 +375,7 @@ True - Alarmas + LOG : False False GTK_JUSTIFY_LEFT @@ -531,34 +421,10 @@ True 5 2 - False + True 0 0 - - - True - Nombre : - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 0 - 1 - fill - - - - True @@ -730,6 +596,30 @@ + + + + True + Nombre : + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + fill + + + @@ -754,65 +644,18 @@ 0 - False + True True - + True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - True - Log : - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - label_item - - + 0.5 + 0.5 + 0 + 0 0 diff --git a/Client/include/principal.h b/Client/include/principal.h index 63b93ae..818d016 100644 --- a/Client/include/principal.h +++ b/Client/include/principal.h @@ -51,13 +51,16 @@ protected: // Archivo XML del Padre Glib::RefPtr refXml; + Glib::RefPtr anim_frames[5]; + int current_frame; + Gtk::Image *anim; + bool paused; // Para la actualizacion automatica ViewItem *last_selected; // Dialogo de Conectar DlgConectar *dlg_conectar; DlgProperty *dlg_property; - Gtk::Entry *txt_target, *txt_command, *txt_args; Gtk::TextView *txt_view; Gtk::Fixed *work_place; Gtk::Label *lbl_nombre, *lbl_color, *lbl_flujo, *lbl_extra, *lbl_cap_flujo, *lbl_cap_extra; @@ -78,7 +81,6 @@ protected: virtual void on_mnu_property(); virtual void on_dlg_property_ok(); virtual void on_dlg_connect_ok(); - virtual void on_get_clicked(); virtual void on_btn_activar_clicked(); virtual void on_btn_simulate_clicked(); virtual void on_btn_pause_clicked(); diff --git a/Client/pixmaps/Makefile.am b/Client/pixmaps/Makefile.am index f9cf9c9..05a00db 100644 --- a/Client/pixmaps/Makefile.am +++ b/Client/pixmaps/Makefile.am @@ -35,7 +35,12 @@ tanque_o.png \ y_e.png \ y_n.png \ y_o.png \ -y_s.png +y_s.png \ +anim_0.png \ +anim_1.png \ +anim_2.png \ +anim_3.png \ +anim_4.png EXTRA_DIST = $(plaqui_DATA) diff --git a/Client/pixmaps/anim_0.png b/Client/pixmaps/anim_0.png new file mode 100644 index 0000000000000000000000000000000000000000..097654acf9e58bb3c57bc9fde0996afd68c8a0b8 GIT binary patch literal 393 zcmeAS@N?(olHy`uVBq!ia0vp^DIm3Meo!xj3+-1Ws60t?@mwRockPN1|_yXt#U4>f4=@H%SVc zEh#-=pqATF(thU>tbgg^7r{k<60!tN6Ocyw0qZeI$qUF!bzLUX|Vv~J(lTtaG6q*z| z6gZSP{9gIJdcGrO%O;-_?>s-s1s&;Dgc*fQn-ns8iweno`N*OV683cUb6Mw<&;$UL CLRp*u literal 0 HcmV?d00001 diff --git a/Client/pixmaps/anim_2.png b/Client/pixmaps/anim_2.png new file mode 100644 index 0000000000000000000000000000000000000000..4cbe59c32d553d4f783f6ec6d4929b3b7769d839 GIT binary patch literal 287 zcmeAS@N?(olHy`uVBq!ia0vp^DImp64!_l=ltB<)VvY~=c3falGGH1 z^30M9g^-L?1$R&1fcGh?c|e72o-U3d6}R5rJji=MfrrJ>`tNrh)(@RO3Yuo}C8P>? ziUQSO0`{+Oxn)8hA6MI=plEn$(U;eXmk!nV<(7NADN*t9?4BrkbfT!6fTMtm0E-}t z}%{fFVdQ&MBb@0O?Is Ar~m)} literal 0 HcmV?d00001 diff --git a/Client/pixmaps/anim_4.png b/Client/pixmaps/anim_4.png new file mode 100644 index 0000000000000000000000000000000000000000..a89a499c9f300eeedf1c90761cfa383329a624be GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^DImwc6hbmm72G|21Ky{o<^dJ9c)B=-RNQ)dqmz?Ck%!^nlV9&6qd#zWm &rg):Gtk::Window(co),refXml(rg) { Gtk::MenuItem *conect=0, *exit=0, *about=0, *mnu_prop=0, *mnu_disconnect=0; - Gtk::Button *btn_get=0, *bar_connect=0; + Gtk::Button *bar_connect=0; txt_view = 0; - txt_target = txt_command = txt_args = 0; work_place = 0; lbl_cap_flujo = lbl_cap_extra = lbl_extra = lbl_nombre = lbl_color = lbl_flujo = 0; btn_simulate = btn_pause = 0; + anim_frames[0] = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/anim_0.png"); + anim_frames[1] = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/anim_1.png"); + anim_frames[2] = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/anim_2.png"); + anim_frames[3] = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/anim_3.png"); + anim_frames[4] = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/anim_4.png"); + current_frame = 0; + + anim = 0; + rg->get_widget("anim_frames", anim); + anim->set(anim_frames[current_frame]); + rg->get_widget("btn_pausa", btn_pause); rg->get_widget("btn_simular", btn_simulate); rg->get_widget("btn_activar", btn_activar); @@ -44,11 +54,7 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr & rg->get_widget("mnu_prop", mnu_prop); rg->get_widget_derived("dlg_property", dlg_property); rg->get_widget_derived("dlgConectar", dlg_conectar); - rg->get_widget("btn_get", btn_get); rg->get_widget("txt_view", txt_view); - rg->get_widget("txt_target", txt_target); - rg->get_widget("txt_command", txt_command); - rg->get_widget("txt_args", txt_args); rg->get_widget("bar_connect", bar_connect); rg->get_widget("work_place", work_place); rg->get_widget("ico_conected", ico_conected); @@ -62,7 +68,6 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr & bar_connect->signal_clicked().connect( SigC::slot(*this, &Principal::on_mnu_file_connect)); exit->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_exit)); about->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_help_about)); - btn_get->signal_clicked().connect( SigC::slot(*this, &Principal::on_get_clicked) ); btn_activar->signal_clicked().connect( SigC::slot(*this, &Principal::on_btn_activar_clicked) ); btn_simulate->signal_clicked().connect( SigC::slot(*this, &Principal::on_btn_simulate_clicked) ); btn_pause->signal_clicked().connect( SigC::slot(*this, &Principal::on_btn_pause_clicked) ); @@ -70,6 +75,7 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr & conexion = NULL; is_xml_loaded = false; last_selected = NULL; + paused = true; update_ui.connect( SigC::slot(*this, &Principal::update_items_prop ) ); load_xml_dispatch.connect( SigC::slot(*this, &Principal::loadXML ) ); gc = Gdk::GC::create(get_window()); @@ -282,17 +288,25 @@ bool Principal::on_item_clicked(GdkEventButton *e, ViewItem *i) void Principal::update_items_prop() { - if (last_selected == NULL) return; + if (last_selected != NULL) { + lbl_nombre->set_text(last_selected->get_name()); + lbl_flujo->set_text(last_selected->get_actual_flow()); + lbl_extra->set_text(last_selected->get_extra()); - lbl_nombre->set_text(last_selected->get_name()); - lbl_flujo->set_text(last_selected->get_actual_flow()); - lbl_extra->set_text(last_selected->get_extra()); + lbl_cap_flujo->set_text(last_selected->get_cap_flow()); + lbl_cap_extra->set_text(last_selected->get_cap_extra()); - lbl_cap_flujo->set_text(last_selected->get_cap_flow()); - lbl_cap_extra->set_text(last_selected->get_cap_extra()); + color_preview->modify_bg(Gtk::STATE_NORMAL, last_selected->get_color()); + color_preview->queue_draw(); + } - color_preview->modify_bg(Gtk::STATE_NORMAL, last_selected->get_color()); - color_preview->queue_draw(); + if (!paused) { + current_frame++; + if (current_frame > 4) { + current_frame = 0; + } + anim->set(anim_frames[current_frame]); + } // Mando a redibujar a todos los items std::map::iterator i; @@ -364,25 +378,6 @@ void Principal::on_conexion_error(unsigned code, const std::string& desc) txt_view->get_buffer()->insert_at_cursor("\n"); } -void Principal::on_get_clicked() -{ - if (conexion == NULL) { - txt_view->get_buffer()->insert_at_cursor("SIN CONEXION\n"); - return; - } - - PlaQui::Server::Command command(txt_target->get_text(), txt_command->get_text()); - command.add_arg( txt_args->get_text() ); - txt_view->get_buffer()->insert_at_cursor("Enviando comando\n"); - try { - conexion->send(command); - } - catch (...) { - txt_view->get_buffer()->insert_at_cursor("EXCEPTION EN conexion->send !!\n"); - } - -} - void Principal::loadXML() { // ya lo cargue @@ -895,6 +890,7 @@ void Principal::on_btn_simulate_clicked() PlaQui::Server::Command c("plant", "start"); c.add_arg("default"); conexion->send(c); + paused = false; } void Principal::on_btn_pause_clicked() @@ -904,5 +900,6 @@ void Principal::on_btn_pause_clicked() PlaQui::Server::Command c("plant", "stop"); c.add_arg("default"); conexion->send(c); + paused = true; } -- 2.43.0