Skip to content

Commit

Permalink
[download-and-upload-speed@cardsurf] v1.6.7 - Display improvement (li…
Browse files Browse the repository at this point in the history
…nuxmint#6446)

* v1.6.7 - Display improvement

* Fixes error in appletGui.js
  • Loading branch information
claudiux authored Sep 28, 2024
1 parent 804d8e1 commit e5e3c5c
Show file tree
Hide file tree
Showing 21 changed files with 796 additions and 606 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ MyApplet.prototype = {
},

_init_gui: function () {
this.gui_speed = new AppletGui.GuiSpeed(this._panelHeight, this.gui_speed_type, this.gui_value_order, this.decimal_places);
this.gui_speed = new AppletGui.GuiSpeed(this._panelHeight, this.gui_speed_type, this.gui_value_order, this.decimal_places, this.is_binary);
this.gui_data_limit = new AppletGui.GuiDataLimit(this._panelHeight, this.gui_data_limit_type);
this.actor.destroy_all_children();
this._add_gui_speed();
Expand Down Expand Up @@ -761,11 +761,11 @@ MyApplet.prototype = {
},

replace_with_zero: function (bytes, minimum) {
return bytes >= minimum ? bytes : 0;
return (bytes >= minimum) ? bytes : 0;
},

scale: function (bytes) {
return this.display_mode == AppletConstants.DisplayMode.SPEED ? Math.round(bytes / this.update_every) : bytes;
return (this.display_mode == AppletConstants.DisplayMode.SPEED) ? Math.round(bytes / this.update_every) : bytes;
},

convert_to_readable_string: function (bytes) {
Expand Down Expand Up @@ -793,32 +793,32 @@ MyApplet.prototype = {
convert_bytes_to_readable_unit: function (bytes) {
if (this.is_binary === true) {
if(bytes >= Math.pow(2, 40)) {
return [bytes/Math.pow(2, 40), _("TiB")];
return [bytes/Math.pow(2, 40), _(" TiB")];
}
if(bytes >= Math.pow(2, 30)) {
return [bytes/Math.pow(2, 30), _("GiB")];
return [bytes/Math.pow(2, 30), _(" GiB")];
}
if(bytes >= Math.pow(2, 20)) {
return [bytes/Math.pow(2, 20), _("MiB")];
return [bytes/Math.pow(2, 20), _(" MiB")];
}
if(bytes >= Math.pow(2, 10)) {
return [bytes/Math.pow(2, 10), _("kiB")];
return [bytes/Math.pow(2, 10), _(" kiB")];
}
return [bytes, _("B")];
return [bytes, _(" B")];
}
if(bytes >= 1000000000000) {
return [bytes/1000000000000, _("TB")];
return [bytes/1000000000000, _(" TB")];
}
if(bytes >= 1000000000) {
return [bytes/1000000000, _("GB")];
return [bytes/1000000000, _(" GB")];
}
if(bytes >= 1000000) {
return [bytes/1000000, _("MB")];
return [bytes/1000000, _(" MB")];
}
if(bytes >= 1000) {
return [bytes/1000, _("kB")];
return [bytes/1000, _(" kB")];
}
return [bytes, _("B")];
return [bytes, _(" B")];
},

convert_to_bits: function (bytes) {
Expand All @@ -828,40 +828,40 @@ MyApplet.prototype = {
convert_bits_to_readable_unit: function (bits) {
if (this.is_binary === true) {
if(bits >= Math.pow(2, 40)) {
return [bits/Math.pow(2, 40), _("Tib")];
return [bits/Math.pow(2, 40), _(" Tib")];
}
if(bits >= Math.pow(2, 30)) {
return [bits/Math.pow(2, 30), _("Gib")];
return [bits/Math.pow(2, 30), _(" Gib")];
}
if(bits >= Math.pow(2, 20)) {
return [bits/Math.pow(2, 20), _("Mib")];
return [bits/Math.pow(2, 20), _(" Mib")];
}
if(bits >= Math.pow(2, 10)) {
return [bits/Math.pow(2, 10), _("kib")];
return [bits/Math.pow(2, 10), _(" kib")];
}
return [bits, _("b")];
return [bits, _(" b")];
}
if(bits >= 1000000000000) {
return [bits/1000000000000, _("Tb")];
return [bits/1000000000000, _(" Tb")];
}
if(bits >= 1000000000) {
return [bits/1000000000, _("Gb")];
return [bits/1000000000, _(" Gb")];
}
if(bits >= 1000000) {
return [bits/1000000, _("Mb")];
return [bits/1000000, _(" Mb")];
}
if(bits >= 1000) {
return [bits/1000, _("kb")];
return [bits/1000, _(" kb")];
}
return [bits, _("b")];
return [bits, _(" b")];
},

is_base: function (unit) {
return unit == "B" || unit == "b";
},

round_output_number: function (number) {
let output_number = this.decimal_places == AppletConstants.DecimalPlaces.AUTO ?
let output_number = (this.decimal_places == AppletConstants.DecimalPlaces.AUTO) ?
this.round_output_number_auto(number) : number.toFixed(this.decimal_places);
return output_number;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,20 @@ IconLabel.prototype = {



function GuiSpeed(panel_height, gui_speed_type, gui_value_order, decimal_places) {
this._init(panel_height, gui_speed_type, gui_value_order, decimal_places);
function GuiSpeed(panel_height, gui_speed_type, gui_value_order, decimal_places, is_binary) {
this._init(panel_height, gui_speed_type, gui_value_order, decimal_places, is_binary);
};

GuiSpeed.prototype = {

_init: function(panel_height, gui_speed_type, gui_value_order, decimal_places) {
_init: function(panel_height, gui_speed_type, gui_value_order, decimal_places, is_binary=false) {

this.panel_height = panel_height;
this.gui_speed_type = gui_speed_type;
this.gui_value_order = gui_value_order;
this.decimal_places = decimal_places;
this.text_spacing = 5;
this.is_binary = is_binary;

this.actor = new St.BoxLayout();
this.iconlabel_received = new IconLabel();
Expand Down Expand Up @@ -235,10 +236,11 @@ GuiSpeed.prototype = {
_get_fixed_width_text: function() {
let text = "";
if(this.decimal_places == AppletConstants.DecimalPlaces.AUTO) {
text = " 99.9MB";
text = (this.is_binary) ? " 999.9 MiB " : " 999.9 MB ";
}
else {
text = " 999." + this.repeat_string("9", this.decimal_places) + "MB";
text = " 999." + this.repeat_string("9", this.decimal_places);
text += (this.is_binary) ? " MiB " : " MB ";
}
return text;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "Shows usage of a network interface",
"version": "1.6.6",
"version": "1.6.7",
"uuid": "download-and-upload-speed@cardsurf",
"name": "Download and upload speed",
"author": "cardsurf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: download-and-upload-speed@cardsurf 1.4.0\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-applets/"
"issues\n"
"POT-Creation-Date: 2024-09-24 09:51+0200\n"
"POT-Creation-Date: 2024-09-27 21:38+0200\n"
"PO-Revision-Date: 2017-11-20 22:44+0200\n"
"Last-Translator: Peyu Yovev <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -94,87 +94,93 @@ msgid "Large"
msgstr "Голям"

#. applet.js:796
msgid "TiB"
msgid " TiB"
msgstr ""

#. applet.js:799
#, fuzzy
msgid "GiB"
msgstr "Гпи"
msgid " GiB"
msgstr ""

#. applet.js:802
#, fuzzy
msgid "MiB"
msgstr "МБ"
msgid " MiB"
msgstr ""

#. applet.js:805
msgid "kiB"
msgid " kiB"
msgstr ""

#. applet.js:807 applet.js:821
#, fuzzy
msgid "B"
msgstr "МБ"
#. applet.js:807
msgid " B"
msgstr ""

#. applet.js:810
msgid "TB"
msgid " TB"
msgstr ""

#. applet.js:813
msgid "GB"
msgstr ""
#, fuzzy
msgid " GB"
msgstr "Гпи"

#. settings-schema.json->data_limit->units
#. applet.js:816
msgid "MB"
#, fuzzy
msgid " MB"
msgstr "МБ"

#. applet.js:819
msgid "kB"
msgid " kB"
msgstr ""

#. applet.js:821
msgid " B"
msgstr ""

#. applet.js:831
msgid "Tib"
msgid " Tib"
msgstr ""

#. applet.js:834
#, fuzzy
msgid "Gib"
msgstr "Гпи"
msgid " Gib"
msgstr ""

#. applet.js:837
msgid "Mib"
msgid " Mib"
msgstr ""

#. applet.js:840
msgid "kib"
msgid " kib"
msgstr ""

#. applet.js:842 applet.js:856
msgid "b"
#. applet.js:842
msgid " b"
msgstr ""

#. applet.js:845
msgid "Tb"
msgid " Tb"
msgstr ""

#. applet.js:848
msgid "Gb"
msgstr ""
#, fuzzy
msgid " Gb"
msgstr "Гпи"

#. applet.js:851
msgid "Mb"
msgid " Mb"
msgstr ""

#. applet.js:854
msgid "kb"
msgid " kb"
msgstr ""

#. applet.js:856
msgid " b"
msgstr ""

#. appletGui.js:478
#. appletGui.js:480
msgid "Total download:"
msgstr "Общо сваляне:"

#. appletGui.js:479
#. appletGui.js:481
msgid "Total upload:"
msgstr "Общо качване:"

Expand Down Expand Up @@ -444,6 +450,10 @@ msgstr ""
msgid "Data limits"
msgstr "Лимити на данни"

#. settings-schema.json->data_limit->units
msgid "MB"
msgstr "МБ"

#. settings-schema.json->data_limit->description
msgid "Data limit"
msgstr "Лимит на данни"
Expand Down
Loading

0 comments on commit e5e3c5c

Please sign in to comment.