little refactoring for bq selection

This commit is contained in:
DYefremov
2018-04-10 11:15:50 +03:00
parent 8a865513b3
commit 952aeb4d22
6 changed files with 20 additions and 7 deletions

View File

@@ -11,9 +11,9 @@
<property name="program_name">DemonEditor</property>
<property name="version">0.3.1 Pre-alpha</property>
<property name="copyright">2018 Dmitriy Yefremov
dmitry.v.yefremov@gmail.com
</property>
<property name="comments" translatable="yes">Enigma2 channel and satellites list editor for GNU/Linux</property>
<property name="website">https://github.com/DYefremov/DemonEditor</property>
<property name="license" translatable="yes">Это приложение распространяется без каких-либо гарантий.
Подробнее в &lt;a href="http://opensource.org/licenses/mit-license.php"&gt;The MIT License (MIT)&lt;/a&gt;.</property>
<property name="authors">Dmitriy Yefremov

View File

@@ -246,10 +246,8 @@ class MainAppWindow:
def on_paste(self, view):
selection = view.get_selection()
dest_index = 0
bq_selected = self.get_selected_bouquet()
bq_selected = self.check_bouquet_selection()
if not bq_selected:
show_dialog(DialogType.ERROR, self._main_window, "Error. No bouquet is selected!")
return
fav_bouquet = self._bouquets[bq_selected]
@@ -440,10 +438,8 @@ class MainAppWindow:
def receive_selection(self, *, view, drop_info, data):
""" Update fav view after data received """
bq_selected = self.get_selected_bouquet()
bq_selected = self.check_bouquet_selection()
if not bq_selected:
show_dialog(DialogType.ERROR, self._main_window, "Error. No bouquet is selected!")
return
model = get_base_model(view.get_model())
@@ -686,6 +682,20 @@ class MainAppWindow:
service.hide, service.service_type, service.pos, service.fav_id,
self._picons.get(service.picon_id, None)))
def check_bouquet_selection(self):
""" checks and returns bouquet if selected """
bq_selected = self.get_selected_bouquet()
if not bq_selected:
show_dialog(DialogType.ERROR, self._main_window, "Error. No bouquet is selected!")
return
if Profile(self._profile) is Profile.NEUTRINO_MP and bq_selected.endswith(BqType.WEBTV.value):
show_dialog(DialogType.ERROR, self._main_window, "Operation not allowed in this context!")
return
return bq_selected
def get_selected_bouquet(self):
""" returns 'name:type' of last selected bouquet or False """
if self._current_bq_name is None:

Binary file not shown.

View File

@@ -465,6 +465,9 @@ msgstr "Не выбран файл satellites.xml!"
msgid "Error. Verify the data!"
msgstr "Ошибка. Проверьте данные!"
msgid "Operation not allowed in this context!"
msgstr "Недопустимая операция в данном контексте!"