Hello community,
here is the log from the commit of package translator for openSUSE:Factory checked in at 2018-04-16 12:49:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/translator (Old)
and /work/SRC/openSUSE:Factory/.translator.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "translator"
Mon Apr 16 12:49:35 2018 rev:5 rq:596528 version:1.2.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/translator/translator.changes 2018-04-04 11:05:35.155675764 +0200
+++ /work/SRC/openSUSE:Factory/.translator.new/translator.changes 2018-04-16 12:49:38.547686226 +0200
@@ -1,0 +2,9 @@
+Sat Apr 7 18:53:03 UTC 2018 - avvissu@yandex.by
+
+- Update to 1.2.1:
+ * Timeout before translate
+ * Fix useless translate on language combobox click
+ * Fixed lack of translation, when text is changed during the
+ transfer
+
+-------------------------------------------------------------------
Old:
----
Translator-1.2.0.tar.gz
New:
----
Translator-1.2.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ translator.spec ++++++
--- /var/tmp/diff_new_pack.pfe69o/_old 2018-04-16 12:49:39.171663529 +0200
+++ /var/tmp/diff_new_pack.pfe69o/_new 2018-04-16 12:49:39.175663383 +0200
@@ -17,7 +17,7 @@
Name: translator
-Version: 1.2.0
+Version: 1.2.1
Release: 0
Summary: Translation program
License: GPL-3.0+
++++++ Translator-1.2.0.tar.gz -> Translator-1.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.2.0/data/com.github.rapidfingers.translator.appdata.xml new/Translator-1.2.1/data/com.github.rapidfingers.translator.appdata.xml
--- old/Translator-1.2.0/data/com.github.rapidfingers.translator.appdata.xml 2018-03-14 17:40:12.000000000 +0100
+++ new/Translator-1.2.1/data/com.github.rapidfingers.translator.appdata.xml 2018-03-25 17:06:59.000000000 +0200
@@ -71,5 +71,14 @@
</ul>
</description>
</release>
+ <release version="1.2.1" date="2018-03-25">
+ <description>
+ <ul>
+ <li>Timeout before translate</li>
+ <li>Fix useless translate on language combobox click</li>
+ <li>Fixed lack of translation, when text is changed during the transfer</li>
+ </ul>
+ </description>
+ </release>
</releases>
</component>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.2.0/debian/changelog new/Translator-1.2.1/debian/changelog
--- old/Translator-1.2.0/debian/changelog 2018-03-14 17:40:12.000000000 +0100
+++ new/Translator-1.2.1/debian/changelog 2018-03-25 17:06:59.000000000 +0200
@@ -1,3 +1,9 @@
+translate (1.2.1) precise; urgency=low
+ * Timeout before translate
+ * Fix useless translate on language combobox click
+ * Fixed lack of translation, when text is changed during the transfer
+ -- Grabli66 Sun, 25 March 2018 18:06:00 -0500
+
translate (1.2.0) precise; urgency=low
* Toast message if no connection to server
* Fix ugly text selection color
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Translator-1.2.0/src/TranslatorWindow.vala new/Translator-1.2.1/src/TranslatorWindow.vala
--- old/Translator-1.2.0/src/TranslatorWindow.vala 2018-03-14 17:40:12.000000000 +0100
+++ new/Translator-1.2.1/src/TranslatorWindow.vala 2018-03-25 17:06:59.000000000 +0200
@@ -1,6 +1,9 @@
// Main translator window
public class TranslateWindow : Gtk.ApplicationWindow {
+ /// Timeout before translate in milliseconds
+ const int TIMEOUT_BEFOR_TRANSLATE = 500;
+
/// Service for translating
private TranslateService _translateService;
/// Dictionary service
@@ -60,6 +63,12 @@
// Right language info
private LangInfo rightLang;
+ // Id of timeout
+ private uint? _timeoutId = null;
+
+ /// Text that is translating
+ private string _translatingText;
+
/// Is translate in progress
private bool _isTranslating = false;
@@ -210,7 +219,7 @@
topText.set_margin_right(7);
topText.override_font(fd);
topText.set_wrap_mode(Gtk.WrapMode.WORD_CHAR);
- topText.buffer.changed.connect(onUpdate);
+ topText.buffer.changed.connect(onTextChange);
var topScroll = new Gtk.ScrolledWindow (null, null);
topScroll.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
topScroll.add (topText);
@@ -395,12 +404,15 @@
topText.buffer.text = bottomText.buffer.text;
}
+ if (rightLa == rightLang)
+ needUpdate = false;
+
if (needUpdate) {
leftLang = leftLa;
rightLang = rightLa;
clearDictText();
refreshLangLabels();
- onUpdate();
+ onTextChange();
}
}
@@ -411,6 +423,7 @@
/// On change value in right combobox
private void onRightComboChange(LangInfo info) {
+
onLangChange(true);
}
@@ -420,28 +433,44 @@
rightLangCombo.setActive (lang.id);
}
- // On text update
- private void onUpdate() {
- if (_isTranslating) return;
-
+ /// Start translate service
+ private bool startTranslate() {
+ Source.remove(_timeoutId);
+ _timeoutId = null;
if (topText.buffer.text.length < 1) {
bottomText.buffer.text = "";
topLabelLen.set_markup(@"0/$MAX_CHARS</span>");
- return;
+ return true;
}
- if ((leftLang == null) || (rightLang == null)) return;
+ if ((leftLang == null) || (rightLang == null)) return true;
var len = topText.buffer.text.length;
if (len > MAX_CHARS) {
var txt = topText.buffer.text.slice(0, MAX_CHARS);
topText.buffer.set_text(txt, MAX_CHARS);
- return;
+ return true;
}
topLabelLen.set_markup(@"$len/$MAX_CHARS</span>");
_isTranslating = true;
_progressSpinner.active = true;
- _translateService.Translate(leftLang.id, rightLang.id, topText.buffer.text);
+ _translatingText = topText.buffer.text;
+ _translateService.Translate(leftLang.id, rightLang.id, _translatingText);
+ return true;
+ }
+
+ /// On text change in text edit
+ private void onTextChange() {
+ if (_isTranslating) return;
+
+ // Stop timer
+ if (_timeoutId != null) {
+ Source.remove(_timeoutId);
+ _timeoutId = null;
+ }
+
+ // Start new timer
+ _timeoutId = Timeout.add(TIMEOUT_BEFOR_TRANSLATE, startTranslate);
}
/// On translate complete
@@ -455,6 +484,9 @@
return;
}
bottomText.buffer.text = string.joinv("", text);
+
+ if (_translatingText != topText.buffer.text)
+ onTextChange();
}
// Search in dictionary