commit 3e35764405a1a9ff823d24a3c0909e17657fcf45
parent 12ad74908740abc8f64a6d5394f1c3af06fd2732
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 8 Feb 2017 14:32:07 -0500
Allow altering text in a ProgressWindow line in OO mode
And fix progress meter display
Diffstat:
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/progressWindow.js b/chrome/content/zotero/xpcom/progressWindow.js
@@ -288,18 +288,15 @@ Zotero.ProgressWindow = function(options = {}) {
* Creates a new object representing a line in the progressWindow. This is the OO
* version of addLines() above.
*/
- this.ItemProgress = _deferUntilWindowLoad(function(iconSrc, title, parentItemProgress) {
- this._itemText = _progressWindow.document.createElement("description");
- this._itemText.appendChild(_progressWindow.document.createTextNode(title));
- this._itemText.setAttribute("class", "zotero-progress-item-label");
- this._itemText.setAttribute("crop", "end");
+ this.ItemProgress = _deferUntilWindowLoad(function(iconSrc, text, parentItemProgress) {
+ this.setText(text);
this._image = _progressWindow.document.createElement("hbox");
this._image.setAttribute("class", "zotero-progress-item-icon");
this._image.setAttribute("flex", 0);
this._image.style.width = "16px";
this._image.style.backgroundRepeat = "no-repeat";
- this._image.style.backgroundSize = "16px";
+ this._image.style.backgroundSize = "auto 16px";
this.setIcon(iconSrc);
this._hbox = _progressWindow.document.createElement("hbox");
@@ -340,7 +337,6 @@ Zotero.ProgressWindow = function(options = {}) {
this._image.style.backgroundImage = "url('chrome://zotero/skin/progress_arcs.png')";
this._image.style.backgroundPosition = "-"+(Math.round(percent/100*nArcs)*16)+"px 0";
this._hbox.style.opacity = percent/200+.5;
- this._hbox.style.filter = "alpha(opacity = "+(percent/2+50)+")";
} else if(percent == 100) {
this._image.style.backgroundImage = "url('"+this._iconSrc+"')";
this._image.style.backgroundPosition = "";
@@ -359,6 +355,18 @@ Zotero.ProgressWindow = function(options = {}) {
this._iconSrc = iconSrc;
});
+ this.ItemProgress.prototype.setText = _deferUntilWindowLoad(function (text) {
+ if (!this._itemText) {
+ this._itemText = _progressWindow.document.createElement("description");
+ }
+ else {
+ this._itemText.textContent = '';
+ }
+ this._itemText.appendChild(_progressWindow.document.createTextNode(text));
+ this._itemText.setAttribute("class", "zotero-progress-item-label");
+ this._itemText.setAttribute("crop", "end");
+ });
+
/**
* Indicates that an error occurred saving this item.
*/