- Make GUI a little bit more responsive. Still doesn't scroll

to the end of output
- Use GraphicalTerminalIO::read_command into GraphicalTerminalIO::onSend()
as per specs (fixes a program crash)


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@552 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-03-18 10:50:16 +00:00
parent b821b94b85
commit 9dc21270a2
4 changed files with 49 additions and 13 deletions

View File

@ -1,3 +1,34 @@
2006-03-10 15:21 tchernobog
* trunk/src/backend/pyloader/ScriptAdapter.py,
trunk/src/backend/pyloader/python_policy.cc: - Finish fix for
return values in PythonPolicy - Put mutex and global _ret_val
variable into ScriptAdapter instead of the global space, space
which is anyway not accessible after decref'ing the corresponding
python module
2006-03-10 15:08 jinx
* trunk/doc/sgpem2uman.texi: essageMinor correcions
2006-03-10 14:54 tchernobog
* trunk/src/backend/pyloader/ScriptAdapter.py,
trunk/src/backend/pyloader/python_policy.cc,
trunk/src/backend/pyloader/python_policy.hh,
trunk/src/builtin-policies/fcfs.py, trunk/src/simulation.cc: -
Partial attempt at fixing PythonPolicies broken return values
2006-03-10 14:46 jinx
* trunk/doc/sgpem2uman.texi: essageAdded chapter Writing new
policies
2006-03-10 11:38 tchernobog
* trunk/ChangeLog, trunk/src/backend/pyloader/python_policy.cc: -
Fix bug with retval not treated as a bool value in wait_unlock()
2006-03-10 03:20 jinx
* trunk/doc/sgpem2uman.texi: Added chapters Overview of SGPEM and

View File

@ -37,7 +37,6 @@
using namespace sgpem;
using namespace std;
using Glib::ustring;
using Glib::Thread;
GraphicalTerminalIO::GraphicalTerminalIO(TextSimulation* sim)
: _sim(sim)
@ -84,22 +83,22 @@ GraphicalTerminalIO::~GraphicalTerminalIO()
void
GraphicalTerminalIO::onSend()
{
using Glib::Thread;
pair<pair<TextSimulation*, IOManager*>, const ustring> p(
pair<TextSimulation*, IOManager*>(_sim, this),
_text_input.get_text());
read_command());
Thread::create(sigc::bind(&TextSimulation::parse_command, p), true);
_text_input.set_text("");
_text_input.grab_focus();
}
uint
GraphicalTerminalIO::write_buffer(const Glib::ustring& buffer)
{
Gtk::TextBuffer::iterator i = _text_output.get_buffer()->end();
_text_output.get_buffer()->insert(i, buffer);
Glib::Mutex::Lock lock(_mtx);
Glib::RefPtr<Gtk::TextBuffer> txbuf = _text_output.get_buffer();
txbuf->insert_at_cursor(buffer);
// Force the UI update queue to flush
// while(Gtk::Main::instance()->events_pending())
@ -128,6 +127,9 @@ GraphicalTerminalIO::read_command()
if(f == ustring::npos)
return "";
_text_input.set_text("");
_text_input.grab_focus();
return command.substr(f,l-f+1);
}

View File

@ -28,6 +28,7 @@
#include <gtkmm/entry.h>
#include <gtkmm/textview.h>
#include <gtkmm/window.h>
#include <glibmm/thread.h>
#include <glibmm/ustring.h>
#include "io_manager.hh"
@ -92,6 +93,7 @@ namespace sgpem {
TextSimulation* _sim;
Gtk::TextView _text_output;
mutable Gtk::Entry _text_input;
Glib::Mutex _mtx;
};
}

View File

@ -93,7 +93,8 @@ parse_options(int& argc, char**& argv)
default :
display_help();
}
} while( opt != -1 );
}
while( opt != -1 );
// Set these two to start from additional filenames on the cmdline:
argc -= optind;
@ -105,7 +106,7 @@ void
display_help()
{
printf( _("SGPEMv2 is an educational software acting as a process scheduling simulator\n"
"\n\nUsage : sgpemv2 [options]" // filenames"
"\n\nUsage : sgpemv2 [options] filename"
"\n\nOptions:\n"
"\t-h, --help this help you're reading\n"
"\t-N, --no-gui starts the program in command line mode\n"
@ -115,9 +116,9 @@ display_help()
"\t-M dir, --modules-dir=dir\n"
"\t add this directory to default plugin\n"
"\t search path\n"
"\nFilenames:\n"
"\t a list of any valid SGPEMv2 XML file\n"
"\t to be opened, space-separated.\n"
"\nFilename:\n"
"\t a valid SGPEMv2 XML file\n"
"\t to be opened.\n"
"\nLong options are available only on GNU systems.\n\n" ) );
exit(0);
}