summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-02-17 01:16:11 +0000
committerCarl Hetherington <cth@carlh.net>2013-02-17 01:16:11 +0000
commit30c2924b9f6cbe30896d2c8ff1c3505ba79f3a88 (patch)
tree3c8bf09cd6b31a5aa053c6fe82d0928dd286e259 /src
parentcd35f8e7e6832581f64f5d364d61dc42839eb687 (diff)
Try to fix flickery updates (#59).
Diffstat (limited to 'src')
-rw-r--r--src/wx/job_manager_view.cc6
-rw-r--r--src/wx/wx_util.cc8
-rw-r--r--src/wx/wx_util.h1
3 files changed, 12 insertions, 3 deletions
diff --git a/src/wx/job_manager_view.cc b/src/wx/job_manager_view.cc
index 8bede709f..7537da287 100644
--- a/src/wx/job_manager_view.cc
+++ b/src/wx/job_manager_view.cc
@@ -98,17 +98,17 @@ JobManagerView::update ()
if (!(*i)->finished ()) {
float const p = (*i)->overall_progress ();
if (p >= 0) {
- _job_records[*i].message->SetLabel (std_to_wx (st));
+ checked_set (_job_records[*i].message, st);
_job_records[*i].gauge->SetValue (p * 100);
} else {
- _job_records[*i].message->SetLabel (_("Running"));
+ checked_set (_job_records[*i].message, wx_to_std (_("Running")));
_job_records[*i].gauge->Pulse ();
}
}
if ((*i)->finished() && !_job_records[*i].finalised) {
_job_records[*i].gauge->SetValue (100);
- _job_records[*i].message->SetLabel (std_to_wx (st));
+ checked_set (_job_records[*i].message, st);
_job_records[*i].finalised = true;
if (!(*i)->error_details().empty ()) {
_job_records[*i].details->Enable (true);
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 632dbc32e..bf78ff4d7 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -171,6 +171,14 @@ checked_set (wxTextCtrl* widget, string value)
}
void
+checked_set (wxStaticText* widget, string value)
+{
+ if (widget->GetLabel() != std_to_wx (value)) {
+ widget->SetLabel (std_to_wx (value));
+ }
+}
+
+void
checked_set (wxCheckBox* widget, bool value)
{
if (widget->GetValue() != value) {
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index dd069a9d7..6cde08a90 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -63,3 +63,4 @@ extern void checked_set (wxChoice* widget, std::string value);
extern void checked_set (wxTextCtrl* widget, std::string value);
extern void checked_set (wxCheckBox* widget, bool value);
extern void checked_set (wxRadioButton* widget, bool value);
+extern void checked_set (wxStaticText* widget, std::string value);