Difference between revisions of "Class Inkscape::UI::Widget::ProgressPannel"

From Inkscape Wiki
Jump to navigation Jump to search
(Created page with '== Inkscape::UI::Widget::ProgressPannel == Discussion and documentation about Inkscape::UI::Widget::ProgressPannel class, a specific Inkscape widget. ProgressPannel will replac...')
 
(code to update progress_text)
Line 6: Line 6:
  
 
The GUI pieces:
 
The GUI pieces:
[[File:Progress-pannel-mockup.png|center]]
+
[[File:Progress-pannel-mockup.png|center|link=File:Progress-pannel-mockup.svg]]
  
 
The panel by default starts with a empty icon, but set it is important for a fast and beauty visual communication.
 
The panel by default starts with a empty icon, but set it is important for a fast and beauty visual communication.
Line 26: Line 26:
 
[[File:Saveing-progress.png]]
 
[[File:Saveing-progress.png]]
 
[[File:Loading-fonts-progress.png]]
 
[[File:Loading-fonts-progress.png]]
 +
Source SVGs: [http://wiki.inkscape.org/wiki/images/Progress-pannel-mockup.svg Progress-pannel-mockup.svg] [http://wiki.inkscape.org/wiki/images/Progress-pannel-examples-mockup.svg Progress-pannel-examples-mockup.svg]
  
Source SVGs: [http://wiki.inkscape.org/wiki/images/Progress-pannel-mocup.svg Progress-pannel-mocup.svg] [http://wiki.inkscape.org/wiki/images/Progress-pannel-examples-mockup.svg Progress-pannel-examples-mockup.svg]
+
=== Code ===
 +
 
 +
The progress_text must be updated together to the progress bar values. A possible updater code is:
 +
  [http://library.gnome.org/devel/gtkmm/stable/classGtk_1_1ProgressBar.html progress]->set_text( Glib::ustring::compose(
 +
      progress_text,
 +
      Glib::ustring::format(std::dec, min),
 +
      Glib::ustring::format(std::dec, max),
 +
      Glib::ustring::format(std::dec, val),
 +
      Glib::ustring::format(std::fixed, std::setprecision(pct_precision),
 +
                            ((double)val-min)*100/(max-min) )

Revision as of 01:34, 2 May 2010

Inkscape::UI::Widget::ProgressPannel

Discussion and documentation about Inkscape::UI::Widget::ProgressPannel class, a specific Inkscape widget.

ProgressPannel will replace the current content of the extension working dialog, defined inside execution-env.cpp and may be used on any other progress or loading related action on Inkscape.

The GUI pieces:

Progress-pannel-mockup.png

The panel by default starts with a empty icon, but set it is important for a fast and beauty visual communication.

Stock icons can be used with this constructor:

 Gtk::Image ( const Gtk::StockID& stock_id, IconSize size )

Example values:

 Gtk::Stock::DIALOG_INFO
 Gtk::ICON_SIZE_DIALOG

progressText may have variables to show optional values:

  • %1 : minimum value
  • %2 : maxmum value
  • %3 : current value
  • %4 : percentage value

Example: "building %3 of %2 pieces. %4%% done."

Extension-progress.png Saveing-progress.png Loading-fonts-progress.png Source SVGs: Progress-pannel-mockup.svg Progress-pannel-examples-mockup.svg

Code

The progress_text must be updated together to the progress bar values. A possible updater code is:

 progress->set_text( Glib::ustring::compose(
     progress_text,
     Glib::ustring::format(std::dec, min),
     Glib::ustring::format(std::dec, max),
     Glib::ustring::format(std::dec, val),
     Glib::ustring::format(std::fixed, std::setprecision(pct_precision),
                           ((double)val-min)*100/(max-min) )