Try to fix flickery updates (#59).
authorCarl Hetherington <cth@carlh.net>
Sun, 17 Feb 2013 01:16:11 +0000 (01:16 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 17 Feb 2013 01:16:11 +0000 (01:16 +0000)
src/wx/job_manager_view.cc
src/wx/wx_util.cc
src/wx/wx_util.h

index 8bede709f5f0bfd1df13ce36c02b46cbff40d2ea..7537da287dca0f4ae545de67f902c5b5ec81e7c0 100644 (file)
@@ -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);
index 632dbc32e034b8ee39b8d507bfff97779a43b005..bf78ff4d7029c1e3acf38f6a6c8ff28574ea362b 100644 (file)
@@ -170,6 +170,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)
 {
index dd069a9d745228c5e82024c5a9b94f6399b1589d..6cde08a90924dd93977d628d4b94ac1f48c730a5 100644 (file)
@@ -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);